diff options
| author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2011-12-31 14:22:02 +0000 |
|---|---|---|
| committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2011-12-31 14:22:02 +0000 |
| commit | 927a44d06532768818c4c5ea8bbe8c4cd91331cf (patch) | |
| tree | 04b7d4812737d8a6d2d3f32fbb8d9e8ed1ff77a0 /sys/mips | |
| parent | d31a91bdfb1a8948052aea042ab2479d097ff6d5 (diff) | |
Notes
Diffstat (limited to 'sys/mips')
| -rw-r--r-- | sys/mips/atheros/ar71xx_ehci.c | 54 | ||||
| -rw-r--r-- | sys/mips/atheros/ar71xx_ohci.c | 8 | ||||
| -rw-r--r-- | sys/mips/cavium/usb/octusb.c | 29 | ||||
| -rw-r--r-- | sys/mips/cavium/usb/octusb.h | 2 | ||||
| -rw-r--r-- | sys/mips/cavium/usb/octusb_octeon.c | 26 | ||||
| -rw-r--r-- | sys/mips/rmi/xls_ehci.c | 58 | ||||
| -rw-r--r-- | sys/mips/rt305x/rt305x_dotg.c | 26 |
7 files changed, 56 insertions, 147 deletions
diff --git a/sys/mips/atheros/ar71xx_ehci.c b/sys/mips/atheros/ar71xx_ehci.c index 7d2c1cc14dea..72fab59414cf 100644 --- a/sys/mips/atheros/ar71xx_ehci.c +++ b/sys/mips/atheros/ar71xx_ehci.c @@ -65,53 +65,11 @@ struct ar71xx_ehci_softc { static device_attach_t ar71xx_ehci_attach; static device_detach_t ar71xx_ehci_detach; -static device_shutdown_t ar71xx_ehci_shutdown; -static device_suspend_t ar71xx_ehci_suspend; -static device_resume_t ar71xx_ehci_resume; bs_r_1_proto(reversed); bs_w_1_proto(reversed); static int -ar71xx_ehci_suspend(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_suspend(self); - if (err) - return (err); - ehci_suspend(sc); - return (0); -} - -static int -ar71xx_ehci_resume(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - - ehci_resume(sc); - - bus_generic_resume(self); - - return (0); -} - -static int -ar71xx_ehci_shutdown(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_shutdown(self); - if (err) - return (err); - ehci_shutdown(sc); - - return (0); -} - -static int ar71xx_ehci_probe(device_t self) { @@ -280,17 +238,17 @@ static device_method_t ehci_methods[] = { DEVMETHOD(device_probe, ar71xx_ehci_probe), DEVMETHOD(device_attach, ar71xx_ehci_attach), DEVMETHOD(device_detach, ar71xx_ehci_detach), - DEVMETHOD(device_suspend, ar71xx_ehci_suspend), - DEVMETHOD(device_resume, ar71xx_ehci_resume), - DEVMETHOD(device_shutdown, ar71xx_ehci_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD_END }; static driver_t ehci_driver = { - "ehci", - ehci_methods, - sizeof(struct ar71xx_ehci_softc), + .name = "ehci", + .methods = ehci_methods, + .size = sizeof(struct ar71xx_ehci_softc), }; static devclass_t ehci_devclass; diff --git a/sys/mips/atheros/ar71xx_ohci.c b/sys/mips/atheros/ar71xx_ohci.c index 4ccd8c2a8f86..d3a1c6585f7a 100644 --- a/sys/mips/atheros/ar71xx_ohci.c +++ b/sys/mips/atheros/ar71xx_ohci.c @@ -194,15 +194,17 @@ static device_method_t ohci_methods[] = { DEVMETHOD(device_probe, ar71xx_ohci_probe), DEVMETHOD(device_attach, ar71xx_ohci_attach), DEVMETHOD(device_detach, ar71xx_ohci_detach), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD_END }; static driver_t ohci_driver = { - "ohci", - ohci_methods, - sizeof(struct ar71xx_ohci_softc), + .name = "ohci", + .methods = ohci_methods, + .size = sizeof(struct ar71xx_ohci_softc), }; static devclass_t ohci_devclass; diff --git a/sys/mips/cavium/usb/octusb.c b/sys/mips/cavium/usb/octusb.c index 7ecf23258e3b..05d0943c6180 100644 --- a/sys/mips/cavium/usb/octusb.c +++ b/sys/mips/cavium/usb/octusb.c @@ -913,16 +913,16 @@ octusb_uninit(struct octusb_softc *sc) } -void +static void octusb_suspend(struct octusb_softc *sc) { - + /* TODO */ } -void +static void octusb_resume(struct octusb_softc *sc) { - + /* TODO */ } /*------------------------------------------------------------------------* @@ -1908,6 +1908,26 @@ octusb_set_hw_power(struct usb_bus *bus) DPRINTF("Nothing to do.\n"); } +static void +octusb_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct octusb_softc *sc = OCTUSB_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + octusb_suspend(sc); + break; + case USB_HW_POWER_SHUTDOWN: + octusb_uninit(sc); + break; + case USB_HW_POWER_RESUME: + octusb_resume(sc); + break; + default: + break; + } +} + struct usb_bus_methods octusb_bus_methods = { .endpoint_init = octusb_ep_init, .xfer_setup = octusb_xfer_setup, @@ -1916,6 +1936,7 @@ struct usb_bus_methods octusb_bus_methods = { .device_resume = octusb_device_resume, .device_suspend = octusb_device_suspend, .set_hw_power = octusb_set_hw_power, + .set_hw_power_sleep = octusb_set_hw_power_sleep, .roothub_exec = octusb_roothub_exec, .xfer_poll = octusb_do_poll, }; diff --git a/sys/mips/cavium/usb/octusb.h b/sys/mips/cavium/usb/octusb.h index 31f4fc0835bd..41320ef1d1a3 100644 --- a/sys/mips/cavium/usb/octusb.h +++ b/sys/mips/cavium/usb/octusb.h @@ -140,8 +140,6 @@ struct octusb_softc { usb_bus_mem_cb_t octusb_iterate_hw_softc; usb_error_t octusb_init(struct octusb_softc *); usb_error_t octusb_uninit(struct octusb_softc *); -void octusb_suspend(struct octusb_softc *); -void octusb_resume(struct octusb_softc *); void octusb_interrupt(struct octusb_softc *); #endif /* _OCTUSB_H_ */ diff --git a/sys/mips/cavium/usb/octusb_octeon.c b/sys/mips/cavium/usb/octusb_octeon.c index ac7b59063817..65208cc9a43d 100644 --- a/sys/mips/cavium/usb/octusb_octeon.c +++ b/sys/mips/cavium/usb/octusb_octeon.c @@ -69,7 +69,6 @@ static device_identify_t octusb_octeon_identify; static device_probe_t octusb_octeon_probe; static device_attach_t octusb_octeon_attach; static device_detach_t octusb_octeon_detach; -static device_shutdown_t octusb_octeon_shutdown; struct octusb_octeon_softc { struct octusb_softc sc_dci; /* must be first */ @@ -182,36 +181,23 @@ octusb_octeon_detach(device_t dev) return (0); } -static int -octusb_octeon_shutdown(device_t dev) -{ - struct octusb_octeon_softc *sc = device_get_softc(dev); - int err; - - err = bus_generic_shutdown(dev); - if (err) - return (err); - - octusb_uninit(&sc->sc_dci); - - return (0); -} - static device_method_t octusb_octeon_methods[] = { /* Device interface */ DEVMETHOD(device_identify, octusb_octeon_identify), DEVMETHOD(device_probe, octusb_octeon_probe), DEVMETHOD(device_attach, octusb_octeon_attach), DEVMETHOD(device_detach, octusb_octeon_detach), - DEVMETHOD(device_shutdown, octusb_octeon_shutdown), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD_END }; static driver_t octusb_octeon_driver = { - "octusb", - octusb_octeon_methods, - sizeof(struct octusb_octeon_softc), + .name = "octusb", + .methods = octusb_octeon_methods, + .size = sizeof(struct octusb_octeon_softc), }; static devclass_t octusb_octeon_devclass; diff --git a/sys/mips/rmi/xls_ehci.c b/sys/mips/rmi/xls_ehci.c index b0360f311894..8ab79cd955d0 100644 --- a/sys/mips/rmi/xls_ehci.c +++ b/sys/mips/rmi/xls_ehci.c @@ -69,50 +69,8 @@ __FBSDID("$FreeBSD$"); #include <dev/usb/controller/ehcireg.h> #include <mips/rmi/pic.h> -static int ehci_xls_attach(device_t self); -static int ehci_xls_detach(device_t self); -static int ehci_xls_shutdown(device_t self); -static int ehci_xls_suspend(device_t self); -static int ehci_xls_resume(device_t self); - -static int -ehci_xls_suspend(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_suspend(self); - if (err) - return (err); - ehci_suspend(sc); - return (0); -} - -static int -ehci_xls_resume(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - - ehci_resume(sc); - - bus_generic_resume(self); - - return (0); -} - -static int -ehci_xls_shutdown(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_shutdown(self); - if (err) - return (err); - ehci_shutdown(sc); - - return (0); -} +static device_attach_t ehci_xls_attach; +static device_detach_t ehci_xls_detach; static const char *xlr_usb_dev_desc = "RMI XLR USB 2.0 controller"; static const char *xlr_vendor_desc = "RMI Corp"; @@ -248,17 +206,17 @@ static device_method_t ehci_methods[] = { DEVMETHOD(device_probe, ehci_xls_probe), DEVMETHOD(device_attach, ehci_xls_attach), DEVMETHOD(device_detach, ehci_xls_detach), - DEVMETHOD(device_suspend, ehci_xls_suspend), - DEVMETHOD(device_resume, ehci_xls_resume), - DEVMETHOD(device_shutdown, ehci_xls_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD_END }; static driver_t ehci_driver = { - "ehci", - ehci_methods, - sizeof(struct ehci_softc), + .name = "ehci", + .methods = ehci_methods, + .size = sizeof(struct ehci_softc), }; static devclass_t ehci_devclass; diff --git a/sys/mips/rt305x/rt305x_dotg.c b/sys/mips/rt305x/rt305x_dotg.c index 144f3ade993d..39691235c3fb 100644 --- a/sys/mips/rt305x/rt305x_dotg.c +++ b/sys/mips/rt305x/rt305x_dotg.c @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); static device_probe_t dotg_obio_probe; static device_attach_t dotg_obio_attach; static device_detach_t dotg_obio_detach; -static device_shutdown_t dotg_obio_shutdown; struct dotg_obio_softc { struct dotg_softc sc_dci; /* must be first */ @@ -208,35 +207,22 @@ dotg_obio_detach(device_t dev) return (0); } -static int -dotg_obio_shutdown(device_t dev) -{ - struct dotg_obio_softc *sc = device_get_softc(dev); - int err; - - err = bus_generic_shutdown(dev); - if (err) - return (err); - - dotg_uninit(&sc->sc_dci); - - return (0); -} - static device_method_t dotg_obio_methods[] = { /* Device interface */ DEVMETHOD(device_probe, dotg_obio_probe), DEVMETHOD(device_attach, dotg_obio_attach), DEVMETHOD(device_detach, dotg_obio_detach), - DEVMETHOD(device_shutdown, dotg_obio_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD_END }; static driver_t dotg_obio_driver = { - "dotg", - dotg_obio_methods, - sizeof(struct dotg_obio_softc), + .name = "dotg", + .methods = dotg_obio_methods, + .size = sizeof(struct dotg_obio_softc), }; static devclass_t dotg_obio_devclass; |
