diff mbox series

[1/1] arm64: dts: imx8mm-tqma8mqml-mba8mx: Fix USB DR

Message ID 20220926112622.2912885-1-alexander.stein@ew.tq-group.com (mailing list archive)
State New, archived
Headers show
Series [1/1] arm64: dts: imx8mm-tqma8mqml-mba8mx: Fix USB DR | expand

Commit Message

Alexander Stein Sept. 26, 2022, 11:26 a.m. UTC
extcon does not work somehow, so switch to usb-role-switch instead.

Fixes: dfcd1b6f7620 ("arm64: dts: freescale: add initial device tree for TQMa8MQML with i.MX8MM")
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 .../dts/freescale/imx8mm-tqma8mqml-mba8mx.dts | 32 +++++++++++++++----
 1 file changed, 26 insertions(+), 6 deletions(-)

Comments

Shawn Guo Oct. 24, 2022, 1:31 a.m. UTC | #1
On Mon, Sep 26, 2022 at 01:26:22PM +0200, Alexander Stein wrote:
> extcon does not work somehow, so switch to usb-role-switch instead.

So extcon was added without testing?

Shawn

> 
> Fixes: dfcd1b6f7620 ("arm64: dts: freescale: add initial device tree for TQMa8MQML with i.MX8MM")
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
>  .../dts/freescale/imx8mm-tqma8mqml-mba8mx.dts | 32 +++++++++++++++----
>  1 file changed, 26 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts b/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts
> index bfb44630da6b..56323c989d55 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts
> @@ -34,11 +34,25 @@ reg_usdhc2_vmmc: regulator-vmmc {
>  		off-on-delay-us = <12000>;
>  	};
>  
> -	extcon_usbotg1: extcon-usbotg1 {
> -		compatible = "linux,extcon-usb-gpio";
> +	connector {
> +		compatible = "gpio-usb-b-connector", "usb-b-connector";
> +		type = "micro";
> +		label = "X19";
>  		pinctrl-names = "default";
> -		pinctrl-0 = <&pinctrl_usb1_extcon>;
> -		id-gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>;
> +		pinctrl-0 = <&pinctrl_usb1_connector>;
> +		id-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
> +
> +		ports {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			port@0 {
> +				reg = <0>;
> +				usb_dr_connector: endpoint {
> +					remote-endpoint = <&usb1_drd_sw>;
> +				};
> +			};
> +		};
>  	};
>  };
>  
> @@ -106,13 +120,19 @@ &usbotg1 {
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&pinctrl_usbotg1>;
>  	dr_mode = "otg";
> -	extcon = <&extcon_usbotg1>;
>  	srp-disable;
>  	hnp-disable;
>  	adp-disable;
>  	power-active-high;
>  	over-current-active-low;
> +	usb-role-switch;
>  	status = "okay";
> +
> +	port {
> +		usb1_drd_sw: endpoint {
> +			remote-endpoint = <&usb_dr_connector>;
> +		};
> +	};
>  };
>  
>  &usbotg2 {
> @@ -242,7 +262,7 @@ pinctrl_usbotg1: usbotg1grp {
>  			   <MX8MM_IOMUXC_GPIO1_IO13_USB1_OTG_OC		0x84>;
>  	};
>  
> -	pinctrl_usb1_extcon: usb1-extcongrp {
> +	pinctrl_usb1_connector: usb1-connectorgrp {
>  		fsl,pins = <MX8MM_IOMUXC_GPIO1_IO10_GPIO1_IO10		0x1c0>;
>  	};
>  
> -- 
> 2.25.1
>
Alexander Stein Oct. 24, 2022, 8:15 a.m. UTC | #2
Hello Shawn,

Am Montag, 24. Oktober 2022, 03:31:23 CEST schrieb Shawn Guo:
> On Mon, Sep 26, 2022 at 01:26:22PM +0200, Alexander Stein wrote:
> > extcon does not work somehow, so switch to usb-role-switch instead.
> 
> So extcon was added without testing?

It had been tested, but apparently only the USB Host case :( extcon itself 
does work and detects ID pin correctly. Cable states switch when a USB device 
(mass storage) is attached and removed, thus mass storage is detect and 
usable.
But unfortunately this is not the case for USB device using g_serial udc 
driver. IMHO this seems to be a problem within chipidea usb driver.
Using usb-role-switch instead, both USB host and USB device do work.

Best regards,
Alexander

> Shawn
> 
> > Fixes: dfcd1b6f7620 ("arm64: dts: freescale: add initial device tree for
> > TQMa8MQML with i.MX8MM") Signed-off-by: Alexander Stein
> > <alexander.stein@ew.tq-group.com>
> > ---
> > 
> >  .../dts/freescale/imx8mm-tqma8mqml-mba8mx.dts | 32 +++++++++++++++----
> >  1 file changed, 26 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts
> > b/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts index
> > bfb44630da6b..56323c989d55 100644
> > --- a/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts
> > +++ b/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts
> > @@ -34,11 +34,25 @@ reg_usdhc2_vmmc: regulator-vmmc {
> > 
> >  		off-on-delay-us = <12000>;
> >  	
> >  	};
> > 
> > -	extcon_usbotg1: extcon-usbotg1 {
> > -		compatible = "linux,extcon-usb-gpio";
> > +	connector {
> > +		compatible = "gpio-usb-b-connector", "usb-b-connector";
> > +		type = "micro";
> > +		label = "X19";
> > 
> >  		pinctrl-names = "default";
> > 
> > -		pinctrl-0 = <&pinctrl_usb1_extcon>;
> > -		id-gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>;
> > +		pinctrl-0 = <&pinctrl_usb1_connector>;
> > +		id-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
> > +
> > +		ports {
> > +			#address-cells = <1>;
> > +			#size-cells = <0>;
> > +
> > +			port@0 {
> > +				reg = <0>;
> > +				usb_dr_connector: endpoint {
> > +					remote-endpoint = 
<&usb1_drd_sw>;
> > +				};
> > +			};
> > +		};
> > 
> >  	};
> >  
> >  };
> > 
> > @@ -106,13 +120,19 @@ &usbotg1 {
> > 
> >  	pinctrl-names = "default";
> >  	pinctrl-0 = <&pinctrl_usbotg1>;
> >  	dr_mode = "otg";
> > 
> > -	extcon = <&extcon_usbotg1>;
> > 
> >  	srp-disable;
> >  	hnp-disable;
> >  	adp-disable;
> >  	power-active-high;
> >  	over-current-active-low;
> > 
> > +	usb-role-switch;
> > 
> >  	status = "okay";
> > 
> > +
> > +	port {
> > +		usb1_drd_sw: endpoint {
> > +			remote-endpoint = <&usb_dr_connector>;
> > +		};
> > +	};
> > 
> >  };
> >  
> >  &usbotg2 {
> > 
> > @@ -242,7 +262,7 @@ pinctrl_usbotg1: usbotg1grp {
> > 
> >  			   <MX8MM_IOMUXC_GPIO1_IO13_USB1_OTG_OC		
0x84>;
> >  	
> >  	};
> > 
> > -	pinctrl_usb1_extcon: usb1-extcongrp {
> > +	pinctrl_usb1_connector: usb1-connectorgrp {
> > 
> >  		fsl,pins = <MX8MM_IOMUXC_GPIO1_IO10_GPIO1_IO10		
0x1c0>;
> >  	
> >  	};
Shawn Guo Oct. 29, 2022, 12:52 a.m. UTC | #3
On Mon, Oct 24, 2022 at 10:15:28AM +0200, Alexander Stein wrote:
> Hello Shawn,
> 
> Am Montag, 24. Oktober 2022, 03:31:23 CEST schrieb Shawn Guo:
> > On Mon, Sep 26, 2022 at 01:26:22PM +0200, Alexander Stein wrote:
> > > extcon does not work somehow, so switch to usb-role-switch instead.
> > 
> > So extcon was added without testing?
> 
> It had been tested, but apparently only the USB Host case :( extcon itself 
> does work and detects ID pin correctly. Cable states switch when a USB device 
> (mass storage) is attached and removed, thus mass storage is detect and 
> usable.
> But unfortunately this is not the case for USB device using g_serial udc 
> driver. IMHO this seems to be a problem within chipidea usb driver.
> Using usb-role-switch instead, both USB host and USB device do work.

Thanks for the clarification!  Could you improve the commit log a bit
with these information?

Shawn
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts b/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts
index bfb44630da6b..56323c989d55 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts
@@ -34,11 +34,25 @@  reg_usdhc2_vmmc: regulator-vmmc {
 		off-on-delay-us = <12000>;
 	};
 
-	extcon_usbotg1: extcon-usbotg1 {
-		compatible = "linux,extcon-usb-gpio";
+	connector {
+		compatible = "gpio-usb-b-connector", "usb-b-connector";
+		type = "micro";
+		label = "X19";
 		pinctrl-names = "default";
-		pinctrl-0 = <&pinctrl_usb1_extcon>;
-		id-gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>;
+		pinctrl-0 = <&pinctrl_usb1_connector>;
+		id-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				usb_dr_connector: endpoint {
+					remote-endpoint = <&usb1_drd_sw>;
+				};
+			};
+		};
 	};
 };
 
@@ -106,13 +120,19 @@  &usbotg1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_usbotg1>;
 	dr_mode = "otg";
-	extcon = <&extcon_usbotg1>;
 	srp-disable;
 	hnp-disable;
 	adp-disable;
 	power-active-high;
 	over-current-active-low;
+	usb-role-switch;
 	status = "okay";
+
+	port {
+		usb1_drd_sw: endpoint {
+			remote-endpoint = <&usb_dr_connector>;
+		};
+	};
 };
 
 &usbotg2 {
@@ -242,7 +262,7 @@  pinctrl_usbotg1: usbotg1grp {
 			   <MX8MM_IOMUXC_GPIO1_IO13_USB1_OTG_OC		0x84>;
 	};
 
-	pinctrl_usb1_extcon: usb1-extcongrp {
+	pinctrl_usb1_connector: usb1-connectorgrp {
 		fsl,pins = <MX8MM_IOMUXC_GPIO1_IO10_GPIO1_IO10		0x1c0>;
 	};