Module Name:    src
Committed By:   skrll
Date:           Wed Oct  2 11:36:27 UTC 2013

Modified Files:
        src/sys/external/bsd/dwc2/dist: dwc2_hcd.c

Log Message:
Some core configurations cannot support LS traffic on a FS root port.

Fix adapted from the github.com/raspberrypi driver.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/dwc2/dist/dwc2_hcd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/dwc2/dist/dwc2_hcd.c
diff -u src/sys/external/bsd/dwc2/dist/dwc2_hcd.c:1.4 src/sys/external/bsd/dwc2/dist/dwc2_hcd.c:1.5
--- src/sys/external/bsd/dwc2/dist/dwc2_hcd.c:1.4	Fri Sep 27 21:56:05 2013
+++ src/sys/external/bsd/dwc2/dist/dwc2_hcd.c	Wed Oct  2 11:36:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2_hcd.c,v 1.4 2013/09/27 21:56:05 skrll Exp $	*/
+/*	$NetBSD: dwc2_hcd.c,v 1.5 2013/10/02 11:36:27 skrll Exp $	*/
 
 /*
  * hcd.c - DesignWare HS OTG Controller host-mode routines
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.4 2013/09/27 21:56:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.5 2013/10/02 11:36:27 skrll Exp $");
 
 #include <sys/types.h>
 #include <sys/kmem.h>
@@ -370,6 +370,7 @@ dwc2_hcd_urb_enqueue(struct dwc2_hsotg *
 	unsigned long flags;
 	u32 intr_mask;
 	int retval;
+	int dev_speed;
 
 	if (!hsotg->flags.b.port_connect_status) {
 		/* No longer connected */
@@ -377,6 +378,20 @@ dwc2_hcd_urb_enqueue(struct dwc2_hsotg *
 		return -ENODEV;
 	}
 
+	dev_speed = dwc2_host_get_speed(hsotg, urb->priv);
+
+	/* Some core configurations cannot support LS traffic on a FS root port */
+	if ((dev_speed == USB_SPEED_LOW) &&
+	    (hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED) &&
+	    (hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_UTMI)) {
+		u32 hprt0 = DWC2_READ_4(hsotg, HPRT0);
+		u32 prtspd = (hprt0 & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT;
+
+		if (prtspd == HPRT0_SPD_FULL_SPEED) {
+			return -ENODEV;
+		}
+	}
+
 	qtd = pool_cache_get(sc->sc_qtdpool, PR_NOWAIT);
 	if (!qtd)
 		return -ENOMEM;

Reply via email to