Skip to contentSkip to conversation

arm64: dts: imx8mq-nitrogen: add USB support

PATCH In review Adrien Grassein 2 participants 3 messages Jan 26, 2021 – Jan 28, 2021

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

PATCH 1/1 arm64: dts: imx8mq-nitrogen: add USB support

add USB support for imx8mq-nitrogen. It consists
in 2 phys: OTG and host.

The OTG port uses a dedicated regulator for vbus.

---
 .../boot/dts/freescale/imx8mq-nitrogen.dts    | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts +36 -0
index 81d269296610..fb8acd83a280 100644
@@ -34,6 +34,17 @@ power {
 		};
 	};
 
+	reg_usb_otg_vbus: regulator-usb-otg-vbus {
+		compatible = "regulator-fixed";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_reg_usbotg_vbus>;
+		regulator-name = "usb_otg_vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
 	reg_vref_0v9: regulator-vref-0v9 {
 		compatible = "regulator-fixed";
 		regulator-name = "vref-0v9";
@@ -190,6 +201,25 @@ &uart2 {
 	status = "okay";
 };
 
+&usb_dwc3_0 {
+	dr_mode = "otg";
+	status = "okay";
+};
+
+&usb3_phy0 {
+	vbus-supply = <&reg_usb_otg_vbus>;
+	status = "okay";
+};
+
+&usb_dwc3_1 {
+	dr_mode = "host";
+	status = "okay";
+};
+
+&usb3_phy1 {
+	status = "okay";
+};
+
 &usdhc1 {
 	assigned-clocks = <&clk IMX8MQ_CLK_USDHC1>;
 	assigned-clock-rates = <400000000>;
@@ -339,6 +369,12 @@ MX8MQ_IOMUXC_SD2_WP_GPIO2_IO20		0x16
 		>;
 	};
 
+	pinctrl_reg_usbotg_vbus: reg-usbotg-vbusgrp {
+		fsl,pins = <
+			MX8MQ_IOMUXC_GPIO1_IO12_GPIO1_IO12	0x16
+		>;
+	};
+
 	pinctrl_uart1: uart1grp {
 		fsl,pins = <
 			MX8MQ_IOMUXC_UART1_RXD_UART1_DCE_RX		0x45
Signature · 7 lines
2.25.1


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

Hi Adrien,

Thanks for improving Nitrogen upstream, much appreciated.

Quoted 33 lines · Adrien Grassein

add USB support for imx8mq-nitrogen. It consists
in 2 phys: OTG and host.

The OTG port uses a dedicated regulator for vbus.

---
 .../boot/dts/freescale/imx8mq-nitrogen.dts    | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts +11 -0
index 81d269296610..fb8acd83a280 100644
@@ -34,6 +34,17 @@ power {
 		};
 	};
 
+	reg_usb_otg_vbus: regulator-usb-otg-vbus {
+		compatible = "regulator-fixed";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_reg_usbotg_vbus>;
+		regulator-name = "usb_otg_vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
 	reg_vref_0v9: regulator-vref-0v9 {
 		compatible = "regulator-fixed";
 		regulator-name = "vref-0v9";

arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts &uart2 { · line 206

Quoted 6 lines
arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts +3 -0
@@ -190,6 +201,25 @@ &uart2 {
 	status = "okay";
 };
 
+&usb_dwc3_0 {
+	dr_mode = "otg";
+	status = "okay";

Please add a pinctrl here to mux GPIO1_IO13 as over current pin. But I confirm the port is working.

arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts &uart2 { · line 217

Quoted 11 lines
arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts +11 -0
+};
+
+&usb3_phy0 {
+	vbus-supply = <&reg_usb_otg_vbus>;
+	status = "okay";
+};
+
+&usb_dwc3_1 {
+	dr_mode = "host";
+	status = "okay";
+};

The Host port doesn't work for me. This is because of the missing reset signal. Maybe it's time to revive the gpio-reset driver [1]?

Anyway, here is how to fix the USB Host ports:

# gpioset 0 14=1

I guess it'd be best to have a proper reset solution before merging the host port addition.

Regards,
Gary

[1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/[email protected]/

#2 lore raw

Hi Gary,

Quoted 42 lines · Gary Bisson

Hi Adrien,

Thanks for improving Nitrogen upstream, much appreciated.

Quoted 36 lines · Adrien Grassein

add USB support for imx8mq-nitrogen. It consists
in 2 phys: OTG and host.

The OTG port uses a dedicated regulator for vbus.

---
 .../boot/dts/freescale/imx8mq-nitrogen.dts    | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts +11 -0
index 81d269296610..fb8acd83a280 100644
@@ -34,6 +34,17 @@ power {
              };
      };
 
+     reg_usb_otg_vbus: regulator-usb-otg-vbus {
+             compatible = "regulator-fixed";
+             pinctrl-names = "default";
+             pinctrl-0 = <&pinctrl_reg_usbotg_vbus>;
+             regulator-name = "usb_otg_vbus";
+             regulator-min-microvolt = <5000000>;
+             regulator-max-microvolt = <5000000>;
+             gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
+             enable-active-high;
+     };
+
      reg_vref_0v9: regulator-vref-0v9 {
              compatible = "regulator-fixed";
              regulator-name = "vref-0v9";
@@ -190,6 +201,25 @@ &uart2 {
      status = "okay";
 };
 
Quoted 6 lines

arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts &uart2 { · line 206

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts +3 -0
+&usb_dwc3_0 {
+     dr_mode = "otg";
+     status = "okay";

Please add a pinctrl here to mux GPIO1_IO13 as over current pin. But I confirm the port is working.

OK, I will do a new version of the patch.

Quoted 15 lines

arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts &uart2 { · line 217

Quoted 12 lines
arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts +11 -0
+};
+
+&usb3_phy0 {
+     vbus-supply = <&reg_usb_otg_vbus>;
+     status = "okay";
+};
+
+&usb_dwc3_1 {
+     dr_mode = "host";
+     status = "okay";
+};

The Host port doesn't work for me. This is because of the missing reset signal. Maybe it's time to revive the gpio-reset driver [1]?

On my side, all the ports are working correctly without any intervention from the user.
(I have a Nitrogen 8M rev 3.0 and I test with a simple keyboard).

Quoted 7 lines

Anyway, here is how to fix the USB Host ports:

# gpioset 0 14=1

I guess it'd be best to have a proper reset solution before merging the host port addition.

Maybe I can add the reset signal to the DW3 driver?
I guess that Boundary is not the only board maker to use a resettable USB HUB.

Quoted 4 lines

Regards,
Gary

[1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/[email protected]/

Thanks,
Adrien