Module Name:    src
Committed By:   reinoud
Date:           Wed Sep 24 20:51:43 UTC 2014

Modified Files:
        src/sys/arch/arm/samsung: exynos_usb.c

Log Message:
Power up both vbus and overcurrent lines for USB


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos_usb.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/arch/arm/samsung/exynos_usb.c
diff -u src/sys/arch/arm/samsung/exynos_usb.c:1.10 src/sys/arch/arm/samsung/exynos_usb.c:1.11
--- src/sys/arch/arm/samsung/exynos_usb.c:1.10	Sun Sep 21 15:22:40 2014
+++ src/sys/arch/arm/samsung/exynos_usb.c	Wed Sep 24 20:51:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_usb.c,v 1.10 2014/09/21 15:22:40 reinoud Exp $	*/
+/*	$NetBSD: exynos_usb.c,v 1.11 2014/09/24 20:51:43 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: exynos_usb.c,v 1.10 2014/09/21 15:22:40 reinoud Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_usb.c,v 1.11 2014/09/24 20:51:43 reinoud Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -108,6 +108,16 @@ static struct exynos_gpio_pinset e5_uhos
 	.pinset_func  = 0,
 	.pinset_mask  = __BIT(5) | __BIT(6),
 };
+static struct exynos_gpio_pinset e5_usb3_bus0_pinset = {
+	.pinset_group = "GPK3",
+	.pinset_func  = 2,
+	.pinset_mask  = __BIT(0) | __BIT(1) | __BIT(3),
+};
+static struct exynos_gpio_pinset e5_usb3_bus1_pinset = {
+	.pinset_group = "GPK2",
+	.pinset_func  = 2,
+	.pinset_mask  = __BIT(4) | __BIT(5) | __BIT(7),
+};
 #endif
 
 
@@ -203,20 +213,52 @@ exynos_usb_attach(device_t parent, devic
 		exynos_gpio_pinset_acquire(&e4_uhost_pwr_pinset);
 		exynos_gpio_pinset_to_pindata(&e4_uhost_pwr_pinset, 6, &XuhostPWREN);
 		exynos_gpio_pinset_to_pindata(&e4_uhost_pwr_pinset, 7, &XuhostOVERCUR);
+
+		/* enable power and set Xuhost OVERCUR to inactive by pulling it up */
+		exynos_gpio_pindata_ctl(&XuhostPWREN, GPIO_PIN_PULLUP);
+		exynos_gpio_pindata_ctl(&XuhostOVERCUR, GPIO_PIN_PULLUP);
+		DELAY(80000);
 	}
 #endif
 #ifdef EXYNOS5
-	if (IS_EXYNOS5_P()) {
+	if (IS_EXYNOS5410_P()) {
+		struct exynos_gpio_pindata Xovercur2, Xovercur3;
+		struct exynos_gpio_pindata Xvbus;
+
+		/* BUS 0 */
+		exynos_gpio_pinset_acquire(&e5_usb3_bus0_pinset);
+		exynos_gpio_pinset_to_pindata(&e5_usb3_bus0_pinset, 0, &Xovercur2);
+		exynos_gpio_pinset_to_pindata(&e5_usb3_bus0_pinset, 1, &Xovercur3);
+		exynos_gpio_pinset_to_pindata(&e5_usb3_bus0_pinset, 3, &Xvbus);
+
+		/* enable power and set overcur inactive by pulling them up */
+		exynos_gpio_pindata_ctl(&Xvbus, GPIO_PIN_PULLUP);
+		exynos_gpio_pindata_ctl(&Xovercur2, GPIO_PIN_PULLUP);
+		exynos_gpio_pindata_ctl(&Xovercur3, GPIO_PIN_PULLUP);
+
+		/* BUS 1 */
+		exynos_gpio_pinset_acquire(&e5_usb3_bus1_pinset);
+		exynos_gpio_pinset_to_pindata(&e5_usb3_bus1_pinset, 4, &Xovercur2);
+		exynos_gpio_pinset_to_pindata(&e5_usb3_bus1_pinset, 5, &Xovercur3);
+		exynos_gpio_pinset_to_pindata(&e5_usb3_bus1_pinset, 7, &Xvbus);
+
+		/* enable power and set overcur inactive by pulling them up */
+		exynos_gpio_pindata_ctl(&Xvbus, GPIO_PIN_PULLUP);
+		exynos_gpio_pindata_ctl(&Xovercur2, GPIO_PIN_PULLUP);
+		exynos_gpio_pindata_ctl(&Xovercur3, GPIO_PIN_PULLUP);
+
+		/* enable power to the hub */
 		exynos_gpio_pinset_acquire(&e5_uhost_pwr_pinset);
 		exynos_gpio_pinset_to_pindata(&e5_uhost_pwr_pinset, 5, &XuhostPWREN);
 		exynos_gpio_pinset_to_pindata(&e5_uhost_pwr_pinset, 6, &XuhostOVERCUR);
+
+		/* enable power and set Xuhost OVERCUR to inactive by pulling it up */
+		exynos_gpio_pindata_ctl(&XuhostPWREN, GPIO_PIN_PULLUP);
+		exynos_gpio_pindata_ctl(&XuhostOVERCUR, GPIO_PIN_PULLUP);
+		DELAY(80000);
 	}
 #endif
 
-	/* enable power and set Xuhost OVERCUR to inactive by pulling it up */
-	exynos_gpio_pindata_ctl(&XuhostPWREN, GPIO_PIN_PULLUP);
-	exynos_gpio_pindata_ctl(&XuhostOVERCUR, GPIO_PIN_PULLUP);
-	DELAY(80000);
 
 	/* init USB phys */
 	exynos_usb_phy_init(sc);

Reply via email to