if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_EHCI)
ehci_controller_setup(pci);
}
+}
- // Wait for all EHCI controllers to initialize. This forces OHCI/UHCI
- // setup to always be after any EHCI ports are routed to EHCI.
- while (PendingEHCI)
+// Wait for all EHCI controllers to initialize. This forces OHCI/UHCI
+// setup to always be after any EHCI ports are routed to EHCI.
+void
+ehci_wait_controllers(void)
+{
+ while (CONFIG_USB_EHCI && CONFIG_THREADS && PendingEHCI)
yield();
}
// usb-ehci.c
void ehci_setup(void);
+void ehci_wait_controllers(void);
struct usbdevice_s;
struct usb_endpoint_descriptor;
struct usb_pipe;
#include "pci_regs.h" // PCI_BASE_ADDRESS_0
#include "string.h" // memset
#include "usb.h" // struct usb_s
+#include "usb-ehci.h" // ehci_wait_controllers
#include "usb-ohci.h" // struct ohci_hcca
#include "util.h" // msleep
#include "x86.h" // readl
check_ohci_ports(struct usb_ohci_s *cntl)
{
ASSERT32FLAT();
+ // Wait for ehci init - in case this is a "companion controller"
+ ehci_wait_controllers();
// Turn on power for all devices on roothub.
u32 rha = readl(&cntl->regs->roothub_a);
rha &= ~(RH_A_PSM | RH_A_OCPM);
#include "pci_regs.h" // PCI_BASE_ADDRESS_4
#include "string.h" // memset
#include "usb.h" // struct usb_s
+#include "usb-ehci.h" // ehci_wait_controllers
#include "usb-uhci.h" // USBLEGSUP
#include "util.h" // msleep
#include "x86.h" // outw
check_uhci_ports(struct usb_uhci_s *cntl)
{
ASSERT32FLAT();
+ // Wait for ehci init - in case this is a "companion controller"
+ ehci_wait_controllers();
+
struct usbhub_s hub;
memset(&hub, 0, sizeof(hub));
hub.cntl = &cntl->usb;