From f72d328d1285cfbaef4c0e13199d9e668414e06d Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 10 Nov 2014 16:50:21 +0100 Subject: libpayload/usb: wait a millisecond to work around device bugs Some USB sticks seem to send a NAK at a place where they mustn't by spec, leading to a controller side error condition. To avoid it, wait a millisecond which is enough to get past the NAK condition. That delay only happens on device discovery so it won't affect boot time by more than 1ms per device. BUG=chromium:414959 BRANCH=none TEST=depthcharge recognizes a Lexar 16GB USB stick after applying this change. Change-Id: I0e385702a5259b16fda0a253fc121d8f66e6705c Signed-off-by: Patrick Georgi Original-Commit-Id: 10bbfda8395af009e7f910cc503f50c2ad969ae8 Original-Change-Id: I6dd5ca34e9f3767003ccb0ca9daaf16116f4a2df Original-Signed-off-by: Patrick Georgi Original-Reviewed-on: https://chromium-review.googlesource.com/228791 Original-Reviewed-by: Julius Werner Original-Reviewed-by: Sheng-liang Song Reviewed-on: http://review.coreboot.org/8735 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer Reviewed-by: Paul Menzel --- payloads/libpayload/drivers/usb/usb.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'payloads/libpayload') diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c index 53006fff21..54b113ce47 100644 --- a/payloads/libpayload/drivers/usb/usb.c +++ b/payloads/libpayload/drivers/usb/usb.c @@ -393,6 +393,9 @@ set_address (hci_t *controller, usb_speed speed, int hubport, int hubaddr) usb_detach_device (controller, dev->address); return -1; } + /* workaround for some USB devices: wait until they're ready, or + * they send a NAK when they're not allowed to do. 1ms is enough */ + mdelay(1); dev->configuration = malloc(buf[1]); if (!dev->configuration) { usb_debug ("could not allocate %d bytes for DT_CFG\n", buf[1]); -- cgit v1.2.3