diff options
Diffstat (limited to 'payloads')
-rw-r--r-- | payloads/libpayload/drivers/usb/ehci.c | 16 | ||||
-rw-r--r-- | payloads/libpayload/drivers/usb/ehci_private.h | 3 |
2 files changed, 18 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) diff --git a/payloads/libpayload/drivers/usb/ehci_private.h b/payloads/libpayload/drivers/usb/ehci_private.h index 3276e23edc..3b9faf6d31 100644 --- a/payloads/libpayload/drivers/usb/ehci_private.h +++ b/payloads/libpayload/drivers/usb/ehci_private.h @@ -61,6 +61,7 @@ typedef volatile struct { typedef volatile struct { u32 usbcmd; #define HC_OP_RS 1 +#define HC_OP_HC_RESET (1 << 1) #define HC_OP_PERIODIC_SCHED_EN_SHIFT 4 #define HC_OP_PERIODIC_SCHED_EN (1 << HC_OP_PERIODIC_SCHED_EN_SHIFT) #define HC_OP_ASYNC_SCHED_EN_SHIFT 5 @@ -70,6 +71,8 @@ typedef volatile struct { #define HC_OP_PERIODIC_SCHED_STAT (1 << HC_OP_PERIODIC_SCHED_STAT_SHIFT) #define HC_OP_ASYNC_SCHED_STAT_SHIFT 15 #define HC_OP_ASYNC_SCHED_STAT (1 << HC_OP_ASYNC_SCHED_STAT_SHIFT) +#define HC_OP_HC_HALTED_SHIFT 12 +#define HC_OP_HC_HALTED (1 << HC_OP_HC_HALTED_SHIFT) u32 usbintr; u32 frindex; u32 ctrldssegment; |