summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2001-09-15 20:57:34 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2001-09-15 20:57:34 +0000
commit0e69df90558f3fd9a003af364ab4ad3757334d58 (patch)
treef7a34a6ba1fbba93f8054713c9fdd15c4223aa33 /sys
parent5dec863bc219a380e5985bc401e2a06dcdf291a2 (diff)
Add a timer to reinable the OHCI RHSC (Root Hub Status Change)
interrupt after one second. Originally the interrupt was disabled permanently after it fired once. This causes futher hot plug/removals to stop working. However the interrupt will fire several times in succession as a device is inserted/removed. This effectively debounces the interrupt. Apparently only some systems actually plug directly into the root hub: Most PCI cards do not, however newer apple motherboards all do. This was sent around for review some time back and again recently, this time with no feedback.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/ohci_pci.c6
-rw-r--r--sys/dev/usb/ohci.c13
-rw-r--r--sys/dev/usb/ohcivar.h6
3 files changed, 22 insertions, 3 deletions
diff --git a/sys/dev/pci/ohci_pci.c b/sys/dev/pci/ohci_pci.c
index 07ddacc581f..77aed422458 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.13 2001/08/25 10:13:30 art Exp $ */
+/* $OpenBSD: ohci_pci.c,v 1.14 2001/09/15 20:57:33 drahn Exp $ */
/* $NetBSD: ohci_pci.c,v 1.9 1999/05/20 09:52:35 augustss Exp $ */
/*
@@ -138,6 +138,10 @@ ohci_pci_attach(parent, self, aux)
return;
}
+#if defined(__OpenBSD__)
+ timeout_set(&sc->sc.sc_tmo_rhsc, ohci_rhsc_enable, sc);
+#endif
+
intrstr = pci_intr_string(pc, ih);
sc->sc_ih = pci_intr_establish(pc, ih, IPL_USB, ohci_intr, sc,
sc->sc.sc_bus.bdev.dv_xname);
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index f367b7a3430..23d05571eba 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci.c,v 1.22 2001/06/13 07:43:36 deraadt Exp $ */
+/* $OpenBSD: ohci.c,v 1.23 2001/09/15 20:57:33 drahn Exp $ */
/* $NetBSD: ohci.c,v 1.102 2001/04/01 15:00:29 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
@@ -1135,6 +1135,10 @@ ohci_intr1(ohci_softc_t *sc)
* on until the port has been reset.
*/
ohci_rhsc_able(sc, 0);
+#if defined (__OpenBSD__)
+ /* Do not allow RHSC interrupts > 1 per second */
+ timeout_add(&sc->sc_tmo_rhsc, hz);
+#endif
}
sc->sc_bus.intr_context--;
@@ -1147,6 +1151,13 @@ ohci_intr1(ohci_softc_t *sc)
}
void
+ohci_rhsc_enable(void *v_sc)
+{
+ ohci_softc_t *sc = v_sc;
+ ohci_rhsc_able(sc, 1);
+}
+
+void
ohci_rhsc_able(ohci_softc_t *sc, int on)
{
DPRINTFN(4, ("ohci_rhsc_able: on=%d\n", on));
diff --git a/sys/dev/usb/ohcivar.h b/sys/dev/usb/ohcivar.h
index 7c94ff33186..a8795edbd24 100644
--- a/sys/dev/usb/ohcivar.h
+++ b/sys/dev/usb/ohcivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohcivar.h,v 1.12 2001/05/03 02:20:32 aaron Exp $ */
+/* $OpenBSD: ohcivar.h,v 1.13 2001/09/15 20:57:33 drahn Exp $ */
/* $NetBSD: ohcivar.h,v 1.27 2001/02/21 10:19:30 minoura Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohcivar.h,v 1.13 1999/11/17 22:33:41 n_hibma Exp $ */
@@ -133,6 +133,9 @@ typedef struct ohci_softc {
device_ptr_t sc_child;
+#if defined(__OpenBSD__)
+ struct timeout sc_tmo_rhsc;
+#endif
char sc_dying;
} ohci_softc_t;
@@ -142,5 +145,6 @@ int ohci_intr(void *);
int ohci_detach(ohci_softc_t *, int);
int ohci_activate(device_ptr_t, enum devact);
#endif
+Static void ohci_rhsc_enable(void *sc);
#define MS_TO_TICKS(ms) ((ms) * hz / 1000)