public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* patch to emi62.c and emi26.c (firmware loaders for Emagic USB audio boxes)
@ 2006-05-03 17:24 Monty
  0 siblings, 0 replies; only message in thread
From: Monty @ 2006-05-03 17:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: xiphmont


Hello folks,

(It's been a few years since I've submitted any kernel patches, my
etiquette may be rusty.  Feel free to flame me.  This was not sent to
the listed maintainer as I don't think Tapio's been heard from in some

time.  Correct me if I'm wrong :-)

It's become apparent as machines get faster that the emagic kernel
firmware loaders (based on the ezusb loader) have a reset race.  a
400MHz TiBook never tripped it, but a 2GHz Pentium M seems to hit it

about 30% of the time.  The bug is seen as a hung USB box and the
kernel error:

drivers/usb/misc/emi62.c: emi62_load_firmware - error loading firmware:
error = -110

The patch below inserts a delay after deasserting reset to allow the

box to settle before a new command is issued.  This affects only device
startup.  It's against 2.6.27-rc3, but should apply to any 2.6 kernel;
I don't think the loader has changed for a long time.

(A side note; I notice the firmware loader is using a rather old

firmware version for both devices.  Several relatively harmless but
annoying bugs have since been fixed... how was the firmware from this
device originally extracted?  Was it taken from a device driver
belonging to another OS, or was it provided as a hexdump from emagic?)


Monty

diff -brwu linux-2.6.17-rc3/drivers/usb/misc/emi26.c
linux-2.6.17-rc3-monty/drivers/usb/misc/emi26.c
--- linux-2.6.17-rc3/drivers/usb/misc/emi26.c	2006-04-26
22:19:25.000000000 -0400
+++ linux-2.6.17-rc3-monty
/drivers/usb/misc/emi26.c	2006-05-02
22:22:50.000000000 -0400
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/usb.h>
+#include <linux/delay.h>


 #define MAX_INTEL_HEX_RECORD_LENGTH 16
 typedef struct _INTEL_HEX_RECORD
@@ -114,6 +115,7 @@

 	/* De-assert reset (let the CPU run) */
 	err = emi26_set_reset(dev,0);
+	msleep(250); /* let device settle */


 	/* 2. We upload the FPGA firmware into the EMI
 	 * Note: collect up to 1023 (yes!) bytes and send them with
@@ -157,6 +159,7 @@
 		err("%s - error loading firmware: error = %d", __FUNCTION__, err);

 		goto wraperr;
 	}
+	msleep(250); /* let device settle */

 	/* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */
 	for (i=0; g_Firmware[i].type == 0; i++) {
@@ -192,6 +195,7 @@

 		err("%s - error loading firmware: error = %d", __FUNCTION__, err);
 		goto wraperr;
 	}
+	msleep(250); /* let device settle */

 	/* return 1 to fail the driver inialization
 	 * and give real driver change to load */

diff -brwu linux-2.6.17-rc3/drivers/usb/misc/emi62.c
linux-2.6.17-rc3-monty/drivers/usb/misc/emi62.c
--- linux-2.6.17-rc3/drivers/usb/misc/emi62.c	2006-04-26
22:19:25.000000000 -0400
+++ linux-2.6.17-rc3-monty
/drivers/usb/misc/emi62.c	2006-05-02
22:54:40.000000000 -0400
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/usb.h>
+#include <linux/delay.h>


 #define MAX_INTEL_HEX_RECORD_LENGTH 16
 typedef struct _INTEL_HEX_RECORD
@@ -123,6 +124,7 @@

 	/* De-assert reset (let the CPU run) */
 	err = emi62_set_reset(dev,0);
+	msleep(250); /* let device settle */


 	/* 2. We upload the FPGA firmware into the EMI
 	 * Note: collect up to 1023 (yes!) bytes and send them with
@@ -166,6 +168,7 @@
 		err("%s - error loading firmware: error = %d", __FUNCTION__, err);

 		goto wraperr;
 	}
+	msleep(250); /* let device settle */

 	/* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */

@@ -228,6 +231,7 @@
 		err("%s - error loading firmware: error = %d", __FUNCTION__, err);

 		goto wraperr;
 	}
+	msleep(250); /* let device settle */
 
 	kfree(buf);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-03 17:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-03 17:24 patch to emi62.c and emi26.c (firmware loaders for Emagic USB audio boxes) Monty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox