Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

DWC OTG host mode improvements:

 - Make HSIC selection dynamic.
 - Make LOW speed USB devices work through HIGH speed USB HUB.
  • Loading branch information...
commit 3f55c6de7e26c63f2018f54da991cc9bd022d415 1 parent 68802f1
hselasky authored
Showing with 36 additions and 3 deletions.
  1. +36 −3 sys/dev/usb/controller/dwc_otg.c
View
39 sys/dev/usb/controller/dwc_otg.c
@@ -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 *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 *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 *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);
Please sign in to comment.
Something went wrong with that request. Please try again.