[U-Boot] [PATCH] usb: replace wait_ms() with mdelay()
Mike Frysinger
vapier at gentoo.org
Tue Mar 6 00:47:00 CET 2012
Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:
ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c | 28 ++++++++++++------------
arch/arm/cpu/pxa/usb.c | 2 +-
arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c | 28 ++++++++++++------------
arch/powerpc/cpu/mpc5xxx/usb_ohci.c | 6 ++--
arch/powerpc/cpu/ppc4xx/usb_ohci.c | 6 ++--
arch/sparc/cpu/leon3/usb_uhci.c | 8 +++---
board/efikamx/efikamx-usb.c | 2 +-
board/mcc200/auto_update.c | 4 +-
board/mpl/common/usb_uhci.c | 8 +++---
board/renesas/sh7785lcr/selfcheck.c | 10 +-------
common/usb.c | 16 ++-----------
common/usb_hub.c | 10 ++++----
common/usb_storage.c | 16 +++++++-------
drivers/usb/host/ehci-hcd.c | 4 +-
drivers/usb/host/isp116x-hcd.c | 12 +++++-----
drivers/usb/host/ohci-hcd.c | 28 ++++++++++++------------
drivers/usb/host/r8a66597-hcd.c | 14 ++++++------
include/usb.h | 1 -
18 files changed, 93 insertions(+), 110 deletions(-)
diff --git a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
index 80bb61b27..cf0335c 100644
--- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
+++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
@@ -1057,7 +1057,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)",
usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (usb_pipeint(pipe)) {
info("Root-Hub submit IRQ: NOT implemented");
@@ -1260,7 +1260,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
#ifdef DEBUG
ohci_dump_roothub(&gohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
len = min_t(int, len, leni);
@@ -1275,7 +1275,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
pkt_print(dev, pipe, buffer, transfer_len, cmd, "RET(rh)",
0 /*usb_pipein(pipe) */);
#else
- wait_ms(1);
+ mdelay(1);
#endif
return stat;
@@ -1302,7 +1302,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB",
usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (!maxsize) {
err("submit_common_message: pipesize for pipe %lx is zero",
@@ -1316,7 +1316,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
return -1;
}
- wait_ms(10);
+ mdelay(10);
/* ohci_dump_status(&gohci); */
/* allow more time for a BULK device to react - some are slow */
@@ -1351,7 +1351,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
}
if (--timeout) {
- wait_ms(1);
+ mdelay(1);
if (!urb_finished)
dbg("\%");
@@ -1396,7 +1396,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
pkt_print(dev, pipe, buffer, transfer_len, setup, "RET(ctlr)",
usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
/* free TDs in urb_priv */
@@ -1423,7 +1423,7 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB",
usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (!maxsize) {
err("submit_control_message: pipesize for pipe %lx is zero",
@@ -1463,7 +1463,7 @@ static int hc_reset(struct ohci *ohci)
writel(OHCI_OCR, &ohci->regs->cmdstatus);
info("USB HC TakeOver from SMM");
while (readl(&ohci->regs->control) & OHCI_CTRL_IR) {
- wait_ms(10);
+ mdelay(10);
if (--smm_timeout == 0) {
err("USB HC TakeOver failed!");
return -1;
@@ -1600,7 +1600,7 @@ static int hc_interrupt(void)
#ifdef DEBUG
ohci_dump(ohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
/* FIXME: be optimistic, hope that bug won't repeat often. */
/* Make some non-interrupt context restart the controller. */
@@ -1611,7 +1611,7 @@ static int hc_interrupt(void)
}
if (ints & OHCI_INTR_WDH) {
- wait_ms(1);
+ mdelay(1);
writel(OHCI_INTR_WDH, ®s->intrdisable);
stat = dl_done_list(&gohci, dl_reverse_done_list(&gohci));
@@ -1627,7 +1627,7 @@ static int hc_interrupt(void)
/* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */
if (ints & OHCI_INTR_SF) {
unsigned int frame = m16_swap(ohci->hcca->frame_no) & 1;
- wait_ms(1);
+ mdelay(1);
writel(OHCI_INTR_SF, ®s->intrdisable);
if (ohci->ed_rm_list[frame] != NULL)
writel(OHCI_INTR_SF, ®s->intrenable);
@@ -1718,7 +1718,7 @@ int usb_lowlevel_init(void)
/* FIXME this is a second HC reset; why?? */
gohci.hc_control = OHCI_USB_RESET;
writel(gohci.hc_control, &gohci.regs->control);
- wait_ms(10);
+ mdelay(10);
if (hc_start(&gohci) < 0) {
err("can't start usb-%s", gohci.slot_name);
@@ -1730,7 +1730,7 @@ int usb_lowlevel_init(void)
#ifdef DEBUG
ohci_dump(&gohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
ohci_inited = 1;
urb_finished = 1;
diff --git a/arch/arm/cpu/pxa/usb.c b/arch/arm/cpu/pxa/usb.c
index 307fc6c..6c7e496 100644
--- a/arch/arm/cpu/pxa/usb.c
+++ b/arch/arm/cpu/pxa/usb.c
@@ -48,7 +48,7 @@ int usb_cpu_init(void)
#endif
writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
- wait_ms(11);
+ mdelay(11);
writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
index 866dd6c..7647e11 100644
--- a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
@@ -1012,7 +1012,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
urb_priv.actual_length = 0;
pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (usb_pipeint(pipe)) {
info("Root-Hub submit IRQ: NOT implemented");
@@ -1189,7 +1189,7 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
#ifdef DEBUG
ohci_dump_roothub (&gohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
len = min_t(int, len, leni);
@@ -1203,7 +1203,7 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
urb_priv.actual_length = transfer_len;
pkt_print(dev, pipe, buffer, transfer_len, cmd, "RET(rh)", 0/*usb_pipein(pipe)*/);
#else
- wait_ms(1);
+ mdelay(1);
#endif
return stat;
@@ -1230,7 +1230,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
urb_priv.actual_length = 0;
pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (!maxsize) {
err("submit_common_message: pipesize for pipe %lx is zero",
@@ -1243,7 +1243,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
return -1;
}
- wait_ms(10);
+ mdelay(10);
/* ohci_dump_status(&gohci); */
/* allow more time for a BULK device to react - some are slow */
@@ -1267,7 +1267,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
break;
}
if (--timeout) {
- udelay(250); /* wait_ms(1); */
+ udelay(250); /* mdelay(1); */
} else {
err("CTL:TIMEOUT ");
stat = USB_ST_CRC_ERR;
@@ -1302,7 +1302,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
#ifdef DEBUG
pkt_print(dev, pipe, buffer, transfer_len, setup, "RET(ctlr)", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
/* free TDs in urb_priv */
@@ -1328,7 +1328,7 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
urb_priv.actual_length = 0;
pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (!maxsize) {
err("submit_control_message: pipesize for pipe %lx is zero",
@@ -1367,7 +1367,7 @@ static int hc_reset (ohci_t *ohci)
writel (OHCI_OCR, &ohci->regs->cmdstatus); /* request ownership */
info("USB HC TakeOver from SMM");
while (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
- wait_ms (10);
+ mdelay (10);
if (--smm_timeout == 0) {
err("USB HC TakeOver failed!");
return -1;
@@ -1490,7 +1490,7 @@ hc_interrupt (void)
#ifdef DEBUG
ohci_dump (ohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
/* FIXME: be optimistic, hope that bug won't repeat often. */
/* Make some non-interrupt context restart the controller. */
@@ -1501,7 +1501,7 @@ hc_interrupt (void)
}
if (ints & OHCI_INTR_WDH) {
- wait_ms(1);
+ mdelay(1);
writel (OHCI_INTR_WDH, ®s->intrdisable);
stat = dl_done_list (&gohci, dl_reverse_done_list (&gohci));
writel (OHCI_INTR_WDH, ®s->intrenable);
@@ -1516,7 +1516,7 @@ hc_interrupt (void)
/* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */
if (ints & OHCI_INTR_SF) {
unsigned int frame = m16_swap (ohci->hcca->frame_no) & 1;
- wait_ms(1);
+ mdelay(1);
writel (OHCI_INTR_SF, ®s->intrdisable);
if (ohci->ed_rm_list[frame] != NULL)
writel (OHCI_INTR_SF, ®s->intrenable);
@@ -1686,7 +1686,7 @@ int usb_lowlevel_init(void)
/* FIXME this is a second HC reset; why?? */
writel (gohci.hc_control = OHCI_USB_RESET, &gohci.regs->control);
- wait_ms (10);
+ mdelay (10);
if (hc_start (&gohci) < 0)
goto errout;
@@ -1694,7 +1694,7 @@ int usb_lowlevel_init(void)
#ifdef DEBUG
ohci_dump (&gohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
ohci_inited = 1;
return 0;
diff --git a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
index d250c19..6d91525 100644
--- a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
+++ b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
@@ -1269,7 +1269,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
}
if (--timeout) {
- wait_ms(1);
+ mdelay(1);
if (!urb_finished)
dbg("\%");
@@ -1372,7 +1372,7 @@ static int hc_reset (ohci_t *ohci)
writel (OHCI_OCR, &ohci->regs->cmdstatus); /* request ownership */
info("USB HC TakeOver from SMM");
while (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
- wait_ms (10);
+ mdelay (10);
if (--smm_timeout == 0) {
err("USB HC TakeOver failed!");
return -1;
@@ -1529,7 +1529,7 @@ hc_interrupt (void)
/* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */
if (ints & OHCI_INTR_SF) {
unsigned int frame = ohci_cpu_to_le16 (ohci->hcca->frame_no) & 1;
- wait_ms(1);
+ mdelay(1);
writel (OHCI_INTR_SF, ®s->intrdisable);
if (ohci->ed_rm_list[frame] != NULL)
writel (OHCI_INTR_SF, ®s->intrenable);
diff --git a/arch/powerpc/cpu/ppc4xx/usb_ohci.c b/arch/powerpc/cpu/ppc4xx/usb_ohci.c
index 4fb7031..14c6a28 100644
--- a/arch/powerpc/cpu/ppc4xx/usb_ohci.c
+++ b/arch/powerpc/cpu/ppc4xx/usb_ohci.c
@@ -1274,7 +1274,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
}
if (--timeout) {
- wait_ms(1);
+ mdelay(1);
if (!urb_finished)
dbg("\%");
@@ -1377,7 +1377,7 @@ static int hc_reset (ohci_t *ohci)
writel (OHCI_OCR, &ohci->regs->cmdstatus); /* request ownership */
info("USB HC TakeOver from SMM");
while (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
- wait_ms (10);
+ mdelay (10);
if (--smm_timeout == 0) {
err("USB HC TakeOver failed!");
return -1;
@@ -1534,7 +1534,7 @@ hc_interrupt (void)
/* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */
if (ints & OHCI_INTR_SF) {
unsigned int frame = ohci_cpu_to_le16 (ohci->hcca->frame_no) & 1;
- wait_ms(1);
+ mdelay(1);
writel (OHCI_INTR_SF, ®s->intrdisable);
if (ohci->ed_rm_list[frame] != NULL)
writel (OHCI_INTR_SF, ®s->intrenable);
diff --git a/arch/sparc/cpu/leon3/usb_uhci.c b/arch/sparc/cpu/leon3/usb_uhci.c
index 358e52a..62cc25d 100644
--- a/arch/sparc/cpu/leon3/usb_uhci.c
+++ b/arch/sparc/cpu/leon3/usb_uhci.c
@@ -515,9 +515,9 @@ void reset_hc(void)
out16r(usb_base_addr + USBCMD, USBCMD_GRESET | USBCMD_RS);
/* Turn off all interrupts */
out16r(usb_base_addr + USBINTR, 0);
- wait_ms(50);
+ mdelay(50);
out16r(usb_base_addr + USBCMD, 0);
- wait_ms(10);
+ mdelay(10);
}
void start_hc(void)
@@ -1044,7 +1044,7 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
status = (status & 0xfff5) | USBPORTSC_PR;
out16r(usb_base_addr + USBPORTSC1 + 2 * (wIndex - 1),
status);
- wait_ms(10);
+ mdelay(10);
status = (status & 0xfff5) & ~USBPORTSC_PR;
out16r(usb_base_addr + USBPORTSC1 + 2 * (wIndex - 1),
status);
@@ -1052,7 +1052,7 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
status = (status & 0xfff5) | USBPORTSC_PE;
out16r(usb_base_addr + USBPORTSC1 + 2 * (wIndex - 1),
status);
- wait_ms(10);
+ mdelay(10);
status = (status & 0xfff5) | 0xa;
out16r(usb_base_addr + USBPORTSC1 + 2 * (wIndex - 1),
status);
diff --git a/board/efikamx/efikamx-usb.c b/board/efikamx/efikamx-usb.c
index ac2d2e9..618b39d 100644
--- a/board/efikamx/efikamx-usb.c
+++ b/board/efikamx/efikamx-usb.c
@@ -187,7 +187,7 @@ void ehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg)
ulpi_write(&ulpi_vp, &ulpi->otg_ctrl_set, ULPI_OTG_CHRGVBUS);
- wait_ms(50);
+ mdelay(50);
/* terminate the reset */
*reg = ehci_readl(status_reg);
diff --git a/board/mcc200/auto_update.c b/board/mcc200/auto_update.c
index 4152873..b9ff311 100644
--- a/board/mcc200/auto_update.c
+++ b/board/mcc200/auto_update.c
@@ -284,7 +284,7 @@ int au_do_update(int idx, long sz)
*/
debug ("flash_sect_erase(%lx, %lx);\n", start, end);
flash_sect_erase(start, end);
- wait_ms(100);
+ mdelay(100);
#ifdef CONFIG_PROGRESSBAR
show_progress(end - start, totsize);
#endif
@@ -352,7 +352,7 @@ int do_auto_update(void)
* Read keypad status
*/
i2c_read(I2C_PSOC_KEYPAD_ADDR, 0, 0, keypad_status1, 2);
- wait_ms(500);
+ mdelay(500);
i2c_read(I2C_PSOC_KEYPAD_ADDR, 0, 0, keypad_status2, 2);
/*
diff --git a/board/mpl/common/usb_uhci.c b/board/mpl/common/usb_uhci.c
index 89d2e0a..ddca587 100644
--- a/board/mpl/common/usb_uhci.c
+++ b/board/mpl/common/usb_uhci.c
@@ -435,9 +435,9 @@ void reset_hc(void)
out16r( usb_base_addr + USBCMD,USBCMD_GRESET | USBCMD_RS);
/* Turn off all interrupts */
out16r(usb_base_addr + USBINTR,0);
- wait_ms(50);
+ mdelay(50);
out16r( usb_base_addr + USBCMD,0);
- wait_ms(10);
+ mdelay(10);
}
void start_hc(void)
@@ -926,13 +926,13 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
status = in16r(usb_base_addr+USBPORTSC1+2*(wIndex-1));
status = (status & 0xfff5) | USBPORTSC_PR;
out16r(usb_base_addr+USBPORTSC1+2*(wIndex-1),status);
- wait_ms(10);
+ mdelay(10);
status = (status & 0xfff5) & ~USBPORTSC_PR;
out16r(usb_base_addr+USBPORTSC1+2*(wIndex-1),status);
udelay(10);
status = (status & 0xfff5) | USBPORTSC_PE;
out16r(usb_base_addr+USBPORTSC1+2*(wIndex-1),status);
- wait_ms(10);
+ mdelay(10);
status = (status & 0xfff5) | 0xa;
out16r(usb_base_addr+USBPORTSC1+2*(wIndex-1),status);
len=0;
diff --git a/board/renesas/sh7785lcr/selfcheck.c b/board/renesas/sh7785lcr/selfcheck.c
index 6d92c83..2cd2ad0 100644
--- a/board/renesas/sh7785lcr/selfcheck.c
+++ b/board/renesas/sh7785lcr/selfcheck.c
@@ -33,12 +33,6 @@
#define SM107_DEVICEID (0x13e00060 + NOCACHE_OFFSET)
-static void wait_ms(unsigned long time)
-{
- while (time--)
- udelay(1000);
-}
-
static void test_pld(void)
{
printf("PLD version = %04x\n", readb(PLD_VERSR));
@@ -53,10 +47,10 @@ static void test_led(void)
{
printf("turn on LEDs 3, 5, 7, 9\n");
writeb(0x55, PLD_LEDCR);
- wait_ms(2000);
+ mdelay(2000);
printf("turn on LEDs 4, 6, 8, 10\n");
writeb(0xaa, PLD_LEDCR);
- wait_ms(2000);
+ mdelay(2000);
writeb(0x00, PLD_LEDCR);
}
diff --git a/common/usb.c b/common/usb.c
index 3c9ede4..1ec30bc 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -81,16 +81,6 @@ char usb_started; /* flag for the started/stopped USB status */
*/
static void usb_scan_devices(void);
-/***********************************************************************
- * wait_ms
- */
-
-inline void wait_ms(unsigned long ms)
-{
- while (ms-- > 0)
- udelay(1000);
-}
-
/***************************************************************************
* Init USB Device
*/
@@ -209,7 +199,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
while (timeout--) {
if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC))
break;
- wait_ms(1);
+ mdelay(1);
}
if (dev->status)
return -1;
@@ -233,7 +223,7 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
while (timeout--) {
if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC))
break;
- wait_ms(1);
+ mdelay(1);
}
*actual_length = dev->act_len;
if (dev->status == 0)
@@ -897,7 +887,7 @@ int usb_new_device(struct usb_device *dev)
return 1;
}
- wait_ms(10); /* Let the SET_ADDRESS settle */
+ mdelay(10); /* Let the SET_ADDRESS settle */
tmp = sizeof(dev->descriptor);
diff --git a/common/usb_hub.c b/common/usb_hub.c
index 84d0d3f..e0edaad 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -120,7 +120,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
}
/* Wait at least 100 msec for power to become stable */
- wait_ms(max(pgood_delay, (unsigned)100));
+ mdelay(max(pgood_delay, (unsigned)100));
}
void usb_hub_reset(void)
@@ -160,7 +160,7 @@ int hub_port_reset(struct usb_device *dev, int port,
for (tries = 0; tries < MAX_TRIES; tries++) {
usb_set_port_feature(dev, port + 1, USB_PORT_FEAT_RESET);
- wait_ms(200);
+ mdelay(200);
if (usb_get_port_status(dev, port + 1, &portsts) < 0) {
USB_HUB_PRINTF("get_port_status failed status %lX\n",
@@ -187,7 +187,7 @@ int hub_port_reset(struct usb_device *dev, int port,
if (portstatus & USB_PORT_STAT_ENABLE)
break;
- wait_ms(200);
+ mdelay(200);
}
if (tries == MAX_TRIES) {
@@ -232,7 +232,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
if (!(portstatus & USB_PORT_STAT_CONNECTION))
return;
}
- wait_ms(200);
+ mdelay(200);
/* Reset the port */
if (hub_port_reset(dev, port, &portstatus) < 0) {
@@ -240,7 +240,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
return;
}
- wait_ms(200);
+ mdelay(200);
/* Allocate a new device struct for it */
usb = usb_alloc_new_device();
diff --git a/common/usb_storage.c b/common/usb_storage.c
index de84c8d..1208333 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -438,19 +438,19 @@ static int usb_stor_BBB_reset(struct us_data *us)
}
/* long wait for reset */
- wait_ms(150);
+ mdelay(150);
USB_STOR_PRINTF("BBB_reset result %d: status %lX reset\n", result,
us->pusb_dev->status);
pipe = usb_rcvbulkpipe(us->pusb_dev, us->ep_in);
result = usb_clear_halt(us->pusb_dev, pipe);
/* long wait for reset */
- wait_ms(150);
+ mdelay(150);
USB_STOR_PRINTF("BBB_reset result %d: status %lX clearing IN endpoint\n",
result, us->pusb_dev->status);
/* long wait for reset */
pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
result = usb_clear_halt(us->pusb_dev, pipe);
- wait_ms(150);
+ mdelay(150);
USB_STOR_PRINTF("BBB_reset result %d: status %lX"
" clearing OUT endpoint\n", result,
us->pusb_dev->status);
@@ -478,7 +478,7 @@ static int usb_stor_CB_reset(struct us_data *us)
USB_CNTL_TIMEOUT * 5);
/* long wait for reset */
- wait_ms(1500);
+ mdelay(1500);
USB_STOR_PRINTF("CB_reset result %d: status %lX"
" clearing endpoint halt\n", result,
us->pusb_dev->status);
@@ -621,7 +621,7 @@ int usb_stor_CBI_get_status(ccb *srb, struct us_data *us)
while (timeout--) {
if ((volatile int *) us->ip_wanted == 0)
break;
- wait_ms(10);
+ mdelay(10);
}
if (us->ip_wanted) {
printf(" Did not get interrupt on CBI\n");
@@ -692,7 +692,7 @@ int usb_stor_BBB_transport(ccb *srb, struct us_data *us)
usb_stor_BBB_reset(us);
return USB_STOR_TRANSPORT_FAILED;
}
- wait_ms(5);
+ mdelay(5);
pipein = usb_rcvbulkpipe(us->pusb_dev, us->ep_in);
pipeout = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
/* DATA phase + error handling */
@@ -884,7 +884,7 @@ do_retry:
srb->sense_buf[12], srb->sense_buf[13]);
return USB_STOR_TRANSPORT_FAILED;
} else {
- wait_ms(100);
+ mdelay(100);
goto do_retry;
}
break;
@@ -960,7 +960,7 @@ static int usb_test_unit_ready(ccb *srb, struct us_data *ss)
if (ss->transport(srb, ss) == USB_STOR_TRANSPORT_GOOD)
return 0;
usb_request_sense(srb, ss);
- wait_ms(100);
+ mdelay(100);
} while (retries--);
return -1;
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index d6fee81..ef5afc2 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -776,7 +776,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
goto unknown;
}
- wait_ms(1);
+ mdelay(1);
len = min3(srclen, le16_to_cpu(req->length), length);
if (srcptr != NULL && len > 0)
memcpy(buffer, srcptr, len);
@@ -857,7 +857,7 @@ int usb_lowlevel_init(void)
ehci_writel(&hcor->or_configflag, cmd);
/* unblock posted write */
cmd = ehci_readl(&hcor->or_usbcmd);
- wait_ms(5);
+ mdelay(5);
reg = HC_VERSION(ehci_readl(&hccr->cr_capbase));
printf("USB EHCI %x.%02x\n", reg >> 8, reg & 0xff);
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index abdcbb4..5ef34c3 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -578,7 +578,7 @@ static int isp116x_interrupt(struct isp116x *isp116x)
/* When root hub or any of its ports is going
to come out of suspend, it may take more
than 10ms for status bits to stabilize. */
- wait_ms(20);
+ mdelay(20);
}
if (intstat & HCINT_SO) {
@@ -679,7 +679,7 @@ retry_same:
/* Pack data into FIFO ram */
pack_fifo(isp116x, dev, pipe, ptd, 1, buffer, len);
#ifdef EXTRA_DELAY
- wait_ms(EXTRA_DELAY);
+ mdelay(EXTRA_DELAY);
#endif
/* Start the data transfer */
@@ -983,11 +983,11 @@ static int isp116x_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
HCRHPORT1 + wIndex - 1);
if (!(tmp & RH_PS_PRS))
break;
- wait_ms(1);
+ mdelay(1);
}
isp116x_write_reg32(isp116x, HCRHPORT1 + wIndex - 1,
RH_PS_PRS);
- wait_ms(10);
+ mdelay(10);
len = 0;
break;
@@ -1251,7 +1251,7 @@ static int isp116x_sw_reset(struct isp116x *isp116x)
isp116x_write_reg32(isp116x, HCCMDSTAT, HCCMDSTAT_HCR);
while (--retries) {
/* It usually resets within 1 ms */
- wait_ms(1);
+ mdelay(1);
if (!(isp116x_read_reg32(isp116x, HCCMDSTAT) & HCCMDSTAT_HCR))
break;
}
@@ -1278,7 +1278,7 @@ static int isp116x_reset(struct isp116x *isp116x)
clkrdy = isp116x_read_reg16(isp116x, HCuPINT) & HCuPINT_CLKRDY;
if (clkrdy)
break;
- wait_ms(1);
+ mdelay(1);
}
if (!clkrdy) {
ERR("clock not ready after %dms", timeout);
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 1a428e9..d24f2f1 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1279,7 +1279,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
pkt_print(NULL, dev, pipe, buffer, transfer_len,
cmd, "SUB(rh)", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (usb_pipeint(pipe)) {
info("Root-Hub submit IRQ: NOT implemented");
@@ -1360,7 +1360,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
OK(0);
case (RH_PORT_POWER):
WR_RH_PORTSTAT(RH_PS_PPS);
- wait_ms(100);
+ mdelay(100);
OK(0);
case (RH_PORT_ENABLE): /* BUG IN HUP CODE *********/
if (RD_RH_PORTSTAT & RH_PS_CCS)
@@ -1465,7 +1465,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
#ifdef DEBUG
ohci_dump_roothub(&gohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
len = min_t(int, len, leni);
@@ -1478,7 +1478,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
pkt_print(NULL, dev, pipe, buffer,
transfer_len, cmd, "RET(rh)", 0/*usb_pipein(pipe)*/);
#else
- wait_ms(1);
+ mdelay(1);
#endif
return stat;
@@ -1516,7 +1516,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
pkt_print(urb, dev, pipe, buffer, transfer_len,
setup, "SUB", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (!maxsize) {
err("submit_common_message: pipesize for pipe %lx is zero",
@@ -1530,7 +1530,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
}
#if 0
- wait_ms(10);
+ mdelay(10);
/* ohci_dump_status(&gohci); */
#endif
@@ -1560,7 +1560,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
}
if (--timeout) {
- wait_ms(1);
+ mdelay(1);
if (!urb->finished)
dbg("*");
@@ -1580,7 +1580,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
pkt_print(urb, dev, pipe, buffer, transfer_len,
setup, "RET(ctlr)", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
/* free TDs in urb_priv */
@@ -1607,7 +1607,7 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
pkt_print(NULL, dev, pipe, buffer, transfer_len,
setup, "SUB", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (!maxsize) {
err("submit_control_message: pipesize for pipe %lx is zero",
@@ -1677,7 +1677,7 @@ static int hc_reset(ohci_t *ohci)
ohci_writel(OHCI_OCR, &ohci->regs->cmdstatus);
info("USB HC TakeOver from SMM");
while (ohci_readl(&ohci->regs->control) & OHCI_CTRL_IR) {
- wait_ms(10);
+ mdelay(10);
if (--smm_timeout == 0) {
err("USB HC TakeOver failed!");
return -1;
@@ -1813,7 +1813,7 @@ static int hc_interrupt(void)
#ifdef DEBUG
ohci_dump(ohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
/* FIXME: be optimistic, hope that bug won't repeat often. */
/* Make some non-interrupt context restart the controller. */
@@ -1824,7 +1824,7 @@ static int hc_interrupt(void)
}
if (ints & OHCI_INTR_WDH) {
- wait_ms(1);
+ mdelay(1);
ohci_writel(OHCI_INTR_WDH, ®s->intrdisable);
(void)ohci_readl(®s->intrdisable); /* flush */
stat = dl_done_list(&gohci);
@@ -1841,7 +1841,7 @@ static int hc_interrupt(void)
/* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */
if (ints & OHCI_INTR_SF) {
unsigned int frame = m16_swap(ohci->hcca->frame_no) & 1;
- wait_ms(1);
+ mdelay(1);
ohci_writel(OHCI_INTR_SF, ®s->intrdisable);
if (ohci->ed_rm_list[frame] != NULL)
ohci_writel(OHCI_INTR_SF, ®s->intrenable);
@@ -1973,7 +1973,7 @@ int usb_lowlevel_init(void)
#ifdef DEBUG
ohci_dump(&gohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
ohci_inited = 1;
return 0;
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index aa753d8..ab1b8d0 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -497,7 +497,7 @@ static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port)
old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port) & LNST);
while (count > 0) {
- wait_ms(R8A66597_RH_POLL_TIME);
+ mdelay(R8A66597_RH_POLL_TIME);
syssts = r8a66597_read(r8a66597, get_syssts_reg(port) & LNST);
if (syssts == old_syssts) {
@@ -511,11 +511,11 @@ static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port)
static void r8a66597_bus_reset(struct r8a66597 *r8a66597, int port)
{
- wait_ms(10);
+ mdelay(10);
r8a66597_mdfy(r8a66597, USBRST, USBRST | UACT, get_dvstctr_reg(port));
- wait_ms(50);
+ mdelay(50);
r8a66597_mdfy(r8a66597, UACT, USBRST | UACT, get_dvstctr_reg(port));
- wait_ms(50);
+ mdelay(50);
}
static int check_usb_device_connecting(struct r8a66597 *r8a66597)
@@ -823,7 +823,7 @@ static int r8a66597_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
stat = USB_ST_STALLED;
}
- wait_ms(1);
+ mdelay(1);
len = min_t(int, len, leni);
@@ -918,7 +918,7 @@ int usb_lowlevel_init(void)
r8a66597->reg = CONFIG_R8A66597_BASE_ADDR;
disable_controller(r8a66597);
- wait_ms(100);
+ mdelay(100);
enable_controller(r8a66597);
r8a66597_port_power(r8a66597, 0 , 1);
@@ -926,7 +926,7 @@ int usb_lowlevel_init(void)
/* check usb device */
check_usb_device_connecting(r8a66597);
- wait_ms(50);
+ mdelay(50);
return 0;
}
diff --git a/include/usb.h b/include/usb.h
index 4534738..48e4bcd 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -199,7 +199,6 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
void *buffer, int transfer_len, int interval);
int usb_disable_asynch(int disable);
int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
-inline void wait_ms(unsigned long ms);
int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer,
int cfgno);
int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type,
--
1.7.8.4
More information about the U-Boot
mailing list