libpayload/usb: Increase USB request timeout to 5 s
Increase the timeout for USB requests to 5 seconds for all USB host controllers. Prior to this fix, the xCHI driver was detecting false timeouts during SET ADDRESS requests when nested downstream hubs were connected to the xHCI root hub. BUG=b:124730179 BRANCH=sarien TEST=Build libpayload and depthcharge on sarien/arcada. TEST=Without change replicate USB set address timeouts in depthcharge when dock and 4K monitor connected (which includes a total of 4 USB hubs). With timeout fix, depthcharge boots OS with no USB errors and the same USB topology. Note that this tests xHCI operation only. Change-Id: I53e3e67d893420e7c9e8b52c47dd0edb979e5468 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/33671 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
committed by
Duncan Laurie
parent
9d0b7b9021
commit
bf2c693f89
@@ -247,6 +247,8 @@ static void free_qh_and_tds(ehci_qh_t *qh, qtd_t *cur)
|
||||
free((void *)qh);
|
||||
}
|
||||
|
||||
#define EHCI_SLEEP_TIME_US 50
|
||||
|
||||
static int wait_for_tds(qtd_t *head)
|
||||
{
|
||||
/* returns the amount of bytes *not* transmitted, or -1 for error */
|
||||
@@ -256,18 +258,10 @@ static int wait_for_tds(qtd_t *head)
|
||||
if (0) dump_td(virt_to_phys(cur));
|
||||
|
||||
/* wait for results */
|
||||
/* how long to wait?
|
||||
* tested with some USB2.0 flash sticks:
|
||||
* TUR turn around took
|
||||
* about 2.2s for the slowest (13fe:3800)
|
||||
* max. 250ms for the others
|
||||
* slowest non-TUR turn around took about 1.3s
|
||||
* set to 3s to be safe as a failed TUR can be fatal
|
||||
*/
|
||||
int timeout = 60000; /* time out after 60000 * 50us == 3s */
|
||||
int timeout = USB_MAX_PROCESSING_TIME_US / EHCI_SLEEP_TIME_US;
|
||||
while ((cur->token & QTD_ACTIVE) && !(cur->token & QTD_HALTED)
|
||||
&& timeout--)
|
||||
udelay(50);
|
||||
udelay(EHCI_SLEEP_TIME_US);
|
||||
if (timeout < 0) {
|
||||
usb_debug("Error: ehci: queue transfer "
|
||||
"processing timed out.\n");
|
||||
|
Reference in New Issue
Block a user