Fix EHCI usb submit timeout and unify with OHCI
Changed both to use a common timeout for URB submission, since they were using
different values and EHCI's was too short.
Also fixed EHCI to actually check if urb submission succeeded, rather than
silently continuing into the weeds.
Change-Id: I7f71499ffaa05187d8e5618db2419e1606007b82
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 6eb38a4..70c02c9 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -319,6 +319,7 @@
uint32_t endpt, token, usbsts;
uint32_t c, toggle;
uint32_t cmd;
+ int timeout;
int ret = 0;
debug("dev=%p, pipe=%lx, buffer=%p, length=%d, req=%p\n", dev, pipe,
@@ -447,6 +448,7 @@
/* Wait for TDs to be processed. */
ts = get_timer(0);
vtd = td;
+ timeout = USB_TIMEOUT_MS(pipe);
do {
/* Invalidate dcache */
ehci_invalidate_dcache(&qh_list);
@@ -454,7 +456,13 @@
if (!(token & 0x80))
break;
WATCHDOG_RESET();
- } while (get_timer(ts) < CONFIG_SYS_HZ);
+ } while (get_timer(ts) < timeout);
+
+ /* Check that the TD processing happened */
+ if (token & 0x80) {
+ printf("EHCI timed out on TD - token=%#x\n", token);
+ goto fail;
+ }
/* Disable async schedule. */
cmd = ehci_readl(&hcor->or_usbcmd);