Skip to content

Commit

Permalink
[PATCH] USB: Emagic USB firmware loading fixes
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Monty authored and Greg Kroah-Hartman committed May 12, 2006
1 parent 332bbf6 commit 16c23f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/usb/misc/emi26.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -114,6 +115,7 @@ static int emi26_load_firmware (struct usb_device *dev)

/* 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
Expand Down Expand Up @@ -150,6 +152,7 @@ static int emi26_load_firmware (struct usb_device *dev)
goto wraperr;
}
}
msleep(250); /* let device settle */

/* De-assert reset (let the CPU run) */
err = emi26_set_reset(dev,0);
Expand Down Expand Up @@ -192,6 +195,7 @@ static int emi26_load_firmware (struct usb_device *dev)
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 */
Expand Down
4 changes: 4 additions & 0 deletions drivers/usb/misc/emi62.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -123,6 +124,7 @@ static int emi62_load_firmware (struct usb_device *dev)

/* 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
Expand Down Expand Up @@ -166,6 +168,7 @@ static int emi62_load_firmware (struct usb_device *dev)
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 */

Expand Down Expand Up @@ -228,6 +231,7 @@ static int emi62_load_firmware (struct usb_device *dev)
err("%s - error loading firmware: error = %d", __FUNCTION__, err);
goto wraperr;
}
msleep(250); /* let device settle */

kfree(buf);

Expand Down

0 comments on commit 16c23f7

Please sign in to comment.