summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/usb/ehci.c
diff options
context:
space:
mode:
authorAnton Kochkov <a.kochkov@securitycode.ru>2012-11-09 14:06:05 +0100
committerStefan Reinauer <stefan.reinauer@coreboot.org>2012-11-09 20:10:05 +0100
commit2fef58eaba93ede5a177afc3538f80a90f4a433e (patch)
tree92a2a4236d3ad35004bdd368539350ecff4b9361 /payloads/libpayload/drivers/usb/ehci.c
parenta1ea82283d868af3681c3575722753f0789b941d (diff)
downloadcoreboot-2fef58eaba93ede5a177afc3538f80a90f4a433e.tar.xz
[PATCH] libpayload: Implement EHCI reset function
Added ehci_reset() function to do a full reset of the host controller Change-Id: Ia48db8462ebbb8f260813eb6ba8349d002c4678b Signed-off-by: Anton Kochkov <a.kochkov@securitycode.ru> Reviewed-on: http://review.coreboot.org/1814 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'payloads/libpayload/drivers/usb/ehci.c')
-rw-r--r--payloads/libpayload/drivers/usb/ehci.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/payloads/libpayload/drivers/usb/ehci.c b/payloads/libpayload/drivers/usb/ehci.c
index 29b399a324..2ac1480632 100644
--- a/payloads/libpayload/drivers/usb/ehci.c
+++ b/payloads/libpayload/drivers/usb/ehci.c
@@ -51,7 +51,21 @@ static void ehci_stop (hci_t *controller)
static void ehci_reset (hci_t *controller)
{
-
+ short count = 0;
+ ehci_stop(controller);
+ /* wait 10 ms just to be shure */
+ mdelay(10);
+ if (EHCI_INST(controller)->operation->usbsts & HC_OP_HC_HALTED) {
+ EHCI_INST(controller)->operation->usbcmd = HC_OP_HC_RESET;
+ /* wait 100 ms */
+ for (count = 0; count < 10; count++) {
+ mdelay(10);
+ if (!(EHCI_INST(controller)->operation->usbcmd & HC_OP_HC_RESET)) {
+ return;
+ }
+ }
+ }
+ usb_debug("ehci_reset(): reset failed!\n");
}
static int ehci_set_periodic_schedule(ehci_t *ehcic, int enable)