mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-27 06:04:40 +08:00
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>
This commit is contained in:
parent
efb063390d
commit
96820a3587
@ -319,6 +319,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,
|
|||||||
uint32_t endpt, token, usbsts;
|
uint32_t endpt, token, usbsts;
|
||||||
uint32_t c, toggle;
|
uint32_t c, toggle;
|
||||||
uint32_t cmd;
|
uint32_t cmd;
|
||||||
|
int timeout;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
debug("dev=%p, pipe=%lx, buffer=%p, length=%d, req=%p\n", dev, pipe,
|
debug("dev=%p, pipe=%lx, buffer=%p, length=%d, req=%p\n", dev, pipe,
|
||||||
@ -447,6 +448,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,
|
|||||||
/* Wait for TDs to be processed. */
|
/* Wait for TDs to be processed. */
|
||||||
ts = get_timer(0);
|
ts = get_timer(0);
|
||||||
vtd = td;
|
vtd = td;
|
||||||
|
timeout = USB_TIMEOUT_MS(pipe);
|
||||||
do {
|
do {
|
||||||
/* Invalidate dcache */
|
/* Invalidate dcache */
|
||||||
ehci_invalidate_dcache(&qh_list);
|
ehci_invalidate_dcache(&qh_list);
|
||||||
@ -454,7 +456,13 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,
|
|||||||
if (!(token & 0x80))
|
if (!(token & 0x80))
|
||||||
break;
|
break;
|
||||||
WATCHDOG_RESET();
|
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. */
|
/* Disable async schedule. */
|
||||||
cmd = ehci_readl(&hcor->or_usbcmd);
|
cmd = ehci_readl(&hcor->or_usbcmd);
|
||||||
|
@ -1524,12 +1524,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
|||||||
/* ohci_dump_status(&gohci); */
|
/* ohci_dump_status(&gohci); */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* allow more time for a BULK device to react - some are slow */
|
timeout = USB_TIMEOUT_MS(pipe);
|
||||||
#define BULK_TO 5000 /* timeout in milliseconds */
|
|
||||||
if (usb_pipebulk(pipe))
|
|
||||||
timeout = BULK_TO;
|
|
||||||
else
|
|
||||||
timeout = 1000;
|
|
||||||
|
|
||||||
/* wait for it to complete */
|
/* wait for it to complete */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -42,6 +42,12 @@
|
|||||||
|
|
||||||
#define USB_CNTL_TIMEOUT 100 /* 100ms timeout */
|
#define USB_CNTL_TIMEOUT 100 /* 100ms timeout */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the timeout to allow for submitting an urb in ms. We allow more
|
||||||
|
* time for a BULK device to react - some are slow.
|
||||||
|
*/
|
||||||
|
#define USB_TIMEOUT_MS(pipe) (usb_pipebulk(pipe) ? 5000 : 100)
|
||||||
|
|
||||||
/* device request (setup) */
|
/* device request (setup) */
|
||||||
struct devrequest {
|
struct devrequest {
|
||||||
unsigned char requesttype;
|
unsigned char requesttype;
|
||||||
|
Loading…
Reference in New Issue
Block a user