mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 00/11] Add RZ/G3L USB2.0 host support
@ 2026-06-12 14:30 Biju
  2026-06-12 14:30 ` [PATCH 01/11] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support Biju
                   ` (10 more replies)
  0 siblings, 11 replies; 26+ messages in thread
From: Biju @ 2026-06-12 14:30 UTC (permalink / raw)
  To: Philipp Zabel, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Michael Turquette,
	Stephen Boyd, Liam Girdwood, Mark Brown, Magnus Damm
  Cc: Biju Das, Neil Armstrong, Yoshihiro Shimoda, linux-phy,
	devicetree, linux-kernel, linux-clk, linux-renesas-soc,
	Prabhakar Mahadev Lad, Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

Add device tree binding support for the RZ/G3L (r9a08g046) USB PHY
controller. The RZ/G3L USB PHY block is similar to RZ/G3S, but each port
has an OTG controller, unlike RZ/G3S, which has an OTG controller only on
port 1.

Biju Das (11):
  dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support
  dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings
  clk: renesas: r9a08g046: Add USB2.0 clock and reset entries
  reset: rzg2l-usbphy-ctrl: Introduce info struct for match data
  reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
  regulator: renesas-usb-vbus-regulator: Introduce helper for regulator
    registration
  regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator
    support
  phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support
  phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for
    disabled VBUS regulator
  arm64: dts: renesas: r9a08g046: Add USB2.0 device nodes
  arm64: dts: renesas: r9a08g046l48-smarc: Add USB2.0 support

 .../bindings/phy/renesas,usb2-phy.yaml        |   2 +
 .../reset/renesas,rzg2l-usbphy-ctrl.yaml      |  20 +++-
 arch/arm64/boot/dts/renesas/r9a08g046.dtsi    | 103 ++++++++++++++++++
 .../boot/dts/renesas/r9a08g046l48-smarc.dts   |  49 +++++++++
 drivers/clk/renesas/r9a08g046-cpg.c           |  15 +++
 drivers/phy/renesas/phy-rcar-gen3-usb2.c      |  20 ++--
 .../regulator/renesas-usb-vbus-regulator.c    |  72 ++++++++++--
 drivers/reset/reset-rzg2l-usbphy-ctrl.c       |  44 +++++---
 8 files changed, 291 insertions(+), 34 deletions(-)

-- 
2.43.0


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

* [PATCH 01/11] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support
  2026-06-12 14:30 [PATCH 00/11] Add RZ/G3L USB2.0 host support Biju
@ 2026-06-12 14:30 ` Biju
  2026-06-13 10:40   ` Krzysztof Kozlowski
  2026-06-12 14:30 ` [PATCH 02/11] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings Biju
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 26+ messages in thread
From: Biju @ 2026-06-12 14:30 UTC (permalink / raw)
  To: Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Geert Uytterhoeven, Magnus Damm
  Cc: Biju Das, devicetree, linux-kernel, linux-renesas-soc,
	Prabhakar Mahadev Lad, Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

Add device tree binding support for the RZ/G3L (r9a08g046) USB PHY
controller. The RZ/G3L USB PHY block is similar to RZ/G3S, but each port
has an OTG controller, unlike RZ/G3S, which has an OTG controller only on
port 1.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 .../reset/renesas,rzg2l-usbphy-ctrl.yaml      | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
index c83469a1b379..788e467b38db 100644
--- a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
+++ b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
@@ -23,6 +23,7 @@ properties:
               - renesas,r9a07g054-usbphy-ctrl # RZ/V2L
           - const: renesas,rzg2l-usbphy-ctrl
       - const: renesas,r9a08g045-usbphy-ctrl # RZ/G3S
+      - const: renesas,r9a08g046-usbphy-ctrl # RZ/G3L
 
   reg:
     maxItems: 1
@@ -50,6 +51,12 @@ properties:
     $ref: /schemas/regulator/regulator.yaml#
     unevaluatedProperties: false
 
+  regulator1-vbus:
+    type: object
+    description: Port 2 USB VBUS regulator
+    $ref: /schemas/regulator/regulator.yaml#
+    unevaluatedProperties: false
+
   renesas,sysc-pwrrdy:
     description:
       The system controller PWRRDY indicates to the USB PHY if the power supply
@@ -78,7 +85,9 @@ allOf:
       properties:
         compatible:
           contains:
-            const: renesas,r9a08g045-usbphy-ctrl
+            enum:
+              - renesas,r9a08g045-usbphy-ctrl
+              - renesas,r9a08g046-usbphy-ctrl
     then:
       required:
         - renesas,sysc-pwrrdy
@@ -86,6 +95,15 @@ allOf:
       properties:
         renesas,sysc-pwrrdy: false
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: renesas,r9a08g046-usbphy-ctrl
+    then:
+      required:
+        - regulator1-vbus
+
 additionalProperties: false
 
 examples:
-- 
2.43.0


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

* [PATCH 02/11] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings
  2026-06-12 14:30 [PATCH 00/11] Add RZ/G3L USB2.0 host support Biju
  2026-06-12 14:30 ` [PATCH 01/11] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support Biju
@ 2026-06-12 14:30 ` Biju
  2026-06-13 10:40   ` Krzysztof Kozlowski
  2026-06-12 14:30 ` [PATCH 03/11] clk: renesas: r9a08g046: Add USB2.0 clock and reset entries Biju
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 26+ messages in thread
From: Biju @ 2026-06-12 14:30 UTC (permalink / raw)
  To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Geert Uytterhoeven, Magnus Damm
  Cc: Biju Das, Neil Armstrong, Yoshihiro Shimoda, linux-phy,
	devicetree, linux-kernel, linux-renesas-soc,
	Prabhakar Mahadev Lad, Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

Add device tree binding support for the RZ/G3L (r9a08g046) USB2 PHY.
The RZ/G3L USB PHY is almost identical to the RZ/G3S USB PHY, the
difference being 2 OTG blocks on RZ/G3L compared to 1 on RZ/G3S.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
index 9740e5b335f9..d6b9d08ceec6 100644
--- a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
@@ -16,6 +16,7 @@ properties:
           - enum:
               - renesas,usb2-phy-r8a77470  # RZ/G1C
               - renesas,usb2-phy-r9a08g045 # RZ/G3S
+              - renesas,usb2-phy-r9a08g046 # RZ/G3L
               - renesas,usb2-phy-r9a09g057 # RZ/V2H(P)
 
       - items:
@@ -132,6 +133,7 @@ allOf:
             enum:
               - renesas,usb2-phy-r9a09g057
               - renesas,usb2-phy-r9a08g045
+              - renesas,usb2-phy-r9a08g046
               - renesas,rzg2l-usb2-phy
     then:
       properties:
-- 
2.43.0


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

* [PATCH 03/11] clk: renesas: r9a08g046: Add USB2.0 clock and reset entries
  2026-06-12 14:30 [PATCH 00/11] Add RZ/G3L USB2.0 host support Biju
  2026-06-12 14:30 ` [PATCH 01/11] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support Biju
  2026-06-12 14:30 ` [PATCH 02/11] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings Biju
@ 2026-06-12 14:30 ` Biju
  2026-06-12 14:30 ` [PATCH 04/11] reset: rzg2l-usbphy-ctrl: Introduce info struct for match data Biju
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 26+ messages in thread
From: Biju @ 2026-06-12 14:30 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette, Stephen Boyd
  Cc: Biju Das, Brian Masney, linux-renesas-soc, linux-clk,
	linux-kernel, Prabhakar Mahadev Lad, Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

Add module clock and reset definitions for the USB2.0 interfaces on the
RZ/G3L (r9a08g046) SoC.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/clk/renesas/r9a08g046-cpg.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/clk/renesas/r9a08g046-cpg.c b/drivers/clk/renesas/r9a08g046-cpg.c
index edc83a4104b2..4488bd1988e8 100644
--- a/drivers/clk/renesas/r9a08g046-cpg.c
+++ b/drivers/clk/renesas/r9a08g046-cpg.c
@@ -416,6 +416,16 @@ static const struct rzg2l_mod_clk r9a08g046_mod_clks[] = {
 					MSTOP(BUS_MCPU1, BIT(13))),
 	DEF_MOD("ssi3_pclk_sfr",	R9A08G046_SSI3_PCLK_SFR, R9A08G046_CLK_P0, 0x570, 7,
 					MSTOP(BUS_MCPU1, BIT(13))),
+	DEF_MOD("usb_u2h0_hclk",	R9A08G046_USB_U2H0_HCLK, R9A08G046_CLK_P1, 0x578, 0,
+					MSTOP(BUS_PERI_COM, BIT(5))),
+	DEF_MOD("usb_u2h1_hclk",	R9A08G046_USB_U2H1_HCLK, R9A08G046_CLK_P1, 0x578, 1,
+					MSTOP(BUS_PERI_COM, BIT(7))),
+	DEF_MOD("usb_u2p0_exr_cpuclk",	R9A08G046_USB_U2P0_EXR_CPUCLK, R9A08G046_CLK_P1, 0x578, 2,
+					MSTOP(BUS_PERI_COM, BIT(6))),
+	DEF_MOD("usb_pclk",		R9A08G046_USB_PCLK, R9A08G046_CLK_P1, 0x578, 3,
+					MSTOP(BUS_PERI_COM, BIT(4))),
+	DEF_MOD("usb_u2p1_exr_cpuclk",	R9A08G046_USB_U2P1_EXR_CPUCLK, R9A08G046_CLK_P1, 0x578, 4,
+					MSTOP(BUS_PERI_COM, BIT(13))),
 	DEF_MOD("eth0_clk_axi",		R9A08G046_ETH0_CLK_AXI, R9A08G046_CLK_P1, 0x57c, 0,
 					MSTOP(BUS_PERI_COM, BIT(2))),
 	DEF_MOD("eth1_clk_axi",		R9A08G046_ETH1_CLK_AXI, R9A08G046_CLK_P1, 0x57c, 1,
@@ -531,6 +541,11 @@ static const struct rzg2l_reset r9a08g046_resets[] = {
 	DEF_RST(R9A08G046_SSI1_RST_M2_REG, 0x870, 1),
 	DEF_RST(R9A08G046_SSI2_RST_M2_REG, 0x870, 2),
 	DEF_RST(R9A08G046_SSI3_RST_M2_REG, 0x870, 3),
+	DEF_RST(R9A08G046_USB_U2H0_HRESETN, 0x878, 0),
+	DEF_RST(R9A08G046_USB_U2H1_HRESETN, 0x878, 1),
+	DEF_RST(R9A08G046_USB_U2P0_EXL_SYSRST, 0x878, 2),
+	DEF_RST(R9A08G046_USB_PRESETN, 0x878, 3),
+	DEF_RST(R9A08G046_USB_U2P1_EXL_SYSRST, 0x878, 4),
 	DEF_RST(R9A08G046_ETH0_ARESET_N, 0x87c, 0),
 	DEF_RST(R9A08G046_ETH1_ARESET_N, 0x87c, 1),
 	DEF_RST(R9A08G046_I2C0_MRST, 0x880, 0),
-- 
2.43.0


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

* [PATCH 04/11] reset: rzg2l-usbphy-ctrl: Introduce info struct for match data
  2026-06-12 14:30 [PATCH 00/11] Add RZ/G3L USB2.0 host support Biju
                   ` (2 preceding siblings ...)
  2026-06-12 14:30 ` [PATCH 03/11] clk: renesas: r9a08g046: Add USB2.0 clock and reset entries Biju
@ 2026-06-12 14:30 ` Biju
  2026-06-15  7:36   ` Biju Das
  2026-06-12 14:30 ` [PATCH 05/11] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support Biju
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 26+ messages in thread
From: Biju @ 2026-06-12 14:30 UTC (permalink / raw)
  To: Philipp Zabel, Geert Uytterhoeven, Magnus Damm
  Cc: Biju Das, linux-kernel, linux-renesas-soc, Prabhakar Mahadev Lad,
	Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

Replace the integer flag RZG2L_USBPHY_CTRL_PWRRDY with a structured
rzg2l_usbphy_ctrl_info type to hold per-compatible configuration data.

The new struct carries the regulator driver name and a pwr_rdy flag,
allowing the probe function to conditionally call
rzg2l_usbphy_ctrl_pwrrdy_init() based on the matched device data rather
than casting match data to an integer.

This restructuring makes it easier to extend per-variant configuration
in a follow-up patch to support the RZ/G3L SoC, which has 2 VBUS
regulators.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/reset/reset-rzg2l-usbphy-ctrl.c | 38 +++++++++++++++----------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
index fd75d9601a3b..1c4c8aae0e80 100644
--- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
+++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
@@ -41,6 +41,11 @@ struct rzg2l_usbphy_ctrl_priv {
 	spinlock_t lock;
 };
 
+struct rzg2l_usbphy_ctrl_info {
+	const char *regulator_driver_name;
+	bool pwrrdy;
+};
+
 #define rcdev_to_priv(x)	container_of(x, struct rzg2l_usbphy_ctrl_priv, rcdev)
 
 static int rzg2l_usbphy_ctrl_assert(struct reset_controller_dev *rcdev,
@@ -106,14 +111,18 @@ static void rzg2l_usbphy_ctrl_init(struct rzg2l_usbphy_ctrl_priv *priv)
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
 
-#define RZG2L_USBPHY_CTRL_PWRRDY	1
+static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {
+	.regulator_driver_name = "rzg2l-usb-vbus-regulator",
+};
+
+static const struct rzg2l_usbphy_ctrl_info rzg3s_info = {
+	.regulator_driver_name = "rzg2l-usb-vbus-regulator",
+	.pwrrdy = true,
+};
 
 static const struct of_device_id rzg2l_usbphy_ctrl_match_table[] = {
-	{ .compatible = "renesas,rzg2l-usbphy-ctrl" },
-	{
-		.compatible = "renesas,r9a08g045-usbphy-ctrl",
-		.data = (void *)RZG2L_USBPHY_CTRL_PWRRDY
-	},
+	{ .compatible = "renesas,rzg2l-usbphy-ctrl", .data = &rzg2l_info },
+	{ .compatible = "renesas,r9a08g045-usbphy-ctrl", .data = &rzg3s_info },
 	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, rzg2l_usbphy_ctrl_match_table);
@@ -153,14 +162,9 @@ static int rzg2l_usbphy_ctrl_pwrrdy_init(struct device *dev,
 {
 	struct reg_field field;
 	struct regmap *regmap;
-	const int *data;
 	u32 args[2];
 	int ret;
 
-	data = device_get_match_data(dev);
-	if ((uintptr_t)data != RZG2L_USBPHY_CTRL_PWRRDY)
-		return 0;
-
 	regmap = syscon_regmap_lookup_by_phandle_args(dev->of_node,
 						      "renesas,sysc-pwrrdy",
 						      ARRAY_SIZE(args), args);
@@ -188,6 +192,7 @@ static int rzg2l_usbphy_ctrl_pwrrdy_init(struct device *dev,
 
 static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
 {
+	const struct rzg2l_usbphy_ctrl_info *info;
 	struct device *dev = &pdev->dev;
 	struct rzg2l_usbphy_ctrl_priv *priv;
 	struct platform_device *vdev;
@@ -206,9 +211,12 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
 	if (IS_ERR(regmap))
 		return PTR_ERR(regmap);
 
-	error = rzg2l_usbphy_ctrl_pwrrdy_init(dev, priv);
-	if (error)
-		return error;
+	info = device_get_match_data(dev);
+	if (info->pwrrdy) {
+		error = rzg2l_usbphy_ctrl_pwrrdy_init(dev, priv);
+		if (error)
+			return error;
+	}
 
 	priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
 	if (IS_ERR(priv->rstc))
@@ -241,7 +249,7 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
 	if (error)
 		goto err_pm_runtime_put;
 
-	vdev = platform_device_alloc("rzg2l-usb-vbus-regulator", pdev->id);
+	vdev = platform_device_alloc(info->regulator_driver_name, pdev->id);
 	if (!vdev) {
 		error = -ENOMEM;
 		goto err_pm_runtime_put;
-- 
2.43.0


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

* [PATCH 05/11] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
  2026-06-12 14:30 [PATCH 00/11] Add RZ/G3L USB2.0 host support Biju
                   ` (3 preceding siblings ...)
  2026-06-12 14:30 ` [PATCH 04/11] reset: rzg2l-usbphy-ctrl: Introduce info struct for match data Biju
@ 2026-06-12 14:30 ` Biju
  2026-06-12 14:30 ` [PATCH 06/11] regulator: renesas-usb-vbus-regulator: Introduce helper for regulator registration Biju
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 26+ messages in thread
From: Biju @ 2026-06-12 14:30 UTC (permalink / raw)
  To: Philipp Zabel, Geert Uytterhoeven, Magnus Damm
  Cc: Biju Das, linux-kernel, linux-renesas-soc, Prabhakar Mahadev Lad,
	Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

Add the renesas,r9a08g046-usbphy-ctrl compatible string to the OF match
table for the RZ/G3L (r9a08g046) SoC, using a dedicated rzg3l_info
struct with pwr_rdy set, similar to RZ/G3S. The RZ/G3L SoC has 2 OTG
controllers compared to one on RZ/G3S, so it uses a separate
rzg3l-usb-vbus-regulator driver to handle the additional VBUSEN control
for port 2.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/reset/reset-rzg2l-usbphy-ctrl.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
index 1c4c8aae0e80..734255258b69 100644
--- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
+++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
@@ -120,9 +120,15 @@ static const struct rzg2l_usbphy_ctrl_info rzg3s_info = {
 	.pwrrdy = true,
 };
 
+static const struct rzg2l_usbphy_ctrl_info rzg3l_info = {
+	.regulator_driver_name = "rzg3l-usb-vbus-regulator",
+	.pwrrdy = true,
+};
+
 static const struct of_device_id rzg2l_usbphy_ctrl_match_table[] = {
 	{ .compatible = "renesas,rzg2l-usbphy-ctrl", .data = &rzg2l_info },
 	{ .compatible = "renesas,r9a08g045-usbphy-ctrl", .data = &rzg3s_info },
+	{ .compatible = "renesas,r9a08g046-usbphy-ctrl", .data = &rzg3l_info },
 	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, rzg2l_usbphy_ctrl_match_table);
-- 
2.43.0


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

* [PATCH 06/11] regulator: renesas-usb-vbus-regulator: Introduce helper for regulator registration
  2026-06-12 14:30 [PATCH 00/11] Add RZ/G3L USB2.0 host support Biju
                   ` (4 preceding siblings ...)
  2026-06-12 14:30 ` [PATCH 05/11] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support Biju
@ 2026-06-12 14:30 ` Biju
  2026-06-12 14:30 ` [PATCH 07/11] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support Biju
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 26+ messages in thread
From: Biju @ 2026-06-12 14:30 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: Biju Das, linux-kernel, Geert Uytterhoeven,
	Prabhakar Mahadev Lad, Biju Das, linux-renesas-soc

From: Biju Das <biju.das.jz@bp.renesas.com>

Extract the regulator node lookup and registration logic from
rzg2l_usb_vbus_regulator_probe() into a new helper function
rzg2l_usb_vbus_regulator_register(), which takes the parent device node,
regulator name, descriptor, and config as parameters.

This refactoring avoids code duplication in a follow-up patch that adds
support for the RZ/G3L SoC, which requires registering a second VBUS
regulator for its additional OTG port.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 .../regulator/renesas-usb-vbus-regulator.c    | 32 ++++++++++++-------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/drivers/regulator/renesas-usb-vbus-regulator.c b/drivers/regulator/renesas-usb-vbus-regulator.c
index 9ba791bd72ec..511631a788c2 100644
--- a/drivers/regulator/renesas-usb-vbus-regulator.c
+++ b/drivers/regulator/renesas-usb-vbus-regulator.c
@@ -31,28 +31,38 @@ static const struct regulator_desc rzg2l_usb_vbus_rdesc = {
 	.n_voltages	= 1,
 };
 
+static int rzg2l_usb_vbus_regulator_register(struct device_node *np,
+					     const char *name,
+					     const struct regulator_desc *desc,
+					     struct regulator_config *config)
+{
+	struct regulator_dev *rdev;
+
+	config->of_node = of_get_child_by_name(np, name);
+	if (!config->of_node)
+		return dev_err_probe(config->dev, -ENODEV, "regulator node %s not found\n", name);
+
+	rdev = devm_regulator_register(config->dev, desc, config);
+	of_node_put(config->of_node);
+	if (IS_ERR(rdev))
+		return dev_err_probe(config->dev, PTR_ERR(rdev), "not able to register %s\n", name);
+
+	return 0;
+}
+
 static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
 {
 	struct regulator_config config = { };
 	struct device *dev = &pdev->dev;
-	struct regulator_dev *rdev;
 
 	config.regmap = dev_get_regmap(dev->parent, NULL);
 	if (!config.regmap)
 		return dev_err_probe(dev, -ENOENT, "Failed to get regmap\n");
 
 	config.dev = dev;
-	config.of_node = of_get_child_by_name(dev->parent->of_node, "regulator-vbus");
-	if (!config.of_node)
-		return dev_err_probe(dev, -ENODEV, "regulator node not found\n");
 
-	rdev = devm_regulator_register(dev, &rzg2l_usb_vbus_rdesc, &config);
-	of_node_put(config.of_node);
-	if (IS_ERR(rdev))
-		return dev_err_probe(dev, PTR_ERR(rdev),
-				     "not able to register vbus regulator\n");
-
-	return 0;
+	return rzg2l_usb_vbus_regulator_register(dev->parent->of_node, "regulator-vbus",
+						 &rzg2l_usb_vbus_rdesc, &config);
 }
 
 static struct platform_driver rzg2l_usb_vbus_regulator_driver = {
-- 
2.43.0


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

* [PATCH 07/11] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support
  2026-06-12 14:30 [PATCH 00/11] Add RZ/G3L USB2.0 host support Biju
                   ` (5 preceding siblings ...)
  2026-06-12 14:30 ` [PATCH 06/11] regulator: renesas-usb-vbus-regulator: Introduce helper for regulator registration Biju
@ 2026-06-12 14:30 ` Biju
  2026-06-12 16:41   ` Mark Brown
  2026-06-12 14:30 ` [PATCH 08/11] phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support Biju
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 26+ messages in thread
From: Biju @ 2026-06-12 14:30 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: Biju Das, linux-kernel, Geert Uytterhoeven,
	Prabhakar Mahadev Lad, Biju Das, linux-renesas-soc

From: Biju Das <biju.das.jz@bp.renesas.com>

Add support for registering two USB VBUS regulators for the RZ/G3L
(r9a08g046) SoC, which has 2 OTG controllers unlike RZ/G3S which has one.

Add a second regulator descriptor rzg2l_usb_vbus_rdesc1 for the second
USB port (regulator1-vbus, enable_mask BIT(1)) alongside the existing
rzg2l_usb_vbus_rdesc (regulator-vbus, enable_mask BIT(0)).

Introduce a common probe helper rzg2l_usb_vbus_regulator_common_probe()
with a multi_regulator parameter, and a dedicated
rzg3l_usb_vbus_regulator_probe() and platform driver
rzg3l-usb-vbus-regulator for RZ/G3L.

The existing rzg2l_usb_vbus_regulator_probe() continues to register only
regulator-vbus for other SoCs.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 .../regulator/renesas-usb-vbus-regulator.c    | 46 +++++++++++++++++--
 1 file changed, 43 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/renesas-usb-vbus-regulator.c b/drivers/regulator/renesas-usb-vbus-regulator.c
index 511631a788c2..ea04d29bb9c9 100644
--- a/drivers/regulator/renesas-usb-vbus-regulator.c
+++ b/drivers/regulator/renesas-usb-vbus-regulator.c
@@ -31,6 +31,19 @@ static const struct regulator_desc rzg2l_usb_vbus_rdesc = {
 	.n_voltages	= 1,
 };
 
+static const struct regulator_desc rzg2l_usb_vbus_rdesc1 = {
+	.name = "vbus1",
+	.of_match = of_match_ptr("regulator1-vbus"),
+	.ops = &rzg2l_usb_vbus_reg_ops,
+	.type = REGULATOR_VOLTAGE,
+	.owner = THIS_MODULE,
+	.enable_reg  = 0,
+	.enable_mask = BIT(1),
+	.enable_is_inverted = true,
+	.fixed_uV	= 5000000,
+	.n_voltages	= 1,
+};
+
 static int rzg2l_usb_vbus_regulator_register(struct device_node *np,
 					     const char *name,
 					     const struct regulator_desc *desc,
@@ -50,10 +63,12 @@ static int rzg2l_usb_vbus_regulator_register(struct device_node *np,
 	return 0;
 }
 
-static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
+static int rzg2l_usb_vbus_regulator_common_probe(struct platform_device *pdev,
+						 bool multi_regulator)
 {
 	struct regulator_config config = { };
 	struct device *dev = &pdev->dev;
+	int ret;
 
 	config.regmap = dev_get_regmap(dev->parent, NULL);
 	if (!config.regmap)
@@ -61,8 +76,24 @@ static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
 
 	config.dev = dev;
 
-	return rzg2l_usb_vbus_regulator_register(dev->parent->of_node, "regulator-vbus",
-						 &rzg2l_usb_vbus_rdesc, &config);
+	ret = rzg2l_usb_vbus_regulator_register(dev->parent->of_node, "regulator-vbus",
+						&rzg2l_usb_vbus_rdesc, &config);
+
+	if (ret || !multi_regulator)
+		return ret;
+
+	return rzg2l_usb_vbus_regulator_register(dev->parent->of_node, "regulator1-vbus",
+						 &rzg2l_usb_vbus_rdesc1, &config);
+}
+
+static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
+{
+	return rzg2l_usb_vbus_regulator_common_probe(pdev, false);
+}
+
+static int rzg3l_usb_vbus_regulator_probe(struct platform_device *pdev)
+{
+	return rzg2l_usb_vbus_regulator_common_probe(pdev, true);
 }
 
 static struct platform_driver rzg2l_usb_vbus_regulator_driver = {
@@ -74,6 +105,15 @@ static struct platform_driver rzg2l_usb_vbus_regulator_driver = {
 };
 module_platform_driver(rzg2l_usb_vbus_regulator_driver);
 
+static struct platform_driver rzg3l_usb_vbus_regulator_driver = {
+	.probe = rzg3l_usb_vbus_regulator_probe,
+	.driver	= {
+		.name = "rzg3l-usb-vbus-regulator",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
+	},
+};
+module_platform_driver(rzg3l_usb_vbus_regulator_driver);
+
 MODULE_AUTHOR("Biju Das <biju.das.jz@bp.renesas.com>");
 MODULE_DESCRIPTION("Renesas RZ/G2L USB Vbus Regulator Driver");
 MODULE_LICENSE("GPL");
-- 
2.43.0


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

* [PATCH 08/11] phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support
  2026-06-12 14:30 [PATCH 00/11] Add RZ/G3L USB2.0 host support Biju
                   ` (6 preceding siblings ...)
  2026-06-12 14:30 ` [PATCH 07/11] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support Biju
@ 2026-06-12 14:30 ` Biju
  2026-06-12 14:30 ` [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator Biju
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 26+ messages in thread
From: Biju @ 2026-06-12 14:30 UTC (permalink / raw)
  To: Yoshihiro Shimoda, Vinod Koul, Geert Uytterhoeven, Magnus Damm
  Cc: Biju Das, Neil Armstrong, linux-renesas-soc, linux-phy,
	linux-kernel, Prabhakar Mahadev Lad, Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

Add renesas,usb2-phy-r9a08g046 to the OF match table, reusing
rz_g3s_phy_usb2_data since the PHY configuration is shared with RZ/G3S.

Unlike RZ/G3S, RZ/G3L has two OTG controllers, OTG interrupts on port 2,
and a controllable OTG_PERI bit in COMMCTRL for host/device switching on
the port 2 USB controller (fixed to host-only on RZ/G3S).

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/phy/renesas/phy-rcar-gen3-usb2.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
index 9a45d840efeb..d06fb52ed5f1 100644
--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
@@ -721,6 +721,10 @@ static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = {
 		.compatible = "renesas,usb2-phy-r9a08g045",
 		.data = &rz_g3s_phy_usb2_data,
 	},
+	{
+		.compatible = "renesas,usb2-phy-r9a08g046",
+		.data = &rz_g3s_phy_usb2_data,
+	},
 	{
 		.compatible = "renesas,usb2-phy-r9a09g057",
 		.data = &rz_v2h_phy_usb2_data,
-- 
2.43.0


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

* [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator
  2026-06-12 14:30 [PATCH 00/11] Add RZ/G3L USB2.0 host support Biju
                   ` (7 preceding siblings ...)
  2026-06-12 14:30 ` [PATCH 08/11] phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support Biju
@ 2026-06-12 14:30 ` Biju
  2026-06-15  9:37   ` Claudiu Beznea
  2026-06-12 14:30 ` [PATCH 10/11] arm64: dts: renesas: r9a08g046: Add USB2.0 device nodes Biju
  2026-06-12 14:30 ` [PATCH 11/11] arm64: dts: renesas: r9a08g046l48-smarc: Add USB2.0 support Biju
  10 siblings, 1 reply; 26+ messages in thread
From: Biju @ 2026-06-12 14:30 UTC (permalink / raw)
  To: Yoshihiro Shimoda, Vinod Koul, Geert Uytterhoeven, Magnus Damm
  Cc: Biju Das, Neil Armstrong, Philipp Zabel, linux-renesas-soc,
	linux-phy, linux-kernel, Prabhakar Mahadev Lad, Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

devm_regulator_get_exclusive() initialises the regulator with
enable_count = 1, requiring the consumer to disable it before release.

Previously, the devm disable action was only registered when the
regulator was explicitly enabled, causing the cleanup path to skip
decrementing enable_count on device removal when the regulator was
left disabled.

Fix this by always registering the devm disable action when the regulator
is enabled (checked via regulator_is_enabled()), covering both the
explicitly-enabled case and the initial state set by
devm_regulator_get_exclusive().

This fixes WARN_ON enable count during regulator release.

Fixes: 24843404efe4 ("phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs")
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/phy/renesas/phy-rcar-gen3-usb2.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
index d06fb52ed5f1..ef38c3b365d4 100644
--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
@@ -905,15 +905,17 @@ static int rcar_gen3_phy_usb2_vbus_regulator_get_exclusive_enable(struct rcar_ge
 	if (IS_ERR(channel->vbus))
 		return PTR_ERR(channel->vbus);
 
-	if (!enable)
-		return 0;
+	if (enable) {
+		ret = regulator_enable(channel->vbus);
+		if (ret)
+			return ret;
+	}
 
-	ret = regulator_enable(channel->vbus);
-	if (ret)
-		return ret;
+	if (regulator_is_enabled(channel->vbus))
+		return devm_add_action_or_reset(dev, rcar_gen3_phy_usb2_vbus_disable_action,
+						channel->vbus);
 
-	return devm_add_action_or_reset(dev, rcar_gen3_phy_usb2_vbus_disable_action,
-					channel->vbus);
+	return 0;
 }
 
 static int rcar_gen3_phy_usb2_vbus_regulator_register(struct rcar_gen3_chan *channel)
-- 
2.43.0


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

* [PATCH 10/11] arm64: dts: renesas: r9a08g046: Add USB2.0 device nodes
  2026-06-12 14:30 [PATCH 00/11] Add RZ/G3L USB2.0 host support Biju
                   ` (8 preceding siblings ...)
  2026-06-12 14:30 ` [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator Biju
@ 2026-06-12 14:30 ` Biju
  2026-06-12 14:30 ` [PATCH 11/11] arm64: dts: renesas: r9a08g046l48-smarc: Add USB2.0 support Biju
  10 siblings, 0 replies; 26+ messages in thread
From: Biju @ 2026-06-12 14:30 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Biju Das, linux-renesas-soc, devicetree, linux-kernel,
	Prabhakar Mahadev Lad, Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

Add USB2.0 device nodes to the RZ/G3L (r9a08g046) SoC DTSI.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 arch/arm64/boot/dts/renesas/r9a08g046.dtsi | 103 +++++++++++++++++++++
 1 file changed, 103 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r9a08g046.dtsi b/arch/arm64/boot/dts/renesas/r9a08g046.dtsi
index 85e409ac8d5c..45aa41467e08 100644
--- a/arch/arm64/boot/dts/renesas/r9a08g046.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a08g046.dtsi
@@ -1198,6 +1198,109 @@ queue3 {
 			};
 		};
 
+		phyrst: usbphy-ctrl@11e00000 {
+			compatible = "renesas,r9a08g046-usbphy-ctrl";
+			reg = <0 0x11e00000 0 0x10000>;
+			clocks = <&cpg CPG_MOD R9A08G046_USB_PCLK>;
+			resets = <&cpg R9A08G046_USB_PRESETN>;
+			power-domains = <&cpg>;
+			#reset-cells = <1>;
+			renesas,sysc-pwrrdy = <&sysc 0xd70 0x1>;
+			status = "disabled";
+
+			usb0_vbus_otg: regulator-vbus {
+				regulator-name = "vbus0";
+			};
+
+			usb1_vbus_otg: regulator1-vbus {
+				regulator-name = "vbus1";
+			};
+		};
+
+		ohci0: usb@11e10000 {
+			compatible = "generic-ohci";
+			reg = <0 0x11e10000 0 0x100>;
+			interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD R9A08G046_USB_PCLK>,
+				 <&cpg CPG_MOD R9A08G046_USB_U2H0_HCLK>;
+			resets = <&phyrst 0>,
+				 <&cpg R9A08G046_USB_U2H0_HRESETN>;
+			phys = <&usb2_phy0 1>;
+			phy-names = "usb";
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
+
+		ohci1: usb@11e90000 {
+			compatible = "generic-ohci";
+			reg = <0 0x11e90000 0 0x100>;
+			interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD R9A08G046_USB_PCLK>,
+				 <&cpg CPG_MOD R9A08G046_USB_U2H1_HCLK>;
+			resets = <&phyrst 1>,
+				 <&cpg R9A08G046_USB_U2H1_HRESETN>;
+			phys = <&usb2_phy1 1>;
+			phy-names = "usb";
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
+
+		ehci0: usb@11e10100 {
+			compatible = "generic-ehci";
+			reg = <0 0x11e10100 0 0x100>;
+			interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD R9A08G046_USB_PCLK>,
+				 <&cpg CPG_MOD R9A08G046_USB_U2H0_HCLK>;
+			resets = <&phyrst 0>,
+				 <&cpg R9A08G046_USB_U2H0_HRESETN>;
+			phys = <&usb2_phy0 2>;
+			phy-names = "usb";
+			companion = <&ohci0>;
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
+
+		ehci1: usb@11e90100 {
+			compatible = "generic-ehci";
+			reg = <0 0x11e90100 0 0x100>;
+			interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD R9A08G046_USB_PCLK>,
+				 <&cpg CPG_MOD R9A08G046_USB_U2H1_HCLK>;
+			resets = <&phyrst 1>,
+				 <&cpg R9A08G046_USB_U2H1_HRESETN>;
+			phys = <&usb2_phy1 2>;
+			phy-names = "usb";
+			companion = <&ohci1>;
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
+
+		usb2_phy0: usb-phy@11e10200 {
+			compatible = "renesas,usb2-phy-r9a08g046";
+			reg = <0 0x11e10200 0 0x700>;
+			interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD R9A08G046_USB_PCLK>,
+				 <&cpg CPG_MOD R9A08G046_USB_U2H0_HCLK>;
+			resets = <&phyrst 0>,
+				 <&cpg R9A08G046_USB_U2H0_HRESETN>;
+			#phy-cells = <1>;
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
+
+		usb2_phy1: usb-phy@11e90200 {
+			compatible = "renesas,usb2-phy-r9a08g046";
+			reg = <0 0x11e90200 0 0x700>;
+			interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD R9A08G046_USB_PCLK>,
+				 <&cpg CPG_MOD R9A08G046_USB_U2H1_HCLK>;
+			resets = <&phyrst 1>,
+				 <&cpg R9A08G046_USB_U2H1_HRESETN>;
+			#phy-cells = <1>;
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
+
 		pcie: pcie@11e40000 {
 			reg = <0 0x11e40000 0 0x10000>;
 			ranges = <0x02000000 0 0x30000000 0 0x30000000 0 0x08000000>;
-- 
2.43.0


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

* [PATCH 11/11] arm64: dts: renesas: r9a08g046l48-smarc: Add USB2.0 support
  2026-06-12 14:30 [PATCH 00/11] Add RZ/G3L USB2.0 host support Biju
                   ` (9 preceding siblings ...)
  2026-06-12 14:30 ` [PATCH 10/11] arm64: dts: renesas: r9a08g046: Add USB2.0 device nodes Biju
@ 2026-06-12 14:30 ` Biju
  10 siblings, 0 replies; 26+ messages in thread
From: Biju @ 2026-06-12 14:30 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Biju Das, linux-renesas-soc, devicetree, linux-kernel,
	Prabhakar Mahadev Lad, Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

Enable USB2.0 on the RZ/G3L SMARC board (r9a08g046l48-smarc):

- ehci0/ohci0: USB port 0 configured as OTG
- ehci1/ohci1: USB port 1 configured as host only
- phyrst: Enable the USB PHY reset controller
- usb2_phy0: Port 0 PHY with usb0_pins pinmux and usb0_vbus_otg supply
- usb2_phy1: Port 1 PHY with usb1_pins pinmux usb1_vbus_otg supply,
  and renesas,no-otg-pins flag

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 .../boot/dts/renesas/r9a08g046l48-smarc.dts   | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r9a08g046l48-smarc.dts b/arch/arm64/boot/dts/renesas/r9a08g046l48-smarc.dts
index 96cc7ee46a6a..b189ae8e808d 100644
--- a/arch/arm64/boot/dts/renesas/r9a08g046l48-smarc.dts
+++ b/arch/arm64/boot/dts/renesas/r9a08g046l48-smarc.dts
@@ -87,6 +87,16 @@ vqmmc_sd1_pvdd: regulator-vqmmc-sd1-pvdd {
 #endif
 };
 
+&ehci0 {
+	dr_mode = "otg";
+	status = "okay";
+};
+
+&ehci1 {
+	dr_mode = "host";
+	status = "okay";
+};
+
 &i2c2 {
 	pinctrl-0 = <&i2c2_pins>;
 	pinctrl-names = "default";
@@ -138,6 +148,20 @@ &keys {
 #endif
 };
 
+&ohci0 {
+	dr_mode = "otg";
+	status = "okay";
+};
+
+&ohci1 {
+	dr_mode = "host";
+	status = "okay";
+};
+
+&phyrst {
+	status = "okay";
+};
+
 &pinctrl {
 	audio_clk_pins: audio-clock {
 		pinmux = <RZG3L_PORT_PINMUX(H, 4, 6)>, /* AUDIO_CLK_B */
@@ -259,6 +283,16 @@ ssi0_pins: ssi0 {
 			 <RZG3L_PORT_PINMUX(H, 2, 9)>, /* SSIF0_RCK */
 			 <RZG3L_PORT_PINMUX(H, 3, 9)>; /* SSIF0_TXD */
 	};
+
+	usb0_pins: usb0 {
+		pinmux = <RZG3L_PORT_PINMUX(3, 0, 12)>, /* USB20_OVRCUR */
+			 <RZG3L_PORT_PINMUX(3, 1, 12)>; /* USB20_VBUSEN */
+	};
+
+	usb1_pins: usb1 {
+		pinmux = <RZG3L_PORT_PINMUX(3, 4, 12)>, /* USB21_OVRCUR */
+			 <RZG3L_PORT_PINMUX(3, 5, 12)>; /* USB21_VBUSEN */
+	};
 };
 
 #if SW_SER0_PMOD
@@ -330,3 +364,18 @@ &ssi0 {
 	status = "okay";
 };
 #endif
+
+&usb2_phy0 {
+	pinctrl-0 = <&usb0_pins>;
+	pinctrl-names = "default";
+	vbus-supply = <&usb0_vbus_otg>;
+	status = "okay";
+};
+
+&usb2_phy1 {
+	pinctrl-0 = <&usb1_pins>;
+	pinctrl-names = "default";
+	vbus-supply = <&usb1_vbus_otg>;
+	renesas,no-otg-pins;
+	status = "okay";
+};
-- 
2.43.0


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

* Re: [PATCH 07/11] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support
  2026-06-12 14:30 ` [PATCH 07/11] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support Biju
@ 2026-06-12 16:41   ` Mark Brown
  2026-06-15  7:19     ` Biju Das
  0 siblings, 1 reply; 26+ messages in thread
From: Mark Brown @ 2026-06-12 16:41 UTC (permalink / raw)
  To: Biju
  Cc: Liam Girdwood, Biju Das, linux-kernel, Geert Uytterhoeven,
	Prabhakar Mahadev Lad, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]

On Fri, Jun 12, 2026 at 03:30:35PM +0100, Biju wrote:

> -static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
> +static int rzg2l_usb_vbus_regulator_common_probe(struct platform_device *pdev,
> +						 bool multi_regulator)

This multi_regulator thing feels not super scalable - it might be better
to pass in a pointer to an array of regulators.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 01/11] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support
  2026-06-12 14:30 ` [PATCH 01/11] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support Biju
@ 2026-06-13 10:40   ` Krzysztof Kozlowski
  2026-06-15  7:26     ` Biju Das
  0 siblings, 1 reply; 26+ messages in thread
From: Krzysztof Kozlowski @ 2026-06-13 10:40 UTC (permalink / raw)
  To: Biju
  Cc: Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Geert Uytterhoeven, Magnus Damm, Biju Das, devicetree,
	linux-kernel, linux-renesas-soc, Prabhakar Mahadev Lad

On Fri, Jun 12, 2026 at 03:30:29PM +0100, Biju wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
> 
> Add device tree binding support for the RZ/G3L (r9a08g046) USB PHY
> controller. The RZ/G3L USB PHY block is similar to RZ/G3S, but each port
> has an OTG controller, unlike RZ/G3S, which has an OTG controller only on
> port 1.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  .../reset/renesas,rzg2l-usbphy-ctrl.yaml      | 20 ++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
> index c83469a1b379..788e467b38db 100644
> --- a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
> +++ b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
> @@ -23,6 +23,7 @@ properties:
>                - renesas,r9a07g054-usbphy-ctrl # RZ/V2L
>            - const: renesas,rzg2l-usbphy-ctrl
>        - const: renesas,r9a08g045-usbphy-ctrl # RZ/G3S
> +      - const: renesas,r9a08g046-usbphy-ctrl # RZ/G3L

These last two should be just enum, by convention.

>  
>    reg:
>      maxItems: 1
> @@ -50,6 +51,12 @@ properties:
>      $ref: /schemas/regulator/regulator.yaml#
>      unevaluatedProperties: false
>  
> +  regulator1-vbus:
> +    type: object
> +    description: Port 2 USB VBUS regulator
> +    $ref: /schemas/regulator/regulator.yaml#
> +    unevaluatedProperties: false

Instead group them under 'regulators' node and use names matching the
datasheet.

> +
>    renesas,sysc-pwrrdy:
>      description:
>        The system controller PWRRDY indicates to the USB PHY if the power supply
> @@ -78,7 +85,9 @@ allOf:
>        properties:
>          compatible:
>            contains:
> -            const: renesas,r9a08g045-usbphy-ctrl
> +            enum:
> +              - renesas,r9a08g045-usbphy-ctrl
> +              - renesas,r9a08g046-usbphy-ctrl
>      then:
>        required:
>          - renesas,sysc-pwrrdy
> @@ -86,6 +95,15 @@ allOf:
>        properties:
>          renesas,sysc-pwrrdy: false
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: renesas,r9a08g046-usbphy-ctrl
> +    then:
> +      required:
> +        - regulator1-vbus

else:
  properties:
    regulators: false

    Best regards,
    Krzysztof


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

* Re: [PATCH 02/11] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings
  2026-06-12 14:30 ` [PATCH 02/11] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings Biju
@ 2026-06-13 10:40   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 26+ messages in thread
From: Krzysztof Kozlowski @ 2026-06-13 10:40 UTC (permalink / raw)
  To: Biju
  Cc: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Geert Uytterhoeven, Magnus Damm, Biju Das, Neil Armstrong,
	Yoshihiro Shimoda, linux-phy, devicetree, linux-kernel,
	linux-renesas-soc, Prabhakar Mahadev Lad

On Fri, Jun 12, 2026 at 03:30:30PM +0100, Biju wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
> 
> Add device tree binding support for the RZ/G3L (r9a08g046) USB2 PHY.
> The RZ/G3L USB PHY is almost identical to the RZ/G3S USB PHY, the
> difference being 2 OTG blocks on RZ/G3L compared to 1 on RZ/G3S.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml | 2 ++
>  1 file changed, 2 insertions(+)

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof


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

* RE: [PATCH 07/11] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support
  2026-06-12 16:41   ` Mark Brown
@ 2026-06-15  7:19     ` Biju Das
  0 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2026-06-15  7:19 UTC (permalink / raw)
  To: Mark Brown, biju.das.au
  Cc: Liam Girdwood, linux-kernel, Geert Uytterhoeven,
	Prabhakar Mahadev Lad, linux-renesas-soc

Hi Mark,

Thanks for the feedback

> -----Original Message-----
> From: Mark Brown <broonie@kernel.org>
> Sent: 12 June 2026 17:41
> Subject: Re: [PATCH 07/11] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support
> 
> On Fri, Jun 12, 2026 at 03:30:35PM +0100, Biju wrote:
> 
> > -static int rzg2l_usb_vbus_regulator_probe(struct platform_device
> > *pdev)
> > +static int rzg2l_usb_vbus_regulator_common_probe(struct platform_device *pdev,
> > +						 bool multi_regulator)
> 
> This multi_regulator thing feels not super scalable - it might be better to pass in a pointer to an array
> of regulators.

Agreed, will pass pointer to an array of regulators for scalability.

Cheers,
Biju

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

* RE: [PATCH 01/11] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support
  2026-06-13 10:40   ` Krzysztof Kozlowski
@ 2026-06-15  7:26     ` Biju Das
  0 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2026-06-15  7:26 UTC (permalink / raw)
  To: Krzysztof Kozlowski, biju.das.au
  Cc: Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Geert Uytterhoeven, magnus.damm, devicetree, linux-kernel,
	linux-renesas-soc, Prabhakar Mahadev Lad

Hi Krzysztof Kozlowski,

Thanks for the feedback.

> -----Original Message-----
> From: Krzysztof Kozlowski <krzk@kernel.org>
> Sent: 13 June 2026 11:40
> Subject: Re: [PATCH 01/11] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support
> 
> On Fri, Jun 12, 2026 at 03:30:29PM +0100, Biju wrote:
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > Add device tree binding support for the RZ/G3L (r9a08g046) USB PHY
> > controller. The RZ/G3L USB PHY block is similar to RZ/G3S, but each
> > port has an OTG controller, unlike RZ/G3S, which has an OTG controller
> > only on port 1.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> >  .../reset/renesas,rzg2l-usbphy-ctrl.yaml      | 20 ++++++++++++++++++-
> >  1 file changed, 19 insertions(+), 1 deletion(-)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.ya
> > ml
> > b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.ya
> > ml index c83469a1b379..788e467b38db 100644
> > ---
> > a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.ya
> > ml
> > +++ b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctr
> > +++ l.yaml
> > @@ -23,6 +23,7 @@ properties:
> >                - renesas,r9a07g054-usbphy-ctrl # RZ/V2L
> >            - const: renesas,rzg2l-usbphy-ctrl
> >        - const: renesas,r9a08g045-usbphy-ctrl # RZ/G3S
> > +      - const: renesas,r9a08g046-usbphy-ctrl # RZ/G3L
> 
> These last two should be just enum, by convention.

OK.
> 
> >
> >    reg:
> >      maxItems: 1
> > @@ -50,6 +51,12 @@ properties:
> >      $ref: /schemas/regulator/regulator.yaml#
> >      unevaluatedProperties: false
> >
> > +  regulator1-vbus:
> > +    type: object
> > +    description: Port 2 USB VBUS regulator
> > +    $ref: /schemas/regulator/regulator.yaml#
> > +    unevaluatedProperties: false
> 
> Instead group them under 'regulators' node and use names matching the datasheet.

OK. Will use vbus0 and vbus1 for these regulators.

> 
> > +
> >    renesas,sysc-pwrrdy:
> >      description:
> >        The system controller PWRRDY indicates to the USB PHY if the
> > power supply @@ -78,7 +85,9 @@ allOf:
> >        properties:
> >          compatible:
> >            contains:
> > -            const: renesas,r9a08g045-usbphy-ctrl
> > +            enum:
> > +              - renesas,r9a08g045-usbphy-ctrl
> > +              - renesas,r9a08g046-usbphy-ctrl
> >      then:
> >        required:
> >          - renesas,sysc-pwrrdy
> > @@ -86,6 +95,15 @@ allOf:
> >        properties:
> >          renesas,sysc-pwrrdy: false
> >
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: renesas,r9a08g046-usbphy-ctrl
> > +    then:
> > +      required:
> > +        - regulator1-vbus
> 
> else:
>   properties:
>     regulators: false

Agreed.

Cheers,
Biju

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

* RE: [PATCH 04/11] reset: rzg2l-usbphy-ctrl: Introduce info struct for match data
  2026-06-12 14:30 ` [PATCH 04/11] reset: rzg2l-usbphy-ctrl: Introduce info struct for match data Biju
@ 2026-06-15  7:36   ` Biju Das
  0 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2026-06-15  7:36 UTC (permalink / raw)
  To: biju.das.au, Philipp Zabel, Geert Uytterhoeven, magnus.damm
  Cc: linux-kernel, linux-renesas-soc, Prabhakar Mahadev Lad, biju.das.au

Hi All,

> -----Original Message-----
> From: Biju <biju.das.au@gmail.com>
> Sent: 12 June 2026 15:31
> Subject: [PATCH 04/11] reset: rzg2l-usbphy-ctrl: Introduce info struct for match data
> 
> From: Biju Das <biju.das.jz@bp.renesas.com>
> 
> Replace the integer flag RZG2L_USBPHY_CTRL_PWRRDY with a structured rzg2l_usbphy_ctrl_info type to hold
> per-compatible configuration data.
> 
> The new struct carries the regulator driver name and a pwr_rdy flag, allowing the probe function to

Typo. pwrrdy is the flag. Will fix it in next version.

Cheers,
Biju

> conditionally call
> rzg2l_usbphy_ctrl_pwrrdy_init() based on the matched device data rather than casting match data to an
> integer.
> 
> This restructuring makes it easier to extend per-variant configuration in a follow-up patch to support
> the RZ/G3L SoC, which has 2 VBUS regulators.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  drivers/reset/reset-rzg2l-usbphy-ctrl.c | 38 +++++++++++++++----------
>  1 file changed, 23 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> index fd75d9601a3b..1c4c8aae0e80 100644
> --- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> +++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> @@ -41,6 +41,11 @@ struct rzg2l_usbphy_ctrl_priv {
>  	spinlock_t lock;
>  };
> 
> +struct rzg2l_usbphy_ctrl_info {
> +	const char *regulator_driver_name;
> +	bool pwrrdy;
> +};
> +
>  #define rcdev_to_priv(x)	container_of(x, struct rzg2l_usbphy_ctrl_priv, rcdev)
> 
>  static int rzg2l_usbphy_ctrl_assert(struct reset_controller_dev *rcdev, @@ -106,14 +111,18 @@ static
> void rzg2l_usbphy_ctrl_init(struct rzg2l_usbphy_ctrl_priv *priv)
>  	spin_unlock_irqrestore(&priv->lock, flags);  }
> 
> -#define RZG2L_USBPHY_CTRL_PWRRDY	1
> +static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {
> +	.regulator_driver_name = "rzg2l-usb-vbus-regulator", };
> +
> +static const struct rzg2l_usbphy_ctrl_info rzg3s_info = {
> +	.regulator_driver_name = "rzg2l-usb-vbus-regulator",
> +	.pwrrdy = true,
> +};
> 
>  static const struct of_device_id rzg2l_usbphy_ctrl_match_table[] = {
> -	{ .compatible = "renesas,rzg2l-usbphy-ctrl" },
> -	{
> -		.compatible = "renesas,r9a08g045-usbphy-ctrl",
> -		.data = (void *)RZG2L_USBPHY_CTRL_PWRRDY
> -	},
> +	{ .compatible = "renesas,rzg2l-usbphy-ctrl", .data = &rzg2l_info },
> +	{ .compatible = "renesas,r9a08g045-usbphy-ctrl", .data = &rzg3s_info
> +},
>  	{ /* Sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, rzg2l_usbphy_ctrl_match_table); @@ -153,14 +162,9 @@ static int
> rzg2l_usbphy_ctrl_pwrrdy_init(struct device *dev,  {
>  	struct reg_field field;
>  	struct regmap *regmap;
> -	const int *data;
>  	u32 args[2];
>  	int ret;
> 
> -	data = device_get_match_data(dev);
> -	if ((uintptr_t)data != RZG2L_USBPHY_CTRL_PWRRDY)
> -		return 0;
> -
>  	regmap = syscon_regmap_lookup_by_phandle_args(dev->of_node,
>  						      "renesas,sysc-pwrrdy",
>  						      ARRAY_SIZE(args), args);
> @@ -188,6 +192,7 @@ static int rzg2l_usbphy_ctrl_pwrrdy_init(struct device *dev,
> 
>  static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)  {
> +	const struct rzg2l_usbphy_ctrl_info *info;
>  	struct device *dev = &pdev->dev;
>  	struct rzg2l_usbphy_ctrl_priv *priv;
>  	struct platform_device *vdev;
> @@ -206,9 +211,12 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
>  	if (IS_ERR(regmap))
>  		return PTR_ERR(regmap);
> 
> -	error = rzg2l_usbphy_ctrl_pwrrdy_init(dev, priv);
> -	if (error)
> -		return error;
> +	info = device_get_match_data(dev);
> +	if (info->pwrrdy) {
> +		error = rzg2l_usbphy_ctrl_pwrrdy_init(dev, priv);
> +		if (error)
> +			return error;
> +	}
> 
>  	priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
>  	if (IS_ERR(priv->rstc))
> @@ -241,7 +249,7 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
>  	if (error)
>  		goto err_pm_runtime_put;
> 
> -	vdev = platform_device_alloc("rzg2l-usb-vbus-regulator", pdev->id);
> +	vdev = platform_device_alloc(info->regulator_driver_name, pdev->id);
>  	if (!vdev) {
>  		error = -ENOMEM;
>  		goto err_pm_runtime_put;
> --
> 2.43.0


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

* Re: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator
  2026-06-12 14:30 ` [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator Biju
@ 2026-06-15  9:37   ` Claudiu Beznea
  2026-06-15 10:22     ` Biju Das
  2026-06-15 12:42     ` Biju Das
  0 siblings, 2 replies; 26+ messages in thread
From: Claudiu Beznea @ 2026-06-15  9:37 UTC (permalink / raw)
  To: Biju, Yoshihiro Shimoda, Vinod Koul, Geert Uytterhoeven, Magnus Damm
  Cc: Biju Das, Neil Armstrong, Philipp Zabel, linux-renesas-soc,
	linux-phy, linux-kernel, Prabhakar Mahadev Lad

Hi, Biju,

On 6/12/26 17:30, Biju wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
> 
> devm_regulator_get_exclusive() initialises the regulator with
> enable_count = 1, requiring the consumer to disable it before release.
> 
> Previously, the devm disable action was only registered when the
> regulator was explicitly enabled, causing the cleanup path to skip
> decrementing enable_count on device removal when the regulator was
> left disabled.
> 
> Fix this by always registering the devm disable action when the regulator
> is enabled (checked via regulator_is_enabled()), covering both the
> explicitly-enabled case and the initial state set by
> devm_regulator_get_exclusive().
> 
> This fixes WARN_ON enable count during regulator release.
> 
> Fixes: 24843404efe4 ("phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs")
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

The approach in this patch don't solve the problem, at least on RZ/G3S. See [1] 
for logs.

I applied this patch on next-20260610:

git log --oneline -2
afe09f11d549 (HEAD) phy: renesas: phy-rcar-gen3-usb2: Fix devm action 
registration for disabled VBUS regulator
abe651837cb3 (tag: next-20260610, linux-next/master) Add linux-next specific 
files for 20260610

[1] 
https://github.com/claudiubeznea/logs/blob/2f1bab20407dfe6031385819ffeabfc4eac772bd/logs

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

* RE: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator
  2026-06-15  9:37   ` Claudiu Beznea
@ 2026-06-15 10:22     ` Biju Das
  2026-06-15 11:41       ` Biju Das
  2026-06-15 11:44       ` Claudiu Beznea
  2026-06-15 12:42     ` Biju Das
  1 sibling, 2 replies; 26+ messages in thread
From: Biju Das @ 2026-06-15 10:22 UTC (permalink / raw)
  To: Claudiu.Beznea, biju.das.au, Yoshihiro Shimoda, Vinod Koul,
	Geert Uytterhoeven, magnus.damm
  Cc: Neil Armstrong, Philipp Zabel, linux-renesas-soc, linux-phy,
	linux-kernel, Prabhakar Mahadev Lad

Hi Claudiu,

> -----Original Message-----
> From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> Sent: 15 June 2026 10:37
> Subject: Re: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled
> VBUS regulator
> 
> Hi, Biju,
> 
> On 6/12/26 17:30, Biju wrote:
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > devm_regulator_get_exclusive() initialises the regulator with
> > enable_count = 1, requiring the consumer to disable it before release.
> >
> > Previously, the devm disable action was only registered when the
> > regulator was explicitly enabled, causing the cleanup path to skip
> > decrementing enable_count on device removal when the regulator was
> > left disabled.
> >
> > Fix this by always registering the devm disable action when the
> > regulator is enabled (checked via regulator_is_enabled()), covering
> > both the explicitly-enabled case and the initial state set by
> > devm_regulator_get_exclusive().
> >
> > This fixes WARN_ON enable count during regulator release.
> >
> > Fixes: 24843404efe4 ("phy: renesas: phy-rcar-gen3-usb2: Control VBUS
> > for RZ/G2L SoCs")
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> 
> The approach in this patch don't solve the problem, at least on RZ/G3S. See [1] for logs.
> 
> I applied this patch on next-20260610:
> 
> git log --oneline -2
> afe09f11d549 (HEAD) phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS
> regulator
> abe651837cb3 (tag: next-20260610, linux-next/master) Add linux-next specific files for 20260610
> 
> [1]
> https://github.com/claudiubeznea/logs/blob/2f1bab20407dfe6031385819ffeabfc4eac772bd/logs

I have tested only with RZ/G3L host and I don't see the issue.
How can the issue be reproduced? It could be related to RZ/G3S.
I have executed the following tests and don't see any issue.
Can you please try the same tests on RZ/G3S?
Is unbind/bind ever worked on RZ?G3S previously?


Test1: Host unbind/bind:
cd /sys/bus/platform/drivers/ohci-platform/
echo 11e10000.usb > unbind
echo 11e90000.usb > unbind

cd /sys/bus/platform/drivers/ehci-platform/
echo 11e10100.usb > unbind
echo 11e90100.usb > unbind

cd /sys/bus/platform/drivers/ohci-platform/
echo 11e10000.usb > bind
echo 11e90000.usb > bind

cd /sys/bus/platform/drivers/ehci-platform/
echo 11e10100.usb > bind
echo 11e90100.usb > bind

Test 2 Function unbind/bind:
cd /sys/bus/platform/drivers/renesas_usbhs 
echo 11e30000.usb > unbind
cd /sys/bus/platform/drivers/renesas_usbhs 
echo 11e30000.usb > bind

Test 3: PHY unbind/bind
cd /sys/bus/platform/drivers/phy_rcar_gen3_usb2
echo 11e10200.usb-phy > unbind
echo 11e90200.usb-phy > unbind

cd /sys/bus/platform/drivers/phy_rcar_gen3_usb2
echo 11e10200.usb-phy > bind
echo 11e90200.usb-phy > bind

Test 4: Regulator unbind/bind
cd /sys/bus/platform/drivers/phy_rcar_gen3_usb2
echo 11e10200.usb-phy > unbind
echo 11e90200.usb-phy > unbind

cd /sys/bus/platform/drivers/rzg3l-usb-vbus-regulator
echo rzg3l-usb-vbus-regulator > unbind

cd /sys/bus/platform/drivers/rzg3l-usb-vbus-regulator
echo rzg3l-usb-vbus-regulator > bind
cd /sys/bus/platform/drivers/phy_rcar_gen3_usb2
echo 11e10200.usb-phy > bind
echo 11e90200.usb-phy > bind

Test 5: Reset unbind/bind

echo "####unbind########"
cd /sys/bus/platform/drivers/rzg2l_usbphy_ctrl
echo 11e00000.usbphy-ctrl > unbind

echo "####bind########"
cd /sys/bus/platform/drivers/rzg2l_usbphy_ctrl
echo 11e00000.usbphy-ctrl > bind



Cheers,
Biju


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

* RE: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator
  2026-06-15 10:22     ` Biju Das
@ 2026-06-15 11:41       ` Biju Das
  2026-06-15 11:44       ` Claudiu Beznea
  1 sibling, 0 replies; 26+ messages in thread
From: Biju Das @ 2026-06-15 11:41 UTC (permalink / raw)
  To: Claudiu.Beznea, biju.das.au, Yoshihiro Shimoda, Vinod Koul,
	Geert Uytterhoeven, magnus.damm
  Cc: Neil Armstrong, Philipp Zabel, linux-renesas-soc, linux-phy,
	linux-kernel, Prabhakar Mahadev Lad

Hi Claudiu,

> -----Original Message-----
> From: Biju Das
> Sent: 15 June 2026 11:22
> Subject: RE: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled
> VBUS regulator
> 
> Hi Claudiu,
> 
> > -----Original Message-----
> > From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> > Sent: 15 June 2026 10:37
> > Subject: Re: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm
> > action registration for disabled VBUS regulator
> >
> > Hi, Biju,
> >
> > On 6/12/26 17:30, Biju wrote:
> > > From: Biju Das <biju.das.jz@bp.renesas.com>
> > >
> > > devm_regulator_get_exclusive() initialises the regulator with
> > > enable_count = 1, requiring the consumer to disable it before release.
> > >
> > > Previously, the devm disable action was only registered when the
> > > regulator was explicitly enabled, causing the cleanup path to skip
> > > decrementing enable_count on device removal when the regulator was
> > > left disabled.
> > >
> > > Fix this by always registering the devm disable action when the
> > > regulator is enabled (checked via regulator_is_enabled()), covering
> > > both the explicitly-enabled case and the initial state set by
> > > devm_regulator_get_exclusive().
> > >
> > > This fixes WARN_ON enable count during regulator release.
> > >
> > > Fixes: 24843404efe4 ("phy: renesas: phy-rcar-gen3-usb2: Control VBUS
> > > for RZ/G2L SoCs")
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > The approach in this patch don't solve the problem, at least on RZ/G3S. See [1] for logs.
> >
> > I applied this patch on next-20260610:
> >
> > git log --oneline -2
> > afe09f11d549 (HEAD) phy: renesas: phy-rcar-gen3-usb2: Fix devm action
> > registration for disabled VBUS regulator
> > abe651837cb3 (tag: next-20260610, linux-next/master) Add linux-next
> > specific files for 20260610
> >
> > [1]
> > https://github.com/claudiubeznea/logs/blob/2f1bab20407dfe6031385819ffe
> > abfc4eac772bd/logs
> 
> I have tested only with RZ/G3L host and I don't see the issue.
> How can the issue be reproduced? It could be related to RZ/G3S.
> I have executed the following tests and don't see any issue.
> Can you please try the same tests on RZ/G3S?
> Is unbind/bind ever worked on RZ?G3S previously?

Looks like your issue is related to USB function/gadget driver related.

I was testing with USB2.0 host and I did not face this issue.

But after enabling the USB function, I can reproduce the issue you mentioned.

Reason:
rcar_gen3_phy_usb2_power_off() is not called during usbhs/gadget unbind.

You can verify regulator count with 

cat /sys/kernel/debug/regulator/regulator_summary

Cheers,
Biju


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

* Re: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator
  2026-06-15 10:22     ` Biju Das
  2026-06-15 11:41       ` Biju Das
@ 2026-06-15 11:44       ` Claudiu Beznea
  2026-06-15 11:50         ` Biju Das
  1 sibling, 1 reply; 26+ messages in thread
From: Claudiu Beznea @ 2026-06-15 11:44 UTC (permalink / raw)
  To: Biju Das, biju.das.au, Yoshihiro Shimoda, Vinod Koul,
	Geert Uytterhoeven, magnus.damm
  Cc: Neil Armstrong, Philipp Zabel, linux-renesas-soc, linux-phy,
	linux-kernel, Prabhakar Mahadev Lad



On 6/15/26 13:22, Biju Das wrote:
> Hi Claudiu,
> 
>> -----Original Message-----
>> From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
>> Sent: 15 June 2026 10:37
>> Subject: Re: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled
>> VBUS regulator
>>
>> Hi, Biju,
>>
>> On 6/12/26 17:30, Biju wrote:
>>> From: Biju Das <biju.das.jz@bp.renesas.com>
>>>
>>> devm_regulator_get_exclusive() initialises the regulator with
>>> enable_count = 1, requiring the consumer to disable it before release.
>>>
>>> Previously, the devm disable action was only registered when the
>>> regulator was explicitly enabled, causing the cleanup path to skip
>>> decrementing enable_count on device removal when the regulator was
>>> left disabled.
>>>
>>> Fix this by always registering the devm disable action when the
>>> regulator is enabled (checked via regulator_is_enabled()), covering
>>> both the explicitly-enabled case and the initial state set by
>>> devm_regulator_get_exclusive().
>>>
>>> This fixes WARN_ON enable count during regulator release.
>>>
>>> Fixes: 24843404efe4 ("phy: renesas: phy-rcar-gen3-usb2: Control VBUS
>>> for RZ/G2L SoCs")
>>> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
>>
>> The approach in this patch don't solve the problem, at least on RZ/G3S. See [1] for logs.
>>
>> I applied this patch on next-20260610:
>>
>> git log --oneline -2
>> afe09f11d549 (HEAD) phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS
>> regulator
>> abe651837cb3 (tag: next-20260610, linux-next/master) Add linux-next specific files for 20260610
>>
>> [1]
>> https://github.com/claudiubeznea/logs/blob/2f1bab20407dfe6031385819ffeabfc4eac772bd/logs
> 
> I have tested only with RZ/G3L host and I don't see the issue.
> How can the issue be reproduced? It could be related to RZ/G3S.

It's reproducible with this patch on G2L as well, please see 
https://github.com/claudiubeznea/logs/blob/0601044903b5ae714592db9770bc4ed31fd8bf84/logs.

> I have executed the following tests and don't see any issue.
> Can you please try the same tests on RZ/G3S?

Try stressing it a bit, e.g. the following command trigger it on both G3S and G2L:

cnt=300; while [ $cnt -ge 0 ]; do echo 11c40000.usbphy-ctrl > unbind ; echo 
11c40000.usbphy-ctrl > bind ; cnt=$((cnt-1)); done

Same command could be executed for other USB drivers.

> Is unbind/bind ever worked on RZ?G3S previously?

In the same way it works on G2L: functionality is OK, these stack traces are 
displayed as on any other RZ/G2L based SoCs.

Thank you,
Claudiu


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

* RE: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator
  2026-06-15 11:44       ` Claudiu Beznea
@ 2026-06-15 11:50         ` Biju Das
  2026-06-15 12:30           ` Biju Das
  0 siblings, 1 reply; 26+ messages in thread
From: Biju Das @ 2026-06-15 11:50 UTC (permalink / raw)
  To: Claudiu.Beznea, biju.das.au, Yoshihiro Shimoda, Vinod Koul,
	Geert Uytterhoeven, magnus.damm
  Cc: Neil Armstrong, Philipp Zabel, linux-renesas-soc, linux-phy,
	linux-kernel, Prabhakar Mahadev Lad

Hi Claudiu,

> -----Original Message-----
> From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> Sent: 15 June 2026 12:44
> Subject: Re: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled
> VBUS regulator
> 
> 
> 
> On 6/15/26 13:22, Biju Das wrote:
> > Hi Claudiu,
> >
> >> -----Original Message-----
> >> From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> >> Sent: 15 June 2026 10:37
> >> Subject: Re: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm
> >> action registration for disabled VBUS regulator
> >>
> >> Hi, Biju,
> >>
> >> On 6/12/26 17:30, Biju wrote:
> >>> From: Biju Das <biju.das.jz@bp.renesas.com>
> >>>
> >>> devm_regulator_get_exclusive() initialises the regulator with
> >>> enable_count = 1, requiring the consumer to disable it before release.
> >>>
> >>> Previously, the devm disable action was only registered when the
> >>> regulator was explicitly enabled, causing the cleanup path to skip
> >>> decrementing enable_count on device removal when the regulator was
> >>> left disabled.
> >>>
> >>> Fix this by always registering the devm disable action when the
> >>> regulator is enabled (checked via regulator_is_enabled()), covering
> >>> both the explicitly-enabled case and the initial state set by
> >>> devm_regulator_get_exclusive().
> >>>
> >>> This fixes WARN_ON enable count during regulator release.
> >>>
> >>> Fixes: 24843404efe4 ("phy: renesas: phy-rcar-gen3-usb2: Control VBUS
> >>> for RZ/G2L SoCs")
> >>> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> >>
> >> The approach in this patch don't solve the problem, at least on RZ/G3S. See [1] for logs.
> >>
> >> I applied this patch on next-20260610:
> >>
> >> git log --oneline -2
> >> afe09f11d549 (HEAD) phy: renesas: phy-rcar-gen3-usb2: Fix devm action
> >> registration for disabled VBUS regulator
> >> abe651837cb3 (tag: next-20260610, linux-next/master) Add linux-next
> >> specific files for 20260610
> >>
> >> [1]
> >> https://github.com/claudiubeznea/logs/blob/2f1bab20407dfe6031385819ff
> >> eabfc4eac772bd/logs
> >
> > I have tested only with RZ/G3L host and I don't see the issue.
> > How can the issue be reproduced? It could be related to RZ/G3S.
> 
> It's reproducible with this patch on G2L as well, please see
> https://github.com/claudiubeznea/logs/blob/0601044903b5ae714592db9770bc4ed31fd8bf84/logs.
> 
> > I have executed the following tests and don't see any issue.
> > Can you please try the same tests on RZ/G3S?
> 
> Try stressing it a bit, e.g. the following command trigger it on both G3S and G2L:

It is nothing related to stress, it is just enable_count issue.
Usb function increments the enable count of regulator, which it never decrement
Leading to WARN_ON(enable_count) during unbind.

> 
> cnt=300; while [ $cnt -ge 0 ]; do echo 11c40000.usbphy-ctrl > unbind ; echo 11c40000.usbphy-ctrl > bind ;
> cnt=$((cnt-1)); done
> 
> Same command could be executed for other USB drivers.
> 
> > Is unbind/bind ever worked on RZ?G3S previously?
> 
> In the same way it works on G2L: functionality is OK, these stack traces are displayed as on any other
> RZ/G2L based SoCs.

I have identified the issue, it is USB function related.

I am investigating the fix, which will fix for all platforms.

Cgeers,
Biju

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

* RE: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator
  2026-06-15 11:50         ` Biju Das
@ 2026-06-15 12:30           ` Biju Das
  0 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2026-06-15 12:30 UTC (permalink / raw)
  To: Claudiu.Beznea, biju.das.au, Yoshihiro Shimoda, Vinod Koul,
	Geert Uytterhoeven, magnus.damm
  Cc: Neil Armstrong, Philipp Zabel, linux-renesas-soc, linux-phy,
	linux-kernel, Prabhakar Mahadev Lad

Hi Claudiu,

> -----Original Message-----
> From: Biju Das
> Sent: 15 June 2026 12:51
> Subject: RE: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled
> VBUS regulator
> 
> Hi Claudiu,
> 
> > -----Original Message-----
> > From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> > Sent: 15 June 2026 12:44
> > Subject: Re: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm
> > action registration for disabled VBUS regulator
> >
> >
> >
> > On 6/15/26 13:22, Biju Das wrote:
> > > Hi Claudiu,
> > >
> > >> -----Original Message-----
> > >> From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> > >> Sent: 15 June 2026 10:37
> > >> Subject: Re: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix
> > >> devm action registration for disabled VBUS regulator
> > >>
> > >> Hi, Biju,
> > >>
> > >> On 6/12/26 17:30, Biju wrote:
> > >>> From: Biju Das <biju.das.jz@bp.renesas.com>
> > >>>
> > >>> devm_regulator_get_exclusive() initialises the regulator with
> > >>> enable_count = 1, requiring the consumer to disable it before release.
> > >>>
> > >>> Previously, the devm disable action was only registered when the
> > >>> regulator was explicitly enabled, causing the cleanup path to skip
> > >>> decrementing enable_count on device removal when the regulator was
> > >>> left disabled.
> > >>>
> > >>> Fix this by always registering the devm disable action when the
> > >>> regulator is enabled (checked via regulator_is_enabled()),
> > >>> covering both the explicitly-enabled case and the initial state
> > >>> set by devm_regulator_get_exclusive().
> > >>>
> > >>> This fixes WARN_ON enable count during regulator release.
> > >>>
> > >>> Fixes: 24843404efe4 ("phy: renesas: phy-rcar-gen3-usb2: Control
> > >>> VBUS for RZ/G2L SoCs")
> > >>> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > >>
> > >> The approach in this patch don't solve the problem, at least on RZ/G3S. See [1] for logs.
> > >>
> > >> I applied this patch on next-20260610:
> > >>
> > >> git log --oneline -2
> > >> afe09f11d549 (HEAD) phy: renesas: phy-rcar-gen3-usb2: Fix devm
> > >> action registration for disabled VBUS regulator
> > >> abe651837cb3 (tag: next-20260610, linux-next/master) Add linux-next
> > >> specific files for 20260610
> > >>
> > >> [1]
> > >> https://github.com/claudiubeznea/logs/blob/2f1bab20407dfe6031385819
> > >> ff
> > >> eabfc4eac772bd/logs
> > >
> > > I have tested only with RZ/G3L host and I don't see the issue.
> > > How can the issue be reproduced? It could be related to RZ/G3S.
> >
> > It's reproducible with this patch on G2L as well, please see
> > https://github.com/claudiubeznea/logs/blob/0601044903b5ae714592db9770bc4ed31fd8bf84/logs.
> >
> > > I have executed the following tests and don't see any issue.
> > > Can you please try the same tests on RZ/G3S?
> >
> > Try stressing it a bit, e.g. the following command trigger it on both G3S and G2L:
> 
> It is nothing related to stress, it is just enable_count issue.
> Usb function increments the enable count of regulator, which it never decrement Leading to
> WARN_ON(enable_count) during unbind.
> 
> >
> > cnt=300; while [ $cnt -ge 0 ]; do echo 11c40000.usbphy-ctrl > unbind ;
> > echo 11c40000.usbphy-ctrl > bind ; cnt=$((cnt-1)); done
> >
> > Same command could be executed for other USB drivers.
> >
> > > Is unbind/bind ever worked on RZ?G3S previously?
> >
> > In the same way it works on G2L: functionality is OK, these stack
> > traces are displayed as on any other RZ/G2L based SoCs.
> 
> I have identified the issue, it is USB function related.
> 
> I am investigating the fix, which will fix for all platforms.

The issue you saw on RZ/G3S is

usbhs_platform_call(priv, hardware_exit, pdev) is called before
usbhsc_power_ctrl(priv, 0);

The former Nullify the PHY pointer and later does not call
phy_power_off(priv->phy) to decrement the regulator.

Cheers,
Biju



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

* RE: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator
  2026-06-15  9:37   ` Claudiu Beznea
  2026-06-15 10:22     ` Biju Das
@ 2026-06-15 12:42     ` Biju Das
  2026-06-16  8:28       ` Claudiu Beznea
  1 sibling, 1 reply; 26+ messages in thread
From: Biju Das @ 2026-06-15 12:42 UTC (permalink / raw)
  To: Claudiu.Beznea, biju.das.au, Yoshihiro Shimoda, Vinod Koul,
	Geert Uytterhoeven, magnus.damm
  Cc: Neil Armstrong, Philipp Zabel, linux-renesas-soc, linux-phy,
	linux-kernel, Prabhakar Mahadev Lad, stable, Greg Kroah-Hartman

Hi Claudiu,

+ stable <stable@kernel.org>

> -----Original Message-----
> From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> Sent: 15 June 2026 10:37
> Subject: Re: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled
> VBUS regulator
> 
> Hi, Biju,
> 
> On 6/12/26 17:30, Biju wrote:
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > devm_regulator_get_exclusive() initialises the regulator with
> > enable_count = 1, requiring the consumer to disable it before release.
> >
> > Previously, the devm disable action was only registered when the
> > regulator was explicitly enabled, causing the cleanup path to skip
> > decrementing enable_count on device removal when the regulator was
> > left disabled.
> >
> > Fix this by always registering the devm disable action when the
> > regulator is enabled (checked via regulator_is_enabled()), covering
> > both the explicitly-enabled case and the initial state set by
> > devm_regulator_get_exclusive().
> >
> > This fixes WARN_ON enable count during regulator release.
> >
> > Fixes: 24843404efe4 ("phy: renesas: phy-rcar-gen3-usb2: Control VBUS
> > for RZ/G2L SoCs")
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> 
> The approach in this patch don't solve the problem, at least on RZ/G3S. See [1] for logs.
> 
> I applied this patch on next-20260610:
> 
> git log --oneline -2
> afe09f11d549 (HEAD) phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS
> regulator
> abe651837cb3 (tag: next-20260610, linux-next/master) Add linux-next specific files for 20260610
> 
> [1]
> https://github.com/claudiubeznea/logs/blob/2f1bab20407dfe6031385819ffeabfc4eac772bd/logs

This issue is introduced by the commit

eb9ac779830b223584 ("usb: renesas_usbhs: Fix synchronous external abort on unbind")

WARN_ON(enable_count) is related to regulator imbalance during unbind/bind cycle.

The above commit changed the code flow from

usbhsc_power_ctrl(priv, 0);
usbhs_platform_call(priv, hardware_exit, pdev);

to

usbhs_platform_call(priv, hardware_exit, pdev);
usbhsc_power_ctrl(priv, 0);


The function usbhs_*_hardware_exit(struct platform_device *pdev) sets
priv->phy to  NULL

and

usbhs_*_power_ctrl() has the below code and [1] is a dead code now after this commit.

if (!priv->phy)
		return -ENODEV;

	if (enable) {
		retval = phy_init(priv->phy);
		usbhs_bset(priv, SUSPMODE, SUSPM, SUSPM);
		udelay(100);	/* Wait for PLL to become stable */
		if (!retval)
			retval = phy_power_on(priv->phy);
	} else {
[1]
		usbhs_bset(priv, SUSPMODE, SUSPM, 0);
		phy_power_off(priv->phy);
		phy_exit(priv->phy);
	}

Cheers,
Biju
 





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

* Re: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator
  2026-06-15 12:42     ` Biju Das
@ 2026-06-16  8:28       ` Claudiu Beznea
  0 siblings, 0 replies; 26+ messages in thread
From: Claudiu Beznea @ 2026-06-16  8:28 UTC (permalink / raw)
  To: Biju Das, biju.das.au, Yoshihiro Shimoda, Vinod Koul,
	Geert Uytterhoeven, magnus.damm
  Cc: Neil Armstrong, Philipp Zabel, linux-renesas-soc, linux-phy,
	linux-kernel, Prabhakar Mahadev Lad, stable, Greg Kroah-Hartman

Hi, Biju,

On 6/15/26 15:42, Biju Das wrote:
> Hi Claudiu,
> 
> + stable <stable@kernel.org>
> 
>> -----Original Message-----
>> From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
>> Sent: 15 June 2026 10:37
>> Subject: Re: [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled
>> VBUS regulator
>>
>> Hi, Biju,
>>
>> On 6/12/26 17:30, Biju wrote:
>>> From: Biju Das <biju.das.jz@bp.renesas.com>
>>>
>>> devm_regulator_get_exclusive() initialises the regulator with
>>> enable_count = 1, requiring the consumer to disable it before release.
>>>
>>> Previously, the devm disable action was only registered when the
>>> regulator was explicitly enabled, causing the cleanup path to skip
>>> decrementing enable_count on device removal when the regulator was
>>> left disabled.
>>>
>>> Fix this by always registering the devm disable action when the
>>> regulator is enabled (checked via regulator_is_enabled()), covering
>>> both the explicitly-enabled case and the initial state set by
>>> devm_regulator_get_exclusive().
>>>
>>> This fixes WARN_ON enable count during regulator release.
>>>
>>> Fixes: 24843404efe4 ("phy: renesas: phy-rcar-gen3-usb2: Control VBUS
>>> for RZ/G2L SoCs")
>>> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
>>
>> The approach in this patch don't solve the problem, at least on RZ/G3S. See [1] for logs.
>>
>> I applied this patch on next-20260610:
>>
>> git log --oneline -2
>> afe09f11d549 (HEAD) phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS
>> regulator
>> abe651837cb3 (tag: next-20260610, linux-next/master) Add linux-next specific files for 20260610
>>
>> [1]
>> https://github.com/claudiubeznea/logs/blob/2f1bab20407dfe6031385819ffeabfc4eac772bd/logs
> 
> This issue is introduced by the commit
> 
> eb9ac779830b223584 ("usb: renesas_usbhs: Fix synchronous external abort on unbind")

Indeed, nice catch. I reverted this commit (just for checking the patch you 
proposed) and and now it looks good on RZ/G2L. Code from commit eb9ac779830b 
("usb: renesas_usbhs: Fix synchronous external abort on unbind") will have to be 
adjusted.

Thank you for investigation,
Claudiu

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

end of thread, other threads:[~2026-06-16  8:28 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-12 14:30 [PATCH 00/11] Add RZ/G3L USB2.0 host support Biju
2026-06-12 14:30 ` [PATCH 01/11] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support Biju
2026-06-13 10:40   ` Krzysztof Kozlowski
2026-06-15  7:26     ` Biju Das
2026-06-12 14:30 ` [PATCH 02/11] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings Biju
2026-06-13 10:40   ` Krzysztof Kozlowski
2026-06-12 14:30 ` [PATCH 03/11] clk: renesas: r9a08g046: Add USB2.0 clock and reset entries Biju
2026-06-12 14:30 ` [PATCH 04/11] reset: rzg2l-usbphy-ctrl: Introduce info struct for match data Biju
2026-06-15  7:36   ` Biju Das
2026-06-12 14:30 ` [PATCH 05/11] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support Biju
2026-06-12 14:30 ` [PATCH 06/11] regulator: renesas-usb-vbus-regulator: Introduce helper for regulator registration Biju
2026-06-12 14:30 ` [PATCH 07/11] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support Biju
2026-06-12 16:41   ` Mark Brown
2026-06-15  7:19     ` Biju Das
2026-06-12 14:30 ` [PATCH 08/11] phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support Biju
2026-06-12 14:30 ` [PATCH 09/11] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator Biju
2026-06-15  9:37   ` Claudiu Beznea
2026-06-15 10:22     ` Biju Das
2026-06-15 11:41       ` Biju Das
2026-06-15 11:44       ` Claudiu Beznea
2026-06-15 11:50         ` Biju Das
2026-06-15 12:30           ` Biju Das
2026-06-15 12:42     ` Biju Das
2026-06-16  8:28       ` Claudiu Beznea
2026-06-12 14:30 ` [PATCH 10/11] arm64: dts: renesas: r9a08g046: Add USB2.0 device nodes Biju
2026-06-12 14:30 ` [PATCH 11/11] arm64: dts: renesas: r9a08g046l48-smarc: Add USB2.0 support Biju

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®