Skip to contentSkip to conversation

usb: dwc3: add Realtek DHC RTD SoC dwc3 glue layer driver

PATCH Superseded Stanley Chang 4 participants 9 messages Jul 28, 2023 – Aug 3, 2023

Subsystems (3)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 usb: dwc3: add Realtek DHC RTD SoC dwc3 glue layer driver

Realtek DHC RTD SoCs integrate dwc3 IP and has some customizations to support different generations of SoCs.

---
 drivers/usb/dwc3/Kconfig    |  10 +
 drivers/usb/dwc3/Makefile   |   1 +
 drivers/usb/dwc3/dwc3-rtk.c | 502 ++++++++++++++++++++++++++++++++++++
 3 files changed, 513 insertions(+)
 create mode 100644 drivers/usb/dwc3/dwc3-rtk.c
drivers/usb/dwc3/Kconfig +10 -0
index be954a9abbe0..4b9e22fe6bc3 100644
@@ -168,4 +168,14 @@ config USB_DWC3_AM62
 	  The Designware Core USB3 IP is programmed to operate in
 	  in USB 2.0 mode only.
 	  Say 'Y' or 'M' here if you have one such device
+
+config USB_DWC3_RTK
+	tristate "Realtek DWC3 Platform Driver"
+	default USB_DWC3
+	help
+	  RTK DHC RTD SoCs with DesignWare Core USB3 IP inside,
+	  and IP Core configured for USB 2.0 and USB 3.0 in host
+	  or dual-role mode.
+	  Say 'Y' or 'M' if you have such device.
+
 endif
drivers/usb/dwc3/Makefile +1 -0
index 9f66bd82b639..38d19e4369a5 100644
@@ -54,3 +54,4 @@ obj-$(CONFIG_USB_DWC3_ST)		+= dwc3-st.o
 obj-$(CONFIG_USB_DWC3_QCOM)		+= dwc3-qcom.o
 obj-$(CONFIG_USB_DWC3_IMX8MP)		+= dwc3-imx8mp.o
 obj-$(CONFIG_USB_DWC3_XILINX)		+= dwc3-xilinx.o
+obj-$(CONFIG_USB_DWC3_RTK)		+= dwc3-rtk.o
drivers/usb/dwc3/dwc3-rtk.c new file +502 -0

502 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 doc: dt: bindings: usb: realtek,dwc3: Add Realtek DHC RTD SoC DWC3 USB

Document the DWC3 USB bindings for Realtek SoCs.

---
 .../devicetree/bindings/usb/realtek,dwc3.yaml | 107 ++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/realtek,dwc3.yaml
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +107 -0
new file mode 100644
index 000000000000..74d388809924
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Realtek Semiconductor Corporation
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/usb/realtek,dwc3.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Realtek DWC3 USB SoC Controller Glue
+
+maintainers:
+  - Stanley Chang <[email protected]>
+
+description:
+  The Realtek DHC SoC embeds a DWC3 USB IP Core configured for USB 2.0
+  and USB 3.0 in host or dual-role mode.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - realtek,rtd1295-dwc3
+          - realtek,rtd1315e-dwc3
+          - realtek,rtd1319-dwc3
+          - realtek,rtd1319d-dwc3
+          - realtek,rtd1395-dwc3
+          - realtek,rtd1619-dwc3
+          - realtek,rtd1619b-dwc3
+      - const: realtek,rtd-dwc3
+
+  reg:
+    maxItems: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 1
+
+  ranges: true
+
+  realtek,unlink-usb3-port:
+    description: Disable link between USB 3.0 PHY and USB mac.
+      Only for RTD1619 SoC, if the board design support maximum 2.0 speed.
+    type: boolean
+
+  realtek,disable-usb3-phy:
+    description: Close USB 3.0 PHY if the board design not support USB 3.0.
+    type: boolean
+
+  realtek,enable-l4icg:
+    description: Enable the power saving feature l4icg by hardware clock.
+      gating.
+    type: boolean
+
+patternProperties:
+  "^usb@[0-9a-f]+$":
+    $ref: snps,dwc3.yaml#
+    description: Required child node
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+  - ranges
+
+allOf:
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - realtek,rtd1619-dwc3
+    then:
+      properties:
+        realtek,unlink-usb3-port: false
+
+additionalProperties: false
+
+examples:
+  - |
+    usb@98013e00 {
+        compatible = "realtek,rtd1319d-dwc3", "realtek,rtd-dwc3";
+        reg = <0x98013e00 0x200>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+        status = "okay";
+        realtek,disable-usb3-phy;
+        realtek,enable-l4icg;
+
+        usb@98050000 {
+            compatible = "snps,dwc3";
+            reg = <0x98050000 0x9000>;
+            interrupts = <0 94 4>;
+            phys = <&usb2phy &usb3phy>;
+            phy-names = "usb2-phy", "usb3-phy";
+            dr_mode = "otg";
+            usb-role-switch;
+            role-switch-default-mode = "host";
+            snps,dis_u2_susphy_quirk;
+            snps,parkmode-disable-ss-quirk;
+            snps,parkmode-disable-hs-quirk;
+            maximum-speed = "high-speed";
+        };
+    };
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v1 2/2] doc: dt: bindings: usb: realtek,dwc3: Add Realtek DHC RTD SoC DWC3 USB

Quoted 1 line · Stanley Chang

Document the DWC3 USB bindings for Realtek SoCs.

Please use subject prefixes matching the subsystem. You can get them for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching.

My filtering of emails depends on it.

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml

Quoted 8 lines
---
 .../devicetree/bindings/usb/realtek,dwc3.yaml | 107 ++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/realtek,dwc3.yaml
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml +0 -0

realtek,rtd-dwc3.yaml

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 6

Quoted 11 lines

new file mode 100644
index 000000000000..74d388809924

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +6 -0
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Realtek Semiconductor Corporation
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/usb/realtek,dwc3.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"

Drop quotes. Wasn't tested, because dtschema reports warnings here...

Quoted 36 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +36 -0
+
+title: Realtek DWC3 USB SoC Controller Glue
+
+maintainers:
+  - Stanley Chang <[email protected]>
+
+description:
+  The Realtek DHC SoC embeds a DWC3 USB IP Core configured for USB 2.0
+  and USB 3.0 in host or dual-role mode.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - realtek,rtd1295-dwc3
+          - realtek,rtd1315e-dwc3
+          - realtek,rtd1319-dwc3
+          - realtek,rtd1319d-dwc3
+          - realtek,rtd1395-dwc3
+          - realtek,rtd1619-dwc3
+          - realtek,rtd1619b-dwc3
+      - const: realtek,rtd-dwc3
+
+  reg:
+    maxItems: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 1
+
+  ranges: true
+
+  realtek,unlink-usb3-port:
+    description: Disable link between USB 3.0 PHY and USB mac.

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 52

Quoted 10 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +10 -0
+      Only for RTD1619 SoC, if the board design support maximum 2.0 speed.
+    type: boolean
+
+  realtek,disable-usb3-phy:
+    description: Close USB 3.0 PHY if the board design not support USB 3.0.
+    type: boolean
+
+  realtek,enable-l4icg:
+    description: Enable the power saving feature l4icg by hardware clock.
+      gating.

You described the desired Linux feature or behavior, not the actual hardware. The bindings are about the latter, so instead you need to rephrase the property and its description to match actual hardware capabilities/features/configuration etc.

Quoted 27 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +27 -0
+    type: boolean
+
+patternProperties:
+  "^usb@[0-9a-f]+$":
+    $ref: snps,dwc3.yaml#
+    description: Required child node
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+  - ranges
+
+allOf:
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - realtek,rtd1619-dwc3
+    then:
+      properties:
+        realtek,unlink-usb3-port: false
+
+additionalProperties: false

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 89

Quoted 10 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +10 -0
+
+examples:
+  - |
+    usb@98013e00 {
+        compatible = "realtek,rtd1319d-dwc3", "realtek,rtd-dwc3";
+        reg = <0x98013e00 0x200>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+        status = "okay";

Drop status.

Quoted 8 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +8 -0
+        realtek,disable-usb3-phy;
+        realtek,enable-l4icg;
+
+        usb@98050000 {
+            compatible = "snps,dwc3";
+            reg = <0x98050000 0x9000>;
+            interrupts = <0 94 4>;
+            phys = <&usb2phy &usb3phy>;

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 107

Quoted 10 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +10 -0
+            phy-names = "usb2-phy", "usb3-phy";
+            dr_mode = "otg";
+            usb-role-switch;
+            role-switch-default-mode = "host";
+            snps,dis_u2_susphy_quirk;
+            snps,parkmode-disable-ss-quirk;
+            snps,parkmode-disable-hs-quirk;
+            maximum-speed = "high-speed";
+        };
+    };

Best regards,
Krzysztof

#3 lore raw

RE: [PATCH v1 2/2] doc: dt: bindings: usb: realtek,dwc3: Add Realtek DHC RTD SoC DWC3 USB

Hi Krzysztof,

Quoted 11 lines

Subject: Re: [PATCH v1 2/2] doc: dt: bindings: usb: realtek,dwc3: Add Realtek DHC RTD SoC DWC3 USB

Quoted 1 line · Stanley Chang

Document the DWC3 USB bindings for Realtek SoCs.

Please use subject prefixes matching the subsystem. You can get them for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching.

My filtering of emails depends on it.

I will revise the subject.

Quoted 4 lines

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml

Quoted 2 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml +0 -0

realtek,rtd-dwc3.yaml

I will rename this file.

Quoted 4 lines
Quoted 2 lines

+$id: "http://devicetree.org/schemas/usb/realtek,dwc3.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#"

Drop quotes. Wasn't tested, because dtschema reports warnings here...

Okay, I will drop it.

Quoted 4 lines

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml

Quoted 3 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml +3 -0
+  realtek,unlink-usb3-port:
+    description: Disable link between USB 3.0 PHY and USB mac.
+      Only for RTD1619 SoC, if the board design support maximum 2.0

speed.

Quoted 14 lines

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 52

Quoted 9 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml +9 -0
+    type: boolean
+
+  realtek,disable-usb3-phy:
+    description: Close USB 3.0 PHY if the board design not support USB 3.0.
+    type: boolean
+
+  realtek,enable-l4icg:
+    description: Enable the power saving feature l4icg by hardware clock.
+      gating.

You described the desired Linux feature or behavior, not the actual hardware. The bindings are about the latter, so instead you need to rephrase the property and its description to match actual hardware capabilities/features/configuration etc.

The l4icg entry is a hardware feature for power saving. The term may not clearly convey the function. So instead of the term "l4icg" I use "hw clock gating".

realtek,enable-hw-clock-gating:
description: Enable the clock gated function which will gating sram
clock when dbus idle.

Quoted 10 lines

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 89

Quoted 9 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml +9 -0
+examples:
+  - |
+    usb@98013e00 {
+        compatible = "realtek,rtd1319d-dwc3", "realtek,rtd-dwc3";
+        reg = <0x98013e00 0x200>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+        status = "okay";
Quoted 2 lines

Drop status.

Okay.

Thanks,
Stanley

#4 lore raw

Re: [PATCH v1 2/2] doc: dt: bindings: usb: realtek,dwc3: Add Realtek DHC RTD SoC DWC3 USB

Quoted 14 lines · Stanley Chang[昌育德]
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +5 -0
+
+  realtek,disable-usb3-phy:
+    description: Close USB 3.0 PHY if the board design not support USB 3.0.
+    type: boolean
+
Quoted 8 lines

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 52

Quoted 3 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +3 -0
+  realtek,enable-l4icg:
+    description: Enable the power saving feature l4icg by hardware clock.
+      gating.

You described the desired Linux feature or behavior, not the actual hardware. The bindings are about the latter, so instead you need to rephrase the property and its description to match actual hardware capabilities/features/configuration etc.

Quoted 7 lines

The l4icg entry is a hardware feature for power saving. The term may not clearly convey the function. So instead of the term "l4icg" I use "hw clock gating".

realtek,enable-hw-clock-gating:
description: Enable the clock gated function which will gating sram
clock when dbus idle.

And why this should be configurable per board? It looks you like to put OS policy into DT, so no.

Best regards,
Krzysztof

#5 lore raw

RE: [PATCH v1 2/2] doc: dt: bindings: usb: realtek,dwc3: Add Realtek DHC RTD SoC DWC3 USB

Hi Krzysztof,

Quoted 15 lines
Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+  realtek,enable-l4icg:
+    description: Enable the power saving feature l4icg by hardware

clock.

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

+ gating.

You described the desired Linux feature or behavior, not the actual

hardware.

Quoted 8 lines
Quoted 3 lines

The bindings are about the latter, so instead you need to rephrase the property and its description to match actual hardware capabilities/features/configuration etc.

The l4icg entry is a hardware feature for power saving. The term may not clearly convey the function. So instead of the term "l4icg" I use "hw clock gating".

Quoted 7 lines
Quoted 3 lines

realtek,enable-hw-clock-gating:
description: Enable the clock gated function which will gating sram
clock when dbus idle.

And why this should be configurable per board? It looks you like to put OS policy into DT, so no.

Ok, I'll remove it from DT.
I put it in DT because hw-clock-gating is not an OS policy. This is a pure hardware function and is not controlled by software. I want to control enabling or disabling on different SoCs or boards.
But for power saving, it should be enabled by default except for rtd1295 SoC.
So I would handle this special case of rtd1295 in the driver.

Thanks,
Stanley

maintainer
#6 lore raw

Re: [PATCH v1 2/2] doc: dt: bindings: usb: realtek,dwc3: Add Realtek DHC RTD SoC DWC3 USB

In reply to Stanley Chang
Quoted 35 lines · Stanley Chang

Document the DWC3 USB bindings for Realtek SoCs.

---
 .../devicetree/bindings/usb/realtek,dwc3.yaml | 107 ++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/realtek,dwc3.yaml
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +21 -0
new file mode 100644
index 000000000000..74d388809924
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Realtek Semiconductor Corporation
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/usb/realtek,dwc3.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Realtek DWC3 USB SoC Controller Glue
+
+maintainers:
+  - Stanley Chang <[email protected]>
+
+description:
+  The Realtek DHC SoC embeds a DWC3 USB IP Core configured for USB 2.0
+  and USB 3.0 in host or dual-role mode.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - realtek,rtd1295-dwc3

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 31

Quoted 10 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +10 -0
+          - realtek,rtd1315e-dwc3
+          - realtek,rtd1319-dwc3
+          - realtek,rtd1319d-dwc3
+          - realtek,rtd1395-dwc3
+          - realtek,rtd1619-dwc3
+          - realtek,rtd1619b-dwc3
+      - const: realtek,rtd-dwc3
+
+  reg:
+    maxItems: 1

Some details on what these registers are would be useful. Or describing what's in the 'glue' device?

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 44

Quoted 13 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +13 -0
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 1
+
+  ranges: true
+
+  realtek,unlink-usb3-port:
+    description: Disable link between USB 3.0 PHY and USB mac.
+      Only for RTD1619 SoC, if the board design support maximum 2.0 speed.
+    type: boolean

We have a property for this: maximum-speed

That belongs in the USB controller node though.

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 48

Quoted 4 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +4 -0
+
+  realtek,disable-usb3-phy:
+    description: Close USB 3.0 PHY if the board design not support USB 3.0.
+    type: boolean

Can't this be determined by not having a USB3 phy listed?

Quoted 31 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +31 -0
+
+  realtek,enable-l4icg:
+    description: Enable the power saving feature l4icg by hardware clock.
+      gating.
+    type: boolean
+
+patternProperties:
+  "^usb@[0-9a-f]+$":
+    $ref: snps,dwc3.yaml#
+    description: Required child node
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+  - ranges
+
+allOf:
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - realtek,rtd1619-dwc3
+    then:
+      properties:
+        realtek,unlink-usb3-port: false
+
+additionalProperties: false

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 89

Quoted 10 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +10 -0
+
+examples:
+  - |
+    usb@98013e00 {
+        compatible = "realtek,rtd1319d-dwc3", "realtek,rtd-dwc3";
+        reg = <0x98013e00 0x200>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+        status = "okay";

Drop status from examples.

Quoted 21 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +18 -0
+        realtek,disable-usb3-phy;
+        realtek,enable-l4icg;
+
+        usb@98050000 {
+            compatible = "snps,dwc3";
+            reg = <0x98050000 0x9000>;
+            interrupts = <0 94 4>;
+            phys = <&usb2phy &usb3phy>;
+            phy-names = "usb2-phy", "usb3-phy";
+            dr_mode = "otg";
+            usb-role-switch;
+            role-switch-default-mode = "host";
+            snps,dis_u2_susphy_quirk;
+            snps,parkmode-disable-ss-quirk;
+            snps,parkmode-disable-hs-quirk;
+            maximum-speed = "high-speed";
+        };
+    };
Signature · 1 line
2.34.1
#7 lore raw

RE: [PATCH v1 2/2] doc: dt: bindings: usb: realtek,dwc3: Add Realtek DHC RTD SoC DWC3 USB

Hi Rob,

Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +10 -0
+properties:
+  compatible:
+    items:
+      - enum:
+          - realtek,rtd1295-dwc3
+          - realtek,rtd1315e-dwc3
+          - realtek,rtd1319-dwc3
+          - realtek,rtd1319d-dwc3
+          - realtek,rtd1395-dwc3
+          - realtek,rtd1619-dwc3
Quoted 8 lines

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 31

Quoted 5 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +5 -0
+          - realtek,rtd1619b-dwc3
+      - const: realtek,rtd-dwc3
+
+  reg:
+    maxItems: 1

Some details on what these registers are would be useful. Or describing what's in the 'glue' device?

Ok, I will add the description.

Quoted 9 lines

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml

Quoted 3 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +3 -0
+  realtek,unlink-usb3-port:
+    description: Disable link between USB 3.0 PHY and USB mac.
+      Only for RTD1619 SoC, if the board design support maximum 2.0

speed.

Quoted 1 line

+ type: boolean

We have a property for this: maximum-speed

That belongs in the USB controller node though.

I can try to use this property.
But I have a question.
This property belongs to dwc3.
When the dwc3-rtk setting disables USB 3.0 phy, dwc3 is not probed. So I can't use api usb_get_maximum_speed(dev) to get maximum_speed.

I can add this property "maximum-speed" to the dwc3-rtk node, which is the same as the dwc3 core node. Is this configuration appropriate?
For example

    usb@98013e00 {
        compatible = "realtek,rtd1319d-dwc3", "realtek,rtd-dwc3";
        reg = <0x98013e00 0x200>;
        #address-cells = <1>;
        #size-cells = <1>;
        ranges;
        maximum-speed = "high-speed";

        usb@98050000 {
            compatible = "snps,dwc3";
            reg = <0x98050000 0x9000>;
            interrupts = <0 94 4>;
            phys = <&usb2phy &usb3phy>;
            phy-names = "usb2-phy", "usb3-phy";
            dr_mode = "otg";
            usb-role-switch;
            role-switch-default-mode = "host";
            snps,dis_u2_susphy_quirk;
            snps,parkmode-disable-ss-quirk;
            snps,parkmode-disable-hs-quirk;
            maximum-speed = "high-speed";
        };
    };
Quoted 6 lines

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 48

Quoted 4 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +4 -0
+
+  realtek,disable-usb3-phy:
+    description: Close USB 3.0 PHY if the board design not support USB 3.0.
+    type: boolean

Can't this be determined by not having a USB3 phy listed?

I will try to use maximum-speed.

Quoted 11 lines

Documentation/devicetree/bindings/usb/realtek,dwc3.yaml line 89

Quoted 9 lines
Documentation/devicetree/bindings/usb/realtek,dwc3.yaml new file +9 -0
+examples:
+  - |
+    usb@98013e00 {
+        compatible = "realtek,rtd1319d-dwc3", "realtek,rtd-dwc3";
+        reg = <0x98013e00 0x200>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+        status = "okay";

Drop status from examples.

Ok.

Thanks,
Stanley

#8 lore raw
In reply to Stanley Chang
kernel test robot noticed the following build errors:

Hi Stanley,

kernel test robot noticed the following build errors:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus linus/master v6.5-rc3 next-20230728] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Stanley-Chang/doc-dt-bindings-usb-realtek-dwc3-Add-Realtek-DHC-RTD-SoC-DWC3-USB/20230728-115507
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20230728035318.18741-1-stanley_chang%40realtek.com
patch subject: [PATCH v1 1/2] usb: dwc3: add Realtek DHC RTD SoC dwc3 glue layer driver
config: x86_64-randconfig-r072-20230728 (https://download.01.org/0day-ci/archive/20230729/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230729/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

ld: vmlinux.o: in function `dwc3_rtk_remove_role_switch':

>> drivers/usb/dwc3/dwc3-rtk.c:196: undefined reference to `usb_role_switch_unregister'

vim +196 drivers/usb/dwc3/dwc3-rtk.c

192
193 static int dwc3_rtk_remove_role_switch(struct dwc3_rtk *rtk)
194 {
195 if (rtk->role_switch)

 > 196			usb_role_switch_unregister(rtk->role_switch);

197
198 rtk->role_switch = NULL;
199
200 return 0;
201 }
202 #else
203 #define dwc3_rtk_setup_role_switch(x) 0
204 #define dwc3_rtk_remove_role_switch(x) 0
205 #endif
206

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki