devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 3/3] arm64: dts: allwinner: h700: Enable USB OTG
       [not found] <20250118102207.9339-1-simons.philippe@gmail.com>
@ 2025-01-18 10:22 ` Philippe Simons
  2025-02-20 20:38   ` Jernej Škrabec
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Simons @ 2025-01-18 10:22 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/Allwinner sunXi SoC support,
	open list:ARM/Allwinner sunXi SoC support, open list
  Cc: Philippe Simons

RG35XX have a GPIO controlled regulator for phy0 vbus, add it.
Enable HCI0s controllers and otg for dr_mode.
Add phy0 properties to descrive id_det, external vbus, and internal vbus

Signed-off-by: Philippe Simons <simons.philippe@gmail.com>
---
 .../sun50i-h700-anbernic-rg35xx-2024.dts      | 25 +++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
index 80ccab7b5..5a6ae42de 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
@@ -175,6 +175,16 @@ reg_vcc5v: regulator-vcc5v { /* USB-C power input */
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
 	};
+
+	reg_usb0_vbus: regulator-usb0-vbus {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&pio 8 16 GPIO_ACTIVE_HIGH>; /* PI16 */
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-name = "usb0-vbus";
+		vin-supply = <&reg_boost>;
+	};
 };
 
 &cpu0 {
@@ -337,12 +347,23 @@ &uart0 {
 	status = "okay";
 };
 
-/* the AXP717 has USB type-C role switch functionality, not yet described by the binding */
+/* the AXP717 has USB type-C role switch functionality */
 &usbotg {
-	dr_mode = "peripheral";   /* USB type-C receptable */
+	dr_mode = "otg";   /* USB type-C receptable */
+	status = "okay";
+};
+
+&ehci0 {
+	status = "okay";
+};
+
+&ohci0 {
 	status = "okay";
 };
 
 &usbphy {
+	usb0_id_det-gpios = <&pio 8 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PI4 */
+	usb0_vbus_power-supply = <&usb_power>;
+	usb0_vbus-supply = <&reg_usb0_vbus>;
 	status = "okay";
 };
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 3/3] arm64: dts: allwinner: h700: Enable USB OTG
  2025-01-18 10:22 ` [RFC PATCH 3/3] arm64: dts: allwinner: h700: Enable USB OTG Philippe Simons
@ 2025-02-20 20:38   ` Jernej Škrabec
  2025-02-21  9:54     ` Philippe Simons
  0 siblings, 1 reply; 4+ messages in thread
From: Jernej Škrabec @ 2025-02-20 20:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Samuel Holland,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/Allwinner sunXi SoC support,
	open list:ARM/Allwinner sunXi SoC support, open list,
	Philippe Simons
  Cc: Philippe Simons

Dne sobota, 18. januar 2025 ob 11:22:06 Srednjeevropski standardni čas je Philippe Simons napisal(a):
> RG35XX have a GPIO controlled regulator for phy0 vbus, add it.
> Enable HCI0s controllers and otg for dr_mode.
> Add phy0 properties to descrive id_det, external vbus, and internal vbus
> 
> Signed-off-by: Philippe Simons <simons.philippe@gmail.com>

This could work without previous two patches, right?

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

> ---
>  .../sun50i-h700-anbernic-rg35xx-2024.dts      | 25 +++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
> index 80ccab7b5..5a6ae42de 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
> @@ -175,6 +175,16 @@ reg_vcc5v: regulator-vcc5v { /* USB-C power input */
>  		regulator-min-microvolt = <5000000>;
>  		regulator-max-microvolt = <5000000>;
>  	};
> +
> +	reg_usb0_vbus: regulator-usb0-vbus {
> +		compatible = "regulator-fixed";
> +		enable-active-high;
> +		gpio = <&pio 8 16 GPIO_ACTIVE_HIGH>; /* PI16 */
> +		regulator-min-microvolt = <5000000>;
> +		regulator-max-microvolt = <5000000>;
> +		regulator-name = "usb0-vbus";
> +		vin-supply = <&reg_boost>;
> +	};
>  };
>  
>  &cpu0 {
> @@ -337,12 +347,23 @@ &uart0 {
>  	status = "okay";
>  };
>  
> -/* the AXP717 has USB type-C role switch functionality, not yet described by the binding */
> +/* the AXP717 has USB type-C role switch functionality */
>  &usbotg {
> -	dr_mode = "peripheral";   /* USB type-C receptable */
> +	dr_mode = "otg";   /* USB type-C receptable */
> +	status = "okay";
> +};
> +
> +&ehci0 {
> +	status = "okay";
> +};
> +
> +&ohci0 {
>  	status = "okay";
>  };
>  
>  &usbphy {
> +	usb0_id_det-gpios = <&pio 8 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PI4 */
> +	usb0_vbus_power-supply = <&usb_power>;
> +	usb0_vbus-supply = <&reg_usb0_vbus>;
>  	status = "okay";
>  };
> 





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 3/3] arm64: dts: allwinner: h700: Enable USB OTG
  2025-02-20 20:38   ` Jernej Škrabec
@ 2025-02-21  9:54     ` Philippe Simons
  2025-02-21 18:20       ` Jernej Škrabec
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Simons @ 2025-02-21  9:54 UTC (permalink / raw)
  To: Jernej Škrabec
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Samuel Holland,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/Allwinner sunXi SoC support,
	open list:ARM/Allwinner sunXi SoC support, open list

On Thu, Feb 20, 2025 at 9:38 PM Jernej Škrabec <jernej.skrabec@gmail.com> wrote:
>
> Dne sobota, 18. januar 2025 ob 11:22:06 Srednjeevropski standardni čas je Philippe Simons napisal(a):
> > RG35XX have a GPIO controlled regulator for phy0 vbus, add it.
> > Enable HCI0s controllers and otg for dr_mode.
> > Add phy0 properties to descrive id_det, external vbus, and internal vbus
> >
> > Signed-off-by: Philippe Simons <simons.philippe@gmail.com>
>
> This could work without previous two patches, right?

While this correctly describes the board, it currently doesn't works
as expected.
HCIs will enable the 5v on PHY and will never disable it.
Resulting in a blown regulator on the board if plugged with another host.
I managed to get this working by removing the PHY ref from the HCI,
but this is wrong.

>
> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
>
> Best regards,
> Jernej
>
> > ---
> >  .../sun50i-h700-anbernic-rg35xx-2024.dts      | 25 +++++++++++++++++--
> >  1 file changed, 23 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
> > index 80ccab7b5..5a6ae42de 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
> > @@ -175,6 +175,16 @@ reg_vcc5v: regulator-vcc5v { /* USB-C power input */
> >               regulator-min-microvolt = <5000000>;
> >               regulator-max-microvolt = <5000000>;
> >       };
> > +
> > +     reg_usb0_vbus: regulator-usb0-vbus {
> > +             compatible = "regulator-fixed";
> > +             enable-active-high;
> > +             gpio = <&pio 8 16 GPIO_ACTIVE_HIGH>; /* PI16 */
> > +             regulator-min-microvolt = <5000000>;
> > +             regulator-max-microvolt = <5000000>;
> > +             regulator-name = "usb0-vbus";
> > +             vin-supply = <&reg_boost>;
> > +     };
> >  };
> >
> >  &cpu0 {
> > @@ -337,12 +347,23 @@ &uart0 {
> >       status = "okay";
> >  };
> >
> > -/* the AXP717 has USB type-C role switch functionality, not yet described by the binding */
> > +/* the AXP717 has USB type-C role switch functionality */
> >  &usbotg {
> > -     dr_mode = "peripheral";   /* USB type-C receptable */
> > +     dr_mode = "otg";   /* USB type-C receptable */
> > +     status = "okay";
> > +};
> > +
> > +&ehci0 {
> > +     status = "okay";
> > +};
> > +
> > +&ohci0 {
> >       status = "okay";
> >  };
> >
> >  &usbphy {
> > +     usb0_id_det-gpios = <&pio 8 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PI4 */
> > +     usb0_vbus_power-supply = <&usb_power>;
> > +     usb0_vbus-supply = <&reg_usb0_vbus>;
> >       status = "okay";
> >  };
> >
>
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 3/3] arm64: dts: allwinner: h700: Enable USB OTG
  2025-02-21  9:54     ` Philippe Simons
@ 2025-02-21 18:20       ` Jernej Škrabec
  0 siblings, 0 replies; 4+ messages in thread
From: Jernej Škrabec @ 2025-02-21 18:20 UTC (permalink / raw)
  To: Philippe Simons
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Samuel Holland,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/Allwinner sunXi SoC support,
	open list:ARM/Allwinner sunXi SoC support, open list

Dne petek, 21. februar 2025 ob 10:54:27 Srednjeevropski standardni čas je Philippe Simons napisal(a):
> On Thu, Feb 20, 2025 at 9:38 PM Jernej Škrabec <jernej.skrabec@gmail.com> wrote:
> >
> > Dne sobota, 18. januar 2025 ob 11:22:06 Srednjeevropski standardni čas je Philippe Simons napisal(a):
> > > RG35XX have a GPIO controlled regulator for phy0 vbus, add it.
> > > Enable HCI0s controllers and otg for dr_mode.
> > > Add phy0 properties to descrive id_det, external vbus, and internal vbus
> > >
> > > Signed-off-by: Philippe Simons <simons.philippe@gmail.com>
> >
> > This could work without previous two patches, right?
> 
> While this correctly describes the board, it currently doesn't works
> as expected.
> HCIs will enable the 5v on PHY and will never disable it.
> Resulting in a blown regulator on the board if plugged with another host.
> I managed to get this working by removing the PHY ref from the HCI,
> but this is wrong.

Ok, so this patch shouldn't be merged until USB patches are in.

Best regards,
Jernej

> 
> >
> > Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> >
> > Best regards,
> > Jernej
> >
> > > ---
> > >  .../sun50i-h700-anbernic-rg35xx-2024.dts      | 25 +++++++++++++++++--
> > >  1 file changed, 23 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
> > > index 80ccab7b5..5a6ae42de 100644
> > > --- a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
> > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
> > > @@ -175,6 +175,16 @@ reg_vcc5v: regulator-vcc5v { /* USB-C power input */
> > >               regulator-min-microvolt = <5000000>;
> > >               regulator-max-microvolt = <5000000>;
> > >       };
> > > +
> > > +     reg_usb0_vbus: regulator-usb0-vbus {
> > > +             compatible = "regulator-fixed";
> > > +             enable-active-high;
> > > +             gpio = <&pio 8 16 GPIO_ACTIVE_HIGH>; /* PI16 */
> > > +             regulator-min-microvolt = <5000000>;
> > > +             regulator-max-microvolt = <5000000>;
> > > +             regulator-name = "usb0-vbus";
> > > +             vin-supply = <&reg_boost>;
> > > +     };
> > >  };
> > >
> > >  &cpu0 {
> > > @@ -337,12 +347,23 @@ &uart0 {
> > >       status = "okay";
> > >  };
> > >
> > > -/* the AXP717 has USB type-C role switch functionality, not yet described by the binding */
> > > +/* the AXP717 has USB type-C role switch functionality */
> > >  &usbotg {
> > > -     dr_mode = "peripheral";   /* USB type-C receptable */
> > > +     dr_mode = "otg";   /* USB type-C receptable */
> > > +     status = "okay";
> > > +};
> > > +
> > > +&ehci0 {
> > > +     status = "okay";
> > > +};
> > > +
> > > +&ohci0 {
> > >       status = "okay";
> > >  };
> > >
> > >  &usbphy {
> > > +     usb0_id_det-gpios = <&pio 8 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PI4 */
> > > +     usb0_vbus_power-supply = <&usb_power>;
> > > +     usb0_vbus-supply = <&reg_usb0_vbus>;
> > >       status = "okay";
> > >  };
> > >
> >
> >
> >
> >
> 





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-02-21 18:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250118102207.9339-1-simons.philippe@gmail.com>
2025-01-18 10:22 ` [RFC PATCH 3/3] arm64: dts: allwinner: h700: Enable USB OTG Philippe Simons
2025-02-20 20:38   ` Jernej Škrabec
2025-02-21  9:54     ` Philippe Simons
2025-02-21 18:20       ` Jernej Škrabec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).