Module Name:    src
Committed By:   skrll
Date:           Tue Sep  1 14:03:00 UTC 2015

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

Log Message:
kern/50185: dwctwo attach failure

Another hunk went walkabout during the import - reapply with a little
update


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/dwc2/dist/dwc2_core.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_core.c
diff -u src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.9 src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.10
--- src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.9	Tue Sep  1 06:24:21 2015
+++ src/sys/external/bsd/dwc2/dist/dwc2_core.c	Tue Sep  1 14:03:00 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2_core.c,v 1.9 2015/09/01 06:24:21 skrll Exp $	*/
+/*	$NetBSD: dwc2_core.c,v 1.10 2015/09/01 14:03:00 skrll Exp $	*/
 
 /*
  * core.c - DesignWare HS OTG Controller common routines
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.9 2015/09/01 06:24:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.10 2015/09/01 14:03:00 skrll Exp $");
 
 #include <sys/types.h>
 #include <sys/bus.h>
@@ -686,12 +686,22 @@ static int dwc2_phy_init(struct dwc2_hso
 
 static int dwc2_gahbcfg_init(struct dwc2_hsotg *hsotg)
 {
+	struct dwc2_softc *sc = hsotg->hsotg_sc;
 	u32 ahbcfg = DWC2_READ_4(hsotg, GAHBCFG);
 
 	switch (hsotg->hw_params.arch) {
 	case GHWCFG2_EXT_DMA_ARCH:
-		dev_err(hsotg->dev, "External DMA Mode not supported\n");
-		return -EINVAL;
+		dev_dbg(hsotg->dev, "External DMA Mode\n");
+		if (!sc->sc_set_dma_addr) {
+			dev_err(hsotg->dev, "External DMA Mode not supported\n");
+			return -EINVAL;
+		}
+		if (hsotg->core_params->ahbcfg != -1) {
+			ahbcfg &= GAHBCFG_CTRL_MASK;
+			ahbcfg |= hsotg->core_params->ahbcfg &
+				  ~GAHBCFG_CTRL_MASK;
+		}
+		break;
 
 	case GHWCFG2_INT_DMA_ARCH:
 		dev_dbg(hsotg->dev, "Internal DMA Mode\n");

Reply via email to