[PATCH v5 15/22] arm64: dts: renesas: r9a09g057: Add USB2.0 VBUS_SEL mux-controller support

Tommaso Merciai posted 22 patches 2 months, 2 weeks ago
There is a newer version of this series
[PATCH v5 15/22] arm64: dts: renesas: r9a09g057: Add USB2.0 VBUS_SEL mux-controller support
Posted by Tommaso Merciai 2 months, 2 weeks ago
Enable control of USB2.0 VBUSEN via the VBUS_SEL bit in the VBENCTL
register. According to the RZ/V2H(P) SoC hardware manual, OTG channels
require VBUS_SEL set, while HOST-only channels require it cleared.

Add `#mux-state-cell` to the usb20phyrst and usb21phyrst reset
nodes to expose them as mux controllers.

Set the required mux-states in usb2_phy0 (OTG: state 1) and usb2_phy1
(HOST: state 0) nodes.

This enables proper VBUSEN management for OTG and HOST-only USB2.0
channels.

Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
v4->v5:
 - No changes.

v3->v4:
 - Switch back to v2 implementation.
 - Improve commit body.

v2->v3:
 - Manipulate the mux controller as an internal node, and update
   commit body accordingly.

v1->v2:
 - New patch

 arch/arm64/boot/dts/renesas/r9a09g057.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r9a09g057.dtsi b/arch/arm64/boot/dts/renesas/r9a09g057.dtsi
index 4df32d7e9998..b4bbcde33099 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g057.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a09g057.dtsi
@@ -1034,6 +1034,7 @@ usb2_phy0: usb-phy@15800200 {
 			resets = <&usb20phyrst>;
 			#phy-cells = <1>;
 			power-domains = <&cpg>;
+			mux-states = <&usb20phyrst 1>;
 			status = "disabled";
 		};
 
@@ -1047,6 +1048,7 @@ usb2_phy1: usb-phy@15810200 {
 			resets = <&usb21phyrst>;
 			#phy-cells = <1>;
 			power-domains = <&cpg>;
+			mux-states = <&usb21phyrst 0>;
 			status = "disabled";
 		};
 
@@ -1074,6 +1076,7 @@ usb20phyrst: usb20phy-reset@15830000 {
 			resets = <&cpg 0xaf>;
 			power-domains = <&cpg>;
 			#reset-cells = <0>;
+			#mux-state-cells = <1>;
 			status = "disabled";
 		};
 
@@ -1084,6 +1087,7 @@ usb21phyrst: usb21phy-reset@15840000 {
 			resets = <&cpg 0xaf>;
 			power-domains = <&cpg>;
 			#reset-cells = <0>;
+			#mux-state-cells = <1>;
 			status = "disabled";
 		};
 
-- 
2.43.0
Re: [PATCH v5 15/22] arm64: dts: renesas: r9a09g057: Add USB2.0 VBUS_SEL mux-controller support
Posted by Geert Uytterhoeven 2 weeks ago
Hi Tommaso,

On Thu, 27 Nov 2025 at 12:51, Tommaso Merciai
<tommaso.merciai.xr@bp.renesas.com> wrote:
> Enable control of USB2.0 VBUSEN via the VBUS_SEL bit in the VBENCTL
> register. According to the RZ/V2H(P) SoC hardware manual, OTG channels
> require VBUS_SEL set, while HOST-only channels require it cleared.
>
> Add `#mux-state-cell` to the usb20phyrst and usb21phyrst reset
> nodes to expose them as mux controllers.
>
> Set the required mux-states in usb2_phy0 (OTG: state 1) and usb2_phy1
> (HOST: state 0) nodes.
>
> This enables proper VBUSEN management for OTG and HOST-only USB2.0
> channels.
>
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>

Thanks for your patch!

> --- a/arch/arm64/boot/dts/renesas/r9a09g057.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r9a09g057.dtsi
> @@ -1034,6 +1034,7 @@ usb2_phy0: usb-phy@15800200 {
>                         resets = <&usb20phyrst>;
>                         #phy-cells = <1>;
>                         power-domains = <&cpg>;
> +                       mux-states = <&usb20phyrst 1>;

I am no USB expert, and didn't really follow the USB specifics of
this series, but isn't the selection of host (VBUSEN = 1) or function
(VBUSEN = 0) mode decided at runtime?

>                         status = "disabled";
>                 };
>
> @@ -1047,6 +1048,7 @@ usb2_phy1: usb-phy@15810200 {
>                         resets = <&usb21phyrst>;
>                         #phy-cells = <1>;
>                         power-domains = <&cpg>;
> +                       mux-states = <&usb21phyrst 0>;

The second controller is always used in host mode, so 0 is correct.

>                         status = "disabled";
>                 };
>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Re: [PATCH v5 15/22] arm64: dts: renesas: r9a09g057: Add USB2.0 VBUS_SEL mux-controller support
Posted by Tommaso Merciai 2 weeks ago
Hi Geert,
Thanks for your review.

On Mon, Jan 26, 2026 at 05:59:02PM +0100, Geert Uytterhoeven wrote:
> Hi Tommaso,
> 
> On Thu, 27 Nov 2025 at 12:51, Tommaso Merciai
> <tommaso.merciai.xr@bp.renesas.com> wrote:
> > Enable control of USB2.0 VBUSEN via the VBUS_SEL bit in the VBENCTL
> > register. According to the RZ/V2H(P) SoC hardware manual, OTG channels
> > require VBUS_SEL set, while HOST-only channels require it cleared.
> >
> > Add `#mux-state-cell` to the usb20phyrst and usb21phyrst reset
> > nodes to expose them as mux controllers.
> >
> > Set the required mux-states in usb2_phy0 (OTG: state 1) and usb2_phy1
> > (HOST: state 0) nodes.
> >
> > This enables proper VBUSEN management for OTG and HOST-only USB2.0
> > channels.
> >
> > Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> 
> Thanks for your patch!
> 
> > --- a/arch/arm64/boot/dts/renesas/r9a09g057.dtsi
> > +++ b/arch/arm64/boot/dts/renesas/r9a09g057.dtsi
> > @@ -1034,6 +1034,7 @@ usb2_phy0: usb-phy@15800200 {
> >                         resets = <&usb20phyrst>;
> >                         #phy-cells = <1>;
> >                         power-domains = <&cpg>;
> > +                       mux-states = <&usb20phyrst 1>;
> 
> I am no USB expert, and didn't really follow the USB specifics of
> this series, but isn't the selection of host (VBUSEN = 1) or function
> (VBUSEN = 0) mode decided at runtime?

usb2_phy0 -> OTG channels -> VBUS_SEL = 1

For peripheral/function will be used (VBOUT bit):

	usb2_phy0_vbus_otg: vbus-regulator {
		regulator-name = "USB2PHY0-VBUS-OTG";
		status = "disabled";
	};

[0] Will drive the VBUSEN signal at runtime using [1].

> 
> >                         status = "disabled";
> >                 };
> >
> > @@ -1047,6 +1048,7 @@ usb2_phy1: usb-phy@15810200 {
> >                         resets = <&usb21phyrst>;
> >                         #phy-cells = <1>;
> >                         power-domains = <&cpg>;
> > +                       mux-states = <&usb21phyrst 0>;
> 
> The second controller is always used in host mode, so 0 is correct.
> 

Right in this way we will have:

usb2_phy1 -> HOST only channel -> VBUS_SEL = 0

and not VBOUT bit.


[0] https://patchwork.kernel.org/project/linux-renesas-soc/patch/c67fcdbc2c6d1694b785d7240d368490037a82fa.1764241212.git.tommaso.merciai.xr@bp.renesas.com/
[1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/4618b939734fcfe1f153e725ac178844b44d9a3f.1764241212.git.tommaso.merciai.xr@bp.renesas.com/


Thanks & Regards,
Tommaso


> >                         status = "disabled";
> >                 };
> >
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds