static void pxaohci_power(int why, void *arg) { struct pxaohci_softc *sc = (struct pxaohci_softc *)arg; int s; s = splhardusb(); sc->sc.sc_bus.ub_usepolling++; switch (why) { case PWR_STANDBY: case PWR_SUSPEND: #if 0 ohci_power(why, &sc->sc); #endif pxa2x0_clkman_config(CKEN_USBHC, 0); break; case PWR_RESUME: pxa2x0_clkman_config(CKEN_USBHC, 1); pxaohci_enable(sc); #if 0 ohci_power(why, &sc->sc); #endif break; } sc->sc.sc_bus.ub_usepolling--; splx(s); }
static int ohci_pci_resume(device_t self) { ohci_softc_t *sc = device_get_softc(self); ohci_power(PWR_RESUME, sc); bus_generic_resume(self); return 0; }
static int ohci_pci_suspend(device_t self) { ohci_softc_t *sc = device_get_softc(self); int err; err = bus_generic_suspend(self); if (err) return err; ohci_power(PWR_SUSPEND, sc); return 0; }
static int ohci_pci_resume(device_t self) { ohci_softc_t *sc = device_get_softc(self); #ifndef BURN_BRIDGES uint32_t reg, int_line; if (pci_get_powerstate(self) != PCI_POWERSTATE_D0) { device_printf(self, "chip is in D%d mode " "-- setting to D0\n", pci_get_powerstate(self)); reg = pci_read_config(self, PCI_CBMEM, 4); int_line = pci_read_config(self, PCIR_INTLINE, 4); pci_set_powerstate(self, PCI_POWERSTATE_D0); pci_write_config(self, PCI_CBMEM, reg, 4); pci_write_config(self, PCIR_INTLINE, int_line, 4); } #endif /* !BURN_BRIDGES */ ohci_power(PWR_RESUME, sc); bus_generic_resume(self); return 0; }