* Set the interrupt threshold of the controller when doing the rest of the

initialization as suggested by the EHCI spec and do not touch it again
  once the controller is running. Doing so would result in undefined behaviour
  according to EHCI specs.
* Set the port routing policy after the controller has started and not before
  as suggested by the EHCI specs.
* Explicitly set the segment register after resetting the host controller and
  not before, as this likely has no real effect ;-)

Might help with some legacy support or UHCI/OHCI to EHCI handover problems.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24925 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2008-04-12 06:10:28 +00:00
parent 487171f0b9
commit e959baed58
1 changed files with 8 additions and 11 deletions

View File

@ -200,15 +200,15 @@ EHCI::EHCI(pci_info *info, Stack *stack)
// disable interrupts
WriteOpReg(EHCI_USBINTR, 0);
// reset the segment register
WriteOpReg(EHCI_CTRDSSEGMENT, 0);
// reset the host controller
if (ControllerReset() < B_OK) {
TRACE_ERROR(("usb_ehci: host controller failed to reset\n"));
return;
}
// reset the segment register
WriteOpReg(EHCI_CTRDSSEGMENT, 0);
// create semaphores the finisher thread will wait for
fAsyncAdvanceSem = create_sem(0, "EHCI Async Advance");
fFinishTransfersSem = create_sem(0, "EHCI Finish Transfers");
@ -359,10 +359,7 @@ EHCI::Start()
WriteOpReg(EHCI_USBCMD, ReadOpReg(EHCI_USBCMD) | EHCI_USBCMD_RUNSTOP
| EHCI_USBCMD_ASENABLE | EHCI_USBCMD_PSENABLE
| (frameListSize << EHCI_USBCMD_FLS_SHIFT)
| (2 << EHCI_USBCMD_ITC_SHIFT));
// route all ports to us
WriteOpReg(EHCI_CONFIGFLAG, EHCI_CONFIGFLAG_FLAG);
| (1 << EHCI_USBCMD_ITC_SHIFT));
bool running = false;
for (int32 i = 0; i < 10; i++) {
@ -377,15 +374,15 @@ EHCI::Start()
}
}
// set the interrupt threshold
WriteOpReg(EHCI_USBCMD, ReadOpReg(EHCI_USBCMD)
| (1 << EHCI_USBCMD_ITC_SHIFT));
if (!running) {
TRACE(("usb_ehci: Host Controller didn't start\n"));
return B_ERROR;
}
// route all ports to us
WriteOpReg(EHCI_CONFIGFLAG, EHCI_CONFIGFLAG_FLAG);
snooze(10000);
fRootHubAddress = AllocateAddress();
fRootHub = new(std::nothrow) EHCIRootHub(RootObject(), fRootHubAddress);
if (!fRootHub) {