diff options
| author | skrll <skrll@NetBSD.org> | 2016-05-06 13:03:06 +0000 |
|---|---|---|
| committer | skrll <skrll@NetBSD.org> | 2016-05-06 13:03:06 +0000 |
| commit | cd075ad0697e42d2969bdb1bd030c32971241df8 (patch) | |
| tree | 060f497e1df2b3da3ff3f7c03f799c0914b7137e /sys/dev | |
| parent | 88a2feddf9e5d54cfa0df61e8316bd72799a7b1c (diff) | |
usb is attached with config_interrupts so we can G/C the code to support
transfers when this wasn't the case.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/ehci.c | 66 | ||||
| -rw-r--r-- | sys/dev/usb/motg.c | 45 | ||||
| -rw-r--r-- | sys/dev/usb/ohci.c | 51 | ||||
| -rw-r--r-- | sys/dev/usb/uhci.c | 57 |
4 files changed, 8 insertions, 211 deletions
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c index 31dcf308c04..a99008e4b22 100644 --- a/sys/dev/usb/ehci.c +++ b/sys/dev/usb/ehci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.249 2016/04/23 10:15:31 skrll Exp $ */ +/* $NetBSD: ehci.c,v 1.250 2016/05/06 13:03:06 skrll Exp $ */ /* * Copyright (c) 2004-2012 The NetBSD Foundation, Inc. @@ -53,7 +53,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.249 2016/04/23 10:15:31 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.250 2016/05/06 13:03:06 skrll Exp $"); #include "ohci.h" #include "uhci.h" @@ -159,7 +159,6 @@ Static usbd_status ehci_open(struct usbd_pipe *); Static void ehci_poll(struct usbd_bus *); Static void ehci_softintr(void *); Static int ehci_intr1(ehci_softc_t *); -Static void ehci_waitintr(ehci_softc_t *, struct usbd_xfer *); Static void ehci_check_qh_intr(ehci_softc_t *, struct ehci_xfer *, ex_completeq_t *); Static void ehci_check_itd_intr(ehci_softc_t *, struct ehci_xfer *, @@ -1279,48 +1278,6 @@ ehci_idone(struct ehci_xfer *ex, ex_completeq_t *cq) DPRINTF("ex=%p done", ex, 0, 0, 0); } -/* - * Wait here until controller claims to have an interrupt. - * Then call ehci_intr and return. Use timeout to avoid waiting - * too long. - */ -Static void -ehci_waitintr(ehci_softc_t *sc, struct usbd_xfer *xfer) -{ - int timo; - uint32_t intrs; - - EHCIHIST_FUNC(); EHCIHIST_CALLED(); - - xfer->ux_status = USBD_IN_PROGRESS; - for (timo = xfer->ux_timeout; timo >= 0; timo--) { - usb_delay_ms(&sc->sc_bus, 1); - if (sc->sc_dying) - break; - intrs = EHCI_STS_INTRS(EOREAD4(sc, EHCI_USBSTS)) & - sc->sc_eintrs; - DPRINTF("0x%04x", intrs, 0, 0, 0); -#ifdef EHCI_DEBUG - if (ehcidebug >= 15) - ehci_dump_regs(sc); -#endif - if (intrs) { - mutex_spin_enter(&sc->sc_intr_lock); - ehci_intr1(sc); - mutex_spin_exit(&sc->sc_intr_lock); - if (xfer->ux_status != USBD_IN_PROGRESS) - return; - } - } - - /* Timeout */ - DPRINTF("timeout", 0, 0, 0, 0); - xfer->ux_status = USBD_TIMEOUT; - mutex_enter(&sc->sc_lock); - usb_transfer_complete(xfer); - mutex_exit(&sc->sc_lock); -} - Static void ehci_poll(struct usbd_bus *bus) { @@ -3704,9 +3661,6 @@ ehci_device_ctrl_start(struct usbd_xfer *xfer) #endif #endif - if (sc->sc_bus.ub_usepolling) - ehci_waitintr(sc, xfer); - return USBD_IN_PROGRESS; } @@ -3909,9 +3863,6 @@ ehci_device_bulk_start(struct usbd_xfer *xfer) #endif #endif - if (sc->sc_bus.ub_usepolling) - ehci_waitintr(sc, xfer); - return USBD_IN_PROGRESS; } @@ -4123,9 +4074,6 @@ ehci_device_intr_start(struct usbd_xfer *xfer) #endif #endif - if (sc->sc_bus.ub_usepolling) - ehci_waitintr(sc, xfer); - return USBD_IN_PROGRESS; } @@ -4509,11 +4457,6 @@ ehci_device_fs_isoc_transfer(struct usbd_xfer *xfer) mutex_exit(&sc->sc_lock); - if (sc->sc_bus.ub_usepolling) { - printf("Starting ehci isoc xfer with polling. Bad idea?\n"); - ehci_waitintr(sc, xfer); - } - return USBD_IN_PROGRESS; } @@ -4908,11 +4851,6 @@ ehci_device_isoc_transfer(struct usbd_xfer *xfer) mutex_exit(&sc->sc_lock); - if (sc->sc_bus.ub_usepolling) { - printf("Starting ehci isoc xfer with polling. Bad idea?\n"); - ehci_waitintr(sc, xfer); - } - return USBD_IN_PROGRESS; } diff --git a/sys/dev/usb/motg.c b/sys/dev/usb/motg.c index a559e5ff86f..a8037207774 100644 --- a/sys/dev/usb/motg.c +++ b/sys/dev/usb/motg.c @@ -1,4 +1,4 @@ -/* $NetBSD: motg.c,v 1.15 2016/04/23 18:54:42 skrll Exp $ */ +/* $NetBSD: motg.c,v 1.16 2016/05/06 13:03:06 skrll Exp $ */ /* * Copyright (c) 1998, 2004, 2011, 2012, 2014 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.15 2016/04/23 18:54:42 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.16 2016/05/06 13:03:06 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_motg.h" @@ -179,7 +179,6 @@ static void motg_device_intr_tx(struct motg_softc *, int); static void motg_device_data_read(struct usbd_xfer *); static void motg_device_data_write(struct usbd_xfer *); -static void motg_waitintr(struct motg_softc *, struct usbd_xfer *); static void motg_device_clear_toggle(struct usbd_pipe *); static void motg_device_xfer_abort(struct usbd_xfer *); @@ -1286,8 +1285,6 @@ motg_device_ctrl_start(struct usbd_xfer *xfer) mutex_exit(&sc->sc_lock); if (err != USBD_IN_PROGRESS) return err; - if (sc->sc_bus.ub_usepolling) - motg_waitintr(sc, xfer); return USBD_IN_PROGRESS; } @@ -1727,8 +1724,6 @@ motg_device_data_start(struct usbd_xfer *xfer) mutex_exit(&sc->sc_lock); if (err != USBD_IN_PROGRESS) return err; - if (sc->sc_bus.ub_usepolling) - motg_waitintr(sc, xfer); return USBD_IN_PROGRESS; } @@ -2155,42 +2150,6 @@ motg_device_data_done(struct usbd_xfer *xfer) KASSERT(otgpipe->hw_ep->xfer != xfer); } -/* - * Wait here until controller claims to have an interrupt. - * Then call motg_intr and return. Use timeout to avoid waiting - * too long. - * Only used during boot when interrupts are not enabled yet. - */ -void -motg_waitintr(struct motg_softc *sc, struct usbd_xfer *xfer) -{ - int timo = xfer->ux_timeout; - MOTGHIST_FUNC(); MOTGHIST_CALLED(); - - mutex_enter(&sc->sc_lock); - - DPRINTF("timeout = %dms", timo, 0, 0, 0); - - for (; timo >= 0; timo--) { - mutex_exit(&sc->sc_lock); - usb_delay_ms(&sc->sc_bus, 1); - mutex_spin_enter(&sc->sc_intr_lock); - motg_poll(&sc->sc_bus); - mutex_spin_exit(&sc->sc_intr_lock); - mutex_enter(&sc->sc_lock); - if (xfer->ux_status != USBD_IN_PROGRESS) - goto done; - } - - /* Timeout */ - DPRINTF("timeout", 0, 0, 0, 0); - panic("motg_waitintr: timeout"); - /* XXX handle timeout ! */ - -done: - mutex_exit(&sc->sc_lock); -} - void motg_device_clear_toggle(struct usbd_pipe *pipe) { diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index fd5e8e5d269..0b8d1e7b8b0 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.260 2016/04/23 10:15:32 skrll Exp $ */ +/* $NetBSD: ohci.c,v 1.261 2016/05/06 13:03:06 skrll Exp $ */ /* * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.260 2016/04/23 10:15:32 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.261 2016/05/06 13:03:06 skrll Exp $"); #include "opt_usb.h" @@ -146,7 +146,6 @@ Static void ohci_reset_std_chain(ohci_softc_t *, struct usbd_xfer *, Static usbd_status ohci_open(struct usbd_pipe *); Static void ohci_poll(struct usbd_bus *); Static void ohci_softintr(void *); -Static void ohci_waitintr(ohci_softc_t *, struct usbd_xfer *); Static void ohci_rhsc(ohci_softc_t *, struct usbd_xfer *); Static void ohci_rhsc_softint(void *); @@ -1705,49 +1704,6 @@ ohci_root_intr_done(struct usbd_xfer *xfer) sc->sc_intrxfer = NULL; } -/* - * Wait here until controller claims to have an interrupt. - * Then call ohci_intr and return. Use timeout to avoid waiting - * too long. - */ -void -ohci_waitintr(ohci_softc_t *sc, struct usbd_xfer *xfer) -{ - int timo; - uint32_t intrs; - OHCIHIST_FUNC(); OHCIHIST_CALLED(); - - mutex_enter(&sc->sc_lock); - - xfer->ux_status = USBD_IN_PROGRESS; - for (timo = xfer->ux_timeout; timo >= 0; timo--) { - usb_delay_ms(&sc->sc_bus, 1); - if (sc->sc_dying) - break; - intrs = OREAD4(sc, OHCI_INTERRUPT_STATUS) & sc->sc_eintrs; - DPRINTFN(15, "intrs 0x%04x", intrs, 0, 0, 0); -#ifdef OHCI_DEBUG - if (ohcidebug > 15) - ohci_dumpregs(sc); -#endif - if (intrs) { - mutex_spin_enter(&sc->sc_intr_lock); - ohci_intr1(sc); - mutex_spin_exit(&sc->sc_intr_lock); - if (xfer->ux_status != USBD_IN_PROGRESS) - goto done; - } - } - - /* Timeout */ - DPRINTF("timeout", 0, 0, 0, 0); - xfer->ux_status = USBD_TIMEOUT; - usb_transfer_complete(xfer); - -done: - mutex_exit(&sc->sc_lock); -} - void ohci_poll(struct usbd_bus *bus) { @@ -2882,9 +2838,6 @@ ohci_device_ctrl_start(struct usbd_xfer *xfer) mutex_exit(&sc->sc_lock); - if (sc->sc_bus.ub_usepolling) - ohci_waitintr(sc, xfer); - return USBD_IN_PROGRESS; } diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index 1c264f2642a..c505d4f73de 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $NetBSD: uhci.c,v 1.270 2016/04/25 20:06:51 joerg Exp $ */ +/* $NetBSD: uhci.c,v 1.271 2016/05/06 13:03:06 skrll Exp $ */ /* * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.270 2016/04/25 20:06:51 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.271 2016/05/06 13:03:06 skrll Exp $"); #include "opt_usb.h" @@ -188,7 +188,6 @@ Static void uhci_reset_std_chain(uhci_softc_t *, struct usbd_xfer *, int, int, int *, uhci_soft_td_t **); Static void uhci_poll_hub(void *); -Static void uhci_waitintr(uhci_softc_t *, struct usbd_xfer *); Static void uhci_check_intr(uhci_softc_t *, struct uhci_xfer *, ux_completeq_t *); Static void uhci_idone(struct uhci_xfer *, ux_completeq_t *); @@ -1736,52 +1735,6 @@ uhci_timeout_task(void *addr) mutex_exit(&sc->sc_lock); } -/* - * Wait here until controller claims to have an interrupt. - * Then call uhci_intr and return. Use timeout to avoid waiting - * too long. - * Only used during boot when interrupts are not enabled yet. - */ -void -uhci_waitintr(uhci_softc_t *sc, struct usbd_xfer *xfer) -{ - int timo = xfer->ux_timeout; - struct uhci_xfer *ux; - - mutex_enter(&sc->sc_lock); - - UHCIHIST_FUNC(); UHCIHIST_CALLED(); - DPRINTFN(10, "timeout = %dms", timo, 0, 0, 0); - - xfer->ux_status = USBD_IN_PROGRESS; - for (; timo >= 0; timo--) { - usb_delay_ms_locked(&sc->sc_bus, 1, &sc->sc_lock); - DPRINTFN(20, "0x%04x", - UREAD2(sc, UHCI_STS), 0, 0, 0); - if (UREAD2(sc, UHCI_STS) & UHCI_STS_USBINT) { - mutex_spin_enter(&sc->sc_intr_lock); - uhci_intr1(sc); - mutex_spin_exit(&sc->sc_intr_lock); - if (xfer->ux_status != USBD_IN_PROGRESS) - goto done; - } - } - - /* Timeout */ - DPRINTF("timeout", 0, 0, 0, 0); - TAILQ_FOREACH(ux, &sc->sc_intrhead, ux_list) - if (&ux->ux_xfer == xfer) - break; - - KASSERT(ux != NULL); - - uhci_idone(ux, NULL); - usb_transfer_complete(&ux->ux_xfer); - -done: - mutex_exit(&sc->sc_lock); -} - void uhci_poll(struct usbd_bus *bus) { @@ -2352,9 +2305,6 @@ uhci_device_bulk_start(struct usbd_xfer *xfer) xfer->ux_status = USBD_IN_PROGRESS; mutex_exit(&sc->sc_lock); - if (sc->sc_bus.ub_usepolling) - uhci_waitintr(sc, xfer); - return USBD_IN_PROGRESS; } @@ -2699,9 +2649,6 @@ uhci_device_ctrl_start(struct usbd_xfer *xfer) xfer->ux_status = USBD_IN_PROGRESS; mutex_exit(&sc->sc_lock); - if (sc->sc_bus.ub_usepolling) - uhci_waitintr(sc, xfer); - return USBD_IN_PROGRESS; } |
