diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 58cdf0ad24f0..bb3e2ae9f668 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -191,6 +191,7 @@ Static int ohci_str(usb_string_descriptor_t *, int, const char *); Static void ohci_timeout(void *); Static void ohci_rhsc_able(ohci_softc_t *, int); +Static void ohci_rhsc_enable(void *); Static void ohci_close_pipe(usbd_pipe_handle, ohci_soft_ed_t *); Static void ohci_abort_xfer(usbd_xfer_handle, usbd_status); @@ -357,6 +358,8 @@ ohci_detach(struct ohci_softc *sc, int flags) if (rv != 0) return (rv); + 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); @@ -861,6 +864,8 @@ ohci_init(ohci_softc_t *sc) sc->sc_shutdownhook = shutdownhook_establish(ohci_shutdown, sc); #endif + usb_callout_init(sc->sc_tmo_rhsc); + return (USBD_NORMAL_COMPLETION); bad5: @@ -1101,6 +1106,8 @@ ohci_intr1(ohci_softc_t *sc) * on until the port has been reset. */ ohci_rhsc_able(sc, 0); + /* Do not allow RHSC interrupts > 1 per second */ + usb_callout(sc->sc_tmo_rhsc, hz, ohci_rhsc_enable, sc); } sc->sc_bus.intr_context--; @@ -1125,6 +1132,14 @@ ohci_rhsc_able(ohci_softc_t *sc, int on) } } +void +ohci_rhsc_enable(void *v_sc) +{ + ohci_softc_t *sc = v_sc; + + ohci_rhsc_able(sc, 1); +} + #ifdef OHCI_DEBUG char *ohci_cc_strs[] = { "NO_ERROR",