Skip to contentSkip to conversation

riscv: sophgo: add USB phy support for CV18XX series

PATCH Applied Inochi Amaoto 2 participants 4 messages Jul 8, 2025 – Sep 10, 2025

Subsystems (4)
lore
Share & tools
lore

Inochi Amaoto

author maintainer
#0 lore raw

v5 cover riscv: sophgo: add USB phy support for CV18XX series

Add USB PHY support for CV18XX/SG200X series

Changed from v4:
- https://lore.kernel.org/all/[email protected]
1. patch 1: apply Conor's tag
2. patch 2: remove dr_mode debugfs entry.
3. patch 2: simplify the cv1800_usb_phy_set_clock function

Changed from v3:
- https://lore.kernel.org/all/IA1PR20MB4953C1876484E149AA390DD5BB1D2@IA1PR20MB4953.namprd20.prod.outlook.com/
1. patch 1: remove vbus-gpio, switch-gpio and dr_mode properties.
2. patch 2: remove all logic related to the bindings change.
3. remove the syscon header file.

Changed from v2:
1. add item description for switch gpios.

Changed from v1:
1. remove dr_mode property and use default mode instead.
2. improve the description of vbus_det-gpios and sophgo,switch-gpios

Inochi Amaoto (2):
dt-bindings: phy: Add Sophgo CV1800 USB phy
phy: sophgo: Add USB 2.0 PHY driver for Sophgo CV18XX/SG200X

 .../bindings/phy/sophgo,cv1800b-usb2-phy.yaml |  54 ++++++
 drivers/phy/Kconfig                           |   1 +
 drivers/phy/Makefile                          |   1 +
 drivers/phy/sophgo/Kconfig                    |  19 ++
 drivers/phy/sophgo/Makefile                   |   2 +
 drivers/phy/sophgo/phy-cv1800-usb2.c          | 170 ++++++++++++++++++
 6 files changed, 247 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/sophgo,cv1800b-usb2-phy.yaml
 create mode 100644 drivers/phy/sophgo/Kconfig
 create mode 100644 drivers/phy/sophgo/Makefile
 create mode 100644 drivers/phy/sophgo/phy-cv1800-usb2.c

--
2.50.0

author maintainer
#1 lore raw

PATCH v5 1/2 dt-bindings: phy: Add Sophgo CV1800 USB phy

The USB phy of Sophgo CV18XX series SoC needs to sense a pin called "VBUS_DET" to get the right operation mode. If this pin is not connected, it only supports setting the mode manually.

Add USB phy bindings for Sophgo CV18XX/SG200X series SoC.

---
 .../bindings/phy/sophgo,cv1800b-usb2-phy.yaml | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/sophgo,cv1800b-usb2-phy.yaml
Documentation/devicetree/bindings/phy/sophgo,cv1800b-usb2-phy.yaml new file +54 -0
new file mode 100644
index 000000000000..2ff8f85d0282
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/sophgo,cv1800b-usb2-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sophgo CV18XX/SG200X USB 2.0 PHY
+
+maintainers:
+  - Inochi Amaoto <[email protected]>
+
+properties:
+  compatible:
+    const: sophgo,cv1800b-usb2-phy
+
+  reg:
+    maxItems: 1
+
+  "#phy-cells":
+    const: 0
+
+  clocks:
+    items:
+      - description: PHY app clock
+      - description: PHY stb clock
+      - description: PHY lpm clock
+
+  clock-names:
+    items:
+      - const: app
+      - const: stb
+      - const: lpm
+
+  resets:
+    maxItems: 1
+
+required:
+  - compatible
+  - "#phy-cells"
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+    phy@48 {
+      compatible = "sophgo,cv1800b-usb2-phy";
+      reg = <0x48 0x4>;
+      #phy-cells = <0>;
+      clocks = <&clk 93>, <&clk 94>, <&clk 95>;
+      clock-names = "app", "stb", "lpm";
+      resets = <&rst 58>;
+    };
Signature · 1 line
2.50.0
author maintainer
#2 lore raw

PATCH v5 2/2 phy: sophgo: Add USB 2.0 PHY driver for Sophgo CV18XX/SG200X

In reply to Inochi Amaoto

Add USB 2.0 PHY driver for Sophgo CV18XX/SG200X. Currently this driver does not support OTG mode as lack of document.

---
 drivers/phy/Kconfig                  |   1 +
 drivers/phy/Makefile                 |   1 +
 drivers/phy/sophgo/Kconfig           |  19 +++
 drivers/phy/sophgo/Makefile          |   2 +
 drivers/phy/sophgo/phy-cv1800-usb2.c | 170 +++++++++++++++++++++++++++
 5 files changed, 193 insertions(+)
 create mode 100644 drivers/phy/sophgo/Kconfig
 create mode 100644 drivers/phy/sophgo/Makefile
 create mode 100644 drivers/phy/sophgo/phy-cv1800-usb2.c
drivers/phy/Kconfig +1 -0
index 58c911e1b2d2..678dd0452f0a 100644
@@ -122,6 +122,7 @@ source "drivers/phy/renesas/Kconfig"
 source "drivers/phy/rockchip/Kconfig"
 source "drivers/phy/samsung/Kconfig"
 source "drivers/phy/socionext/Kconfig"
+source "drivers/phy/sophgo/Kconfig"
 source "drivers/phy/st/Kconfig"
 source "drivers/phy/starfive/Kconfig"
 source "drivers/phy/sunplus/Kconfig"
drivers/phy/Makefile +1 -0
index c670a8dac468..bfb27fb5a494 100644
@@ -35,6 +35,7 @@ obj-y					+= allwinner/	\
 					   rockchip/	\
 					   samsung/	\
 					   socionext/	\
+					   sophgo/	\
 					   st/		\
 					   starfive/	\
 					   sunplus/	\
drivers/phy/sophgo/Kconfig new file +19 -0
new file mode 100644
index 000000000000..2c943bbe1f81
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Phy drivers for Sophgo platforms
+#
+
+if ARCH_SOPHGO || COMPILE_TEST
+
+config PHY_SOPHGO_CV1800_USB2
+	tristate "Sophgo CV18XX/SG200X USB 2.0 PHY support"
+	depends on MFD_SYSCON
+	depends on USB_SUPPORT
+	select GENERIC_PHY
+	help
+	  Enable this to support the USB 2.0 PHY used with
+	  the DWC2 USB controller in Sophgo CV18XX/SG200X
+	  series SoC.
+	  If unsure, say N.
+
+endif # ARCH_SOPHGO || COMPILE_TEST
drivers/phy/sophgo/Makefile new file +2 -0
new file mode 100644
index 000000000000..318060661759
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_PHY_SOPHGO_CV1800_USB2)	+= phy-cv1800-usb2.o
drivers/phy/sophgo/phy-cv1800-usb2.c new file +170 -0

170 lines not on this page · raw message

Signature · 1 line
2.50.0
maintainer Applied
#3 lore raw
In reply to Inochi Amaoto
Quoted 9 lines · Inochi Amaoto

Add USB PHY support for CV18XX/SG200X series

Changed from v4:
- https://lore.kernel.org/all/[email protected]
1. patch 1: apply Conor's tag
2. patch 2: remove dr_mode debugfs entry.
3. patch 2: simplify the cv1800_usb_phy_set_clock function

[...]

Applied, thanks!

[1/2] dt-bindings: phy: Add Sophgo CV1800 USB phy

      commit: cdb2511bf3925ce095c31e1647c12086d34f9cc2
[2/2] phy: sophgo: Add USB 2.0 PHY driver for Sophgo CV18XX/SG200X
      commit: f0c6d776f74d1d8bda94f6f042b2919bcd615280

Best regards,

Signature · 1 line
~Vinod