All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller
@ 2026-08-06  5:03 Marek Vasut
  2026-08-06  5:03 ` [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Marek Vasut @ 2026-08-06  5:03 UTC (permalink / raw)
  To: linux-usb
  Cc: Marek Vasut, Conor Dooley, Geert Uytterhoeven, Greg Kroah-Hartman,
	Krzysztof Kozlowski, Rob Herring, Thinh Nguyen, devicetree,
	linux-kernel, linux-renesas-soc

The Renesas R-Car Gen5 SoC contains multiple instances of DWC3 USB
controller with glue logic wrapper around them. Document the glue
logic and DWC3 controller.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-usb@vger.kernel.org
---
V2: Rework to use flat bindings for generic plat driver
---
 .../bindings/usb/renesas,rcar-gen5-dwc3.yaml  | 79 +++++++++++++++++++
 1 file changed, 79 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/renesas,rcar-gen5-dwc3.yaml

diff --git a/Documentation/devicetree/bindings/usb/renesas,rcar-gen5-dwc3.yaml b/Documentation/devicetree/bindings/usb/renesas,rcar-gen5-dwc3.yaml
new file mode 100644
index 0000000000000..9f48f90d6df85
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/renesas,rcar-gen5-dwc3.yaml
@@ -0,0 +1,79 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/renesas,rcar-gen5-dwc3.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas R-Car Gen5 DWC3 xHCI USB controller
+
+maintainers:
+  - Marek Vasut <marek.vasut+renesas@mailbox.org>
+
+properties:
+  compatible:
+    items:
+      - const: renesas,r8a78000-dwc3
+      - const: renesas,rcar-gen5-dwc3
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: dwc3
+      - const: glue
+
+  clocks:
+    maxItems: 1
+
+  dr_mode:
+    enum: [ host, otg, peripheral ]
+
+  interrupts:
+    maxItems: 1
+
+  maximum-speed:
+    enum: [ super-speed-plus, super-speed, high-speed ]
+
+  phys:
+    maxItems: 1
+
+  phy-names:
+    enum: [ usb2-phy, usb3-phy ]
+
+  power-domains:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - interrupts
+  - maximum-speed
+  - phys
+  - phy-names
+  - power-domains
+  - resets
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    usb@c8800000 {
+        compatible = "renesas,r8a78000-dwc3", "renesas,rcar-gen5-dwc3";
+        reg = <0xc8800000 0x100000>, <0xc9c54000 0x2000>;
+        reg-names = "dwc3", "glue";
+        clocks = <&scmi_clk 336>;
+        interrupts = <GIC_SPI 795 IRQ_TYPE_LEVEL_HIGH>;
+        maximum-speed = "super-speed-plus";
+        phys = <&mp_phy 2>;
+        phy-names = "usb3-phy";
+        power-domains = <&scmi_devpd 16>;
+        resets = <&scmi_reset 336>;
+    };
-- 
2.53.0


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

* [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue
  2026-08-06  5:03 [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller Marek Vasut
@ 2026-08-06  5:03 ` Marek Vasut
  2026-08-06  5:13   ` sashiko-bot
  2026-08-07 23:31   ` Thinh Nguyen
  2026-08-06  5:14 ` [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller sashiko-bot
  2026-08-08  4:21 ` Marek Vasut
  2 siblings, 2 replies; 7+ messages in thread
From: Marek Vasut @ 2026-08-06  5:03 UTC (permalink / raw)
  To: linux-usb
  Cc: Thanh Quan, Marek Vasut, Conor Dooley, Geert Uytterhoeven,
	Greg Kroah-Hartman, Krzysztof Kozlowski, Rob Herring,
	Thinh Nguyen, devicetree, linux-kernel, linux-renesas-soc

From: Thanh Quan <thanh.quan.xn@renesas.com>

The Renesas R-Car Gen5 SoC contains multiple instances of DWC3 USB
controller with glue logic wrapper around them. Extend the generic
DWC3 platform driver with Renesas R-Car Gen5 glue logic specifics.

Signed-off-by: Thanh Quan <thanh.quan.xn@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-usb@vger.kernel.org
---
V2: Extend dwc3-generic-plat driver instead
---
 drivers/usb/dwc3/dwc3-generic-plat.c | 52 ++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c
index ca69ac0eb07ce..518bb40d1372c 100644
--- a/drivers/usb/dwc3/dwc3-generic-plat.c
+++ b/drivers/usb/dwc3/dwc3-generic-plat.c
@@ -71,6 +71,52 @@ static int dwc3_eic7700_init(struct dwc3_generic *dwc3g)
 	return 0;
 }
 
+static int dwc3_renesas_rcar_gen5_init(struct dwc3_generic *dwc3g)
+{
+	struct device *dev = dwc3g->dev;
+	struct platform_device *pdev = to_platform_device(dev);
+	const char *maximum_speed;
+	bool use_usb3_flow;
+	void __iomem *glue;
+	int ret;
+
+	glue = devm_platform_ioremap_resource_byname(pdev, "glue");
+	if (IS_ERR(glue))
+		return PTR_ERR(glue);
+
+	ret = of_property_read_string(dev->of_node, "maximum-speed", &maximum_speed);
+	if (ret)
+		return dev_err_probe(dev, -ENODEV, "Failed to determine maximum speed\n");
+
+	use_usb3_flow = !strcmp(maximum_speed, "super-speed-plus") ||
+			!strcmp(maximum_speed, "super-speed");
+
+	/*
+	 * The datasheet describes initialization procedure without full
+	 * information about the registers. Therefore, the source code is
+	 * based on the bare metal code shared by the board team.
+	 */
+	writew(0x211, glue + 0x26);
+
+	/* USB3 does not need additional register programming. */
+	if (use_usb3_flow)
+		return 0;
+
+	writew(0x11, glue + 0x81c);
+	writew(0x0, glue + 0x81a);
+	writew(0x1, glue + 0x802);
+
+	usleep_range(10000, 20000);
+
+	writew(0x0, glue + 0x802);
+	writew(0x1, glue + 0x2a);
+	writew(0x1, glue + 0x81a);
+
+	usleep_range(10000, 20000);
+
+	return 0;
+}
+
 static int dwc3_spacemit_k1_init(struct dwc3_generic *dwc3g)
 {
 	struct device *dev = dwc3g->dev;
@@ -231,11 +277,17 @@ static const struct dwc3_generic_config eic7700_dwc3 =  {
 	.properties = DWC3_DEFAULT_PROPERTIES,
 };
 
+static const struct dwc3_generic_config renesas_rcar_gen5_dwc3 = {
+	.init = dwc3_renesas_rcar_gen5_init,
+	.properties = DWC3_DEFAULT_PROPERTIES,
+};
+
 static const struct of_device_id dwc3_generic_of_match[] = {
 	{ .compatible = "spacemit,k1-dwc3", &spacemit_k1_dwc3},
 	{ .compatible = "spacemit,k3-dwc3", },
 	{ .compatible = "fsl,ls1028a-dwc3", &fsl_ls1028_dwc3},
 	{ .compatible = "eswin,eic7700-dwc3", &eic7700_dwc3},
+	{ .compatible = "renesas,rcar-gen5-dwc3", &renesas_rcar_gen5_dwc3},
 	{ .compatible = "starfive,jhb100-dwc3", },
 	{ /* sentinel */ }
 };
-- 
2.53.0


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

* Re: [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue
  2026-08-06  5:03 ` [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue Marek Vasut
@ 2026-08-06  5:13   ` sashiko-bot
  2026-08-07 23:31   ` Thinh Nguyen
  1 sibling, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-08-06  5:13 UTC (permalink / raw)
  To: Marek Vasut; +Cc: devicetree, robh, wsa+renesas, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The Renesas R-Car Gen5 glue register initialization performed during probe is not restored during system or runtime resume, leading to silent hardware state loss after a suspend cycle.
--

--- Patch [2]: [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue ---
commit 211fb3fb7a52e528bcd297e2261a315030e4d2c9
Author: Thanh Quan <thanh.quan.xn@renesas.com>

usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue

This commit extends the generic DWC3 platform driver to support the Renesas
R-Car Gen5 glue logic. It adds platform-specific initialization for the
glue registers based on the maximum speed property.

> diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c
> index ca69ac0eb07ce..518bb40d1372c 100644
> --- a/drivers/usb/dwc3/dwc3-generic-plat.c
> +++ b/drivers/usb/dwc3/dwc3-generic-plat.c

[ ... ]

> @@ -71,6 +71,52 @@ static int dwc3_eic7700_init(struct dwc3_generic *dwc3g)
>  	return 0;
>  }
>  
> +static int dwc3_renesas_rcar_gen5_init(struct dwc3_generic *dwc3g)
> +{
> +	struct device *dev = dwc3g->dev;
> +	struct platform_device *pdev = to_platform_device(dev);
> +	const char *maximum_speed;
> +	bool use_usb3_flow;
> +	void __iomem *glue;
> +	int ret;
> +
> +	glue = devm_platform_ioremap_resource_byname(pdev, "glue");
> +	if (IS_ERR(glue))
> +		return PTR_ERR(glue);
> +
> +	ret = of_property_read_string(dev->of_node, "maximum-speed", &maximum_speed);
> +	if (ret)
> +		return dev_err_probe(dev, -ENODEV, "Failed to determine maximum speed\n");
> +
> +	use_usb3_flow = !strcmp(maximum_speed, "super-speed-plus") ||
> +			!strcmp(maximum_speed, "super-speed");
> +
> +	/*
> +	 * The datasheet describes initialization procedure without full
> +	 * information about the registers. Therefore, the source code is
> +	 * based on the bare metal code shared by the board team.
> +	 */
> +	writew(0x211, glue + 0x26);
> +
> +	/* USB3 does not need additional register programming. */
> +	if (use_usb3_flow)
> +		return 0;
> +
> +	writew(0x11, glue + 0x81c);
> +	writew(0x0, glue + 0x81a);
> +	writew(0x1, glue + 0x802);
> +
> +	usleep_range(10000, 20000);
> +
> +	writew(0x0, glue + 0x802);
> +	writew(0x1, glue + 0x2a);
> +	writew(0x1, glue + 0x81a);

[Severity: High]
Does this code lose the glue register state across power management suspend
and resume cycles?

Looking at dwc3_generic_resume() in the same file, the generic resume handler
reenables clocks and calls dwc3_pm_resume(), but it lacks any mechanism to
invoke platform-specific glue re-initialization (such as a resume callback in
struct dwc3_generic_config).

Since these stateful MMIO registers are configured exactly once during
dwc3_renesas_rcar_gen5_init() and never restored upon resume, it seems the USB
controller glue registers will silently lose their state when the power domain
is cycled during system suspend or runtime PM suspend.

Will this cause USB functionality (especially the USB2 flow) to break upon
wake?

> +
> +	usleep_range(10000, 20000);
> +
> +	return 0;
> +}
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260806050422.324435-1-marek.vasut+renesas@mailbox.org?part=2

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

* Re: [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller
  2026-08-06  5:03 [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller Marek Vasut
  2026-08-06  5:03 ` [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue Marek Vasut
@ 2026-08-06  5:14 ` sashiko-bot
  2026-08-08  4:21 ` Marek Vasut
  2 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-08-06  5:14 UTC (permalink / raw)
  To: Marek Vasut; +Cc: wsa+renesas, conor+dt, devicetree, robh

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] The compatible string list does not include the generic 'snps,dwc3' fallback required for the generic platform driver to probe.
- [Medium] The flat DWC3 controller binding fails to reference the common DWC3 schema and incorrectly uses `additionalProperties: false`, which explicitly rejects standard DWC3 and USB properties.
- [Low] The `phy-names` property uses a scalar `enum` on an array type, which causes a JSON schema type mismatch.
--

--- Patch [1]: [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller ---
commit 4cc09ce41f0476bc2f778f2624aafad6ed1dfffc
Author: Marek Vasut <marek.vasut+renesas@mailbox.org>

dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller

This commit introduces the device tree binding documentation for the Renesas 
R-Car Gen5 DWC3 USB controller. It specifies the properties required for the 
glue logic and the controller itself, using a flat binding approach.

> diff --git a/Documentation/devicetree/bindings/usb/renesas,rcar-gen5-dwc3.yaml b/Documentation/devicetree/bindings/usb/renesas,rcar-gen5-dwc3.yaml
> new file mode 100644
> index 0000000000000..9f48f90d6df85
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/renesas,rcar-gen5-dwc3.yaml
> @@ -0,0 +1,79 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/usb/renesas,rcar-gen5-dwc3.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Renesas R-Car Gen5 DWC3 xHCI USB controller
> +
> +maintainers:
> +  - Marek Vasut <marek.vasut+renesas@mailbox.org>
> +
> +properties:
> +  compatible:
> +    items:
> +      - const: renesas,r8a78000-dwc3
> +      - const: renesas,rcar-gen5-dwc3

[Severity: High]
Is the generic snps,dwc3 fallback required in this compatible string list?

The commit message notes this is a flat binding for the generic platform
driver, but omitting the mandatory snps,dwc3 fallback restricts the schema
to exactly these two items.

Without the generic fallback, the generic DWC3 driver in
drivers/usb/dwc3/core.c will not recognize the Renesas-specific compatible
string. This regression will cause the USB controller to silently fail to
probe when booting with this schema.

[ ... ]

> +  phys:
> +    maxItems: 1
> +
> +  phy-names:
> +    enum: [ usb2-phy, usb3-phy ]

[Severity: Low]
Will applying a scalar enum directly to the phy-names property cause a JSON
schema type mismatch during validation?

Because phy-names is typed as a string-array by the core device tree schemas,
limiting its items with a direct enum implies the array itself must identically
match one of the string elements. This type mismatch introduces a regression
leading to validation errors during dt_binding_check.

Should this be defined using items: enum: [ usb2-phy, usb3-phy ] instead?

[ ... ]

> +required:
> +  - compatible
> +  - reg
> +  - reg-names
> +  - clocks
> +  - interrupts
> +  - maximum-speed
> +  - phys
> +  - phy-names
> +  - power-domains
> +  - resets
> +
> +additionalProperties: false

[Severity: Medium]
By setting additionalProperties to false without a reference to the core DWC3
schema, are we blocking all standard DWC3 and USB properties?

If a device tree attempts to use standard DWC3 properties like
snps,dis_u2_susphy_quirk or usb-role-switch, the schema validation phase
(dt_binding_check) will reject them because only explicitly listed properties
are allowed.

Could a reference like $ref: snps,dwc3.yaml# be missing here to allow the
flat binding to accept generic properties?

> +
> +examples:

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260806050422.324435-1-marek.vasut+renesas@mailbox.org?part=1

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

* Re: [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue
  2026-08-06  5:03 ` [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue Marek Vasut
  2026-08-06  5:13   ` sashiko-bot
@ 2026-08-07 23:31   ` Thinh Nguyen
  2026-08-08  4:15     ` Marek Vasut
  1 sibling, 1 reply; 7+ messages in thread
From: Thinh Nguyen @ 2026-08-07 23:31 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-usb@vger.kernel.org, Thanh Quan, Conor Dooley,
	Geert Uytterhoeven, Greg Kroah-Hartman, Krzysztof Kozlowski,
	Rob Herring, Thinh Nguyen, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org

On Thu, Aug 06, 2026, Marek Vasut wrote:
> From: Thanh Quan <thanh.quan.xn@renesas.com>
> 
> The Renesas R-Car Gen5 SoC contains multiple instances of DWC3 USB
> controller with glue logic wrapper around them. Extend the generic
> DWC3 platform driver with Renesas R-Car Gen5 glue logic specifics.
> 
> Signed-off-by: Thanh Quan <thanh.quan.xn@renesas.com>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: Conor Dooley <conor+dt@kernel.org>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> Cc: devicetree@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-renesas-soc@vger.kernel.org
> Cc: linux-usb@vger.kernel.org
> ---
> V2: Extend dwc3-generic-plat driver instead

Great! This seems to fit in nicely for dwc3-generic-plat.

> ---
>  drivers/usb/dwc3/dwc3-generic-plat.c | 52 ++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c
> index ca69ac0eb07ce..518bb40d1372c 100644
> --- a/drivers/usb/dwc3/dwc3-generic-plat.c
> +++ b/drivers/usb/dwc3/dwc3-generic-plat.c
> @@ -71,6 +71,52 @@ static int dwc3_eic7700_init(struct dwc3_generic *dwc3g)
>  	return 0;
>  }
>  
> +static int dwc3_renesas_rcar_gen5_init(struct dwc3_generic *dwc3g)
> +{
> +	struct device *dev = dwc3g->dev;
> +	struct platform_device *pdev = to_platform_device(dev);
> +	const char *maximum_speed;
> +	bool use_usb3_flow;
> +	void __iomem *glue;
> +	int ret;
> +
> +	glue = devm_platform_ioremap_resource_byname(pdev, "glue");
> +	if (IS_ERR(glue))
> +		return PTR_ERR(glue);
> +
> +	ret = of_property_read_string(dev->of_node, "maximum-speed", &maximum_speed);
> +	if (ret)
> +		return dev_err_probe(dev, -ENODEV, "Failed to determine maximum speed\n");

We shouldn't overload the generic "maximum-speed" definition.

Can we check for the presence of the "usb3-phy" instead?

BR,
Thinh

> +
> +	use_usb3_flow = !strcmp(maximum_speed, "super-speed-plus") ||
> +			!strcmp(maximum_speed, "super-speed");
> +
> +	/*
> +	 * The datasheet describes initialization procedure without full
> +	 * information about the registers. Therefore, the source code is
> +	 * based on the bare metal code shared by the board team.
> +	 */
> +	writew(0x211, glue + 0x26);
> +
> +	/* USB3 does not need additional register programming. */
> +	if (use_usb3_flow)
> +		return 0;
> +
> +	writew(0x11, glue + 0x81c);
> +	writew(0x0, glue + 0x81a);
> +	writew(0x1, glue + 0x802);
> +
> +	usleep_range(10000, 20000);
> +
> +	writew(0x0, glue + 0x802);
> +	writew(0x1, glue + 0x2a);
> +	writew(0x1, glue + 0x81a);
> +
> +	usleep_range(10000, 20000);
> +
> +	return 0;
> +}
> +
>  static int dwc3_spacemit_k1_init(struct dwc3_generic *dwc3g)
>  {
>  	struct device *dev = dwc3g->dev;
> @@ -231,11 +277,17 @@ static const struct dwc3_generic_config eic7700_dwc3 =  {
>  	.properties = DWC3_DEFAULT_PROPERTIES,
>  };
>  
> +static const struct dwc3_generic_config renesas_rcar_gen5_dwc3 = {
> +	.init = dwc3_renesas_rcar_gen5_init,
> +	.properties = DWC3_DEFAULT_PROPERTIES,
> +};
> +
>  static const struct of_device_id dwc3_generic_of_match[] = {
>  	{ .compatible = "spacemit,k1-dwc3", &spacemit_k1_dwc3},
>  	{ .compatible = "spacemit,k3-dwc3", },
>  	{ .compatible = "fsl,ls1028a-dwc3", &fsl_ls1028_dwc3},
>  	{ .compatible = "eswin,eic7700-dwc3", &eic7700_dwc3},
> +	{ .compatible = "renesas,rcar-gen5-dwc3", &renesas_rcar_gen5_dwc3},
>  	{ .compatible = "starfive,jhb100-dwc3", },
>  	{ /* sentinel */ }
>  };
> -- 
> 2.53.0
> 

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

* Re: [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue
  2026-08-07 23:31   ` Thinh Nguyen
@ 2026-08-08  4:15     ` Marek Vasut
  0 siblings, 0 replies; 7+ messages in thread
From: Marek Vasut @ 2026-08-08  4:15 UTC (permalink / raw)
  To: Thinh Nguyen
  Cc: linux-usb@vger.kernel.org, Thanh Quan, Conor Dooley,
	Geert Uytterhoeven, Greg Kroah-Hartman, Krzysztof Kozlowski,
	Rob Herring, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org

On 8/8/26 1:31 AM, Thinh Nguyen wrote:

Hello Thinh,

>> The Renesas R-Car Gen5 SoC contains multiple instances of DWC3 USB
>> controller with glue logic wrapper around them. Extend the generic
>> DWC3 platform driver with Renesas R-Car Gen5 glue logic specifics.
>>
>> Signed-off-by: Thanh Quan <thanh.quan.xn@renesas.com>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

[...]

>> V2: Extend dwc3-generic-plat driver instead
> 
> Great! This seems to fit in nicely for dwc3-generic-plat.

Indeed, this is nice.

[...]

>> +static int dwc3_renesas_rcar_gen5_init(struct dwc3_generic *dwc3g)
>> +{
>> +	struct device *dev = dwc3g->dev;
>> +	struct platform_device *pdev = to_platform_device(dev);
>> +	const char *maximum_speed;
>> +	bool use_usb3_flow;
>> +	void __iomem *glue;
>> +	int ret;
>> +
>> +	glue = devm_platform_ioremap_resource_byname(pdev, "glue");
>> +	if (IS_ERR(glue))
>> +		return PTR_ERR(glue);
>> +
>> +	ret = of_property_read_string(dev->of_node, "maximum-speed", &maximum_speed);
>> +	if (ret)
>> +		return dev_err_probe(dev, -ENODEV, "Failed to determine maximum speed\n");
> 
> We shouldn't overload the generic "maximum-speed" definition.
> 
> Can we check for the presence of the "usb3-phy" instead?
This could be made to work, but I don't think this would work nicely, 
please see below.

The Gen5 contains four DWC3 controllers, two are USB2-only and two are 
combined USB2+USB3.2 ; the USB2-only controllers each use one PHY, the 
USB2+USB3.2 controllers each use two PHYs -- one USB2 and one USB3 PHY.
-> The PHYs are always present and always connected inside the SoC, so I
    believe the PHYs should always be described in the SoC DT, and the
    DWC3 controller node should always have phandle(s) to its matching
    PHYs.

The USB2-only controllers are a non-issue, there we could get away with 
checking for the presence of "usb3-phy" and if this is missing in DT, 
apply the magic code ("use_usb3_flow" is always false).

It is the USB2+USB3.2 controllers that are more complicated. These 
controllers can be downgraded to USB2-only mode. Currently, this is done 
via this "maximum-speed" DT property, which, if set to "high-speed" or 
lower triggers the application of the magic code. If the "maximum-speed" 
DT property is "super-speed" or "super-speed-plus", the magic code is 
not applied (this is the "use_usb3_flow").

If we were to opt for checking for presence of "usb3-phy" , then the 
board DTs (which include the SoC DT) for board which would require the 
USB2+USB3.2 controller to be downgraded to USB2-only mode would have to 
adjust the PHY phandles of such controller DT node in board DT, which 
itself does not seem right (DT describes the SoC hardware, and the PHY 
is still in the SoC and connected to the controller, please see "->" above).

That is why using "maximum-speed" is I think a bit better.

But maybe there is yet another option that I missed ?

Thank you for your help !

-- 
Best regards,
Marek Vasut

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

* Re: [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller
  2026-08-06  5:03 [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller Marek Vasut
  2026-08-06  5:03 ` [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue Marek Vasut
  2026-08-06  5:14 ` [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller sashiko-bot
@ 2026-08-08  4:21 ` Marek Vasut
  2 siblings, 0 replies; 7+ messages in thread
From: Marek Vasut @ 2026-08-08  4:21 UTC (permalink / raw)
  To: linux-usb
  Cc: Conor Dooley, Geert Uytterhoeven, Greg Kroah-Hartman,
	Krzysztof Kozlowski, Rob Herring, Thinh Nguyen, devicetree,
	linux-kernel, linux-renesas-soc

On 8/6/26 7:03 AM, Marek Vasut wrote:

[...]

> +  phys:
> +    maxItems: 1
> +
> +  phy-names:
> +    enum: [ usb2-phy, usb3-phy ]
I will be adding this change here and will send V3:

    phys:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2

    phy-names:
-    enum: [ usb2-phy, usb3-phy ]
+    minItems: 1
+    items:
+      - const: usb2-phy
+      - const: usb3-phy


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

end of thread, other threads:[~2026-08-08  4:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06  5:03 [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller Marek Vasut
2026-08-06  5:03 ` [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue Marek Vasut
2026-08-06  5:13   ` sashiko-bot
2026-08-07 23:31   ` Thinh Nguyen
2026-08-08  4:15     ` Marek Vasut
2026-08-06  5:14 ` [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller sashiko-bot
2026-08-08  4:21 ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.