Skip to contentSkip to conversation

Add CIX Sky1 USB3 PHY support

PATCH Superseded Hongliang Yang 2 participants 6 messages Sep 6 – Sep 23

Subsystems (3)

v4 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add CIX Sky1 USB3 PHY support

This series adds support for the multi-port USB3 PHY found on the CIX Sky1 SoC: the devicetree binding, the PHY driver, and the device tree node covering the PHY block that serves the USB4 and USB5 controllers.

This is the first of two series; the USBSSP controller (Cadence DRD glue) series that consumes this PHY follows separately and depends on this one.

Changes in v4:
- Split the combined USB series into two: this PHY series and a separate USBSSP controller series that depends on it.

USB3 PHY driver:
- Assert the hardware resets before registering the PHY provider, so a consumer cannot race with the probe-time assertion.
- Disable the clocks in LIFO order (ref before apb) in phy_exit().
- Reorder the error unroll path of phy_init() to assert the resets before disabling the clocks, matching the teardown sequence, and fix the goto targets so clocks that were never enabled are not disabled.
- Check fwnode_get_name() for NULL and only match "usb-port@" child nodes exactly, instead of any name with a "usb-port" or "USB" prefix.

Hongliang Yang (3):
dt-bindings: phy: Add CIX Sky1 USB3 PHY
phy: cix: Add CIX Sky1 USB3 PHY driver
arm64: dts: cix: Add USB3 PHY node for Sky1

 .../bindings/phy/cix,sky1-usb3-phy.yaml       | 107 +++++
 arch/arm64/boot/dts/cix/sky1-orion-o6.dts     |  12 +
 arch/arm64/boot/dts/cix/sky1.dtsi             |  31 ++
 drivers/phy/Kconfig                           |   1 +
 drivers/phy/Makefile                          |   1 +
 drivers/phy/cix/Kconfig                       |  20 +
 drivers/phy/cix/Makefile                      |   6 +
 drivers/phy/cix/phy-cix-usb3.c                | 413 ++++++++++++++++++
 drivers/phy/cix/phy-cix-usbdp.h               | 289 ++++++++++++
 9 files changed, 880 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/cix,sky1-usb3-phy.yaml
 create mode 100644 drivers/phy/cix/Kconfig
 create mode 100644 drivers/phy/cix/Makefile
 create mode 100644 drivers/phy/cix/phy-cix-usb3.c
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.h
Signature · 1 line
2.54.0
#1 lore raw

PATCH v4 1/3 dt-bindings: phy: Add CIX Sky1 USB3 PHY

Add device tree binding for the CIX Sky1 USB3 PHY, a multi-port SuperSpeedPlus PHY supporting up to two USB3 lanes.

---
 .../bindings/phy/cix,sky1-usb3-phy.yaml       | 107 ++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/cix,sky1-usb3-phy.yaml
Documentation/devicetree/bindings/phy/cix,sky1-usb3-phy.yaml new file +107 -0
new file mode 100644
index 000000000000..5b025a48c844
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/cix,sky1-usb3-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: CIX Sky1 USB3 PHY
+
+maintainers:
+  - Hongliang Yang <[email protected]>
+
+description:
+  The CIX Sky1 USB3 PHY is a multi-port SuperSpeedPlus PHY that
+  supports up to two USB3 lanes. Each port is represented as a
+  child node of the PHY controller.
+
+properties:
+  compatible:
+    const: cix,sky1-usb3-phy
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: APB register interface clock
+      - description: PHY reference clock
+
+  clock-names:
+    items:
+      - const: apb
+      - const: ref
+
+  resets:
+    items:
+      - description: PHY reset
+      - description: PHY APB preset
+
+  reset-names:
+    items:
+      - const: core
+      - const: apb
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^usb-port@[0-9a-f]+$":
+    type: object
+    description:
+      A single USB3 PHY port/lane.
+
+    properties:
+      reg:
+        maxItems: 1
+
+      "#phy-cells":
+        const: 0
+
+    required:
+      - reg
+      - "#phy-cells"
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/cix,sky1.h>
+    #include <dt-bindings/reset/cix,sky1-s5-system-control.h>
+
+    usb-phy@9210000 {
+        compatible = "cix,sky1-usb3-phy";
+        reg = <0x9210000 0x40000>;
+        #address-cells = <1>;
+        clocks = <&scmi_clk CLK_TREE_USB3A_PHY3_GATE>,
+                 <&scmi_clk CLK_TREE_USB3A_PHY_x2_REF>;
+        clock-names = "apb", "ref";
+        resets = <&s5_syscon SKY1_USBPHY_SS_RST_N>,
+                 <&s5_syscon SKY1_USBPHY_SS_PST_N>;
+        reset-names = "core", "apb";
+        #size-cells = <0>;
+
+        usb-port@0 {
+            reg = <0>;
+            #phy-cells = <0>;
+        };
+
+        usb-port@1 {
+            reg = <1>;
+            #phy-cells = <0>;
+        };
+    };
Signature · 1 line
2.54.0
#3 lore raw

PATCH v4 2/3 phy: cix: Add CIX Sky1 USB3 PHY driver

In reply to Hongliang Yang

Add PHY driver for the USB3 PHY found on CIX Sky1 SoCs. The driver handles initialization, reset, and clock management for the multi-port USB3 PHY.

---
 drivers/phy/Kconfig             |   1 +
 drivers/phy/Makefile            |   1 +
 drivers/phy/cix/Kconfig         |  20 ++
 drivers/phy/cix/Makefile        |   6 +
 drivers/phy/cix/phy-cix-usb3.c  | 413 ++++++++++++++++++++++++++++++++
 drivers/phy/cix/phy-cix-usbdp.h | 289 ++++++++++++++++++++++
 6 files changed, 730 insertions(+)
 create mode 100644 drivers/phy/cix/Kconfig
 create mode 100644 drivers/phy/cix/Makefile
 create mode 100644 drivers/phy/cix/phy-cix-usb3.c
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.h
drivers/phy/Kconfig +1 -0
index 19f3b7d12b7d..cb0d4be47628 100644
@@ -175,6 +175,7 @@ source "drivers/phy/axiado/Kconfig"
 source "drivers/phy/broadcom/Kconfig"
 source "drivers/phy/cadence/Kconfig"
 source "drivers/phy/canaan/Kconfig"
+source "drivers/phy/cix/Kconfig"
 source "drivers/phy/eswin/Kconfig"
 source "drivers/phy/freescale/Kconfig"
 source "drivers/phy/hisilicon/Kconfig"
drivers/phy/Makefile +1 -0
index d7aa516bcc49..6fd0f3910018 100644
@@ -27,6 +27,7 @@ obj-$(CONFIG_GENERIC_PHY)		+= allwinner/	\
 					   broadcom/	\
 					   cadence/	\
 					   canaan/	\
+					   cix/		\
 					   eswin/	\
 					   freescale/	\
 					   hisilicon/	\
drivers/phy/cix/Kconfig new file +20 -0
new file mode 100644
index 000000000000..aaa2eb9d4552
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Phy drivers for Cix PHYs
+#
+
+if ARCH_CIX || COMPILE_TEST
+
+config PHY_CIX_USB3
+	tristate "Cix USB3 PHY Driver"
+	depends on OF && HAS_IOMEM
+	select GENERIC_PHY
+	help
+	  Enable this to support the CIX USB3 PHY for TYPEA Connection.
+
+	  This driver provides initialization and power management for
+	  the USB3 PHY found on CIX Sky1 SoCs.
+
+	  If unsure, say N.
+
+endif # ARCH_CIX || COMPILE_TEST
drivers/phy/cix/Makefile new file +6 -0
new file mode 100644
index 000000000000..b46b1059b2ab
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for the Cix phy drivers.
+#
+
+obj-$(CONFIG_PHY_CIX_USB3)	+= phy-cix-usb3.o
drivers/phy/cix/phy-cix-usb3.c new file +413 -0

413 lines not on this page · raw message

drivers/phy/cix/phy-cix-usbdp.h new file +289 -0

289 lines not on this page · raw message

Signature · 1 line
2.54.0
#4 lore raw

Re: [PATCH v4 2/3] phy: cix: Add CIX Sky1 USB3 PHY driver

Hi Vinod,

Gentle ping on this series. The binding (1/3) has Conor's Acked-by. The driver patch (2/3) could still use a review.

The USB controller glue series that consumes this PHY is also under review, so having the PHY side settled would help both.

Thanks,
Hongliang

#5 lore raw

PATCH v4 3/3 arm64: dts: cix: Add USB3 PHY node for Sky1

In reply to Hongliang Yang

Add the USB3 PHY node for the USB4/USB5 controllers on the CIX Sky1 SoC. Enable the PHY and both of its ports on the Radxa Orion O6 board.

---
 arch/arm64/boot/dts/cix/sky1-orion-o6.dts | 12 +++++++++
 arch/arm64/boot/dts/cix/sky1.dtsi         | 31 +++++++++++++++++++++++
 2 files changed, 43 insertions(+)
arch/arm64/boot/dts/cix/sky1-orion-o6.dts +12 -0
index e39c87774c12..b152942aaa60 100644
@@ -117,3 +117,15 @@ &s5_gpio2 {
 &uart2 {
 	status = "okay";
 };
+
+&usb3_phy4 {
+	status = "okay";
+
+	usb-port@0 {
+		status = "okay";
+	};
+
+	usb-port@1 {
+		status = "okay";
+	};
+};
arch/arm64/boot/dts/cix/sky1.dtsi +31 -0
index a77c52296ebd..478c726fae96 100644
@@ -6,6 +6,8 @@
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/clock/cix,sky1.h>
+#include <dt-bindings/phy/phy.h>
+#include <dt-bindings/reset/cix,sky1-s5-system-control.h>
 #include "sky1-power.h"
 
 / {
@@ -574,6 +576,35 @@ mbox_ap2sfh: mailbox@80a0000 {
 			cix,mbox-dir = "tx";
 		};
 
+		usb3_phy4: usb-phy@9210000 {
+			compatible = "cix,sky1-usb3-phy";
+			reg = <0x00 0x09210000 0x00 0x40000>;
+			#address-cells = <1>;
+			clocks = <&scmi_clk CLK_TREE_USB3A_PHY3_GATE>,
+			         <&scmi_clk CLK_TREE_USB3A_PHY_x2_REF>;
+			clock-names = "apb", "ref";
+			resets = <&s5_syscon SKY1_USBPHY_SS_RST_N>,
+			         <&s5_syscon SKY1_USBPHY_SS_PST_N>;
+			reset-names = "core", "apb";
+			#size-cells = <0>;
+
+			status = "disabled";
+
+			usb3_phy4_0: usb-port@0 {
+				reg = <0>;
+				#phy-cells = <0>;
+
+				status = "disabled";
+			};
+
+			usb3_phy4_1: usb-port@1 {
+				reg = <1>;
+				#phy-cells = <0>;
+
+				status = "disabled";
+			};
+		};
+
 		pcie_x8_rc: pcie@a010000 {
 			compatible = "cix,sky1-pcie-host";
 			reg = <0x00 0x0a010000 0x00 0x10000>,
Signature · 1 line
2.54.0