Author: hselasky
Date: Mon Sep 24 16:34:13 2012
New Revision: 240890
URL: http://svn.freebsd.org/changeset/base/240890

Log:
  DWC OTG host mode improvements:
   - Make HSIC selection dynamic.
   - Make LOW speed USB devices work through HIGH speed USB HUB.

Modified:
  head/sys/dev/usb/controller/dwc_otg.c

Modified: head/sys/dev/usb/controller/dwc_otg.c
==============================================================================
--- head/sys/dev/usb/controller/dwc_otg.c       Mon Sep 24 15:16:06 2012        
(r240889)
+++ head/sys/dev/usb/controller/dwc_otg.c       Mon Sep 24 16:34:13 2012        
(r240890)
@@ -101,12 +101,18 @@ __FBSDID("$FreeBSD$");
    GINTMSK_HCHINTMSK |                 \
    GINTSTS_PRTINT)
 
-#define DWC_OTG_USE_HSIC 0
+static int dwc_otg_use_hsic;
+
+static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW, 0, "USB DWC OTG");
+
+SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, use_hsic, CTLFLAG_RD,
+    &dwc_otg_use_hsic, 0, "DWC OTG uses HSIC interface");
+
+TUNABLE_INT("hw.usb.dwc_otg.use_hsic", &dwc_otg_use_hsic);
 
 #ifdef USB_DEBUG
 static int dwc_otg_debug;
 
-static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW, 0, "USB DWC OTG");
 SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, debug, CTLFLAG_RW,
     &dwc_otg_debug, 0, "DWC OTG debug level");
 #endif
@@ -701,6 +707,15 @@ dwc_otg_host_setup_tx(struct dwc_otg_td 
                }
        }
 
+       /* treat NYET like NAK, if SPLIT transactions are used */
+       if (hcint & HCINT_NYET) {
+               if (td->hcsplt != 0) {
+                       DPRINTF("CH=%d NYET+SPLIT\n", td->channel);
+                       hcint &= ~HCINT_NYET;
+                       hcint |= HCINT_NAK;
+               }
+       }
+
        /* channel must be disabled before we can complete the transfer */
 
        if (hcint & (HCINT_ERRORS | HCINT_RETRY |
@@ -1041,6 +1056,15 @@ dwc_otg_host_data_rx(struct dwc_otg_td *
                }
        }
 
+       /* treat NYET like NAK, if SPLIT transactions are used */
+       if (hcint & HCINT_NYET) {
+               if (td->hcsplt != 0) {
+                       DPRINTF("CH=%d NYET+SPLIT\n", td->channel);
+                       hcint &= ~HCINT_NYET;
+                       hcint |= HCINT_NAK;
+               }
+       }
+
        /* channel must be disabled before we can complete the transfer */
 
        if (hcint & (HCINT_ERRORS | HCINT_RETRY |
@@ -1391,6 +1415,15 @@ dwc_otg_host_data_tx(struct dwc_otg_td *
                }
        }
 
+       /* treat NYET like NAK, if SPLIT transactions are used */
+       if (hcint & HCINT_NYET) {
+               if (td->hcsplt != 0) {
+                       DPRINTF("CH=%d NYET+SPLIT\n", td->channel);
+                       hcint &= ~HCINT_NYET;
+                       hcint |= HCINT_NAK;
+               }
+       }
+
        /* channel must be disabled before we can complete the transfer */
 
        if (hcint & (HCINT_ERRORS | HCINT_RETRY |
@@ -2979,7 +3012,7 @@ dwc_otg_init(struct dwc_otg_softc *sc)
        }
 
        /* select HSIC or non-HSIC mode */
-       if (DWC_OTG_USE_HSIC) {
+       if (dwc_otg_use_hsic) {
                DWC_OTG_WRITE_4(sc, DOTG_GUSBCFG,
                    GUSBCFG_PHYIF |
                    GUSBCFG_TRD_TIM_SET(5) | temp);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to