Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys usb is attached with config_interrupts so we can G/C the...



details:   https://anonhg.NetBSD.org/src/rev/401c0216ff76
branches:  trunk
changeset: 345080:401c0216ff76
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri May 06 13:03:06 2016 +0000

description:
usb is attached with config_interrupts so we can G/C the code to support
transfers when this wasn't the case.

diffstat:

 sys/dev/usb/ehci.c           |  66 +------------------------------------------
 sys/dev/usb/motg.c           |  45 +----------------------------
 sys/dev/usb/ohci.c           |  51 +--------------------------------
 sys/dev/usb/uhci.c           |  57 +------------------------------------
 sys/external/bsd/dwc2/dwc2.c |  48 +------------------------------
 5 files changed, 10 insertions(+), 257 deletions(-)

diffs (truncated from 498 to 300 lines):

diff -r 68a91e61860d -r 401c0216ff76 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Fri May 06 10:56:04 2016 +0000
+++ b/sys/dev/usb/ehci.c        Fri May 06 13:03:06 2016 +0000
@@ -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 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 @@
        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 @@
 #endif
 #endif
 
-       if (sc->sc_bus.ub_usepolling)
-               ehci_waitintr(sc, xfer);
-
        return USBD_IN_PROGRESS;
 }
 
@@ -3909,9 +3863,6 @@
 #endif
 #endif
 
-       if (sc->sc_bus.ub_usepolling)
-               ehci_waitintr(sc, xfer);
-
        return USBD_IN_PROGRESS;
 }
 
@@ -4123,9 +4074,6 @@
 #endif
 #endif
 
-       if (sc->sc_bus.ub_usepolling)
-               ehci_waitintr(sc, xfer);
-
        return USBD_IN_PROGRESS;
 }
 
@@ -4509,11 +4457,6 @@
 
        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 @@
 
        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 -r 68a91e61860d -r 401c0216ff76 sys/dev/usb/motg.c
--- a/sys/dev/usb/motg.c        Fri May 06 10:56:04 2016 +0000
+++ b/sys/dev/usb/motg.c        Fri May 06 13:03:06 2016 +0000
@@ -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_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 @@
        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 @@
        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 @@
        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 -r 68a91e61860d -r 401c0216ff76 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Fri May 06 10:56:04 2016 +0000
+++ b/sys/dev/usb/ohci.c        Fri May 06 13:03:06 2016 +0000
@@ -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 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 @@
        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 @@
 
        mutex_exit(&sc->sc_lock);
 
-       if (sc->sc_bus.ub_usepolling)
-               ohci_waitintr(sc, xfer);
-
        return USBD_IN_PROGRESS;



Home | Main Index | Thread Index | Old Index