From a9f46ba20de99dba4788fc06cb53f20217ad205f Mon Sep 17 00:00:00 2001 From: n_hibma Date: Mon, 23 Aug 1999 21:00:08 +0000 Subject: Reset the UHCI controller when the device comes back from suspend. This should be replaced by proper support for suspend one day (global suspend). Submitted-by: Christopher Masto --- sys/pci/uhci_pci.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'sys/pci') diff --git a/sys/pci/uhci_pci.c b/sys/pci/uhci_pci.c index 3183eda..83bca9b 100644 --- a/sys/pci/uhci_pci.c +++ b/sys/pci/uhci_pci.c @@ -1,5 +1,3 @@ -/* $FreeBSD$ */ - /* * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -35,6 +33,8 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ */ /* Universal Host Controller Interface @@ -58,11 +58,12 @@ #include #include #if defined(__FreeBSD__) -#include -#endif +#include + #include -#include #include +#include +#endif #include #include @@ -90,6 +91,29 @@ static const char *uhci_device_generic = "UHCI (generic) USB controller"; #define PCI_UHCI_BASE_REG 0x20 +static int +uhci_pci_suspend(device_t self) +{ + uhci_softc_t *sc; + + sc = device_get_softc(self); + bus_generic_suspend(self); + + return 0; +} + +static int +uhci_pci_resume(device_t self) +{ + uhci_softc_t *sc; + + sc = device_get_softc(self); + uhci_reset(sc); + bus_generic_resume(self); + + return 0; +} + static const char * uhci_pci_match(device_t self) { @@ -148,7 +172,8 @@ uhci_pci_attach(device_t self) sc->iot = rman_get_bustag(res); sc->ioh = rman_get_bushandle(res); - bus_space_write_2(sc->iot, sc->ioh, UHCI_INTR, 0); /* disable interrupts */ + /* disable interrupts */ + bus_space_write_2(sc->iot, sc->ioh, UHCI_INTR, 0); rid = 0; res = bus_alloc_resource(self, SYS_RES_IRQ, &rid, 0, ~0, 1, @@ -247,6 +272,8 @@ static device_method_t uhci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, uhci_pci_probe), DEVMETHOD(device_attach, uhci_pci_attach), + DEVMETHOD(device_suspend, uhci_pci_suspend), + DEVMETHOD(device_resume, uhci_pci_resume), /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), -- cgit v1.1