diff options
author | Nico Huber <nico.huber@secunet.com> | 2012-05-21 14:23:03 +0200 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2012-06-09 13:13:08 +0200 |
commit | bb1c42b92037dc3dbbb639a1140dd284e978c595 (patch) | |
tree | ee8d0f1e942d69ae5c4f57b08385579d012b5626 /payloads/libpayload/drivers/usb/uhci.c | |
parent | c43e736c0ccd26fbfea11c19d5140ea1cc30d90d (diff) | |
download | coreboot-bb1c42b92037dc3dbbb639a1140dd284e978c595.tar.xz |
libpayload: Add timeouts in the UHCI USB driver
We should always have some timeout when we wait for the hardware. This adds
missing timeouts to the UHCI driver.
Change-Id: Ic37b95ce12ff3ff5efe3e7ca346090946f6ee7de
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: http://review.coreboot.org/1073
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'payloads/libpayload/drivers/usb/uhci.c')
-rw-r--r-- | payloads/libpayload/drivers/usb/uhci.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/payloads/libpayload/drivers/usb/uhci.c b/payloads/libpayload/drivers/usb/uhci.c index 8f2321eedf..78f7aba2dc 100644 --- a/payloads/libpayload/drivers/usb/uhci.c +++ b/payloads/libpayload/drivers/usb/uhci.c @@ -102,13 +102,18 @@ static void uhci_reset (hci_t *controller) { /* reset */ - uhci_reg_write16 (controller, USBCMD, 4); - mdelay (50); + uhci_reg_write16 (controller, USBCMD, 4); /* Global Reset */ + mdelay (50); /* uhci spec 2.1.1: at least 10ms */ uhci_reg_write16 (controller, USBCMD, 0); mdelay (10); - uhci_reg_write16 (controller, USBCMD, 2); - while ((uhci_reg_read16 (controller, USBCMD) & 2) != 0) - mdelay (1); + uhci_reg_write16 (controller, USBCMD, 2); /* Host Controller Reset */ + /* wait for controller to finish reset */ + /* TOTEST: how long to wait? 100ms for now */ + int timeout = 200; /* time out after 200 * 500us == 100ms */ + while (((uhci_reg_read16 (controller, USBCMD) & 2) != 0) && timeout--) + udelay (500); + if (timeout < 0) + debug ("Warning: uhci: host controller reset timed out.\n"); uhci_reg_write32 (controller, FLBASEADD, (u32) virt_to_phys (UHCI_INST (controller)-> |