summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRyzee119 <[email protected]>2022-06-04 14:06:23 +0930
committerRyan Wendland <[email protected]>2023-02-18 10:24:21 +1030
commitd5e6d028171a38e435ac1ab7c18ae5615f8af5cf (patch)
treee31111708283bbd2451e3243212ee4d0edb7b374 /src
parentc820c8769267644af049e0be73b04b45d57e8d98 (diff)
ohci: Leave SMM or bios mode during init
Diffstat (limited to 'src')
-rw-r--r--src/portable/ohci/ohci.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/portable/ohci/ohci.c b/src/portable/ohci/ohci.c
index 45600c03b..364f61cf1 100644
--- a/src/portable/ohci/ohci.c
+++ b/src/portable/ohci/ohci.c
@@ -177,6 +177,22 @@ bool hcd_init(uint8_t rhport)
ohci_data.bulk_head_ed.skip = 1;
ohci_data.period_head_ed.skip = 1;
+ //If OHCI hardware is in SMM mode, gain ownership (Ref OHCI spec 5.1.1.3.3)
+ if (OHCI_REG->control_bit.interrupt_routing == 1)
+ {
+ OHCI_REG->command_status_bit.ownership_change_request = 1;
+ while (OHCI_REG->control_bit.interrupt_routing == 1) {}
+ }
+
+ //If OHCI hardware has come from warm-boot, signal resume (Ref OHCI spec 5.1.1.3.4)
+ else if (OHCI_REG->control_bit.hc_functional_state != OHCI_CONTROL_FUNCSTATE_RESET &&
+ OHCI_REG->control_bit.hc_functional_state != OHCI_CONTROL_FUNCSTATE_OPERATIONAL)
+ {
+ //Wait 20 ms. (Ref Usb spec 7.1.7.7)
+ OHCI_REG->control_bit.hc_functional_state = OHCI_CONTROL_FUNCSTATE_RESUME;
+ osal_task_delay(20);
+ }
+
// reset controller
OHCI_REG->command_status_bit.controller_reset = 1;
while( OHCI_REG->command_status_bit.controller_reset ) {} // should not take longer than 10 us