[v2] arm64: dts: imx8mn-var-som-symphony: fix USB OTG

Message ID 20230705174932.3652479-1-hugo@hugovil.com
State New
Headers
Series [v2] arm64: dts: imx8mn-var-som-symphony: fix USB OTG |

Commit Message

Hugo Villeneuve July 5, 2023, 5:49 p.m. UTC
  From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

USB OTG is currently broken on the Variscite Symphony EVK and imx8mn
nano SOM.

The PTN5150 circuitry on newer versions of the Symphony EVK board has
a non-standard configuration in which the PTN5150 IRQ pin is left
unconnected, and the PTN5150 ID pin is connected to GPIO1_IO11. This
requires changes to the ptn5150 driver to support this new mode.
Variscite have indicated their intention to submit those changes
upstream.

In the meantime, import device tree changes from linux-5.15 branch of
varigit repos to at least make the USB OTG port operate correctly in
host mode.

Fixes: 7358e05bddca ("arm64: dts: imx8mn-var-som-symphony: Add Variscite Symphony board with VAR-SOM-MX8MN")
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
Link: [v1] https://lkml.org/lkml/2023/7/4/702

Changes from v1:
- Add comments about PTN5150 IRQ/ID line connections
- Remove "typec1_con: connector" node
- Change IRQ type to IRQ_TYPE_EDGE_FALLING

 .../dts/freescale/imx8mn-var-som-symphony.dts | 32 +++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)


base-commit: d528014517f2b0531862c02865b9d4c908019dc4
  

Comments

Shawn Guo July 18, 2023, 6:37 a.m. UTC | #1
On Wed, Jul 05, 2023 at 01:49:32PM -0400, Hugo Villeneuve wrote:
> From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> 
> USB OTG is currently broken on the Variscite Symphony EVK and imx8mn
> nano SOM.
> 
> The PTN5150 circuitry on newer versions of the Symphony EVK board has
> a non-standard configuration in which the PTN5150 IRQ pin is left
> unconnected, and the PTN5150 ID pin is connected to GPIO1_IO11. This
> requires changes to the ptn5150 driver to support this new mode.
> Variscite have indicated their intention to submit those changes
> upstream.
> 
> In the meantime, import device tree changes from linux-5.15 branch of
> varigit repos to at least make the USB OTG port operate correctly in
> host mode.
> 
> Fixes: 7358e05bddca ("arm64: dts: imx8mn-var-som-symphony: Add Variscite Symphony board with VAR-SOM-MX8MN")

Has USB OTG been ever worked at all?  If the answer is no, it's not
a fix but a new feature, and I would suggest you rework the patch
subject and drop the Fixes tag.

Shawn

> Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> ---
> Link: [v1] https://lkml.org/lkml/2023/7/4/702
> 
> Changes from v1:
> - Add comments about PTN5150 IRQ/ID line connections
> - Remove "typec1_con: connector" node
> - Change IRQ type to IRQ_TYPE_EDGE_FALLING
> 
>  .../dts/freescale/imx8mn-var-som-symphony.dts | 32 +++++++++++++++++--
>  1 file changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts b/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts
> index 406a711486da..a7a57442cb81 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts
> @@ -1,11 +1,14 @@
>  // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>  /*
> + * Supports Symphony evaluation board versions >= 1.4a.
> + *
>   * Copyright 2019-2020 Variscite Ltd.
>   * Copyright (C) 2020 Krzysztof Kozlowski <krzk@kernel.org>
>   */
>  
>  /dts-v1/;
>  
> +#include <dt-bindings/usb/pd.h>
>  #include "imx8mn-var-som.dtsi"
>  
>  / {
> @@ -100,14 +103,26 @@ enet-sel-hog {
>  		};
>  	};
>  
> +	/*
> +	 * For Symphony board version <= 1.4, the PTN5150 IRQ pin is connected
> +	 * to GPIO1_IO11 on the SoM (R106 present, R132 absent). From Symphony
> +	 * board version >= 1.4a, the PTN5150 ID pin is connected to GPIO1_IO11
> +	 * on the SoM (R106 absent, R132 present).
> +	 */
>  	extcon_usbotg1: typec@3d {
>  		compatible = "nxp,ptn5150";
>  		reg = <0x3d>;
>  		interrupt-parent = <&gpio1>;
> -		interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
> +		interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&pinctrl_ptn5150>;
>  		status = "okay";
> +
> +		port {
> +			typec1_dr_sw: endpoint {
> +				remote-endpoint = <&usb1_drd_sw>;
> +			};
> +		};
>  	};
>  };
>  
> @@ -148,8 +163,21 @@ &uart3 {
>  };
>  
>  &usbotg1 {
> +	dr_mode = "otg";
> +	hnp-disable;
> +	srp-disable;
> +	adp-disable;
> +	usb-role-switch;
>  	disable-over-current;
> -	extcon = <&extcon_usbotg1>, <&extcon_usbotg1>;
> +	samsung,picophy-pre-emp-curr-control = <3>;
> +	samsung,picophy-dc-vol-level-adjust = <7>;
> +	status = "okay";
> +
> +	port {
> +		usb1_drd_sw: endpoint {
> +			remote-endpoint = <&typec1_dr_sw>;
> +		};
> +	};
>  };
>  
>  &iomuxc {
> 
> base-commit: d528014517f2b0531862c02865b9d4c908019dc4
> -- 
> 2.30.2
>
  
Hugo Villeneuve July 18, 2023, 2:03 p.m. UTC | #2
On Tue, 18 Jul 2023 14:37:15 +0800
Shawn Guo <shawnguo@kernel.org> wrote:

> On Wed, Jul 05, 2023 at 01:49:32PM -0400, Hugo Villeneuve wrote:
> > From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > 
> > USB OTG is currently broken on the Variscite Symphony EVK and imx8mn
> > nano SOM.
> > 
> > The PTN5150 circuitry on newer versions of the Symphony EVK board has
> > a non-standard configuration in which the PTN5150 IRQ pin is left
> > unconnected, and the PTN5150 ID pin is connected to GPIO1_IO11. This
> > requires changes to the ptn5150 driver to support this new mode.
> > Variscite have indicated their intention to submit those changes
> > upstream.
> > 
> > In the meantime, import device tree changes from linux-5.15 branch of
> > varigit repos to at least make the USB OTG port operate correctly in
> > host mode.
> > 
> > Fixes: 7358e05bddca ("arm64: dts: imx8mn-var-som-symphony: Add Variscite Symphony board with VAR-SOM-MX8MN")
> 
> Has USB OTG been ever worked at all?  If the answer is no, it's not
> a fix but a new feature, and I would suggest you rework the patch
> subject and drop the Fixes tag.

Hi Shawn,
it never worked for me since commit 7358e05bddca, but it may have
something to do with the new hardware board version (>=1.4a) that I
have. It probably worked for older boards (< 1.4a) altough I cannot
confirm it without old hardware.

Let me know if you want me to remove the Fixes tag.

Hugo.


> 
> Shawn
> 
> > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > ---
> > Link: [v1] https://lkml.org/lkml/2023/7/4/702
> > 
> > Changes from v1:
> > - Add comments about PTN5150 IRQ/ID line connections
> > - Remove "typec1_con: connector" node
> > - Change IRQ type to IRQ_TYPE_EDGE_FALLING
> > 
> >  .../dts/freescale/imx8mn-var-som-symphony.dts | 32 +++++++++++++++++--
> >  1 file changed, 30 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts b/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts
> > index 406a711486da..a7a57442cb81 100644
> > --- a/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts
> > +++ b/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts
> > @@ -1,11 +1,14 @@
> >  // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> >  /*
> > + * Supports Symphony evaluation board versions >= 1.4a.
> > + *
> >   * Copyright 2019-2020 Variscite Ltd.
> >   * Copyright (C) 2020 Krzysztof Kozlowski <krzk@kernel.org>
> >   */
> >  
> >  /dts-v1/;
> >  
> > +#include <dt-bindings/usb/pd.h>
> >  #include "imx8mn-var-som.dtsi"
> >  
> >  / {
> > @@ -100,14 +103,26 @@ enet-sel-hog {
> >  		};
> >  	};
> >  
> > +	/*
> > +	 * For Symphony board version <= 1.4, the PTN5150 IRQ pin is connected
> > +	 * to GPIO1_IO11 on the SoM (R106 present, R132 absent). From Symphony
> > +	 * board version >= 1.4a, the PTN5150 ID pin is connected to GPIO1_IO11
> > +	 * on the SoM (R106 absent, R132 present).
> > +	 */
> >  	extcon_usbotg1: typec@3d {
> >  		compatible = "nxp,ptn5150";
> >  		reg = <0x3d>;
> >  		interrupt-parent = <&gpio1>;
> > -		interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
> > +		interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
> >  		pinctrl-names = "default";
> >  		pinctrl-0 = <&pinctrl_ptn5150>;
> >  		status = "okay";
> > +
> > +		port {
> > +			typec1_dr_sw: endpoint {
> > +				remote-endpoint = <&usb1_drd_sw>;
> > +			};
> > +		};
> >  	};
> >  };
> >  
> > @@ -148,8 +163,21 @@ &uart3 {
> >  };
> >  
> >  &usbotg1 {
> > +	dr_mode = "otg";
> > +	hnp-disable;
> > +	srp-disable;
> > +	adp-disable;
> > +	usb-role-switch;
> >  	disable-over-current;
> > -	extcon = <&extcon_usbotg1>, <&extcon_usbotg1>;
> > +	samsung,picophy-pre-emp-curr-control = <3>;
> > +	samsung,picophy-dc-vol-level-adjust = <7>;
> > +	status = "okay";
> > +
> > +	port {
> > +		usb1_drd_sw: endpoint {
> > +			remote-endpoint = <&typec1_dr_sw>;
> > +		};
> > +	};
> >  };
> >  
> >  &iomuxc {
> > 
> > base-commit: d528014517f2b0531862c02865b9d4c908019dc4
> > -- 
> > 2.30.2
> > 
>
  
Shawn Guo July 19, 2023, 2 a.m. UTC | #3
On Tue, Jul 18, 2023 at 10:03:44AM -0400, Hugo Villeneuve wrote:
> On Tue, 18 Jul 2023 14:37:15 +0800
> Shawn Guo <shawnguo@kernel.org> wrote:
> 
> > On Wed, Jul 05, 2023 at 01:49:32PM -0400, Hugo Villeneuve wrote:
> > > From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > > 
> > > USB OTG is currently broken on the Variscite Symphony EVK and imx8mn
> > > nano SOM.
> > > 
> > > The PTN5150 circuitry on newer versions of the Symphony EVK board has
> > > a non-standard configuration in which the PTN5150 IRQ pin is left
> > > unconnected, and the PTN5150 ID pin is connected to GPIO1_IO11. This
> > > requires changes to the ptn5150 driver to support this new mode.
> > > Variscite have indicated their intention to submit those changes
> > > upstream.
> > > 
> > > In the meantime, import device tree changes from linux-5.15 branch of
> > > varigit repos to at least make the USB OTG port operate correctly in
> > > host mode.
> > > 
> > > Fixes: 7358e05bddca ("arm64: dts: imx8mn-var-som-symphony: Add Variscite Symphony board with VAR-SOM-MX8MN")
> > 
> > Has USB OTG been ever worked at all?  If the answer is no, it's not
> > a fix but a new feature, and I would suggest you rework the patch
> > subject and drop the Fixes tag.
> 
> Hi Shawn,
> it never worked for me since commit 7358e05bddca, but it may have
> something to do with the new hardware board version (>=1.4a) that I
> have. It probably worked for older boards (< 1.4a) altough I cannot
> confirm it without old hardware.
> 
> Let me know if you want me to remove the Fixes tag.

The change doesn't look like a bug fix as it stands.  Please rework the
patch subject and remove the Fixes tag.

Shawn
  

Patch

diff --git a/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts b/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts
index 406a711486da..a7a57442cb81 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts
@@ -1,11 +1,14 @@ 
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
+ * Supports Symphony evaluation board versions >= 1.4a.
+ *
  * Copyright 2019-2020 Variscite Ltd.
  * Copyright (C) 2020 Krzysztof Kozlowski <krzk@kernel.org>
  */
 
 /dts-v1/;
 
+#include <dt-bindings/usb/pd.h>
 #include "imx8mn-var-som.dtsi"
 
 / {
@@ -100,14 +103,26 @@  enet-sel-hog {
 		};
 	};
 
+	/*
+	 * For Symphony board version <= 1.4, the PTN5150 IRQ pin is connected
+	 * to GPIO1_IO11 on the SoM (R106 present, R132 absent). From Symphony
+	 * board version >= 1.4a, the PTN5150 ID pin is connected to GPIO1_IO11
+	 * on the SoM (R106 absent, R132 present).
+	 */
 	extcon_usbotg1: typec@3d {
 		compatible = "nxp,ptn5150";
 		reg = <0x3d>;
 		interrupt-parent = <&gpio1>;
-		interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
+		interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_ptn5150>;
 		status = "okay";
+
+		port {
+			typec1_dr_sw: endpoint {
+				remote-endpoint = <&usb1_drd_sw>;
+			};
+		};
 	};
 };
 
@@ -148,8 +163,21 @@  &uart3 {
 };
 
 &usbotg1 {
+	dr_mode = "otg";
+	hnp-disable;
+	srp-disable;
+	adp-disable;
+	usb-role-switch;
 	disable-over-current;
-	extcon = <&extcon_usbotg1>, <&extcon_usbotg1>;
+	samsung,picophy-pre-emp-curr-control = <3>;
+	samsung,picophy-dc-vol-level-adjust = <7>;
+	status = "okay";
+
+	port {
+		usb1_drd_sw: endpoint {
+			remote-endpoint = <&typec1_dr_sw>;
+		};
+	};
 };
 
 &iomuxc {