diff options
author | Nico Huber <nico.huber@secunet.com> | 2012-06-19 10:27:00 +0200 |
---|---|---|
committer | Nico Huber <nico.huber@secunet.com> | 2012-06-22 18:20:21 +0200 |
commit | df28d9fe170b2d22f71045806e5fe6f3242c6de9 (patch) | |
tree | 0cac7e578d8c094be10db2bfa6fa4aff64990a90 /payloads/libpayload/drivers | |
parent | efb479c08bc1b03838c6493324d11d6164c78861 (diff) | |
download | coreboot-df28d9fe170b2d22f71045806e5fe6f3242c6de9.tar.xz |
libpayload: Adjust timeouts and delays in OHCI driver
This sets the timeout for control and bulk transfers to 2s per
transfer descriptor (like we set it in the EHCI driver). It also adds
delays around the disabling of control and bulk list access to
overcome some race conditions.
Change-Id: Ia2d1db890fca51c7d9477de163d55030e0c5a04a
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: http://review.coreboot.org/1127
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads/libpayload/drivers')
-rw-r--r-- | payloads/libpayload/drivers/usb/ohci.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/payloads/libpayload/drivers/usb/ohci.c b/payloads/libpayload/drivers/usb/ohci.c index 0f4886fc63..2e22ecf9e7 100644 --- a/payloads/libpayload/drivers/usb/ohci.c +++ b/payloads/libpayload/drivers/usb/ohci.c @@ -205,11 +205,10 @@ static int wait_for_ed(usbdev_t *dev, ed_t *head, int pages) { /* wait for results */ - /* TODO: how long to wait? - * give 50ms per page plus another 100ms for now - * this should even work with low-speed + /* TOTEST: how long to wait? + * give 2s per TD (2 pages) plus another 2s for now */ - int timeout = pages*50 + 100; + int timeout = pages*1000 + 2000; while (((head->head_pointer & ~3) != head->tail_pointer) && !(head->head_pointer & 1) && ((((td_t*)phys_to_virt(head->head_pointer & ~3))->config @@ -363,7 +362,10 @@ ohci_control (usbdev_t *dev, direction_t dir, int drlen, void *devreq, int dalen int failure = wait_for_ed(dev, head, (dalen==0)?0:(last_page - first_page + 1)); + /* Wait some frames before and one after disabling list access. */ + mdelay(4); OHCI_INST(dev->controller)->opreg->HcControl &= ~ControlListEnable; + mdelay(1); /* free memory */ ohci_free_ed(head); @@ -464,7 +466,10 @@ ohci_bulk (endpoint_t *ep, int dalen, u8 *data, int finalize) int failure = wait_for_ed(ep->dev, head, (dalen==0)?0:(last_page - first_page + 1)); + /* Wait some frames before and one after disabling list access. */ + mdelay(4); OHCI_INST(ep->dev->controller)->opreg->HcControl &= ~BulkListEnable; + mdelay(1); ep->toggle = head->head_pointer & ED_TOGGLE; |