// Check if need companion controllers for full/low speed devices static void ehci_note_port(struct usb_ehci_s *cntl) { if (--cntl->checkports) // Ports still being detected. return; if (! cntl->legacycount) // No full/low speed devices found. return; // Start companion controllers. int i; for (i=0; i<ARRAY_SIZE(cntl->companion); i++) { struct pci_device *pci = cntl->companion[i]; if (!pci) break; // ohci/uhci_setup call pci_config_X - don't run from irq handler. wait_preempt(); if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_UHCI) uhci_setup(pci, cntl->usb.busid + i); else if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_OHCI) ohci_setup(pci, cntl->usb.busid + i); } }
static int ohci_pci_reset (struct usb_hcd *hcd) { struct ohci_hcd *ohci = hcd_to_ohci (hcd); struct pci_dev *pdev = to_pci_dev(hcd->self.controller); int ret = 0; if (hcd->self.controller) { const struct pci_device_id *quirk_id; quirk_id = pci_match_id(ohci_pci_quirks, pdev); if (quirk_id != NULL) { int (*quirk)(struct usb_hcd *ohci); quirk = (void *)quirk_id->driver_data; ret = quirk(hcd); } } if (ret == 0) ret = ohci_setup(hcd); /* * After ohci setup RWC may not be set for add-in PCI cards. * This transfers PCI PM wakeup capabilities. */ if (device_can_wakeup(&pdev->dev)) ohci->hc_control |= OHCI_CTRL_RWC; return ret; }
void __usb_setup(void *data) { dprintf(3, "init usb\n"); xhci_setup(); ehci_setup(); uhci_setup(); ohci_setup(); }
void usb_setup(void) { ASSERT32FLAT(); if (! CONFIG_USB) return; dprintf(3, "init usb\n"); usb_time_sigatt = romfile_loadint("etc/usb-time-sigatt", USB_TIME_SIGATT); xhci_setup(); ehci_setup(); uhci_setup(); ohci_setup(); }
static int ohci_da8xx_reset(struct usb_hcd *hcd) { struct device *dev = hcd->self.controller; struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); int result; u32 rh_a; dev_dbg(dev, "starting USB controller\n"); result = ohci_da8xx_enable(hcd); if (result < 0) return result; /* * DA8xx only have 1 port connected to the pins but the HC root hub * register A reports 2 ports, thus we'll have to override it... */ ohci->num_ports = 1; result = ohci_setup(hcd); if (result < 0) { ohci_da8xx_disable(hcd); return result; } /* * Since we're providing a board-specific root hub port power control * and over-current reporting, we have to override the HC root hub A * register's default value, so that ohci_hub_control() could return * the correct hub descriptor... */ rh_a = ohci_readl(ohci, &ohci->regs->roothub.a); if (ohci_da8xx_has_set_power(hcd)) { rh_a &= ~RH_A_NPS; rh_a |= RH_A_PSM; } if (ohci_da8xx_has_oci(hcd)) { rh_a &= ~RH_A_NOCP; rh_a |= RH_A_OCPM; } if (ohci_da8xx_has_potpgt(hcd)) { rh_a &= ~RH_A_POTPGT; rh_a |= hub->potpgt << 24; } ohci_writel(ohci, rh_a, &ohci->regs->roothub.a); return result; }
static int ohci_omap_reset(struct usb_hcd *hcd) { struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct omap_usb_config *config = dev_get_platdata(hcd->self.controller); int need_transceiver = (config->otg != 0); int ret; dev_dbg(hcd->self.controller, "starting USB Controller\n"); if (config->otg) { hcd->self.otg_port = config->otg; /* default/minimum OTG power budget: 8 mA */ hcd->power_budget = 8; } /* boards can use OTG transceivers in non-OTG modes */ need_transceiver = need_transceiver || machine_is_omap_h2() || machine_is_omap_h3(); /* XXX OMAP16xx only */ if (config->ocpi_enable) config->ocpi_enable(); #ifdef CONFIG_USB_OTG if (need_transceiver) { hcd->phy = usb_get_phy(USB_PHY_TYPE_USB2); if (!IS_ERR_OR_NULL(hcd->phy)) { int status = otg_set_host(hcd->phy->otg, &ohci_to_hcd(ohci)->self); dev_dbg(hcd->self.controller, "init %s phy, status %d\n", hcd->phy->label, status); if (status) { usb_put_phy(hcd->phy); return status; } } else { dev_err(hcd->self.controller, "can't find phy\n"); return -ENODEV; } ohci->start_hnp = start_hnp; } #endif omap_ohci_clock_power(1); if (cpu_is_omap15xx()) { omap_1510_local_bus_power(1); omap_1510_local_bus_init(); } ret = ohci_setup(hcd); if (ret < 0) return ret; if (config->otg || config->rwc) { ohci->hc_control = OHCI_CTRL_RWC; writel(OHCI_CTRL_RWC, &ohci->regs->control); } /* board-specific power switching and overcurrent support */ if (machine_is_omap_osk() || machine_is_omap_innovator()) { u32 rh = roothub_a (ohci); /* power switching (ganged by default) */ rh &= ~RH_A_NPS; /* TPS2045 switch for internal transceiver (port 1) */ if (machine_is_omap_osk()) { ohci_to_hcd(ohci)->power_budget = 250; rh &= ~RH_A_NOCP; /* gpio9 for overcurrent detction */ omap_cfg_reg(W8_1610_GPIO9); gpio_request(9, "OHCI overcurrent"); gpio_direction_input(9); /* for paranoia's sake: disable USB.PUEN */ omap_cfg_reg(W4_USB_HIGHZ); } ohci_writel(ohci, rh, &ohci->regs->roothub.a); ohci->flags &= ~OHCI_QUIRK_HUB_POWER; } else if (machine_is_nokia770()) { /* We require a self-powered hub, which should have * plenty of power. */ ohci_to_hcd(ohci)->power_budget = 0; } /* FIXME khubd hub requests should manage power switching */ omap_ohci_transceiver_power(1); /* board init will have already handled HMC and mux setup. * any external transceiver should already be initialized * too, so all configured ports use the right signaling now. */ return 0; }