Skip to contentSkip to conversation

arm64: dts: verdin-imx8mp: usb dual-role switching et. al.

PATCH Applied Marcel Ziswiler 2 participants 8 messages Nov 2, 2022 – Nov 11, 2022

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

cover arm64: dts: verdin-imx8mp: usb dual-role switching et. al.

From: Marcel Ziswiler <[email protected]>

This series is an assortment of USB dual-role specific commits as follows:

Improvement of pinctrl for vbus-supplies:
As we are using two fixed regulators for Verdin USB_1_EN (SODIMM 155) and Verdin USB_2_EN (SODIMM 185), those should be muxed as GPIOs rather than OTG_PWR.

Removal of USB_2 over-current detection disabling:
The disable-over-current property is only applicable for the ci-hdrc-usb2 and dwc2 drivers while the i.MX 8M Plus integrates dwc3 IP. Therefore remove this property which does not really serve any purpose here.

Addition of USB_1 over-current detection:
Add Verdin USB_1 over-current detection functionality via Verdin USB_1_OC# (SODIMM 157) being active-low and removing its previous gpio_hog3 mapping.

Disabling of USB port power controls:
Disable port power control on Verdin USB_1/2 as we use regular fixed-regulators with Verdin USB_1/2_EN as enable GPIOs.

Addition of GPIO USB-B connector:
Add GPIO USB-B connector (gpio-usb-b-connector) functionality using Verdin USB_1_ID.

Marking USB_2 as permanently attached:
As both Dahlia and the Verdin Development Board have on-carrier permanently attached USB hubs mark Verdin USB_2 as such.

Note:
Currently, I am still seeing a rare race condition of sorts when booting the system with Verdin USB_1 as a host port with a USB memory stick plugged in. This exact patch series applied on top of NXP's latest downstream 5.15.52_2.1.0 release (together with backporting a few more dwc3-specific patches) actually makes this same use case work very reliably. However, NXP also keeps further downstream-only patches which I plan to further investigate and hopefully upstream a proper fix for soon.

Marcel Ziswiler (6):
arm64: dts: verdin-imx8mp: improve pinctrl for vbus-supplies
arm64: dts: verdin-imx8mp: remove usb_2 over-current detection
disabling
arm64: dts: verdin-imx8mp: add usb_1 over-current detection
arm64: dts: verdin-imx8mp: disable usb port power control
arm64: dts: verdin-imx8mp: add gpio usb-b connector
arm64: dts: verdin-imx8mp: dahlia: mark usb_2 permanently attached

 .../dts/freescale/imx8mp-verdin-dahlia.dtsi   |  1 +
 .../boot/dts/freescale/imx8mp-verdin.dtsi     | 40 ++++++++++++++-----
 2 files changed, 32 insertions(+), 9 deletions(-)
Signature · 7 lines
2.36.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

PATCH 1/6 arm64: dts: verdin-imx8mp: improve pinctrl for vbus-supplies

From: Marcel Ziswiler <[email protected]>

As we are using two fixed regulators for Verdin USB_1_EN (SODIMM 155) and Verdin USB_2_EN (SODIMM 185), those should be muxed as GPIOs rather than OTG_PWR.

---

 arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi +2 -2
index cc3b0725ce06..97e88440a251 100644
@@ -1221,7 +1221,7 @@ pinctrl_uart4: uart4grp {
 
 	pinctrl_usb1_vbus: usb1vbusgrp {
 		fsl,pins =
-			<MX8MP_IOMUXC_GPIO1_IO12__USB1_OTG_PWR		0x19>;	/* SODIMM 155 */
+			<MX8MP_IOMUXC_GPIO1_IO12__GPIO1_IO12		0x106>;	/* SODIMM 155 */
 	};
 
 	/* USB_1_ID */
@@ -1232,7 +1232,7 @@ pinctrl_usb_1_id: usb1idgrp {
 
 	pinctrl_usb2_vbus: usb2vbusgrp {
 		fsl,pins =
-			<MX8MP_IOMUXC_GPIO1_IO14__USB2_OTG_PWR		0x19>;	/* SODIMM 185 */
+			<MX8MP_IOMUXC_GPIO1_IO14__GPIO1_IO14		0x106>;	/* SODIMM 185 */
 	};
 
 	/* On-module Wi-Fi */
Signature · 7 lines
2.36.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw

PATCH 2/6 arm64: dts: verdin-imx8mp: remove usb_2 over-current detection disabling

In reply to Marcel Ziswiler

From: Marcel Ziswiler <[email protected]>

The disable-over-current property is only applicable for the ci-hdrc-usb2 and dwc2 drivers while the i.MX 8M Plus integrates dwc3 IP. Therefore remove this property which does not really serve any purpose here.

---

 arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi | 1 -
 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi +0 -1
index 97e88440a251..57cddf1bf6b3 100644
@@ -828,7 +828,6 @@ &usb3_phy1 {
 };
 
 &usb_dwc3_1 {
-	disable-over-current;
 	dr_mode = "host";
 };
 
Signature · 7 lines
2.36.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw

PATCH 3/6 arm64: dts: verdin-imx8mp: add usb_1 over-current detection

In reply to Marcel Ziswiler

From: Marcel Ziswiler <[email protected]>

Add Verdin USB_1 over-current detection functionality via Verdin USB_1_OC# (SODIMM 157) being active-low and removing its previous gpio_hog3 mapping.

---

 arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi +12 -2
index 57cddf1bf6b3..85af2875fb70 100644
@@ -807,6 +807,12 @@ &uart4 {
 };
 
 /* Verdin USB_1 */
+&usb3_0 {
+	fsl,over-current-active-low;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usb_1_oc_n>;
+};
+
 &usb3_phy0 {
 	vbus-supply = <&reg_usb1_vbus>;
 };
@@ -816,7 +822,6 @@ &usb_dwc3_0 {
 	dr_mode = "otg";
 	hnp-disable;
 	maximum-speed = "high-speed";
-	over-current-active-low;
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_usb_1_id>;
 	srp-disable;
@@ -1045,7 +1050,6 @@ pinctrl_gpio_hog2: gpiohog2grp {
 
 	pinctrl_gpio_hog3: gpiohog3grp {
 		fsl,pins =
-			<MX8MP_IOMUXC_GPIO1_IO13__GPIO1_IO13		0x1c4>,	/* SODIMM 157 */
 			/* CSI_1_MCLK */
 			<MX8MP_IOMUXC_GPIO1_IO15__GPIO1_IO15		0x1c4>;	/* SODIMM 91 */
 	};
@@ -1229,6 +1233,12 @@ pinctrl_usb_1_id: usb1idgrp {
 			<MX8MP_IOMUXC_SD1_RESET_B__GPIO2_IO10		0x1c4>;	/* SODIMM 161 */
 	};
 
+	/* USB_1_OC# */
+	pinctrl_usb_1_oc_n: usb1ocngrp {
+		fsl,pins =
+			<MX8MP_IOMUXC_GPIO1_IO13__USB1_OTG_OC		0x1c4>;	/* SODIMM 157 */
+	};
+
 	pinctrl_usb2_vbus: usb2vbusgrp {
 		fsl,pins =
 			<MX8MP_IOMUXC_GPIO1_IO14__GPIO1_IO14		0x106>;	/* SODIMM 185 */
Signature · 7 lines
2.36.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#4 lore raw

PATCH 4/6 arm64: dts: verdin-imx8mp: disable usb port power control

In reply to Marcel Ziswiler

From: Marcel Ziswiler <[email protected]>

Disable port power control on Verdin USB_1/2 as we use regular fixed-regulators with Verdin USB_1/2_EN as enable GPIOs.

---

 arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi +5 -0
index 85af2875fb70..795e02df9f29 100644
@@ -808,6 +808,7 @@ &uart4 {
 
 /* Verdin USB_1 */
 &usb3_0 {
+	fsl,disable-port-power-control;
 	fsl,over-current-active-low;
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_usb_1_oc_n>;
@@ -828,6 +829,10 @@ &usb_dwc3_0 {
 };
 
 /* Verdin USB_2 */
+&usb3_1 {
+	fsl,disable-port-power-control;
+};
+
 &usb3_phy1 {
 	vbus-supply = <&reg_usb2_vbus>;
 };
Signature · 7 lines
2.36.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#5 lore raw

PATCH 5/6 arm64: dts: verdin-imx8mp: add gpio usb-b connector

In reply to Marcel Ziswiler

From: Marcel Ziswiler <[email protected]>

Add GPIO USB-B connector (gpio-usb-b-connector) functionality using Verdin USB_1_ID.

---

 .../boot/dts/freescale/imx8mp-verdin.dtsi     | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi +14 -6
index 795e02df9f29..6a1890a4b5d8 100644
@@ -814,18 +814,26 @@ &usb3_0 {
 	pinctrl-0 = <&pinctrl_usb_1_oc_n>;
 };
 
-&usb3_phy0 {
-	vbus-supply = <&reg_usb1_vbus>;
-};
-
 &usb_dwc3_0 {
+	/* dual role only, not full featured OTG */
 	adp-disable;
 	dr_mode = "otg";
 	hnp-disable;
 	maximum-speed = "high-speed";
-	pinctrl-names = "default";
-	pinctrl-0 = <&pinctrl_usb_1_id>;
+	role-switch-default-mode = "peripheral";
 	srp-disable;
+	usb-role-switch;
+
+	connector {
+		compatible = "gpio-usb-b-connector", "usb-b-connector";
+		id-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
+		label = "Type-C";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_usb_1_id>;
+		self-powered;
+		type = "micro";
+		vbus-supply = <&reg_usb1_vbus>;
+	};
 };
 
 /* Verdin USB_2 */
Signature · 7 lines
2.36.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#6 lore raw

PATCH 6/6 arm64: dts: verdin-imx8mp: dahlia: mark usb_2 permanently attached

In reply to Marcel Ziswiler

From: Marcel Ziswiler <[email protected]>

As both Dahlia and the Verdin Development Board have on-carrier permanently attached USB hubs mark Verdin USB_2 as such.

---

 arch/arm64/boot/dts/freescale/imx8mp-verdin-dahlia.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mp-verdin-dahlia.dtsi +1 -0
index 4b8f86f63081..80db1ad7c230 100644
@@ -116,6 +116,7 @@ &usb3_phy0 {
 
 /* Verdin USB_2 */
 &usb3_1 {
+	fsl,permanently-attached;
 	status = "okay";
 };
 
Signature · 7 lines
2.36.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Applied
#7 lore raw
In reply to Marcel Ziswiler
Quoted 34 lines · Marcel Ziswiler

From: Marcel Ziswiler <[email protected]>

This series is an assortment of USB dual-role specific commits as follows:

Improvement of pinctrl for vbus-supplies:
As we are using two fixed regulators for Verdin USB_1_EN (SODIMM 155) and Verdin USB_2_EN (SODIMM 185), those should be muxed as GPIOs rather than OTG_PWR.

Removal of USB_2 over-current detection disabling:
The disable-over-current property is only applicable for the ci-hdrc-usb2 and dwc2 drivers while the i.MX 8M Plus integrates dwc3 IP. Therefore remove this property which does not really serve any purpose here.

Addition of USB_1 over-current detection:
Add Verdin USB_1 over-current detection functionality via Verdin USB_1_OC# (SODIMM 157) being active-low and removing its previous gpio_hog3 mapping.

Disabling of USB port power controls:
Disable port power control on Verdin USB_1/2 as we use regular fixed-regulators with Verdin USB_1/2_EN as enable GPIOs.

Addition of GPIO USB-B connector:
Add GPIO USB-B connector (gpio-usb-b-connector) functionality using Verdin USB_1_ID.

Marking USB_2 as permanently attached:
As both Dahlia and the Verdin Development Board have on-carrier permanently attached USB hubs mark Verdin USB_2 as such.

Quoted 9 lines

Note:
Currently, I am still seeing a rare race condition of sorts when booting the system with Verdin USB_1 as a host port with a USB memory stick plugged in. This exact patch series applied on top of NXP's latest downstream 5.15.52_2.1.0 release (together with backporting a few more dwc3-specific patches) actually makes this same use case work very reliably. However, NXP also keeps further downstream-only patches which I plan to further investigate and hopefully upstream a proper fix for soon.

Thanks for the noting!

Quoted 10 lines

Marcel Ziswiler (6):
arm64: dts: verdin-imx8mp: improve pinctrl for vbus-supplies
arm64: dts: verdin-imx8mp: remove usb_2 over-current detection
disabling
arm64: dts: verdin-imx8mp: add usb_1 over-current detection
arm64: dts: verdin-imx8mp: disable usb port power control
arm64: dts: verdin-imx8mp: add gpio usb-b connector
arm64: dts: verdin-imx8mp: dahlia: mark usb_2 permanently attached

Applied all, thanks!