Patchwork Add delays to dediprog driver

login
register
about
Submitter Nico Huber
Date 2012-06-13 08:54:17
Message ID <4FD85539.5040400@secunet.com>
Download mbox | patch
Permalink /patch/3654/
State Accepted
Commit r1544
Headers show

Comments

Nico Huber - 2012-06-13 08:54:17
Some investigations have shown, that the original dediprog driver waits
about 200ms after setting voltage up and before setting voltage down.
This patch adds those delays. It helps flash chips to come up in time.


Signed-off-by: Nico Huber <nico.huber@secunet.com>
Carl-Daniel Hailfinger - 2012-06-16 00:04:01
Am 13.06.2012 10:54 schrieb Nico Huber:
> Some investigations have shown, that the original dediprog driver waits
> about 200ms after setting voltage up and before setting voltage down.
> This patch adds those delays. It helps flash chips to come up in time.
>
>
> Signed-off-by: Nico Huber <nico.huber@secunet.com>

Thanks for your patch.
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
and committed in r1544 with minor cosmetic changes.

Regards,
Carl-Daniel

Patch

Index: dediprog.c
===================================================================
--- dediprog.c	(Revision 1541)
+++ dediprog.c	(Arbeitskopie)
@@ -131,6 +131,9 @@ 
 	msg_pdbg("Setting SPI voltage to %u.%03u V\n", millivolt / 1000,
 		 millivolt % 1000);
 
+	if (voltage_selector == 0)
+		/* Wait some time as the original driver does. */
+		programmer_delay(200 * 1000);
 	ret = usb_control_msg(dediprog_handle, 0x42, 0x9, voltage_selector,
 			      0xff, NULL, 0x0, DEFAULT_TIMEOUT);
 	if (ret != 0x0) {
@@ -138,6 +141,9 @@ 
 			 voltage_selector);
 		return 1;
 	}
+	if (voltage_selector != 0)
+		/* Wait some time as the original driver does. */
+		programmer_delay(200 * 1000);
 	return 0;
 }