summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhihong Chen <[email protected]>2024-07-05 20:17:15 +0800
committersakumisu <[email protected]>2024-07-09 21:11:36 +0800
commita942ec85a8753173ea14cdc9b9cd27376926b075 (patch)
tree94430bfac05163514a5415dc93ff200a986f69d8
parenta4a06573ea6efe3d7a27b5d38cc3b8bff5370a00 (diff)
port: ehci: update init and deinit
- update init and deinit Signed-off-by: Zhihong Chen <[email protected]>
-rw-r--r--port/ehci/usb_hc_ehci.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/port/ehci/usb_hc_ehci.c b/port/ehci/usb_hc_ehci.c
index cdb2362e..b2e3d46e 100644
--- a/port/ehci/usb_hc_ehci.c
+++ b/port/ehci/usb_hc_ehci.c
@@ -777,6 +777,8 @@ int usb_hc_init(struct usbh_bus *bus)
g_ehci_hcd[bus->hcd.hcd_id].n_cc,
g_ehci_hcd[bus->hcd.hcd_id].n_pcc);
+ EHCI_HCOR->usbcmd &= ~EHCI_USBCMD_RUN;
+ usb_osal_msleep(2);
EHCI_HCOR->usbcmd |= EHCI_USBCMD_HCRESET;
while (EHCI_HCOR->usbcmd & EHCI_USBCMD_HCRESET) {
usb_osal_msleep(1);
@@ -872,7 +874,7 @@ int usb_hc_deinit(struct usbh_bus *bus)
regval &= ~EHCI_USBCMD_RUN;
EHCI_HCOR->usbcmd = regval;
- while ((EHCI_HCOR->usbsts & (EHCI_USBSTS_PSS | EHCI_USBSTS_ASS))) {
+ while ((EHCI_HCOR->usbsts & (EHCI_USBSTS_PSS | EHCI_USBSTS_ASS)) || ((EHCI_HCOR->usbsts & EHCI_USBSTS_HALTED) == 0)) {
usb_osal_msleep(1);
timeout++;
if (timeout > 100) {
@@ -893,6 +895,7 @@ int usb_hc_deinit(struct usbh_bus *bus)
#endif
EHCI_HCOR->usbsts = EHCI_HCOR->usbsts;
+ EHCI_HCOR->usbcmd |= EHCI_USBCMD_HCRESET;
for (uint8_t index = 0; index < CONFIG_USB_EHCI_QH_NUM; index++) {
qh = &ehci_qh_pool[bus->hcd.hcd_id][index];