diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2007-08-03 17:31:52 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2007-08-03 17:31:52 +0000 |
commit | 3d1f7d76e97b7bad91b79e0e91419d8dda2f99ee (patch) | |
tree | 3b263f80d844ef9596f1a5afb855c310bc700fb2 /target/linux/adm5120-2.6/files | |
parent | 1ac768c62f5deb88c0bc04e85fb40eeb6aa65ff1 (diff) | |
download | upstream-3d1f7d76e97b7bad91b79e0e91419d8dda2f99ee.tar.gz upstream-3d1f7d76e97b7bad91b79e0e91419d8dda2f99ee.tar.bz2 upstream-3d1f7d76e97b7bad91b79e0e91419d8dda2f99ee.zip |
[adm5120] fix reset function in USB driver
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8332 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/adm5120-2.6/files')
-rw-r--r-- | target/linux/adm5120-2.6/files/drivers/usb/host/adm5120-hcd.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/target/linux/adm5120-2.6/files/drivers/usb/host/adm5120-hcd.c b/target/linux/adm5120-2.6/files/drivers/usb/host/adm5120-hcd.c index 6e005bffad..875dc6c0b4 100644 --- a/target/linux/adm5120-2.6/files/drivers/usb/host/adm5120-hcd.c +++ b/target/linux/adm5120-2.6/files/drivers/usb/host/adm5120-hcd.c @@ -54,6 +54,7 @@ MODULE_AUTHOR("Jeroen Vreeken (pe1rxq@amsat.org)"); #define ADMHCD_INTMASK 0x00000001 /* Interrupt mask */ #define ADMHCD_REG_HOSTCONTROL 0x10 #define ADMHCD_DMA_EN 0x00000004 /* USB host DMA enable */ +#define ADMHCD_STATE_MASK 0x00000003 #define ADMHCD_STATE_RST 0x00000000 /* bus state reset */ #define ADMHCD_STATE_RES 0x00000001 /* bus state resume */ #define ADMHCD_STATE_OP 0x00000002 /* bus state operational */ @@ -776,7 +777,7 @@ static int admhcd_sw_reset(struct admhcd *ahcd) static int admhcd_reset(struct usb_hcd *hcd) { struct admhcd *ahcd = hcd_to_admhcd(hcd); - u32 val = 0; + u32 state = 0; int ret, timeout = 15; /* ms */ unsigned long t; @@ -785,19 +786,22 @@ static int admhcd_reset(struct usb_hcd *hcd) return ret; t = jiffies + msecs_to_jiffies(timeout); - while (time_before_eq(jiffies, t)) { - msleep(4); + do { spin_lock_irq(&ahcd->lock); - val = admhcd_reg_get(ahcd, ADMHCD_REG_HOSTCONTROL) & ADMHCD_STATE_RST; + state = admhcd_reg_get(ahcd, ADMHCD_REG_HOSTCONTROL); spin_unlock_irq(&ahcd->lock); - if (val) + state &= ADMHCD_STATE_MASK; + if (state == ADMHCD_STATE_RST) break; - } - if (!val) { + msleep(4); + } while (time_before_eq(jiffies, t)); + + if (state != ADMHCD_STATE_RST) { printk(KERN_WARNING "%s: device not ready after %dms\n", hcd_name, timeout); ret = -ENODEV; } + return ret; } |