summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2005-03-30 14:02:04 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2005-03-30 14:02:04 +0000
commitc593492063adad7596bea476f7ca7656c6ec3f33 (patch)
tree91e61e1ee77ea5fa73bdb3a349e000cbf29033fa
parent0b6d27832ef6d0e331b4660db5272c34ae508242 (diff)
make the powerhooks the responsibility of the bus ohci is attached to
ok uwe@
-rw-r--r--sys/arch/arm/xscale/pxa2x0_ohci.c7
-rw-r--r--sys/dev/cardbus/ohci_cardbus.c6
-rw-r--r--sys/dev/pci/ohci_pci.c8
-rw-r--r--sys/dev/usb/ohci.c5
-rw-r--r--sys/dev/usb/ohcivar.h3
5 files changed, 19 insertions, 10 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0_ohci.c b/sys/arch/arm/xscale/pxa2x0_ohci.c
index 753213ec4f3..a635a003e68 100644
--- a/sys/arch/arm/xscale/pxa2x0_ohci.c
+++ b/sys/arch/arm/xscale/pxa2x0_ohci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0_ohci.c,v 1.13 2005/02/23 13:17:29 dlg Exp $ */
+/* $OpenBSD: pxa2x0_ohci.c,v 1.14 2005/03/30 14:02:02 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -127,12 +127,12 @@ pxaohci_attach(struct device *parent, struct device *self, void *aux)
sc->sc.sc_bus.bdev.dv_xname, r);
bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
sc->sc.sc_size = 0;
- pxa2x0_intr_disestablish(sc->sc_ih);
- sc->sc_ih = NULL;
pxa2x0_clkman_config(CKEN_USBHC, 0);
return;
}
+ sc->sc.sc_powerhook = powerhook_establish(ohci_power, &sc->sc);
+
sc->sc_ih = pxa2x0_intr_establish(PXA2X0_INT_USBH1, IPL_USB,
ohci_intr, sc, sc->sc.sc_bus.bdev.dv_xname);
@@ -150,6 +150,7 @@ pxaohci_detach(struct device *self, int flags)
rv = ohci_detach(&sc->sc, flags);
if (rv)
return (rv);
+ powerhook_disestablish(sc->sc.sc_powerhook);
if (sc->sc_ih != NULL) {
pxa2x0_intr_disestablish(sc->sc_ih);
diff --git a/sys/dev/cardbus/ohci_cardbus.c b/sys/dev/cardbus/ohci_cardbus.c
index 4f0073eaf33..409f5b2553a 100644
--- a/sys/dev/cardbus/ohci_cardbus.c
+++ b/sys/dev/cardbus/ohci_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci_cardbus.c,v 1.1 2004/12/07 05:42:41 dlg Exp $ */
+/* $OpenBSD: ohci_cardbus.c,v 1.2 2005/03/30 14:02:02 dlg Exp $ */
/* $NetBSD: ohci_cardbus.c,v 1.19 2004/08/02 19:14:28 mycroft Exp $ */
/*
@@ -208,6 +208,8 @@ XXX (ct->ct_cf->cardbus_mem_open)(cc, 0, iob, iob + 0x40);
return;
}
+ sc->sc.sc_powerhook = powerhook_establish(ohci_power, &sc->sc);
+
#if NEHCI_CARDBUS > 0
usb_cardbus_add(&sc->sc_cardbus, ca, &sc->sc.sc_bus);
#endif
@@ -231,6 +233,8 @@ ohci_cardbus_detach(struct device *self, int flags)
rv = ohci_detach(&sc->sc, flags);
if (rv)
return (rv);
+ powerhook_disestablish(sc->sc.sc_powerhook);
+
if (sc->sc_ih != NULL) {
cardbus_intr_disestablish(sc->sc_cc, sc->sc_cf, sc->sc_ih);
sc->sc_ih = NULL;
diff --git a/sys/dev/pci/ohci_pci.c b/sys/dev/pci/ohci_pci.c
index 0364bdab81a..804c65225f4 100644
--- a/sys/dev/pci/ohci_pci.c
+++ b/sys/dev/pci/ohci_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci_pci.c,v 1.22 2004/12/31 04:22:32 dlg Exp $ */
+/* $OpenBSD: ohci_pci.c,v 1.23 2005/03/30 14:02:03 dlg Exp $ */
/* $NetBSD: ohci_pci.c,v 1.23 2002/10/02 16:51:47 thorpej Exp $ */
/*
@@ -178,6 +178,9 @@ ohci_pci_attach(struct device *parent, struct device *self, void *aux)
splx(s);
return;
}
+
+ sc->sc.sc_powerhook = powerhook_establish(ohci_power, &sc->sc);
+
splx(s);
usb_pci_add(&sc->sc_pci, pa, &sc->sc.sc_bus);
@@ -196,6 +199,9 @@ ohci_pci_detach(device_ptr_t self, int flags)
rv = ohci_detach(&sc->sc, flags);
if (rv)
return (rv);
+
+ powerhook_disestablish(sc->sc.sc_powerhook);
+
if (sc->sc_ih != NULL) {
pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
sc->sc_ih = NULL;
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index 9b68c77d6b0..8ec47dc7eca 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci.c,v 1.56 2005/03/30 03:01:55 pascoe Exp $ */
+/* $OpenBSD: ohci.c,v 1.57 2005/03/30 14:02:03 dlg Exp $ */
/* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
@@ -135,7 +135,6 @@ Static usbd_status ohci_alloc_std_chain(struct ohci_pipe *,
ohci_soft_td_t *, ohci_soft_td_t **);
Static void ohci_shutdown(void *v);
-Static void ohci_power(int, void *);
Static usbd_status ohci_open(usbd_pipe_handle);
Static void ohci_poll(struct usbd_bus *);
Static void ohci_softintr(void *);
@@ -374,7 +373,6 @@ ohci_detach(struct ohci_softc *sc, int flags)
usb_uncallout(sc->sc_tmo_rhsc, ohci_rhsc_enable, sc);
#if defined(__NetBSD__) || defined(__OpenBSD__)
- powerhook_disestablish(sc->sc_powerhook);
shutdownhook_disestablish(sc->sc_shutdownhook);
#endif
@@ -869,7 +867,6 @@ ohci_init(ohci_softc_t *sc)
#if defined(__NetBSD__) || defined(__OpenBSD__)
sc->sc_control = sc->sc_intre = 0;
- sc->sc_powerhook = powerhook_establish(ohci_power, sc);
sc->sc_shutdownhook = shutdownhook_establish(ohci_shutdown, sc);
#endif
diff --git a/sys/dev/usb/ohcivar.h b/sys/dev/usb/ohcivar.h
index 96be803111a..4792958b9c9 100644
--- a/sys/dev/usb/ohcivar.h
+++ b/sys/dev/usb/ohcivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohcivar.h,v 1.18 2003/07/08 13:19:09 nate Exp $ */
+/* $OpenBSD: ohcivar.h,v 1.19 2005/03/30 14:02:03 dlg Exp $ */
/* $NetBSD: ohcivar.h,v 1.32 2003/02/22 05:24:17 tsutsui Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohcivar.h,v 1.13 1999/11/17 22:33:41 n_hibma Exp $ */
@@ -152,4 +152,5 @@ int ohci_intr(void *);
#if defined(__NetBSD__) || defined(__OpenBSD__)
int ohci_detach(ohci_softc_t *, int);
int ohci_activate(device_ptr_t, enum devact);
+void ohci_power(int, void *);
#endif