Skip to contentSkip to conversation

ARM: dts: Configure USB host for 37xx-evm

PATCH Superseded Tony Lindgren 2 participants 4 messages May 22, 2017 – May 24, 2017 3 messages not in the archive Device tree bindings

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: dts: Configure USB host for 37xx-evm

Looks like nobody bothered to configure USB host for 37xx-evm when we converted things to device tree, so let's add it. This is similar to beagleboard configuration with few extra quirks to configure the port. And as with beagleboard, OHCI won't work because there is no USB LS/FS PHY. A HS USB hub is needed to use devices like keyboard and mice.

---
 arch/arm/boot/dts/omap3-evm-37xx.dts    | 82 +++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/omap3-evm-common.dtsi | 33 +++++++++++++
 2 files changed, 115 insertions(+)
arch/arm/boot/dts/omap3-evm-37xx.dts +82 -0
@@ -98,6 +98,32 @@
 		>;
 	};
 
+	hsusb2_pins: pinmux_hsusb2_pins {
+		pinctrl-single,pins = <
+
+		/* On-board EHCI USB2 gpmc_nbe1.gpio_61 */
+		OMAP3_CORE1_IOPAD(0x20c8, PIN_OUTPUT | MUX_MODE4)
+
+		/* mcspi1_cs3.hsusb2_data2 */
+		OMAP3_CORE1_IOPAD(0x21d4, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* mcspi2_clk.hsusb2_data7 */
+		OMAP3_CORE1_IOPAD(0x21d6, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* mcspi2_simo.hsusb2_data4 */
+		OMAP3_CORE1_IOPAD(0x21d8, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* mcspi2_somi.hsusb2_data5 */
+		OMAP3_CORE1_IOPAD(0x21da, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* mcspi2_cs0.hsusb2_data6 */
+		OMAP3_CORE1_IOPAD(0x21dc, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* mcspi2_cs1.hsusb2_data3 */
+		OMAP3_CORE1_IOPAD(0x21de, PIN_INPUT_PULLDOWN | MUX_MODE3)
+		>;
+	};
+
 	wl12xx_gpio: pinmux_wl12xx_gpio {
 		pinctrl-single,pins = <
 			OMAP3_CORE1_IOPAD(0x2180, PIN_OUTPUT | MUX_MODE4)		/* uart1_cts.gpio_150 */
@@ -112,6 +138,37 @@
 	};
 };
 
+&omap3_pmx_core2 {
+	hsusb2_2_pins: pinmux_hsusb2_2_pins {
+		pinctrl-single,pins = <
+
+		/* EHCI PHY reset GPIO etk_d7.gpio_21 */
+		OMAP3630_CORE2_IOPAD(0x25ea, PIN_OUTPUT | MUX_MODE4)
+
+		/* EHCI VBUS etk_d8.gpio_22 */
+		OMAP3630_CORE2_IOPAD(0x25ec, PIN_OUTPUT | MUX_MODE4)
+
+		/* etk_d10.hsusb2_clk */
+		OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3)
+
+		/* etk_d11.hsusb2_stp */
+		OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3)
+
+		/* etk_d12.hsusb2_dir */
+		OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* etk_d13.hsusb2_nxt */
+		OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* etk_d14.hsusb2_data0 */
+		OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* etk_d15.hsusb2_data1 */
+		OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3)
+		>;
+	};
+};
+
 &omap3_pmx_wkup {
 	dss_dpi_pins2: pinmux_dss_dpi_pins1 {
 		pinctrl-single,pins = <
@@ -153,6 +210,31 @@
 	pinctrl-0 = <&uart3_pins>;
 };
 
+&hsusb2_power {
+	pinctrl-names = "default";
+	pinctrl-0 = <&hsusb2_pins &hsusb2_2_pins>;
+};
+
+/* GPIO_61 (nUSB2_EN_1V8) low for on-board EHCI USB2 interface */
+&gpio2 {
+	en_hsusb2_clk {
+		gpio-hog;
+		gpios = <29 GPIO_ACTIVE_HIGH>;
+		output-low;
+		line-name = "hsusb2 port";
+	};
+};
+
+/* T2_GPIO_2 low to route GPIO_61 to on-board devices */
+&twl_gpio {
+	en_hsusb2_clk {
+		gpio-hog;
+		gpios = <2 GPIO_ACTIVE_HIGH>;
+		output-low;
+		line-name = "en_hsusb2_clk";
+	};
+};
+
 &gpmc {
 	ranges = <0 0 0x30000000 0x1000000>,	/* CS0: 16MB for NAND */
 		 <5 0 0x2c000000 0x01000000>;
arch/arm/boot/dts/omap3-evm-common.dtsi +33 -0
@@ -12,6 +12,24 @@
 		};
 	};
 
+	/* HS USB Port 2 Power */
+	hsusb2_power: hsusb2_power_reg {
+		compatible = "regulator-fixed";
+		regulator-name = "hsusb2_vbus";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio1 22 GPIO_ACTIVE_HIGH>; /* gpio_22 */
+		startup-delay-us = <70000>;
+		enable-active-high;
+	};
+
+	/* HS USB Host PHY on PORT 2 */
+	hsusb2_phy: hsusb2_phy {
+		compatible = "usb-nop-xceiv";
+		reset-gpios = <&gpio1 21 GPIO_ACTIVE_LOW>; /* gpio_21 */
+		vcc-supply = <&hsusb2_power>;
+	};
+
 	leds {
 		compatible = "gpio-leds";
 		ledb {
@@ -143,6 +161,14 @@
 			>;
 };
 
+&usbhshost {
+	port2-mode = "ehci-phy";
+};
+
+&usbhsehci {
+	phys = <0 &hsusb2_phy>;
+};
+
 &usb_otg_hs {
 	interface-type = <0>;
 	usb-phy = <&usb2_phy>;
@@ -159,3 +185,10 @@
 		reg = <5 0 0xff>;
 	};
 };
+
+&vaux2 {
+	regulator-name = "usb_1v8";
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-always-on;
+};
Signature · 5 lines
2.13.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to a message not in the archive

Hi,

Quoted 18 lines · Tony Lindgren

Looks like nobody bothered to configure USB host for 37xx-evm when we converted things to device tree, so let's add it. This is similar to beagleboard configuration with few extra quirks to configure the port. And as with beagleboard, OHCI won't work because there is no USB LS/FS PHY. A HS USB hub is needed to use devices like keyboard and mice.

---
 arch/arm/boot/dts/omap3-evm-37xx.dts    | 82 +++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/omap3-evm-common.dtsi | 33 +++++++++++++
 2 files changed, 115 insertions(+)

arch/arm/boot/dts/omap3-evm-37xx.dts line 105

Quoted 8 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +5 -0
@@ -98,6 +98,32 @@
 		>;
 	};
 
+	hsusb2_pins: pinmux_hsusb2_pins {
+		pinctrl-single,pins = <
+
+		/* On-board EHCI USB2 gpmc_nbe1.gpio_61 */
+		OMAP3_CORE1_IOPAD(0x20c8, PIN_OUTPUT | MUX_MODE4)

GPIO_61 looks like nUSB2_EN_1V8 from you comment. This is PHY power related and not hsusb2 related so it should be in a different group?

Quoted 25 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +21 -0
+
+		/* mcspi1_cs3.hsusb2_data2 */
+		OMAP3_CORE1_IOPAD(0x21d4, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* mcspi2_clk.hsusb2_data7 */
+		OMAP3_CORE1_IOPAD(0x21d6, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* mcspi2_simo.hsusb2_data4 */
+		OMAP3_CORE1_IOPAD(0x21d8, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* mcspi2_somi.hsusb2_data5 */
+		OMAP3_CORE1_IOPAD(0x21da, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* mcspi2_cs0.hsusb2_data6 */
+		OMAP3_CORE1_IOPAD(0x21dc, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* mcspi2_cs1.hsusb2_data3 */
+		OMAP3_CORE1_IOPAD(0x21de, PIN_INPUT_PULLDOWN | MUX_MODE3)
+		>;
+	};
+
 	wl12xx_gpio: pinmux_wl12xx_gpio {
 		pinctrl-single,pins = <
 			OMAP3_CORE1_IOPAD(0x2180, PIN_OUTPUT | MUX_MODE4)		/* uart1_cts.gpio_150 */

arch/arm/boot/dts/omap3-evm-37xx.dts line 146

Quoted 9 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +6 -0
@@ -112,6 +138,37 @@
 	};
 };
 
+&omap3_pmx_core2 {
+	hsusb2_2_pins: pinmux_hsusb2_2_pins {
+		pinctrl-single,pins = <
+
+		/* EHCI PHY reset GPIO etk_d7.gpio_21 */
+		OMAP3630_CORE2_IOPAD(0x25ea, PIN_OUTPUT | MUX_MODE4)

GPIO_21 is PHY RESET related and not hsusb2 related. Can we have this in a pin group for hsusb2_phy?

Also, hsusb2_pins and hsusb2_2_pins are both related to hsusb2. In omap3-beagle.dts we don't assign them to any node and they are just setup once at boot by pincltrl default.

arch/arm/boot/dts/omap3-evm-37xx.dts line 149

Quoted 3 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +3 -0
+
+		/* EHCI VBUS etk_d8.gpio_22 */
+		OMAP3630_CORE2_IOPAD(0x25ec, PIN_OUTPUT | MUX_MODE4)

GPIO_21 is PHY power enable so can we have this in a pin group for hsusb2_power?

Quoted 27 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +22 -0
+
+		/* etk_d10.hsusb2_clk */
+		OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3)
+
+		/* etk_d11.hsusb2_stp */
+		OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3)
+
+		/* etk_d12.hsusb2_dir */
+		OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* etk_d13.hsusb2_nxt */
+		OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* etk_d14.hsusb2_data0 */
+		OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3)
+
+		/* etk_d15.hsusb2_data1 */
+		OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3)
+		>;
+	};
+};
+
 &omap3_pmx_wkup {
 	dss_dpi_pins2: pinmux_dss_dpi_pins1 {
 		pinctrl-single,pins = <
@@ -153,6 +210,31 @@
 	pinctrl-0 = <&uart3_pins>;

arch/arm/boot/dts/omap3-evm-37xx.dts line 220

Quoted 10 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +8 -0
 };
 
+&hsusb2_power {
+	pinctrl-names = "default";
+	pinctrl-0 = <&hsusb2_pins &hsusb2_2_pins>;
+};
+
+/* GPIO_61 (nUSB2_EN_1V8) low for on-board EHCI USB2 interface */
+&gpio2 {
+	en_hsusb2_clk {

Is this GPIO_61 enabling 1V8 supply or clk? Node name should be fixed accordingly.

arch/arm/boot/dts/omap3-evm-37xx.dts line 222

Quoted 2 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +2 -0
+		gpio-hog;
+		gpios = <29 GPIO_ACTIVE_HIGH>;

Should this be be GPIO_61?
Does this need to be a hog?

arch/arm/boot/dts/omap3-evm-37xx.dts line 224

Quoted 2 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +2 -0
+		output-low;
+		line-name = "hsusb2 port";

Can line name be more revealing? e.g. hsusb2 power or hsusb2 clock?

Quoted 26 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +13 -0
+	};
+};
+
+/* T2_GPIO_2 low to route GPIO_61 to on-board devices */
+&twl_gpio {
+	en_hsusb2_clk {
+		gpio-hog;
+		gpios = <2 GPIO_ACTIVE_HIGH>;
+		output-low;
+		line-name = "en_hsusb2_clk";
+	};
+};
+
 &gpmc {
 	ranges = <0 0 0x30000000 0x1000000>,	/* CS0: 16MB for NAND */
 		 <5 0 0x2c000000 0x01000000>;
arch/arm/boot/dts/omap3-evm-common.dtsi +3 -0
@@ -12,6 +12,24 @@
 		};
 	};
 
+	/* HS USB Port 2 Power */
+	hsusb2_power: hsusb2_power_reg {
+		compatible = "regulator-fixed";

arch/arm/boot/dts/omap3-evm-common.dtsi line 27

Quoted 10 lines
arch/arm/boot/dts/omap3-evm-common.dtsi +10 -0
+		regulator-name = "hsusb2_vbus";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio1 22 GPIO_ACTIVE_HIGH>; /* gpio_22 */
+		startup-delay-us = <70000>;
+		enable-active-high;
+	};
+
+	/* HS USB Host PHY on PORT 2 */
+	hsusb2_phy: hsusb2_phy {

Here we can put the PHY reset related pinmux group.

Quoted 34 lines
arch/arm/boot/dts/omap3-evm-common.dtsi +19 -0
+		compatible = "usb-nop-xceiv";
+		reset-gpios = <&gpio1 21 GPIO_ACTIVE_LOW>; /* gpio_21 */
+		vcc-supply = <&hsusb2_power>;
+	};
+
 	leds {
 		compatible = "gpio-leds";
 		ledb {
@@ -143,6 +161,14 @@
 			>;
 };
 
+&usbhshost {
+	port2-mode = "ehci-phy";
+};
+
+&usbhsehci {
+	phys = <0 &hsusb2_phy>;
+};
+
 &usb_otg_hs {
 	interface-type = <0>;
 	usb-phy = <&usb2_phy>;
@@ -159,3 +185,10 @@
 		reg = <5 0 0xff>;
 	};
 };
+
+&vaux2 {
+	regulator-name = "usb_1v8";
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-always-on> +};
Signature · 6 lines
cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to a message not in the archive
Quoted 9 lines · Roger Quadros

arch/arm/boot/dts/omap3-evm-37xx.dts line 105

Quoted 5 lines · Tony Lindgren
arch/arm/boot/dts/omap3-evm-37xx.dts +5 -0
+	hsusb2_pins: pinmux_hsusb2_pins {
+		pinctrl-single,pins = <
+
+		/* On-board EHCI USB2 gpmc_nbe1.gpio_61 */
+		OMAP3_CORE1_IOPAD(0x20c8, PIN_OUTPUT | MUX_MODE4)

GPIO_61 looks like nUSB2_EN_1V8 from you comment. This is PHY power related and not hsusb2 related so it should be in a different group?

Hmm only ehci is using the legacy usb-phy and it will never get set for ohci alone. Even though ohci alone is not usable without a LS/FS phy, that might create more confusion if anybody attempts to actually use ohci with a real phy. So we probably want to set them as pinctrl hogs like beagle board is doing.

Quoted 8 lines

arch/arm/boot/dts/omap3-evm-37xx.dts line 146

Quoted 6 lines

+&omap3_pmx_core2 {

arch/arm/boot/dts/omap3-evm-37xx.dts +5 -0
+	hsusb2_2_pins: pinmux_hsusb2_2_pins {
+		pinctrl-single,pins = <
+
+		/* EHCI PHY reset GPIO etk_d7.gpio_21 */
+		OMAP3630_CORE2_IOPAD(0x25ea, PIN_OUTPUT | MUX_MODE4)

GPIO_21 is PHY RESET related and not hsusb2 related. Can we have this in a pin group for hsusb2_phy?

Probably should be just pinctrl hog then for the same reasons until the phy vs usb-phy mess is cleared.

Quoted 2 lines

Also, hsusb2_pins and hsusb2_2_pins are both related to hsusb2. In omap3-beagle.dts we don't assign them to any node and they are just setup once at boot by pincltrl default.

Yup I totally see why that is done now..

Quoted 5 lines

arch/arm/boot/dts/omap3-evm-37xx.dts line 149

Quoted 3 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +3 -0
+
+		/* EHCI VBUS etk_d8.gpio_22 */
+		OMAP3630_CORE2_IOPAD(0x25ec, PIN_OUTPUT | MUX_MODE4)

GPIO_21 is PHY power enable so can we have this in a pin group for hsusb2_power?

Again should probably be a pinctrl hog for now for the same reasons.

Quoted 10 lines

arch/arm/boot/dts/omap3-evm-37xx.dts line 220

Quoted 3 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +3 -0
+/* GPIO_61 (nUSB2_EN_1V8) low for on-board EHCI USB2 interface */
+&gpio2 {
+	en_hsusb2_clk {

Is this GPIO_61 enabling 1V8 supply or clk? Node name should be fixed accordingly.

arch/arm/boot/dts/omap3-evm-37xx.dts line 222

Quoted 2 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +2 -0
+		gpio-hog;
+		gpios = <29 GPIO_ACTIVE_HIGH>;

Should this be be GPIO_61?

Oh that seems wrong, thanks for noticing it. Will check.

Quoted 6 lines

Does this need to be a hog?

arch/arm/boot/dts/omap3-evm-37xx.dts line 224

Quoted 2 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +2 -0
+		output-low;
+		line-name = "hsusb2 port";

Can line name be more revealing? e.g. hsusb2 power or hsusb2 clock?

It seems to route the interface between extension connector pins and the phy on the device.

Quoted 4 lines

arch/arm/boot/dts/omap3-evm-common.dtsi line 27

Quoted 2 lines
arch/arm/boot/dts/omap3-evm-common.dtsi +2 -0
+	/* HS USB Host PHY on PORT 2 */
+	hsusb2_phy: hsusb2_phy {

Here we can put the PHY reset related pinmux group.

That will never get claimed for ohci alone currently. There is no real LS/FS phy, so best to set them up as pinctrl hogs.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to a message not in the archive
Quoted 7 lines · Tony Lindgren
Quoted 4 lines · Roger Quadros

arch/arm/boot/dts/omap3-evm-37xx.dts line 222

Quoted 2 lines
arch/arm/boot/dts/omap3-evm-37xx.dts +2 -0
+		gpio-hog;
+		gpios = <29 GPIO_ACTIVE_HIGH>;

Should this be be GPIO_61?

Oh that seems wrong, thanks for noticing it. Will check.

Heh that's already at &gpio2, so it is gpio_61.

Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html