Skip to contentSkip to conversation

enable OTG on wandboard and riotboard

PATCH New Alexander Kurz 3 participants 10 messages May 29, 2018 – Jun 17, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Both boards wandboard and riotboard feature an USB OTG connector. Change the DT regulator nodes to match the convention, fix the GPIO regulator polatity for the riotboard and add enable OTG including the regulator infrastructure on the riotboard.

Changes since v2:
* split patch 0001 into two board specific patches
* use GPIO_ACTIVE_HIGH instead of literal numbers in patch v1-0001 (now v2-0002)

#1 lore raw

PATCH v2 1/4 ARM: dts: imx6qdl-wandboard: remove regulators bus node

To match the convention, move all regulator-fixed nodes directly into the root node.

---
 arch/arm/boot/dts/imx6qdl-wandboard.dtsi | 40 +++++++++++++-------------------
 1 file changed, 16 insertions(+), 24 deletions(-)
arch/arm/boot/dts/imx6qdl-wandboard.dtsi +16 -24
index ed96d7b5feab..b9c6c9d5d357 100644
@@ -12,30 +12,6 @@
 #include <dt-bindings/gpio/gpio.h>
 
 / {
-	regulators {
-		compatible = "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		reg_2p5v: regulator at 0 {
-			compatible = "regulator-fixed";
-			reg = <0>;
-			regulator-name = "2P5V";
-			regulator-min-microvolt = <2500000>;
-			regulator-max-microvolt = <2500000>;
-			regulator-always-on;
-		};
-
-		reg_3p3v: regulator at 1 {
-			compatible = "regulator-fixed";
-			reg = <1>;
-			regulator-name = "3P3V";
-			regulator-min-microvolt = <3300000>;
-			regulator-max-microvolt = <3300000>;
-			regulator-always-on;
-		};
-	};
-
 	sound {
 		compatible = "fsl,imx6-wandboard-sgtl5000",
 			     "fsl,imx-audio-sgtl5000";
@@ -56,6 +32,22 @@
 		spdif-controller = <&spdif>;
 		spdif-out;
 	};
+
+	reg_2p5v: regulator-2p5v {
+		compatible = "regulator-fixed";
+		regulator-name = "2P5V";
+		regulator-min-microvolt = <2500000>;
+		regulator-max-microvolt = <2500000>;
+		regulator-always-on;
+	};
+
+	reg_3p3v: regulator-3p3v {
+		compatible = "regulator-fixed";
+		regulator-name = "3P3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+	};
 };
 
 &audmux {
Signature · 1 line
2.11.0
#4 lore raw

PATCH v2 2/4 ARM: dts: imx6dl-riotboard: remove regulators bus node

In reply to Alexander Kurz

To match the convention, move regulator-fixed nodes directly into the root node.

---
 arch/arm/boot/dts/imx6dl-riotboard.dts | 55 ++++++++++++++--------------------
 1 file changed, 23 insertions(+), 32 deletions(-)
arch/arm/boot/dts/imx6dl-riotboard.dts +23 -32
index 2e98c92adff7..a6851bfebbdb 100644
@@ -19,38 +19,6 @@
 		reg = <0x10000000 0x40000000>;
 	};
 
-	regulators {
-		compatible = "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		reg_2p5v: regulator at 0 {
-			compatible = "regulator-fixed";
-			reg = <0>;
-			regulator-name = "2P5V";
-			regulator-min-microvolt = <2500000>;
-			regulator-max-microvolt = <2500000>;
-		};
-
-		reg_3p3v: regulator at 1 {
-			compatible = "regulator-fixed";
-			reg = <1>;
-			regulator-name = "3P3V";
-			regulator-min-microvolt = <3300000>;
-			regulator-max-microvolt = <3300000>;
-		};
-
-		reg_usb_otg_vbus: regulator at 2 {
-			compatible = "regulator-fixed";
-			reg = <2>;
-			regulator-name = "usb_otg_vbus";
-			regulator-min-microvolt = <5000000>;
-			regulator-max-microvolt = <5000000>;
-			gpio = <&gpio3 22 0>;
-			enable-active-high;
-		};
-	};
-
 	leds {
 		compatible = "gpio-leds";
 		pinctrl-names = "default";
@@ -82,6 +50,29 @@
 			mux-int-port = <1>;
 			mux-ext-port = <3>;
 	};
+
+	reg_2p5v: regulator-2p5v {
+		compatible = "regulator-fixed";
+		regulator-name = "2P5V";
+		regulator-min-microvolt = <2500000>;
+		regulator-max-microvolt = <2500000>;
+	};
+
+	reg_3p3v: regulator-3p3v {
+		compatible = "regulator-fixed";
+		regulator-name = "3P3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
+
+	reg_usb_otg_vbus: regulator-usbotgvbus {
+		compatible = "regulator-fixed";
+		regulator-name = "usb_otg_vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
 };
 
 &audmux {
Signature · 1 line
2.11.0
#6 lore raw

PATCH v2 3/4 ARM: dts: imx6qdl-wandboard: enable USB OTG

In reply to Alexander Kurz

Enable USB OTG (dual-role) on the Wandboard.
Note, that the USB_OTG_VBUS current is quite limited due to a 22R resistor in the power line. Hence, the overcurrent signal of 1A will never be triggered on this board.

---
 arch/arm/boot/dts/imx6qdl-wandboard.dtsi | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx6qdl-wandboard.dtsi +18 -1
index b9c6c9d5d357..01ee36af7ba4 100644
@@ -48,6 +48,16 @@
 		regulator-max-microvolt = <3300000>;
 		regulator-always-on;
 	};
+
+	reg_usb_otg_vbus: regulator-usbotgvbus {
+		compatible = "regulator-fixed";
+		regulator-name = "usb_otg_vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_usbotgvbus>;
+		gpio = <&gpio3 22 GPIO_ACTIVE_LOW>;
+	};
 };
 
 &audmux {
@@ -162,6 +172,12 @@
 			>;
 		};
 
+		pinctrl_usbotgvbus: usbotgvbusgrp {
+			fsl,pins = <
+				MX6QDL_PAD_EIM_D22__GPIO3_IO22		0x130b0
+			>;
+		};
+
 		pinctrl_usdhc1: usdhc1grp {
 			fsl,pins = <
 				MX6QDL_PAD_SD1_CMD__SD1_CMD		0x17059
@@ -236,10 +252,11 @@
 };
 
 &usbotg {
+	vbus-supply = <&reg_usb_otg_vbus>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_usbotg>;
 	disable-over-current;
-	dr_mode = "peripheral";
+	dr_mode = "otg";
 	status = "okay";
 };
 
Signature · 1 line
2.11.0
reviewer
#7 lore raw

PATCH v2 3/4 ARM: dts: imx6qdl-wandboard: enable USB OTG

Quoted 6 lines · Alexander Kurz

Enable USB OTG (dual-role) on the Wandboard.
Note, that the USB_OTG_VBUS current is quite limited due to a 22R resistor in the power line. Hence, the overcurrent signal of 1A will never be triggered on this board.

#8 lore raw

PATCH v2 4/4 ARM: dts: imx6dl-riotboard: fix OTG regulator polarity

In reply to Alexander Kurz

USB OTG power is switched on when the GPIO is pulled low.

---
 arch/arm/boot/dts/imx6dl-riotboard.dts | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/boot/dts/imx6dl-riotboard.dts +1 -2
index a6851bfebbdb..89b06e20480d 100644
@@ -70,8 +70,7 @@
 		regulator-name = "usb_otg_vbus";
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
-		gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
-		enable-active-high;
+		gpio = <&gpio3 22 GPIO_ACTIVE_LOW>;
 	};
 };
 
Signature · 1 line
2.11.0
reviewer
#9 lore raw

PATCH v2 4/4 ARM: dts: imx6dl-riotboard: fix OTG regulator polarity

Quoted 12 lines · Alexander Kurz

USB OTG power is switched on when the GPIO is pulled low.

---
 arch/arm/boot/dts/imx6dl-riotboard.dts | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/boot/dts/imx6dl-riotboard.dts +0 -0
index a6851bfebbdb..89b06e20480d 100644

arch/arm/boot/dts/imx6dl-riotboard.dts line 73

Quoted 6 lines
arch/arm/boot/dts/imx6dl-riotboard.dts +1 -2
@@ -70,8 +70,7 @@
                regulator-name = "usb_otg_vbus";
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
-               gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
+               gpio = <&gpio3 22 GPIO_ACTIVE_LOW>;