mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/9] Add RZ/G3L USB2.0 host support
@ 2026-07-09  8:30 Biju
  2026-07-09  8:30 ` [PATCH v4 1/9] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support Biju
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: Biju @ 2026-07-09  8: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>

Hi All,

This patch series aims to add USB2.0 host support for the RZ/G3L SMARC
EVK. 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. This series migrates regulator driver to use id-table so there
is hard dependency between reset driver and regulator driver.

Merge strategy:
  An Ack/Rb tag from Regulator Maintainer for patch#4.
  Patch #1,#2,#3,#4 - Reset subsystem
  Patch #5,#6,#7 - PHY subsystem
  Patch #8,#9 - Renesas SoC

v3->v4:
 * Updated cover letter with merge strategy
 * Reorder the phy binding patch for easy merging.
 * Updated the commit description for patch #2,#3, #4.
 * Moved the handling of regulator_driver_name to patch #3
   in preparation for id_table match.
 * Migrated to id_table match using driver_name and reduced the length
   < 24.
 * Dropped rzg3l specific platform driver.
 * Dropped the tag for regulator driver,
 * Added id_table handling by introducing a common probe().
v2->v3:
 * Replaced items->enum in reset controller bindings.
 * Collected the tag for reset binding patch.
 * Dropped clock patch as it is accepted.
v1->v2:
 * Dropped patch#6(Introduce helper for regulator registration)
 * Passing pointer to an array of regulators to make it scalable.
 * Dropped regulator1-vbus and added a regulators group node.
 * Updated commit description for patch#1,#4,#6,#7,#8,#9 and #10.
 * Added enum instead of const in the compatible section.
 * Updated schema check.
 * Collected tag for PHY binding patch.
   in the regulator driver.
 * Added regulators group node and its children in SoC dtsi.

Biju Das (9):
  dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support
  reset: rzg2l-usbphy-ctrl: Introduce info struct for match data
  reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
  regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator
    support
  dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings
  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      |  48 +++++++-
 arch/arm64/boot/dts/renesas/r9a08g046.dtsi    | 105 ++++++++++++++++++
 .../boot/dts/renesas/r9a08g046l48-smarc.dts   |  49 ++++++++
 drivers/phy/renesas/phy-rcar-gen3-usb2.c      |  20 ++--
 .../regulator/renesas-usb-vbus-regulator.c    |  74 +++++++++++-
 drivers/reset/reset-rzg2l-usbphy-ctrl.c       |  44 +++++---
 7 files changed, 316 insertions(+), 26 deletions(-)

-- 
2.43.0


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

* [PATCH v4 1/9] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support
  2026-07-09  8:30 [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju
@ 2026-07-09  8:30 ` Biju
  2026-07-09  8:30 ` [PATCH v4 2/9] reset: rzg2l-usbphy-ctrl: Introduce info struct for match data Biju
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Biju @ 2026-07-09  8: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, Conor Dooley

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

Document Renesas RZ/G3L (r9a08g046) USB PHY controller bindings.
The RZ/G3L USB PHY block is similar to RZ/G3S but differs in that each
port has its own OTG controller, whereas RZ/G3S only has one on port 1.
To reflect this, RZ/G3L uses a regulators sub-node with per-port vbus0
and vbus1 entries instead of the single regulator-vbus property used
by other compatible SoCs.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
 * No change.
v2->v3:
 * Replaced items->enum
 * Collected tag.
v1->v2:
 * Updated commit description.
 * Added enum instead of const in the compatible section.
 * Dropped regulator1-vbus and added a regulators group node.
 * Updated schema check.
---
 .../reset/renesas,rzg2l-usbphy-ctrl.yaml      | 48 +++++++++++++++++--
 1 file changed, 45 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
index c83469a1b379..06e003218d2a 100644
--- a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
+++ b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
@@ -16,13 +16,16 @@ description:
 properties:
   compatible:
     oneOf:
+      - enum:
+          - renesas,r9a08g045-usbphy-ctrl # RZ/G3S
+          - renesas,r9a08g046-usbphy-ctrl # RZ/G3L
+
       - items:
           - enum:
               - renesas,r9a07g043-usbphy-ctrl # RZ/G2UL and RZ/Five
               - renesas,r9a07g044-usbphy-ctrl # RZ/G2{L,LC}
               - renesas,r9a07g054-usbphy-ctrl # RZ/V2L
           - const: renesas,rzg2l-usbphy-ctrl
-      - const: renesas,r9a08g045-usbphy-ctrl # RZ/G3S
 
   reg:
     maxItems: 1
@@ -50,6 +53,28 @@ properties:
     $ref: /schemas/regulator/regulator.yaml#
     unevaluatedProperties: false
 
+  regulators:
+    type: object
+    description:
+      list of vbus regulators provided by this controller.
+
+    properties:
+      vbus0:
+        type: object
+        description: Port 1 USB VBUS regulator
+        $ref: /schemas/regulator/regulator.yaml#
+        unevaluatedProperties: false
+
+      vbus1:
+        type: object
+        description: Port 2 USB VBUS regulator
+        $ref: /schemas/regulator/regulator.yaml#
+        unevaluatedProperties: false
+
+    required:
+      - vbus0
+      - vbus1
+
   renesas,sysc-pwrrdy:
     description:
       The system controller PWRRDY indicates to the USB PHY if the power supply
@@ -71,14 +96,15 @@ required:
   - resets
   - power-domains
   - '#reset-cells'
-  - regulator-vbus
 
 allOf:
   - if:
       properties:
         compatible:
           contains:
-            const: renesas,r9a08g045-usbphy-ctrl
+            enum:
+              - renesas,r9a08g045-usbphy-ctrl
+              - renesas,r9a08g046-usbphy-ctrl
     then:
       required:
         - renesas,sysc-pwrrdy
@@ -86,6 +112,22 @@ allOf:
       properties:
         renesas,sysc-pwrrdy: false
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: renesas,r9a08g046-usbphy-ctrl
+    then:
+      properties:
+        regulator-vbus: false
+      required:
+        - regulators
+    else:
+      properties:
+        regulators: false
+      required:
+        - regulator-vbus
+
 additionalProperties: false
 
 examples:
-- 
2.43.0


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

* [PATCH v4 2/9] reset: rzg2l-usbphy-ctrl: Introduce info struct for match data
  2026-07-09  8:30 [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju
  2026-07-09  8:30 ` [PATCH v4 1/9] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support Biju
@ 2026-07-09  8:30 ` Biju
  2026-07-09  8:30 ` [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support Biju
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Biju @ 2026-07-09  8:30 UTC (permalink / raw)
  To: Philipp Zabel, Geert Uytterhoeven, Mark Brown, 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 currently carries a pwrrdy boolean. The probe function
now retrieves this struct via device_get_match_data() and
conditionally calls rzg2l_usbphy_ctrl_pwrrdy_init() based on the
pwrrdy flag, removing the previous integer cast approach.

This refactoring prepares the driver for RZ/G3L (r9a08g046) support,
which requires a different regulator configuration with two per-port
VBUS regulators.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
 * Updated the commit description.
 * Moved the handling of regulator_driver_name to patch #3
   in preparation for id_table match.
v2->v3:
  No change.
v1->v2:
 * Updated commit description.
---
 drivers/reset/reset-rzg2l-usbphy-ctrl.c | 32 ++++++++++++++-----------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
index fd75d9601a3b..84e745e49240 100644
--- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
+++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
@@ -41,6 +41,10 @@ struct rzg2l_usbphy_ctrl_priv {
 	spinlock_t lock;
 };
 
+struct rzg2l_usbphy_ctrl_info {
+	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 +110,15 @@ 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 = {};
+
+static const struct rzg2l_usbphy_ctrl_info rzg3s_info = {
+	.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 +158,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 +188,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 +207,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))
-- 
2.43.0


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

* [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
  2026-07-09  8:30 [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju
  2026-07-09  8:30 ` [PATCH v4 1/9] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support Biju
  2026-07-09  8:30 ` [PATCH v4 2/9] reset: rzg2l-usbphy-ctrl: Introduce info struct for match data Biju
@ 2026-07-09  8:30 ` Biju
  2026-07-23  9:18   ` Philipp Zabel
  2026-08-05 10:26   ` Biju Das
  2026-07-09  8:30 ` [PATCH v4 4/9] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support Biju
                   ` (6 subsequent siblings)
  9 siblings, 2 replies; 18+ messages in thread
From: Biju @ 2026-07-09  8:30 UTC (permalink / raw)
  To: Philipp Zabel, Geert Uytterhoeven, Mark Brown, 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 pwrrdy 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-vbus-regulator driver to handle the additional
VBUSEN control for port 2. The regulator_driver_name field is used as
the platform device name passed to platform_device_alloc(), and must
exactly match the name the corresponding regulator driver registers
via its id_table for platform bus matching to succeed.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
 * Updated the commit description.
 * Migrated to id_table match using driver_name and reduced the length
   < 24.
v2->v3:
 * No change.
v1->v2:
 * No change.
---
 drivers/reset/reset-rzg2l-usbphy-ctrl.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
index 84e745e49240..0803195080bd 100644
--- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
+++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
@@ -42,6 +42,7 @@ struct rzg2l_usbphy_ctrl_priv {
 };
 
 struct rzg2l_usbphy_ctrl_info {
+	const char *regulator_driver_name;
 	bool pwrrdy;
 };
 
@@ -110,15 +111,24 @@ static void rzg2l_usbphy_ctrl_init(struct rzg2l_usbphy_ctrl_priv *priv)
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
 
-static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {};
+static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {
+	.regulator_driver_name = "rzg2l-vbus-regulator",
+};
 
 static const struct rzg2l_usbphy_ctrl_info rzg3s_info = {
+	.regulator_driver_name = "rzg2l-vbus-regulator",
+	.pwrrdy = true,
+};
+
+static const struct rzg2l_usbphy_ctrl_info rzg3l_info = {
+	.regulator_driver_name = "rzg3l-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);
@@ -245,7 +255,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] 18+ messages in thread

* [PATCH v4 4/9] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support
  2026-07-09  8:30 [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju
                   ` (2 preceding siblings ...)
  2026-07-09  8:30 ` [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support Biju
@ 2026-07-09  8:30 ` Biju
  2026-07-10 17:03   ` Mark Brown
  2026-07-09  8:30 ` [PATCH v4 5/9] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings Biju
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Biju @ 2026-07-09  8:30 UTC (permalink / raw)
  To: Liam Girdwood, Philipp Zabel, 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 dual USB VBUS regulator support for the RZ/G3L (r9a08g046) SoC, which
has two OTG controllers (one per port), unlike RZ/G3S which has only one.

Introduce a RZG3L_USB_VBUS_REG macro and a rzg3l_usb_vbus_regulators
array with two descriptors: vbus0 (BIT(0)) and vbus1 (BIT(1)), both
sourced from a regulators sub-node as defined in the binding. Add a
dedicated rzg3l_usb_vbus_regulator_probe() that iterates over the array
and registers both regulators using devm_regulator_register().

Convert the existing platform driver to use an id_table, allowing it to
dispatch to either the RZ/G2L or RZ/G3L probe function based on the
matched platform device name.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
 * Dropped rzg3l specific platform driver.
 * Dropped the tag as there are new changes
 * Added id_table handling by introducing a common probe().
v2->v3:
 * No change.
v1->v2:
 * Passing pointer to an array of regulators to make it scalable.
 * Updated commit description.
---
 .../regulator/renesas-usb-vbus-regulator.c    | 74 ++++++++++++++++++-
 1 file changed, 73 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/renesas-usb-vbus-regulator.c b/drivers/regulator/renesas-usb-vbus-regulator.c
index 9ba791bd72ec..493397143617 100644
--- a/drivers/regulator/renesas-usb-vbus-regulator.c
+++ b/drivers/regulator/renesas-usb-vbus-regulator.c
@@ -55,8 +55,80 @@ static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
 	return 0;
 }
 
+#define RZG3L_USB_VBUS_REG(rname, en_mask)				\
+	{								\
+		.name			= #rname,			\
+		.of_match		= of_match_ptr(#rname),		\
+		.regulators_node	= of_match_ptr("regulators"),	\
+		.type			= REGULATOR_VOLTAGE,		\
+		.owner			= THIS_MODULE,			\
+		.ops			= &rzg2l_usb_vbus_reg_ops,	\
+		.enable_reg		= 0,				\
+		.enable_mask		= (en_mask),			\
+		.enable_is_inverted	= true,				\
+		.fixed_uV		= 5000000,			\
+		.n_voltages		= 1,				\
+	}
+
+static const struct regulator_desc rzg3l_usb_vbus_regulators[] = {
+	RZG3L_USB_VBUS_REG(vbus0, BIT(0)),
+	RZG3L_USB_VBUS_REG(vbus1, BIT(1)),
+};
+
+static int rzg3l_usb_vbus_regulator_probe(struct platform_device *pdev)
+{
+	struct regulator_config config = { };
+	struct device *dev = &pdev->dev;
+	struct regulator_dev *rdev;
+
+	config.dev = pdev->dev.parent;
+	config.regmap = dev_get_regmap(dev->parent, NULL);
+	if (!config.regmap)
+		return dev_err_probe(dev, -ENOENT, "Failed to get regmap\n");
+
+	for (unsigned int i = 0; i < ARRAY_SIZE(rzg3l_usb_vbus_regulators); i++) {
+		rdev = devm_regulator_register(dev, &rzg3l_usb_vbus_regulators[i],
+					       &config);
+		if (IS_ERR(rdev)) {
+			dev_err(dev, "failed to register %s regulator\n",
+				rzg3l_usb_vbus_regulators[i].name);
+			return PTR_ERR(rdev);
+		}
+	}
+
+	return 0;
+}
+
+static int rzg2l_usb_vbus_regulator_common_probe(struct platform_device *pdev)
+{
+	int (*probe_func)(struct platform_device *pdev);
+	const struct platform_device_id *id;
+
+	id = platform_get_device_id(pdev);
+	if (!id)
+		return dev_err_probe(&pdev->dev, -ENODEV, "No ID match found\n");
+
+	probe_func = (int (*)(struct platform_device *))id->driver_data;
+
+	return probe_func(pdev);
+}
+
+static const struct platform_device_id rzg2l_usb_vbus_regulator_ids[] = {
+	{
+		.name = "rzg2l-vbus-regulator",
+		.driver_data = (kernel_ulong_t)rzg2l_usb_vbus_regulator_probe
+	},
+	{
+		.name = "rzg3l-vbus-regulator",
+		.driver_data = (kernel_ulong_t)rzg3l_usb_vbus_regulator_probe
+	},
+	{ /* Sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, rzg2l_usb_vbus_regulator_ids);
+
 static struct platform_driver rzg2l_usb_vbus_regulator_driver = {
-	.probe = rzg2l_usb_vbus_regulator_probe,
+	.probe = rzg2l_usb_vbus_regulator_common_probe,
+	.id_table = rzg2l_usb_vbus_regulator_ids,
 	.driver	= {
 		.name = "rzg2l-usb-vbus-regulator",
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
-- 
2.43.0


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

* [PATCH v4 5/9] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings
  2026-07-09  8:30 [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju
                   ` (3 preceding siblings ...)
  2026-07-09  8:30 ` [PATCH v4 4/9] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support Biju
@ 2026-07-09  8:30 ` Biju
  2026-07-09  8:30 ` [PATCH v4 6/9] phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support Biju
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Biju @ 2026-07-09  8: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, Krzysztof Kozlowski

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.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
 * Moved the patch for easy merging.
v2->v3:
 * No change
v1->v2:
 * Collected tag.
---
 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] 18+ messages in thread

* [PATCH v4 6/9] phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support
  2026-07-09  8:30 [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju
                   ` (4 preceding siblings ...)
  2026-07-09  8:30 ` [PATCH v4 5/9] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings Biju
@ 2026-07-09  8:30 ` Biju
  2026-07-09  8:31 ` [PATCH v4 7/9] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator Biju
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Biju @ 2026-07-09  8: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 as the PHY configuration is shared with RZ/G3S.

While the PHY data is shared, RZ/G3L differs from RZ/G3S in that it 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, which is fixed to host-only on RZ/G3S.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
 * No change.
v2->v3:
 * No change.
v1->v2:
 * Updated commit description.
---
 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] 18+ messages in thread

* [PATCH v4 7/9] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator
  2026-07-09  8:30 [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju
                   ` (5 preceding siblings ...)
  2026-07-09  8:30 ` [PATCH v4 6/9] phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support Biju
@ 2026-07-09  8:31 ` Biju
  2026-07-09  8:31 ` [PATCH v4 8/9] arm64: dts: renesas: r9a08g046: Add USB2.0 device nodes Biju
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Biju @ 2026-07-09  8:31 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.

The devm disable action was previously only registered when the caller
explicitly requested enable, so when the regulator was left in its initial
enabled state without an explicit enable call, the cleanup path skipped
decrementing enable_count, triggering a WARN_ON during regulator
release on device removal.

Fix this by always registering the devm disable action based on the actual
enabled state via regulator_is_enabled(), regardless of whether the
caller requested an explicit enable. This covers both the explicitly
enabled case and the initial state set by devm_regulator_get_exclusive().

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>
---
v3->v4:
 * No change.
v2->v3:
 * No change.
v1->v2:
 * Updated commit description.
---
 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] 18+ messages in thread

* [PATCH v4 8/9] arm64: dts: renesas: r9a08g046: Add USB2.0 device nodes
  2026-07-09  8:30 [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju
                   ` (6 preceding siblings ...)
  2026-07-09  8:31 ` [PATCH v4 7/9] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator Biju
@ 2026-07-09  8:31 ` Biju
  2026-07-09  8:31 ` [PATCH v4 9/9] arm64: dts: renesas: r9a08g046l48-smarc: Add USB2.0 support Biju
  2026-07-22 19:15 ` [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju Das
  9 siblings, 0 replies; 18+ messages in thread
From: Biju @ 2026-07-09  8:31 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, covering
the USB PHY controller, OHCI/EHCI host controllers, and USB2 PHYs for
both ports.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
 * No change
v2->v3:
 * No change
v1->v2:
 * Updated commit description.
 * Added regulators group node and its children.
---
 arch/arm64/boot/dts/renesas/r9a08g046.dtsi | 105 +++++++++++++++++++++
 1 file changed, 105 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r9a08g046.dtsi b/arch/arm64/boot/dts/renesas/r9a08g046.dtsi
index 85e409ac8d5c..926a81cec37e 100644
--- a/arch/arm64/boot/dts/renesas/r9a08g046.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a08g046.dtsi
@@ -1198,6 +1198,111 @@ 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";
+
+			regulators {
+				usb0_vbus_otg: vbus0 {
+					regulator-name = "usb0_vbus";
+				};
+
+				usb1_vbus_otg: vbus1 {
+					regulator-name = "usb1_vbus";
+				};
+			};
+		};
+
+		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] 18+ messages in thread

* [PATCH v4 9/9] arm64: dts: renesas: r9a08g046l48-smarc: Add USB2.0 support
  2026-07-09  8:30 [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju
                   ` (7 preceding siblings ...)
  2026-07-09  8:31 ` [PATCH v4 8/9] arm64: dts: renesas: r9a08g046: Add USB2.0 device nodes Biju
@ 2026-07-09  8:31 ` Biju
  2026-07-22 19:15 ` [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju Das
  9 siblings, 0 replies; 18+ messages in thread
From: Biju @ 2026-07-09  8:31 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).

Port 0 (ehci0, ohci0, usb2_phy0) is configured as OTG with
usb0_pins pinmux (USB20_OVRCUR, USB20_VBUSEN) and usb0_vbus_otg
as the VBUS supply. Port 1 (ehci1, ohci1, usb2_phy1) is configured
as host-only with usb1_pins pinmux (USB21_OVRCUR, USB21_VBUSEN),
usb1_vbus_otg as the VBUS supply, and renesas,no-otg-pins set to
indicate no OTG pin routing. The phyrst USB PHY reset controller is
also enabled.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
 * No change.
v2->v3:
 * No change.
v1->v2:
 * Updated commit description.
---
 .../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] 18+ messages in thread

* Re: [PATCH v4 4/9] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support
  2026-07-09  8:30 ` [PATCH v4 4/9] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support Biju
@ 2026-07-10 17:03   ` Mark Brown
  0 siblings, 0 replies; 18+ messages in thread
From: Mark Brown @ 2026-07-10 17:03 UTC (permalink / raw)
  To: Biju
  Cc: Liam Girdwood, Philipp Zabel, Biju Das, linux-kernel,
	Geert Uytterhoeven, Prabhakar Mahadev Lad, linux-renesas-soc

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

On Thu, Jul 09, 2026 at 09:30:57AM +0100, Biju wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
> 
> Add dual USB VBUS regulator support for the RZ/G3L (r9a08g046) SoC, which
> has two OTG controllers (one per port), unlike RZ/G3S which has only one.

Acked-by: Mark Brown <broonie@kernel.org>

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

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

* RE: [PATCH v4 0/9] Add RZ/G3L USB2.0 host support
  2026-07-09  8:30 [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju
                   ` (8 preceding siblings ...)
  2026-07-09  8:31 ` [PATCH v4 9/9] arm64: dts: renesas: r9a08g046l48-smarc: Add USB2.0 support Biju
@ 2026-07-22 19:15 ` Biju Das
  2026-07-24 15:26   ` Biju Das
  9 siblings, 1 reply; 18+ messages in thread
From: Biju Das @ 2026-07-22 19:15 UTC (permalink / raw)
  To: biju.das.au, Philipp Zabel, Vinod Koul, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Michael Turquette, Stephen Boyd, Liam Girdwood, Mark Brown,
	magnus.damm
  Cc: Neil Armstrong, Yoshihiro Shimoda, linux-phy, devicetree,
	linux-kernel, linux-clk, linux-renesas-soc,
	Prabhakar Mahadev Lad, biju.das.au

Hi All,

> -----Original Message-----
> From: Biju <biju.das.au@gmail.com>
> Sent: 09 July 2026 09:31
> Subject: [PATCH v4 0/9] Add RZ/G3L USB2.0 host support
> 
> From: Biju Das <biju.das.jz@bp.renesas.com>
> 
> Hi All,
> 
> This patch series aims to add USB2.0 host support for the RZ/G3L SMARC EVK. 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. This series migrates regulator driver to use id-table so there is hard dependency between
> reset driver and regulator driver.
> 
> Merge strategy:
>   An Ack/Rb tag from Regulator Maintainer for patch#4.
>   Patch #1,#2,#3,#4 - Reset subsystem
>   Patch #5,#6,#7 - PHY subsystem
>   Patch #8,#9 - Renesas SoC
> 
> v3->v4:
>  * Updated cover letter with merge strategy
>  * Reorder the phy binding patch for easy merging.
>  * Updated the commit description for patch #2,#3, #4.
>  * Moved the handling of regulator_driver_name to patch #3
>    in preparation for id_table match.
>  * Migrated to id_table match using driver_name and reduced the length
>    < 24.
>  * Dropped rzg3l specific platform driver.
>  * Dropped the tag for regulator driver,
>  * Added id_table handling by introducing a common probe().
> v2->v3:
>  * Replaced items->enum in reset controller bindings.
>  * Collected the tag for reset binding patch.
>  * Dropped clock patch as it is accepted.
> v1->v2:
>  * Dropped patch#6(Introduce helper for regulator registration)
>  * Passing pointer to an array of regulators to make it scalable.
>  * Dropped regulator1-vbus and added a regulators group node.
>  * Updated commit description for patch#1,#4,#6,#7,#8,#9 and #10.
>  * Added enum instead of const in the compatible section.
>  * Updated schema check.
>  * Collected tag for PHY binding patch.
>    in the regulator driver.
>  * Added regulators group node and its children in SoC dtsi.
> 
> Biju Das (9):
>   dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support
>   reset: rzg2l-usbphy-ctrl: Introduce info struct for match data
>   reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
>   regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator
>     support
>   dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings
>   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      |  48 +++++++-
>  arch/arm64/boot/dts/renesas/r9a08g046.dtsi    | 105 ++++++++++++++++++
>  .../boot/dts/renesas/r9a08g046l48-smarc.dts   |  49 ++++++++
>  drivers/phy/renesas/phy-rcar-gen3-usb2.c      |  20 ++--
>  .../regulator/renesas-usb-vbus-regulator.c    |  74 +++++++++++-
>  drivers/reset/reset-rzg2l-usbphy-ctrl.c       |  44 +++++---
>  7 files changed, 316 insertions(+), 26 deletions(-)
> 
> --
> 2.43.0

Gentle ping.

Cheers,
Biju


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

* Re: [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
  2026-07-09  8:30 ` [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support Biju
@ 2026-07-23  9:18   ` Philipp Zabel
  2026-07-23  9:29     ` Biju Das
  2026-08-05 10:26   ` Biju Das
  1 sibling, 1 reply; 18+ messages in thread
From: Philipp Zabel @ 2026-07-23  9:18 UTC (permalink / raw)
  To: Biju, Geert Uytterhoeven, Mark Brown, Magnus Damm
  Cc: Biju Das, linux-kernel, linux-renesas-soc, Prabhakar Mahadev Lad

On Do, 2026-07-09 at 09:30 +0100, Biju wrote:
> 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 pwrrdy 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-vbus-regulator driver to handle the additional
> VBUSEN control for port 2. The regulator_driver_name field is used as
> the platform device name passed to platform_device_alloc(), and must
> exactly match the name the corresponding regulator driver registers
> via its id_table for platform bus matching to succeed.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v3->v4:
>  * Updated the commit description.
>  * Migrated to id_table match using driver_name and reduced the length
>    < 24.
> v2->v3:
>  * No change.
> v1->v2:
>  * No change.
> ---
>  drivers/reset/reset-rzg2l-usbphy-ctrl.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> index 84e745e49240..0803195080bd 100644
> --- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> +++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> @@ -42,6 +42,7 @@ struct rzg2l_usbphy_ctrl_priv {
>  };
>  
>  struct rzg2l_usbphy_ctrl_info {
> +	const char *regulator_driver_name;

After patch 4, this will not be driver.name anymore.
Maybe call this regulator_name or regulator_device_name?

>  	bool pwrrdy;
>  };
>  
> @@ -110,15 +111,24 @@ static void rzg2l_usbphy_ctrl_init(struct rzg2l_usbphy_ctrl_priv *priv)
>  	spin_unlock_irqrestore(&priv->lock, flags);
>  }
>  
> -static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {};
> +static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {
> +	.regulator_driver_name = "rzg2l-vbus-regulator",
> +};
>  
>  static const struct rzg2l_usbphy_ctrl_info rzg3s_info = {
> +	.regulator_driver_name = "rzg2l-vbus-regulator",
> +	.pwrrdy = true,
> +};
> +
> +static const struct rzg2l_usbphy_ctrl_info rzg3l_info = {
> +	.regulator_driver_name = "rzg3l-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);
> @@ -245,7 +255,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);

Switching from "rzg2l-usb-vbus-regulator" to "rzg2l-vbus-regulator"
breaks bisectability. Any reason not to just use "rzg2l-usb-vbus-
regulator" and "rzg3l-usb-vbus-regulator"?

regards
Philipp

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

* RE: [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
  2026-07-23  9:18   ` Philipp Zabel
@ 2026-07-23  9:29     ` Biju Das
  0 siblings, 0 replies; 18+ messages in thread
From: Biju Das @ 2026-07-23  9:29 UTC (permalink / raw)
  To: Philipp Zabel, biju.das.au, Geert Uytterhoeven, Mark Brown, magnus.damm
  Cc: linux-kernel, linux-renesas-soc, Prabhakar Mahadev Lad

Hi Philipp,

Thanks for the feedback.

> -----Original Message-----
> From: Philipp Zabel <p.zabel@pengutronix.de>
> Sent: 23 July 2026 10:19
> Subject: Re: [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
> 
> On Do, 2026-07-09 at 09:30 +0100, Biju wrote:
> > 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 pwrrdy 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-vbus-regulator driver to handle the additional
> > VBUSEN control for port 2. The regulator_driver_name field is used as
> > the platform device name passed to platform_device_alloc(), and must
> > exactly match the name the corresponding regulator driver registers
> > via its id_table for platform bus matching to succeed.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > v3->v4:
> >  * Updated the commit description.
> >  * Migrated to id_table match using driver_name and reduced the length
> >    < 24.
> > v2->v3:
> >  * No change.
> > v1->v2:
> >  * No change.
> > ---
> >  drivers/reset/reset-rzg2l-usbphy-ctrl.c | 14 ++++++++++++--
> >  1 file changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> > b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> > index 84e745e49240..0803195080bd 100644
> > --- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> > +++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> > @@ -42,6 +42,7 @@ struct rzg2l_usbphy_ctrl_priv {  };
> >
> >  struct rzg2l_usbphy_ctrl_info {
> > +	const char *regulator_driver_name;
> 
> After patch 4, this will not be driver.name anymore.
> Maybe call this regulator_name or regulator_device_name?

OK. Will use regulator_name.

> 
> >  	bool pwrrdy;
> >  };
> >
> > @@ -110,15 +111,24 @@ static void rzg2l_usbphy_ctrl_init(struct rzg2l_usbphy_ctrl_priv *priv)
> >  	spin_unlock_irqrestore(&priv->lock, flags);  }
> >
> > -static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {};
> > +static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {
> > +	.regulator_driver_name = "rzg2l-vbus-regulator", };
> >
> >  static const struct rzg2l_usbphy_ctrl_info rzg3s_info = {
> > +	.regulator_driver_name = "rzg2l-vbus-regulator",
> > +	.pwrrdy = true,
> > +};
> > +
> > +static const struct rzg2l_usbphy_ctrl_info rzg3l_info = {
> > +	.regulator_driver_name = "rzg3l-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); @@ -245,7
> > +255,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);
> 
> Switching from "rzg2l-usb-vbus-regulator" to "rzg2l-vbus-regulator"
> breaks bisectability. Any reason not to just use "rzg2l-usb-vbus- regulator" and "rzg3l-usb-vbus-
> regulator"?

I had an issue in probing the device related to id_table match due to string length
restriction in [1], so adjusted the length to less than 24 chars.

Should I create a patch to increase the length to 32chars? Please let me know.

[1]https://elixir.bootlin.com/linux/v7.1.2/source/include/linux/mod_devicetable.h#L604

Cheers,
Biju

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

* RE: [PATCH v4 0/9] Add RZ/G3L USB2.0 host support
  2026-07-22 19:15 ` [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju Das
@ 2026-07-24 15:26   ` Biju Das
  0 siblings, 0 replies; 18+ messages in thread
From: Biju Das @ 2026-07-24 15:26 UTC (permalink / raw)
  To: Biju Das, biju.das.au, Philipp Zabel, Vinod Koul, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Michael Turquette, Stephen Boyd, Liam Girdwood, Mark Brown,
	magnus.damm, Bartosz Golaszewski
  Cc: Neil Armstrong, Yoshihiro Shimoda, linux-phy, devicetree,
	linux-kernel, linux-clk, linux-renesas-soc,
	Prabhakar Mahadev Lad, biju.das.au

Hi All,

> -----Original Message-----
> From: Biju Das <biju.das.jz@bp.renesas.com>
> Sent: 22 July 2026 20:15
> Subject: RE: [PATCH v4 0/9] Add RZ/G3L USB2.0 host support
> 
> Hi All,
> 
> > -----Original Message-----
> > From: Biju <biju.das.au@gmail.com>
> > Sent: 09 July 2026 09:31
> > Subject: [PATCH v4 0/9] Add RZ/G3L USB2.0 host support
> >
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > Hi All,
> >
> > This patch series aims to add USB2.0 host support for the RZ/G3L SMARC
> > EVK. 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. This series migrates regulator driver to use id-table so there is hard dependency between reset
> driver and regulator driver.
> >
> > Merge strategy:
> >   An Ack/Rb tag from Regulator Maintainer for patch#4.
> >   Patch #1,#2,#3,#4 - Reset subsystem
> >   Patch #5,#6,#7 - PHY subsystem
> >   Patch #8,#9 - Renesas SoC
> >
> > v3->v4:
> >  * Updated cover letter with merge strategy
> >  * Reorder the phy binding patch for easy merging.
> >  * Updated the commit description for patch #2,#3, #4.
> >  * Moved the handling of regulator_driver_name to patch #3
> >    in preparation for id_table match.
> >  * Migrated to id_table match using driver_name and reduced the length
> >    < 24.
> >  * Dropped rzg3l specific platform driver.
> >  * Dropped the tag for regulator driver,
> >  * Added id_table handling by introducing a common probe().
> > v2->v3:
> >  * Replaced items->enum in reset controller bindings.
> >  * Collected the tag for reset binding patch.
> >  * Dropped clock patch as it is accepted.
> > v1->v2:
> >  * Dropped patch#6(Introduce helper for regulator registration)
> >  * Passing pointer to an array of regulators to make it scalable.
> >  * Dropped regulator1-vbus and added a regulators group node.
> >  * Updated commit description for patch#1,#4,#6,#7,#8,#9 and #10.
> >  * Added enum instead of const in the compatible section.
> >  * Updated schema check.
> >  * Collected tag for PHY binding patch.
> >    in the regulator driver.
> >  * Added regulators group node and its children in SoC dtsi.
> >
> > Biju Das (9):
> >   dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support
> >   reset: rzg2l-usbphy-ctrl: Introduce info struct for match data
> >   reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
> >   regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator
> >     support
> >   dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings
> >   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      |  48 +++++++-
> >  arch/arm64/boot/dts/renesas/r9a08g046.dtsi    | 105 ++++++++++++++++++
> >  .../boot/dts/renesas/r9a08g046l48-smarc.dts   |  49 ++++++++
> >  drivers/phy/renesas/phy-rcar-gen3-usb2.c      |  20 ++--
> >  .../regulator/renesas-usb-vbus-regulator.c    |  74 +++++++++++-
> >  drivers/reset/reset-rzg2l-usbphy-ctrl.c       |  44 +++++---
> >  7 files changed, 316 insertions(+), 26 deletions(-)
> >
> > --
> > 2.43.0
> 
> Gentle ping.

Based on the feedback on [1],

I have modelled pwrrdy signal as power sequence driver and used
with DSI driver and it works fine. So, it should work with USB PHY control
driver as well.

So, there will binding change to dropping renesas,sysc-pwrrdy for RZ/G3L.
and the driver will use Power sequence driver for configuring Power ready signal.

What should I do for RZ/G3S as it uses renesas,sysc-pwrrdy? Should I leave like
as it is to avoid ABI breakage? Or do you want me to add backward compatibility?

Please let me know.

[1] https://lore.kernel.org/all/TY3PR01MB11346892D9619A8D1A6C2DF4A86CF2@TY3PR01MB11346.jpnprd01.prod.outlook.com/


Cheers,
Biju

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

* RE: [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
  2026-07-09  8:30 ` [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support Biju
  2026-07-23  9:18   ` Philipp Zabel
@ 2026-08-05 10:26   ` Biju Das
  2026-08-06  7:56     ` Philipp Zabel
  1 sibling, 1 reply; 18+ messages in thread
From: Biju Das @ 2026-08-05 10:26 UTC (permalink / raw)
  To: biju.das.au, Philipp Zabel, Geert Uytterhoeven, Mark Brown, magnus.damm
  Cc: linux-kernel, linux-renesas-soc, Prabhakar Mahadev Lad, biju.das.au

Hi Philipp Zabel,

> -----Original Message-----
> From: Biju <biju.das.au@gmail.com>
> Sent: 09 July 2026 09:31
> Subject: [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
> 
> 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 pwrrdy 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-vbus-
> regulator driver to handle the additional VBUSEN control for port 2. The regulator_driver_name field is
> used as the platform device name passed to platform_device_alloc(), and must exactly match the name the
> corresponding regulator driver registers via its id_table for platform bus matching to succeed.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v3->v4:
>  * Updated the commit description.
>  * Migrated to id_table match using driver_name and reduced the length
>    < 24.
> v2->v3:
>  * No change.
> v1->v2:
>  * No change.
> ---
>  drivers/reset/reset-rzg2l-usbphy-ctrl.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> index 84e745e49240..0803195080bd 100644
> --- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> +++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> @@ -42,6 +42,7 @@ struct rzg2l_usbphy_ctrl_priv {  };
> 
>  struct rzg2l_usbphy_ctrl_info {
> +	const char *regulator_driver_name;
>  	bool pwrrdy;
>  };
> 
> @@ -110,15 +111,24 @@ static void rzg2l_usbphy_ctrl_init(struct rzg2l_usbphy_ctrl_priv *priv)
>  	spin_unlock_irqrestore(&priv->lock, flags);  }
> 
> -static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {};
> +static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {
> +	.regulator_driver_name = "rzg2l-vbus-regulator", };
> 
>  static const struct rzg2l_usbphy_ctrl_info rzg3s_info = {
> +	.regulator_driver_name = "rzg2l-vbus-regulator",
> +	.pwrrdy = true,
> +};
> +
> +static const struct rzg2l_usbphy_ctrl_info rzg3l_info = {
> +	.regulator_driver_name = "rzg3l-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); @@ -245,7 +255,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);

Please let me know, should I send a patch to increase the length from 24->32 [1]
So that there won't be any backward compatibility issues.

[1] https://elixir.bootlin.com/linux/v7.1.2/source/include/linux/mod_devicetable.h#L604

[2] https://elixir.bootlin.com/linux/v7.1.2/source/drivers/base/platform.c#L1138

Cheers,
Biju
>  	if (!vdev) {
>  		error = -ENOMEM;
>  		goto err_pm_runtime_put;
> --
> 2.43.0


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

* Re: [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
  2026-08-05 10:26   ` Biju Das
@ 2026-08-06  7:56     ` Philipp Zabel
  2026-08-06  9:45       ` Biju Das
  0 siblings, 1 reply; 18+ messages in thread
From: Philipp Zabel @ 2026-08-06  7:56 UTC (permalink / raw)
  To: Biju Das, biju.das.au, Geert Uytterhoeven, Mark Brown, magnus.damm
  Cc: linux-kernel, linux-renesas-soc, Prabhakar Mahadev Lad

On Mi, 2026-08-05 at 10:26 +0000, Biju Das wrote:
> Hi Philipp Zabel,
> 
> > -----Original Message-----
> > From: Biju <biju.das.au@gmail.com>
> > Sent: 09 July 2026 09:31
> > Subject: [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
> > 
> > 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 pwrrdy 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-vbus-
> > regulator driver to handle the additional VBUSEN control for port 2. The regulator_driver_name field is
> > used as the platform device name passed to platform_device_alloc(), and must exactly match the name the
> > corresponding regulator driver registers via its id_table for platform bus matching to succeed.
> > 
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > v3->v4:
> >  * Updated the commit description.
> >  * Migrated to id_table match using driver_name and reduced the length
> >    < 24.
> > v2->v3:
> >  * No change.
> > v1->v2:
> >  * No change.
> > ---
> >  drivers/reset/reset-rzg2l-usbphy-ctrl.c | 14 ++++++++++++--
> >  1 file changed, 12 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> > index 84e745e49240..0803195080bd 100644
> > --- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> > +++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> > @@ -42,6 +42,7 @@ struct rzg2l_usbphy_ctrl_priv {  };
> > 
> >  struct rzg2l_usbphy_ctrl_info {
> > +	const char *regulator_driver_name;
> >  	bool pwrrdy;
> >  };
> > 
> > @@ -110,15 +111,24 @@ static void rzg2l_usbphy_ctrl_init(struct rzg2l_usbphy_ctrl_priv *priv)
> >  	spin_unlock_irqrestore(&priv->lock, flags);  }
> > 
> > -static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {};
> > +static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {
> > +	.regulator_driver_name = "rzg2l-vbus-regulator", };
> > 
> >  static const struct rzg2l_usbphy_ctrl_info rzg3s_info = {
> > +	.regulator_driver_name = "rzg2l-vbus-regulator",
> > +	.pwrrdy = true,
> > +};
> > +
> > +static const struct rzg2l_usbphy_ctrl_info rzg3l_info = {
> > +	.regulator_driver_name = "rzg3l-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); @@ -245,7 +255,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);
> 
> Please let me know, should I send a patch to increase the length from 24->32 [1]
> So that there won't be any backward compatibility issues.
> 
> [1] https://elixir.bootlin.com/linux/v7.1.2/source/include/linux/mod_devicetable.h#L604

I'm not sure.

PLATFORM_NAME_SIZE was last extended in commit 655862865c97
("mod_devicetable: Enlarge the maximum platform_device_id name
length"), but only very conservatively. Whether it is relevant that
platform_device_id fits into 32-byte cache line size of some
architectures, I can't say. The _NAME_SIZEs of other buses (aux, i2c,
spi, ...) already vary between 20 and 40 chars.

You could either try that, or you could prepend a single patch that
does the "rzg2l-usb-vbus-regulator" -> "rzg2l-vbus-regulator" rename in
both regulator and reset drivers and that could be merged into both
trees.


regards
Philipp

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

* RE: [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
  2026-08-06  7:56     ` Philipp Zabel
@ 2026-08-06  9:45       ` Biju Das
  0 siblings, 0 replies; 18+ messages in thread
From: Biju Das @ 2026-08-06  9:45 UTC (permalink / raw)
  To: Philipp Zabel, biju.das.au, Geert Uytterhoeven, Mark Brown, magnus.damm
  Cc: linux-kernel, linux-renesas-soc, Prabhakar Mahadev Lad

Hi Philipp,

> -----Original Message-----
> From: Philipp Zabel <p.zabel@pengutronix.de>
> Sent: 06 August 2026 08:56
> Subject: Re: [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
> 
> On Mi, 2026-08-05 at 10:26 +0000, Biju Das wrote:
> > Hi Philipp Zabel,
> >
> > > -----Original Message-----
> > > From: Biju <biju.das.au@gmail.com>
> > > Sent: 09 July 2026 09:31
> > > Subject: [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support
> > >
> > > 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 pwrrdy 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-vbus- regulator driver to handle the
> > > additional VBUSEN control for port 2. The regulator_driver_name
> > > field is used as the platform device name passed to platform_device_alloc(), and must exactly match
> the name the corresponding regulator driver registers via its id_table for platform bus matching to
> succeed.
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > ---
> > > v3->v4:
> > >  * Updated the commit description.
> > >  * Migrated to id_table match using driver_name and reduced the length
> > >    < 24.
> > > v2->v3:
> > >  * No change.
> > > v1->v2:
> > >  * No change.
> > > ---
> > >  drivers/reset/reset-rzg2l-usbphy-ctrl.c | 14 ++++++++++++--
> > >  1 file changed, 12 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> > > b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> > > index 84e745e49240..0803195080bd 100644
> > > --- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> > > +++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
> > > @@ -42,6 +42,7 @@ struct rzg2l_usbphy_ctrl_priv {  };
> > >
> > >  struct rzg2l_usbphy_ctrl_info {
> > > +	const char *regulator_driver_name;
> > >  	bool pwrrdy;
> > >  };
> > >
> > > @@ -110,15 +111,24 @@ static void rzg2l_usbphy_ctrl_init(struct rzg2l_usbphy_ctrl_priv *priv)
> > >  	spin_unlock_irqrestore(&priv->lock, flags);  }
> > >
> > > -static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {};
> > > +static const struct rzg2l_usbphy_ctrl_info rzg2l_info = {
> > > +	.regulator_driver_name = "rzg2l-vbus-regulator", };
> > >
> > >  static const struct rzg2l_usbphy_ctrl_info rzg3s_info = {
> > > +	.regulator_driver_name = "rzg2l-vbus-regulator",
> > > +	.pwrrdy = true,
> > > +};
> > > +
> > > +static const struct rzg2l_usbphy_ctrl_info rzg3l_info = {
> > > +	.regulator_driver_name = "rzg3l-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); @@ -245,7
> > > +255,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);
> >
> > Please let me know, should I send a patch to increase the length from
> > 24->32 [1] So that there won't be any backward compatibility issues.
> >
> > [1]
> > https://elixir.bootlin.com/linux/v7.1.2/source/include/linux/mod_devic
> > etable.h#L604
> 
> I'm not sure.
> 
> PLATFORM_NAME_SIZE was last extended in commit 655862865c97
> ("mod_devicetable: Enlarge the maximum platform_device_id name length"), but only very conservatively.
> Whether it is relevant that platform_device_id fits into 32-byte cache line size of some architectures, I
> can't say. The _NAME_SIZEs of other buses (aux, i2c, spi, ...) already vary between 20 and 40 chars.

Thanks for the pointer. 

> 
> You could either try that, or you could prepend a single patch that does the "rzg2l-usb-vbus-regulator" -
> > "rzg2l-vbus-regulator" rename in both regulator and reset drivers and that could be merged into both
> trees.


After reading commit message in 655862865c97 [1], the size is
restricted to 32 bytes. So, I will prepare a single patch that
does the "rzg2l-usb-vbus-regulator" ->"rzg2l-vbus-regulator" rename
in both regulator and reset drivers.

[1]
struct platform_device_id {
            char                       name[20];             /*     0    20 */
    
            /* XXX 4 bytes hole, try to pack */
    
            kernel_ulong_t             driver_data;          /*    24     8 */
    
            /* size: 32, cachelines: 1, members: 2 */
            /* sum members: 28, holes: 1, sum holes: 4 */
            /* last cacheline: 32 bytes */
    };

Cheers,
Biju

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

end of thread, other threads:[~2026-08-06  9:45 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-09  8:30 [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju
2026-07-09  8:30 ` [PATCH v4 1/9] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3L support Biju
2026-07-09  8:30 ` [PATCH v4 2/9] reset: rzg2l-usbphy-ctrl: Introduce info struct for match data Biju
2026-07-09  8:30 ` [PATCH v4 3/9] reset: rzg2l-usbphy-ctrl: Add RZ/G3L support Biju
2026-07-23  9:18   ` Philipp Zabel
2026-07-23  9:29     ` Biju Das
2026-08-05 10:26   ` Biju Das
2026-08-06  7:56     ` Philipp Zabel
2026-08-06  9:45       ` Biju Das
2026-07-09  8:30 ` [PATCH v4 4/9] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support Biju
2026-07-10 17:03   ` Mark Brown
2026-07-09  8:30 ` [PATCH v4 5/9] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings Biju
2026-07-09  8:30 ` [PATCH v4 6/9] phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support Biju
2026-07-09  8:31 ` [PATCH v4 7/9] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator Biju
2026-07-09  8:31 ` [PATCH v4 8/9] arm64: dts: renesas: r9a08g046: Add USB2.0 device nodes Biju
2026-07-09  8:31 ` [PATCH v4 9/9] arm64: dts: renesas: r9a08g046l48-smarc: Add USB2.0 support Biju
2026-07-22 19:15 ` [PATCH v4 0/9] Add RZ/G3L USB2.0 host support Biju Das
2026-07-24 15:26   ` Biju Das

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®