Skip to contentSkip to conversation

riscv: sophgo: add top syscon device for cv18xx

RFC PATCH In review Inochi Amaoto 5 participants 19 messages Jun 11, 2025 – Nov 27, 2025

Subsystems (3)
lore
Share & tools
lore

Inochi Amaoto

author maintainer
#0 lore raw

cover riscv: sophgo: add top syscon device for cv18xx

Add top syscon device bindings related DTS change for CV1800.

The patch required the following 3 patch series.
1. https://lore.kernel.org/all/[email protected]
2. https://lore.kernel.org/all/[email protected]
3. https://lore.kernel.org/all/[email protected]

Inochi Amaoto (3):
dt-bindings: soc: sophgo: add TOP syscon for CV18XX/SG200X series SoC
riscv: dts: sophgo: Add syscon node for cv18xx
riscv: dts: sophgo: Add USB support for cv18xx

 .../soc/sophgo/sophgo,cv1800b-top-syscon.yaml | 57 +++++++++++++++++++
 arch/riscv/boot/dts/sophgo/cv180x.dtsi        | 40 +++++++++++++
 .../boot/dts/sophgo/cv1812h-huashan-pi.dts    |  4 ++
 3 files changed, 101 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml

--
2.49.0

author maintainer
#1 lore raw

RFC PATCH 1/3 dt-bindings: soc: sophgo: add TOP syscon for CV18XX/SG200X series SoC

The Sophgo CV1800/SG2000 SoC top misc system controller provides register access to configure related modules. It includes a usb2 phy and a dma multiplexer.

---
 .../soc/sophgo/sophgo,cv1800b-top-syscon.yaml | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +57 -0
new file mode 100644
index 000000000000..e8093a558c4e
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/sophgo/sophgo,cv1800b-top-syscon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sophgo CV18XX/SG200X SoC top system controller
+
+maintainers:
+  - Inochi Amaoto <[email protected]>
+
+description:
+  The Sophgo CV18XX/SG200X SoC top misc system controller provides
+  register access to configure related modules.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: sophgo,cv1800b-top-syscon
+          - const: syscon
+          - const: simple-mfd
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 1
+
+patternProperties:
+  "dma-router@[0-9a-f]+$":
+    $ref: /schemas/dma/sophgo,cv1800b-dmamux.yaml#
+
+  "phy@[0-9a-f]+$":
+    $ref: /schemas/phy/sophgo,cv1800b-usb2-phy.yaml#
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    syscon@3000000 {
+      compatible = "sophgo,cv1800b-top-syscon", "syscon", "simple-mfd";
+      reg = <0x03000000 0x1000>;
+      #address-cells = <1>;
+      #size-cells = <1>;
+    };
+
+...
Signature · 1 line
2.49.0
#2 lore raw

Re: [PATCH RFC 1/3] dt-bindings: soc: sophgo: add TOP syscon for CV18XX/SG200X series SoC

Quoted 41 lines · Inochi Amaoto

The Sophgo CV1800/SG2000 SoC top misc system controller provides register access to configure related modules. It includes a usb2 phy and a dma multiplexer.

---
 .../soc/sophgo/sophgo,cv1800b-top-syscon.yaml | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +25 -0
new file mode 100644
index 000000000000..e8093a558c4e
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/sophgo/sophgo,cv1800b-top-syscon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sophgo CV18XX/SG200X SoC top system controller
+
+maintainers:
+  - Inochi Amaoto <[email protected]>
+
+description:
+  The Sophgo CV18XX/SG200X SoC top misc system controller provides
+  register access to configure related modules.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: sophgo,cv1800b-top-syscon
+          - const: syscon
+          - const: simple-mfd
+
+  reg:
+    maxItems: 1

Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml line 35

Quoted 10 lines
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +10 -0
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 1
+
+patternProperties:
+  "dma-router@[0-9a-f]+$":
+    $ref: /schemas/dma/sophgo,cv1800b-dmamux.yaml#

I think you're supposed to add "unevaluatedProperties: false" to each of these nodes.

Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml line 38

Quoted 3 lines
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +3 -0
+
+  "phy@[0-9a-f]+$":
+    $ref: /schemas/phy/sophgo,cv1800b-usb2-phy.yaml#

Why are these permitting random addresses? Are they not at fixed addreses given that you only support one platform (modulo the rebrand)?

Quoted 22 lines
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +19 -0
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    syscon@3000000 {
+      compatible = "sophgo,cv1800b-top-syscon", "syscon", "simple-mfd";
+      reg = <0x03000000 0x1000>;
+      #address-cells = <1>;
+      #size-cells = <1>;
+    };
+
+...
Signature · 1 line
2.49.0
author maintainer
#3 lore raw

Re: [PATCH RFC 1/3] dt-bindings: soc: sophgo: add TOP syscon for CV18XX/SG200X series SoC

Quoted 47 lines · Conor Dooley
Quoted 46 lines · Inochi Amaoto

The Sophgo CV1800/SG2000 SoC top misc system controller provides register access to configure related modules. It includes a usb2 phy and a dma multiplexer.

---
 .../soc/sophgo/sophgo,cv1800b-top-syscon.yaml | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +30 -0
new file mode 100644
index 000000000000..e8093a558c4e
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/sophgo/sophgo,cv1800b-top-syscon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sophgo CV18XX/SG200X SoC top system controller
+
+maintainers:
+  - Inochi Amaoto <[email protected]>
+
+description:
+  The Sophgo CV18XX/SG200X SoC top misc system controller provides
+  register access to configure related modules.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: sophgo,cv1800b-top-syscon
+          - const: syscon
+          - const: simple-mfd
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
Quoted 9 lines

Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml line 35

Quoted 5 lines
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +5 -0
+    const: 1
+
+patternProperties:
+  "dma-router@[0-9a-f]+$":
+    $ref: /schemas/dma/sophgo,cv1800b-dmamux.yaml#

I think you're supposed to add "unevaluatedProperties: false" to each of these nodes.

This is is OK for me.

Quoted 7 lines

Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml line 38

Quoted 3 lines
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +3 -0
+
+  "phy@[0-9a-f]+$":
+    $ref: /schemas/phy/sophgo,cv1800b-usb2-phy.yaml#

Why are these permitting random addresses? Are they not at fixed addreses given that you only support one platform (modulo the rebrand)?

IIRC, they are fixed address. I use random addresses as I see many one in binding do the same. Should I switch to the fixed one?

Regards,
Inochi

#4 lore raw

Re: [PATCH RFC 1/3] dt-bindings: soc: sophgo: add TOP syscon for CV18XX/SG200X series SoC

Quoted 64 lines · Inochi Amaoto
Quoted 47 lines · Conor Dooley
Quoted 46 lines · Inochi Amaoto

The Sophgo CV1800/SG2000 SoC top misc system controller provides register access to configure related modules. It includes a usb2 phy and a dma multiplexer.

---
 .../soc/sophgo/sophgo,cv1800b-top-syscon.yaml | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +30 -0
new file mode 100644
index 000000000000..e8093a558c4e
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/sophgo/sophgo,cv1800b-top-syscon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sophgo CV18XX/SG200X SoC top system controller
+
+maintainers:
+  - Inochi Amaoto <[email protected]>
+
+description:
+  The Sophgo CV18XX/SG200X SoC top misc system controller provides
+  register access to configure related modules.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: sophgo,cv1800b-top-syscon
+          - const: syscon
+          - const: simple-mfd
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
Quoted 9 lines

Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml line 35

Quoted 5 lines
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +5 -0
+    const: 1
+
+patternProperties:
+  "dma-router@[0-9a-f]+$":
+    $ref: /schemas/dma/sophgo,cv1800b-dmamux.yaml#

I think you're supposed to add "unevaluatedProperties: false" to each of these nodes.

This is is OK for me.

Quoted 4 lines
Quoted 3 lines
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +3 -0
+
+  "phy@[0-9a-f]+$":
+    $ref: /schemas/phy/sophgo,cv1800b-usb2-phy.yaml#
Quoted 6 lines
Quoted 3 lines

Why are these permitting random addresses? Are they not at fixed addreses given that you only support one platform (modulo the rebrand)?

IIRC, they are fixed address. I use random addresses as I see many one in binding do the same. Should I switch to the fixed one?

If things are actually possible to have at variable addresses, then sure use pattern properties and a regex. It may be like that if a new device is released that reuses the dmamux or phy but locates it differently or on a platform with multiple phys etc. If not, then then just restrict the address to the only permitted one.

author maintainer
#5 lore raw

Re: [PATCH RFC 1/3] dt-bindings: soc: sophgo: add TOP syscon for CV18XX/SG200X series SoC

Quoted 69 lines · Conor Dooley
Quoted 68 lines · Inochi Amaoto
Quoted 47 lines · Conor Dooley
Quoted 46 lines · Inochi Amaoto

The Sophgo CV1800/SG2000 SoC top misc system controller provides register access to configure related modules. It includes a usb2 phy and a dma multiplexer.

---
 .../soc/sophgo/sophgo,cv1800b-top-syscon.yaml | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +30 -0
new file mode 100644
index 000000000000..e8093a558c4e
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/sophgo/sophgo,cv1800b-top-syscon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sophgo CV18XX/SG200X SoC top system controller
+
+maintainers:
+  - Inochi Amaoto <[email protected]>
+
+description:
+  The Sophgo CV18XX/SG200X SoC top misc system controller provides
+  register access to configure related modules.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: sophgo,cv1800b-top-syscon
+          - const: syscon
+          - const: simple-mfd
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
Quoted 9 lines

Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml line 35

Quoted 5 lines
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +5 -0
+    const: 1
+
+patternProperties:
+  "dma-router@[0-9a-f]+$":
+    $ref: /schemas/dma/sophgo,cv1800b-dmamux.yaml#

I think you're supposed to add "unevaluatedProperties: false" to each of these nodes.

This is is OK for me.

Quoted 7 lines

Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml line 38

Quoted 3 lines
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +3 -0
+
+  "phy@[0-9a-f]+$":
+    $ref: /schemas/phy/sophgo,cv1800b-usb2-phy.yaml#

Why are these permitting random addresses? Are they not at fixed addreses given that you only support one platform (modulo the rebrand)?

Quoted 8 lines
Quoted 2 lines

IIRC, they are fixed address. I use random addresses as I see many one in binding do the same. Should I switch to the fixed one?

If things are actually possible to have at variable addresses, then sure use pattern properties and a regex. It may be like that if a new device is released that reuses the dmamux or phy but locates it differently or on a platform with multiple phys etc. If not, then then just restrict the address to the only permitted one.

Great, Since all the CV1800 devices I can reach have the same register layout, I will switch to fixed address.

Regards,
Inochi

maintainer
#6 lore raw

Re: [PATCH RFC 1/3] dt-bindings: soc: sophgo: add TOP syscon for CV18XX/SG200X series SoC

In reply to Conor Dooley
Quoted 47 lines · Conor Dooley
Quoted 46 lines · Inochi Amaoto

The Sophgo CV1800/SG2000 SoC top misc system controller provides register access to configure related modules. It includes a usb2 phy and a dma multiplexer.

---
 .../soc/sophgo/sophgo,cv1800b-top-syscon.yaml | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +30 -0
new file mode 100644
index 000000000000..e8093a558c4e
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/sophgo/sophgo,cv1800b-top-syscon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sophgo CV18XX/SG200X SoC top system controller
+
+maintainers:
+  - Inochi Amaoto <[email protected]>
+
+description:
+  The Sophgo CV18XX/SG200X SoC top misc system controller provides
+  register access to configure related modules.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: sophgo,cv1800b-top-syscon
+          - const: syscon
+          - const: simple-mfd
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
Quoted 8 lines

Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml line 35

Quoted 5 lines
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +5 -0
+    const: 1
+
+patternProperties:
+  "dma-router@[0-9a-f]+$":
+    $ref: /schemas/dma/sophgo,cv1800b-dmamux.yaml#

I think you're supposed to add "unevaluatedProperties: false" to each of these nodes.

Not necessary if the referenced schema has unevaluatedProperties/additionalProperties set to false. The tools check for this.

Rob

#7 lore raw

Re: [PATCH RFC 1/3] dt-bindings: soc: sophgo: add TOP syscon for CV18XX/SG200X series SoC

Quoted 57 lines · Rob Herring
Quoted 47 lines · Conor Dooley
Quoted 46 lines · Inochi Amaoto

The Sophgo CV1800/SG2000 SoC top misc system controller provides register access to configure related modules. It includes a usb2 phy and a dma multiplexer.

---
 .../soc/sophgo/sophgo,cv1800b-top-syscon.yaml | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +30 -0
new file mode 100644
index 000000000000..e8093a558c4e
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/sophgo/sophgo,cv1800b-top-syscon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sophgo CV18XX/SG200X SoC top system controller
+
+maintainers:
+  - Inochi Amaoto <[email protected]>
+
+description:
+  The Sophgo CV18XX/SG200X SoC top misc system controller provides
+  register access to configure related modules.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: sophgo,cv1800b-top-syscon
+          - const: syscon
+          - const: simple-mfd
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
Quoted 8 lines

Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml line 35

Quoted 5 lines
Documentation/devicetree/bindings/soc/sophgo/sophgo,cv1800b-top-syscon.yaml new file +5 -0
+    const: 1
+
+patternProperties:
+  "dma-router@[0-9a-f]+$":
+    $ref: /schemas/dma/sophgo,cv1800b-dmamux.yaml#

I think you're supposed to add "unevaluatedProperties: false" to each of these nodes.

Quoted 3 lines

Not necessary if the referenced schema has unevaluatedProperties/additionalProperties set to false. The tools check for this.

Oh cool, that's good to know, thanks.

author maintainer
#8 lore raw

RFC PATCH 2/3 riscv: dts: sophgo: Add syscon node for cv18xx

In reply to Inochi Amaoto

Add top syscon node and all subdevice nodes for cv18xx series SoC.

---
 arch/riscv/boot/dts/sophgo/cv180x.dtsi | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
arch/riscv/boot/dts/sophgo/cv180x.dtsi +26 -0
index 929864ba1b26..65eceaa5d2f8 100644
@@ -25,6 +25,32 @@ soc {
 		#size-cells = <1>;
 		ranges;
 
+		syscon: syscon@3000000 {
+			compatible = "sophgo,cv1800b-top-syscon",
+				     "syscon", "simple-mfd";
+			reg = <0x03000000 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			usbphy: phy@48 {
+				compatible = "sophgo,cv1800b-usb2-phy";
+				reg = <0x48 0x4>;
+				#phy-cells = <0>;
+				clocks = <&clk CLK_USB_125M>,
+					 <&clk CLK_USB_33K>,
+					 <&clk CLK_USB_12M>;
+				clock-names = "app", "stb", "lpm";
+				resets = <&rst RST_COMBO_PHY0>;
+			};
+
+			dmamux: dma-router@154 {
+				compatible = "sophgo,cv1800b-dmamux";
+				reg = <0x154 0x8>, <0x298 0x4>;
+				#dma-cells = <2>;
+				dma-masters = <&dmac>;
+			};
+		};
+
 		rst: reset-controller@3003000 {
 			compatible = "sophgo,cv1800b-reset";
 			reg = <0x3003000 0x1000>;
Signature · 1 line
2.49.0
Tested-by on v1 2/3
#9 lore raw

Re: [PATCH RFC 2/3] riscv: dts: sophgo: Add syscon node for cv18xx

Thanks for the patch, Inochi!

Quoted 3 lines · Inochi Amaoto

Add top syscon node and all subdevice nodes for cv18xx series SoC.

Successfully tested in host mode on Milk-V Duo Module 01 EVB:

Quoted 37 lines

---
 arch/riscv/boot/dts/sophgo/cv180x.dtsi | 26 ++++++++++++++++++++++++++

 1 file changed, 26 insertions(+)
arch/riscv/boot/dts/sophgo/cv180x.dtsi +0 -0
index 929864ba1b26..65eceaa5d2f8 100644
@@ -25,6 +25,32 @@ soc {
  		#size-cells = <1>;
  		ranges;

arch/riscv/boot/dts/sophgo/cv180x.dtsi +25 -0
+		syscon: syscon@3000000 {
+			compatible = "sophgo,cv1800b-top-syscon",
+				     "syscon", "simple-mfd";
+			reg = <0x03000000 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			usbphy: phy@48 {
+				compatible = "sophgo,cv1800b-usb2-phy";
+				reg = <0x48 0x4>;
+				#phy-cells = <0>;
+				clocks = <&clk CLK_USB_125M>,
+					 <&clk CLK_USB_33K>,
+					 <&clk CLK_USB_12M>;
+				clock-names = "app", "stb", "lpm";
+				resets = <&rst RST_COMBO_PHY0>;
+			};
+
+			dmamux: dma-router@154 {
+				compatible = "sophgo,cv1800b-dmamux";
+				reg = <0x154 0x8>, <0x298 0x4>;
+				#dma-cells = <2>;
+				dma-masters = <&dmac>;
+			};
+		};
Signature · 1 line
Alexander Sverdlin.
author maintainer
#10 lore raw

RFC PATCH 3/3 riscv: dts: sophgo: Add USB support for cv18xx

In reply to Inochi Amaoto

Add USB controller node for cv18xx and enable it for Huashan Pi.

---
 arch/riscv/boot/dts/sophgo/cv180x.dtsi            | 14 ++++++++++++++
 arch/riscv/boot/dts/sophgo/cv1812h-huashan-pi.dts |  4 ++++
 2 files changed, 18 insertions(+)
arch/riscv/boot/dts/sophgo/cv180x.dtsi +14 -0
index 65eceaa5d2f8..3ea3a1af103f 100644
@@ -428,5 +428,19 @@ dmac: dma-controller@4330000 {
 			snps,data-width = <2>;
 			status = "disabled";
 		};
+
+		usb: usb@4340000 {
+			compatible = "sophgo,cv1800-usb";
+			reg = <0x04340000 0x10000>;
+			clocks = <&clk CLK_AXI4_USB>, <&clk CLK_APB_USB>;
+			clock-names = "otg", "utmi";
+			g-np-tx-fifo-size = <32>;
+			g-rx-fifo-size = <536>;
+			g-tx-fifo-size = <768 512 512 384 128 128>;
+			interrupts = <SOC_PERIPHERAL_IRQ(14) IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&usbphy>;
+			phy-names = "usb2-phy";
+			status = "disabled";
+		};
 	};
 };
arch/riscv/boot/dts/sophgo/cv1812h-huashan-pi.dts +4 -0
index c7181ad99f32..f5a800f488fc 100644
@@ -88,3 +88,7 @@ &sdhci1 {
 &uart0 {
 	status = "okay";
 };
+
+&usb {
+	status = "okay";
+};
Signature · 1 line
2.49.0
Tested-by on v1 3/3
#11 lore raw

Re: [PATCH RFC 3/3] riscv: dts: sophgo: Add USB support for cv18xx

Thanks for the patch, Inochi!

Quoted 3 lines · Inochi Amaoto

Add USB controller node for cv18xx and enable it for Huashan Pi.

Successfully tested in host mode on Milk-V Duo Module 01 EVB:

Quoted 27 lines

---
 arch/riscv/boot/dts/sophgo/cv180x.dtsi            | 14 ++++++++++++++ arch/riscv/boot/dts/sophgo/cv1812h-huashan-pi.dts |  4 ++++

 2 files changed, 18 insertions(+)
arch/riscv/boot/dts/sophgo/cv180x.dtsi +14 -0
index 65eceaa5d2f8..3ea3a1af103f 100644
@@ -428,5 +428,19 @@ dmac: dma-controller@4330000 {
  			snps,data-width = <2>;
  			status = "disabled";
  		};
+
+		usb: usb@4340000 {
+			compatible = "sophgo,cv1800-usb";
+			reg = <0x04340000 0x10000>;
+			clocks = <&clk CLK_AXI4_USB>, <&clk CLK_APB_USB>;
+			clock-names = "otg", "utmi";
+			g-np-tx-fifo-size = <32>;
+			g-rx-fifo-size = <536>;
+			g-tx-fifo-size = <768 512 512 384 128 128>;
+			interrupts = <SOC_PERIPHERAL_IRQ(14) IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&usbphy>;
+			phy-names = "usb2-phy";
+			status = "disabled";
+		};
Signature · 1 line
Alexander Sverdlin.
#12 lore raw

PATCH 1/1 riscv: dts: sophgo: cv180x: fix USB dwc2 FIFO sizes

In reply to Inochi Amaoto

I've tested the current dwc2 FIFO configuration and found that USB device mode breaks in ECM mode when transmitting frames larger than 128 bytes. For example, large ICMP packets or iperf3 traffic cause the USB link to hang and eventually disconnect without any messages in dmesg.

After switching to more conservative FIFO sizes, ECM becomes stable and no longer drops the connection. iperf3 now shows ~130 Mbit/s RX and ~100 Mbit/s TX on SG2002 (MilkV Duo 256M).

Fix the FIFO sizes accordingly.

---
 arch/riscv/boot/dts/sophgo/cv180x.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/boot/dts/sophgo/cv180x.dtsi +2 -2
index 1b2b1969a648..06b0ce5a2db7 100644
@@ -438,8 +438,8 @@ usb: usb@4340000 {
 			clocks = <&clk CLK_AXI4_USB>, <&clk CLK_APB_USB>;
 			clock-names = "otg", "utmi";
 			g-np-tx-fifo-size = <32>;
-			g-rx-fifo-size = <536>;
-			g-tx-fifo-size = <768 512 512 384 128 128>;
+			g-rx-fifo-size = <1536>;
+			g-tx-fifo-size = <128 128 64 64 64 64 32 32>;
 			interrupts = <SOC_PERIPHERAL_IRQ(14) IRQ_TYPE_LEVEL_HIGH>;
 			phys = <&usbphy>;
 			phy-names = "usb2-phy";
Signature · 1 line
2.43.0
author maintainer Reviewed-by on v1 1/1
#13 lore raw

Re: [PATCH] riscv: dts: sophgo: cv180x: fix USB dwc2 FIFO sizes

Quoted 35 lines · Anton D. Stavinskii

I've tested the current dwc2 FIFO configuration and found that USB device mode breaks in ECM mode when transmitting frames larger than 128 bytes. For example, large ICMP packets or iperf3 traffic cause the USB link to hang and eventually disconnect without any messages in dmesg.

After switching to more conservative FIFO sizes, ECM becomes stable and no longer drops the connection. iperf3 now shows ~130 Mbit/s RX and ~100 Mbit/s TX on SG2002 (MilkV Duo 256M).

Fix the FIFO sizes accordingly.

---
 arch/riscv/boot/dts/sophgo/cv180x.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/boot/dts/sophgo/cv180x.dtsi +2 -2
index 1b2b1969a648..06b0ce5a2db7 100644
@@ -438,8 +438,8 @@ usb: usb@4340000 {
 			clocks = <&clk CLK_AXI4_USB>, <&clk CLK_APB_USB>;
 			clock-names = "otg", "utmi";
 			g-np-tx-fifo-size = <32>;
-			g-rx-fifo-size = <536>;
-			g-tx-fifo-size = <768 512 512 384 128 128>;
+			g-rx-fifo-size = <1536>;
+			g-tx-fifo-size = <128 128 64 64 64 64 32 32>;
 			interrupts = <SOC_PERIPHERAL_IRQ(14) IRQ_TYPE_LEVEL_HIGH>;
 			phys = <&usbphy>;
 			phy-names = "usb2-phy";
Signature · 1 line
2.43.0

Please add a fix tag next time, I will add it by myself this time, otherwise LGTM.

Fixes e307248a3c2d ("riscv: dts: sophgo: Add USB support for cv18xx")

Regards,
Inochi

author maintainer Applied
#14 lore raw

Re: [PATCH] riscv: dts: sophgo: cv180x: fix USB dwc2 FIFO sizes

In reply to Anton D. Stavinskii
Quoted 11 lines · Anton D. Stavinskii

I've tested the current dwc2 FIFO configuration and found that USB device mode breaks in ECM mode when transmitting frames larger than 128 bytes. For example, large ICMP packets or iperf3 traffic cause the USB link to hang and eventually disconnect without any messages in dmesg.

After switching to more conservative FIFO sizes, ECM becomes stable and no longer drops the connection. iperf3 now shows ~130 Mbit/s RX and ~100 Mbit/s TX on SG2002 (MilkV Duo 256M).

[...]

Applied to dt/riscv, thanks!

[1/1] riscv: dts: sophgo: cv180x: fix USB dwc2 FIFO sizes

      https://github.com/sophgo/linux/commit/1d3ed9920a193e5d99d651d6ec1dbbe215ca172f

Thanks,
Inochi

author maintainer
#16 lore raw
Quoted 9 lines · Conor Dooley
Quoted 6 lines · Inochi Amaoto

Add top syscon device bindings related DTS change for CV1800.

The patch required the following 3 patch series.
1. https://lore.kernel.org/all/[email protected]
2. https://lore.kernel.org/all/[email protected]
3. https://lore.kernel.org/all/[email protected]

What is RFC about this?

I use RFC to ignore the patch check, as the dependency are not merged. This series itself require the binding from link 2 3, which provdes binding of the USB2 phy and DMA multiplexer.

Regards,
Inochi

#17 lore raw
Quoted 9 lines · Inochi Amaoto
Quoted 8 lines · Conor Dooley
Quoted 6 lines · Inochi Amaoto

Add top syscon device bindings related DTS change for CV1800.

The patch required the following 3 patch series.
1. https://lore.kernel.org/all/[email protected]
2. https://lore.kernel.org/all/[email protected]
3. https://lore.kernel.org/all/[email protected]

Quoted 5 lines
Quoted 1 line

What is RFC about this?

I use RFC to ignore the patch check, as the dependency are not merged. This series itself require the binding from link 2 3, which provdes binding of the USB2 phy and DMA multiplexer.

In the future, please provide a reason for things being RFC in the cover letter or patches themselves.

author maintainer
#18 lore raw
Quoted 10 lines · Conor Dooley
Quoted 9 lines · Inochi Amaoto
Quoted 8 lines · Conor Dooley
Quoted 6 lines · Inochi Amaoto

Add top syscon device bindings related DTS change for CV1800.

The patch required the following 3 patch series.
1. https://lore.kernel.org/all/[email protected]
2. https://lore.kernel.org/all/[email protected]
3. https://lore.kernel.org/all/[email protected]

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

What is RFC about this?

I use RFC to ignore the patch check, as the dependency are not merged. This series itself require the binding from link 2 3, which provdes binding of the USB2 phy and DMA multiplexer.

In the future, please provide a reason for things being RFC in the cover letter or patches themselves.

Sure, I will.

Regards,
Inochi