Skip to content

Commit d5e6d02

Browse files
committed
ohci: Leave SMM or bios mode during init
1 parent c820c87 commit d5e6d02

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/portable/ohci/ohci.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,22 @@ bool hcd_init(uint8_t rhport)
177177
ohci_data.bulk_head_ed.skip = 1;
178178
ohci_data.period_head_ed.skip = 1;
179179

180+
//If OHCI hardware is in SMM mode, gain ownership (Ref OHCI spec 5.1.1.3.3)
181+
if (OHCI_REG->control_bit.interrupt_routing == 1)
182+
{
183+
OHCI_REG->command_status_bit.ownership_change_request = 1;
184+
while (OHCI_REG->control_bit.interrupt_routing == 1) {}
185+
}
186+
187+
//If OHCI hardware has come from warm-boot, signal resume (Ref OHCI spec 5.1.1.3.4)
188+
else if (OHCI_REG->control_bit.hc_functional_state != OHCI_CONTROL_FUNCSTATE_RESET &&
189+
OHCI_REG->control_bit.hc_functional_state != OHCI_CONTROL_FUNCSTATE_OPERATIONAL)
190+
{
191+
//Wait 20 ms. (Ref Usb spec 7.1.7.7)
192+
OHCI_REG->control_bit.hc_functional_state = OHCI_CONTROL_FUNCSTATE_RESUME;
193+
osal_task_delay(20);
194+
}
195+
180196
// reset controller
181197
OHCI_REG->command_status_bit.controller_reset = 1;
182198
while( OHCI_REG->command_status_bit.controller_reset ) {} // should not take longer than 10 us

0 commit comments

Comments
 (0)