Skip to contentSkip to conversation

phy: cix: add Sky1 USB/DP combo PHY

PATCH Superseded Gary Yang 3 participants 11 messages Nov 2 – Nov 17

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Gary Yang

author maintainer
#0 lore raw

cover phy: cix: add Sky1 USB/DP combo PHY

This series adds support for the USB/DP combo PHY found on the CIX Sky1 SoC. Each PHY instance provides one SuperSpeedPlus USB lane and one DisplayPort lane of a USB Type-C port, with plug orientation and USB/DP lane muxing handled through the S5 system controller.

The PHY registers a Type-C switch and mux so that the connector driver owns orientation and mode decisions, and exposes the USB and DP lanes as separate child PHYs so that the USB and DP controllers can bind to them independently.

Patch 1 documents the binding, patch 2 adds the driver, and patch 3 adds the SoC nodes and enables them on the Radxa Orion O6.

The driver has been built for arm64 with the PHY enabled both built-in and as a module. dt_binding_check, dtbs_check and checkpatch --strict pass.

Gary Yang (3):
dt-bindings: phy: add CIX Sky1 USB/DP combo PHY
phy: cix: add Sky1 USB/DP combo PHY driver
arm64: dts: cix: add Sky1 USB/DP combo PHY

 .../bindings/phy/cix,sky1-usbdp-phy.yaml      |  150 ++
 MAINTAINERS                                   |    2 +
 arch/arm64/boot/dts/cix/sky1-orion-o6.dts     |   28 +
 arch/arm64/boot/dts/cix/sky1.dtsi             |   96 ++
 drivers/phy/Kconfig                           |    1 +
 drivers/phy/Makefile                          |    1 +
 drivers/phy/cix/Kconfig                       |   22 +
 drivers/phy/cix/Makefile                      |    2 +
 drivers/phy/cix/phy-cix-usbdp.c               | 1477 +++++++++++++++++
 drivers/phy/cix/phy-cix-usbdp.h               |  265 +++
 10 files changed, 2044 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml
 create mode 100644 drivers/phy/cix/Kconfig
 create mode 100644 drivers/phy/cix/Makefile
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.c
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.h
Signature · 1 line
2.50.1
author maintainer
#1 lore raw

PATCH 1/3 dt-bindings: phy: add CIX Sky1 USB/DP combo PHY

Document the USB/DP combo PHY of the CIX Sky1 SoC. Each PHY instance exposes one SuperSpeedPlus USB lane and one DisplayPort lane as child nodes, so that the USB and DP consumers can each reference the lane they use.

The PHY performs Type-C plug orientation switching and USB/DP lane muxing in hardware and is therefore described with the "orientation-switch" and "mode-switch" properties. Lane muxing is programmed through the S5 system controller, identified by the "cix,usbphy-syscon" phandle followed by the PHY instance index.

---
 .../bindings/phy/cix,sky1-usbdp-phy.yaml      | 150 ++++++++++++++++++
 MAINTAINERS                                   |   1 +
 2 files changed, 151 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml
Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml new file +150 -0
new file mode 100644
index 000000000000..a5b6943f84eb
@@ -0,0 +1,150 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/cix,sky1-usbdp-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: CIX Sky1 USB/DP Combo PHY
+
+maintainers:
+  - Gary Yang <[email protected]>
+
+description:
+  The CIX Sky1 USB/DP combo PHY provides one SuperSpeedPlus USB lane
+  and one DisplayPort lane for a USB3C Type-C port. The USB and DP
+  lanes are represented as child nodes of the PHY controller.
+
+properties:
+  compatible:
+    const: cix,sky1-usbdp-phy
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  clocks:
+    maxItems: 1
+    description: PHY APB clock.
+
+  resets:
+    items:
+      - description: PHY core reset
+      - description: PHY APB preset
+
+  reset-names:
+    items:
+      - const: core
+      - const: apb
+
+  orientation-switch:
+    description:
+      The PHY handles Type-C plug orientation switching.
+    type: boolean
+
+  mode-switch:
+    description:
+      The PHY handles multiplexing of the USB and DisplayPort lanes.
+    type: boolean
+
+  cix,usbphy-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      - items:
+          - description: phandle to the S5 system controller
+          - description: PHY instance index within the system controller
+    description:
+      Phandle to the system controller used for lane muxing and
+      Type-C orientation control, followed by the PHY instance index.
+
+  cix,default-conf:
+    $ref: /schemas/types.yaml#/definitions/uint8
+    enum: [0, 1, 2, 3]
+    default: 3
+    description: |
+      Lane mode the PHY is put in until a consumer changes it through the
+      Type-C mux. The value is a bit mask: 0 = none, 1 = USB, 2 = DP,
+      3 = USB and DP.
+
+patternProperties:
+  "^usb-port@[0-9a-f]+$":
+    type: object
+    description:
+      The USB lane of the combo PHY.
+
+    properties:
+      reg:
+        maxItems: 1
+
+      "#phy-cells":
+        const: 0
+
+    required:
+      - reg
+      - "#phy-cells"
+
+    additionalProperties: false
+
+  "^dp-port@[0-9a-f]+$":
+    type: object
+    description:
+      The DisplayPort lane of the combo PHY.
+
+    properties:
+      reg:
+        maxItems: 1
+
+      "#phy-cells":
+        const: 0
+
+    required:
+      - reg
+      - "#phy-cells"
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+  - clocks
+  - resets
+  - reset-names
+  - cix,usbphy-syscon
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/cix,sky1.h>
+    #include <dt-bindings/reset/cix,sky1-s5-system-control.h>
+
+    usbc_phy0: usb-phy@9030000 {
+        compatible = "cix,sky1-usbdp-phy";
+        reg = <0x09030000 0x40000>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+        clocks = <&scmi_clk CLK_TREE_USB3C_DRD_PHY3_GATE>;
+        resets = <&s5_syscon SKY1_USB_DP_PHY0_RST_N>,
+                 <&s5_syscon SKY1_USB_DP_PHY0_PRST_N>;
+        reset-names = "core", "apb";
+        cix,usbphy-syscon = <&s5_syscon 0>;
+        cix,default-conf = /bits/ 8 <0x03>;
+        orientation-switch;
+        mode-switch;
+
+        usb-port@0 {
+            reg = <0>;
+            #phy-cells = <0>;
+        };
+
+        dp-port@1 {
+            reg = <1>;
+            #phy-cells = <0>;
+        };
+    };
MAINTAINERS +1 -0
index 93abbb315065..8fb940a3ea3b 100644
@@ -2903,6 +2903,7 @@ S:	Maintained
 T:	git https://github.com/cixtech/linux-mainline.git
 F:	Documentation/devicetree/bindings/arm/cix.yaml
 F:	Documentation/devicetree/bindings/mailbox/cix,sky1-mbox.yaml
+F:	Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml
 F:	arch/arm64/boot/dts/cix/
 F:	drivers/mailbox/cix-mailbox.c
 K:	\bcix\b
Signature · 1 line
2.50.1
#2 lore raw

Re: [PATCH 1/3] dt-bindings: phy: add CIX Sky1 USB/DP combo PHY

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [Medium] dt-bindings: phy: cix,sky1-usbdp-phy: missing OF graph port for usb-switch - [Low] dt-bindings…

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] dt-bindings: phy: cix,sky1-usbdp-phy: missing OF graph port for usb-switch
- [Low] dt-bindings: phy: cix,sky1-usbdp-phy: redundant usb-port and dp-port nodes
- [Low] dt-bindings: phy: cix,sky1-usbdp-phy: software policy in cix,default-conf --

commit 04fdff6aa671993772ad90b645872bcdaa857848
Author: Gary Yang <[email protected]>

dt-bindings: phy: add CIX Sky1 USB/DP combo PHY

This commit adds the Device Tree binding schema for the CIX Sky1 USB/DP combo PHY, describing its USB and DisplayPort lane child nodes, Type-C switch properties, and S5 system controller phandle.

Quoted 6 lines
Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml new file +0 -0
new file mode 100644
index 0000000000000..a5b6943f84ebd
@@ -0,0 +1,150 @@

[ ... ]

Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml line 52

Quoted 9 lines
Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml new file +9 -0
+  orientation-switch:
+    description:
+      The PHY handles Type-C plug orientation switching.
+    type: boolean
+
+  mode-switch:
+    description:
+      The PHY handles multiplexing of the USB and DisplayPort lanes.
+    type: boolean

[Severity: Medium]
How does a Type-C connector or port controller link to this PHY's orientation-switch and mode-switch without an OF graph port or ports node?

In the Type-C mux and switch subsystem, fwnode_typec_switch_get()->fwnode_connection_find_matches() and fwnode_typec_mux_get()->fwnode_connection_find_matches() match orientation-switch in typec_switch_match() and mode-switch in typec_mux_match() by traversing OF graph endpoints via fwnode_graph_devcon_matches().

Because this schema sets additionalProperties: false without defining a port or ports node, any board Device Tree that adds an OF graph connection from a usb-c-connector to this PHY will fail dtbs_check validation, and without the graph link the Type-C subsystem cannot resolve the switch or mux.

Should this binding reference /schemas/usb/usb-switch.yaml# (or /schemas/usb/usb-switch-ports.yaml#) instead of redefining orientation-switch and mode-switch locally without graph endpoints?

Quoted 9 lines
Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml new file +9 -0
+
+  cix,usbphy-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      - items:
+          - description: phandle to the S5 system controller
+          - description: PHY instance index within the system controller
+    description:
+      Phandle to the system controller used for lane muxing and

Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml line 71

Quoted 10 lines
Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml new file +10 -0
+      Type-C orientation control, followed by the PHY instance index.
+
+  cix,default-conf:
+    $ref: /schemas/types.yaml#/definitions/uint8
+    enum: [0, 1, 2, 3]
+    default: 3
+    description: |
+      Lane mode the PHY is put in until a consumer changes it through the
+      Type-C mux. The value is a bit mask: 0 = none, 1 = USB, 2 = DP,
+      3 = USB and DP.

[Severity: Low]
Does cix,default-conf describe a hardware characteristic, or is it encoding initial driver software policy in Device Tree?

Which lane mode the driver configures prior to receiving a Type-C mux or PHY consumer state update appears to be runtime driver policy rather than static board or SoC hardware description. Could this property be dropped from the binding?

Quoted 27 lines
Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml new file +27 -0
+
+patternProperties:
+  "^usb-port@[0-9a-f]+$":
+    type: object
+    description:
+      The USB lane of the combo PHY.
+
+    properties:
+      reg:
+        maxItems: 1
+
+      "#phy-cells":
+        const: 0
+
+    required:
+      - reg
+      - "#phy-cells"
+
+    additionalProperties: false
+
+  "^dp-port@[0-9a-f]+$":
+    type: object
+    description:
+      The DisplayPort lane of the combo PHY.
+
+    properties:
+      reg:

Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml line 108

Quoted 10 lines
Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml new file +10 -0
+        maxItems: 1
+
+      "#phy-cells":
+        const: 0
+
+    required:
+      - reg
+      - "#phy-cells"
+
+    additionalProperties: false

[Severity: Low]
Are the usb-port and dp-port child nodes necessary when neither subnode has any dedicated Device Tree resources?

Each child node only contains reg and #phy-cells = <0>, with no per-lane clocks, resets, power supplies, or distinct MMIO register ranges. Could the parent PHY node set #phy-cells = <1> (for example, taking PHY_TYPE_USB3 and PHY_TYPE_DP) and omit these child nodes?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author maintainer
#3 lore raw

PATCH 2/3 phy: cix: add Sky1 USB/DP combo PHY driver

In reply to Gary Yang

Add a driver for the USB/DP combo PHY found on the CIX Sky1 SoC. A single PHY instance drives one SuperSpeedPlus USB lane and one DisplayPort lane of a USB Type-C port, and exposes the two lanes as separate child PHYs so that the USB and DP controllers can bind to them independently.

The PHY supports Type-C plug orientation switching and lane muxing between USB and DP, both driven through the S5 system controller. It registers a Type-C switch and mux with the Type-C class, so the orientation and mode decisions are taken by the connector driver instead of the PHY.

The bootloader may hand over the port already initialized; in that case the first power_on calls skip the re-initialization.

---
 MAINTAINERS                     |    1 +
 drivers/phy/Kconfig             |    1 +
 drivers/phy/Makefile            |    1 +
 drivers/phy/cix/Kconfig         |   22 +
 drivers/phy/cix/Makefile        |    2 +
 drivers/phy/cix/phy-cix-usbdp.c | 1477 +++++++++++++++++++++++++++++++
 drivers/phy/cix/phy-cix-usbdp.h |  265 ++++++
 7 files changed, 1769 insertions(+)
 create mode 100644 drivers/phy/cix/Kconfig
 create mode 100644 drivers/phy/cix/Makefile
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.c
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.h
MAINTAINERS +1 -0
index 8fb940a3ea3b..ed595861174b 100644
@@ -2906,6 +2906,7 @@ F:	Documentation/devicetree/bindings/mailbox/cix,sky1-mbox.yaml
 F:	Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml
 F:	arch/arm64/boot/dts/cix/
 F:	drivers/mailbox/cix-mailbox.c
+F:	drivers/phy/cix/
 K:	\bcix\b
 
 ARM/CLKDEV SUPPORT
drivers/phy/Kconfig +1 -0
index 105fbe408aa2..876e5857634c 100644
@@ -176,6 +176,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 c6dd02003bbe..5a31c5df1746 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_GENERIC_PHY)		+= allwinner/	\
 					   broadcom/	\
 					   cadence/	\
 					   canaan/	\
+					   cix/		\
 					   eswin/	\
 					   freescale/	\
 					   hisilicon/	\
drivers/phy/cix/Kconfig new file +22 -0
new file mode 100644
index 000000000000..769ec302657c
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Phy drivers for CIX platforms
+#
+
+config PHY_CIX_USBDP
+	tristate "CIX USB3/DP combo PHY driver"
+	depends on ARCH_CIX || COMPILE_TEST
+	depends on OF
+	depends on HAS_IOMEM
+	depends on RESET_CONTROLLER
+	depends on TYPEC
+	select GENERIC_PHY
+	select MFD_SYSCON
+	select REGMAP
+	help
+	  Enable this to support the CIX USB3/DP combo PHY, which provides
+	  one SuperSpeedPlus USB lane and one DisplayPort lane for a USB
+	  Type-C port.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called phy-cix-usbdp.
drivers/phy/cix/Makefile new file +2 -0
new file mode 100644
index 000000000000..68b5d7a029a8
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_PHY_CIX_USBDP)		+= phy-cix-usbdp.o
drivers/phy/cix/phy-cix-usbdp.c new file +1477 -0

1,477 lines not on this page · raw message

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

265 lines not on this page · raw message

Signature · 1 line
2.50.1
#4 lore raw

Re: [PATCH 2/3] phy: cix: add Sky1 USB/DP combo PHY driver

Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider: - [High] phy: cix: udphy_dp_phy_set_rate() checks DPCD codes instead of Mb/s link_rate - [High] phy: cix…

Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider:
- [High] phy: cix: udphy_dp_phy_set_rate() checks DPCD codes instead of Mb/s link_rate
- [High] phy: cix: udphy_dp_phy_set_voltages() applies lane 0 settings to all lanes
- [High] phy: cix: mode tracking in cix_usbdp_phy_power_on() leaks clk and skips init
- [High] phy: cix: udphy_dp_phy_configure() accesses MMIO when DP PHY is unpowered
- [High] phy: cix: udphy_dp_phy_verify_config() mishandles dp->lanes and dp->set_lanes
- [High] phy: cix: cix_u3phy_ops omits .init/.power_on and misuses .set_mode
- [Medium] phy: cix: cix_udphy_probe() resets PHY despite bootloader handover claim --

commit d4e0ce4573b0a846fb24af3d6c745c7798d8f7a9
Author: Gary Yang <[email protected]>

phy: cix: add Sky1 USB/DP combo PHY driver

This commit adds a driver for the CIX Sky1 USB/DP combo PHY, exposing separate child PHYs for the SuperSpeedPlus USB lane and DisplayPort lane while registering a Type-C orientation switch and mode mux.

Quoted 5 lines
drivers/phy/cix/phy-cix-usbdp.c new file +0 -0
new file mode 100644
index 0000000000000..d596e89c74f76

[ ... ]

Quoted 31 lines
drivers/phy/cix/phy-cix-usbdp.c new file +31 -0
+static int sky1_udphy_exit(struct cix_udphy *udphy)
+{
+	reset_control_assert(udphy->reset);
+	reset_control_assert(udphy->preset);
+	clk_disable_unprepare(udphy->apb_clk);
+	return 0;
+}
+
+static int sky1_udphy_init(struct cix_udphy *udphy)
+{
+	int ret;
+	u32 value;
+	const struct cix_udphy_con_dir *con_dir = &udphy->cfg->con_dir[udphy->id];
+
+	regmap_update_bits(udphy->usbphy_syscon, con_dir->offset,
+			   GENMASK(con_dir->bit, con_dir->bit),
+			   udphy->flip << con_dir->bit);
+
+	usleep_range(10, 20);
+
+	regmap_read(udphy->usbphy_syscon, con_dir->offset, &value);
+
+	/* usb rcsu reset is default deassert */
+	reset_control_assert(udphy->reset);
+	reset_control_assert(udphy->preset);
+
+	ret = sky1_udphy_clk_enable(udphy->apb_clk);
+	if (ret) {
+		dev_err(udphy->dev, "Failed to prepare_enable udphy apb clock\n");
+		return ret;
+	}

[ ... ]

Quoted 16 lines
drivers/phy/cix/phy-cix-usbdp.c new file +16 -0
+static int udphy_orien_sw_set(struct typec_switch_dev *sw,
+			      enum typec_orientation orien)
+{
+	struct cix_udphy *udphy = typec_switch_get_drvdata(sw);
+
+	mutex_lock(&udphy->mutex);
+
+	if (orien == TYPEC_ORIENTATION_NONE)
+		goto unlock_ret;
+
+	udphy->flip = (orien == TYPEC_ORIENTATION_REVERSE) ? true : false;
+
+unlock_ret:
+	mutex_unlock(&udphy->mutex);
+	return 0;
+}

[ ... ]

Quoted 53 lines
drivers/phy/cix/phy-cix-usbdp.c new file +53 -0
+static int cix_usbdp_phy_power_on(struct cix_udphy *udphy)
+{
+	const struct cix_udphy_cfg *phy_cfgs = udphy->cfg;
+	int ret;
+
+	if (udphy->cur_mode == udphy->next_mode)
+		return 0;
+
+	if ((udphy->cur_mode == UDPHY_MODE_USB || udphy->cur_mode == UDPHY_MODE_DP) &&
+	    udphy->next_mode == UDPHY_MODE_DP_USB)
+		return 0;
+
+	if (phy_cfgs->udphy_init) {
+		ret = phy_cfgs->udphy_init(udphy);
+		if (ret) {
+			dev_err(udphy->dev, "failed to init udphy\n");
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static int cix_usbdp_phy_power_off(struct cix_udphy *udphy)
+{
+	const struct cix_udphy_cfg *phy_cfgs = udphy->cfg;
+	int ret;
+
+	if (phy_cfgs->udphy_exit) {
+		ret = phy_cfgs->udphy_exit(udphy);
+		if (ret) {
+			dev_err(udphy->dev, "failed to exit udphy\n");
+			return ret;
+		}
+	}
+
+	udphy->cur_mode = UDPHY_MODE_NONE;
+	return 0;
+}
+
+static int udphy_dp_phy_power_on(struct phy *phy)
+{
+	struct cix_udphy *udphy = phy_get_drvdata(phy);
+	int ret = 0;
+
+	mutex_lock(&udphy->mutex);
+	if (!(udphy->next_mode & UDPHY_MODE_DP))
+		goto unlock;
+
+	ret = cix_usbdp_phy_power_on(udphy);
+	if (ret)
+		goto unlock;
+

drivers/phy/cix/phy-cix-usbdp.c line 913

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+	phy_set_bus_width(phy, udphy_dplane_get(udphy));
+	if (udphy->next_mode == UDPHY_MODE_DP)
+		udphy->cur_mode = UDPHY_MODE_DP;
+	else
+		udphy->cur_mode |= UDPHY_MODE_DP;
+
+unlock:
+	mutex_unlock(&udphy->mutex);
+	return ret;
+}

[Severity: High]
Can the mode tracking in cix_usbdp_phy_power_on() and udphy_dp_phy_power_on() leak theudphy->apb_clk enable count or skip needed hardware re-initialization?

First, sky1_udphy_init() unconditionally calls sky1_udphy_clk_enable(udphy->apb_clk), whereas sky1_udphy_exit() only calls clk_disable_unprepare(udphy->apb_clk) once when udphy->cur_mode reaches UDPHY_MODE_NONE in cix_usbdp_phy_power_off(). If one child PHY is already active (udphy->cur_mode != UDPHY_MODE_NONE) and udphy->next_mode changes such that cix_usbdp_phy_power_on() invokes sky1_udphy_init() a second time, udphy->apb_clk is prepared and enabled again without a matching disable.

In addition, when udphy->next_mode == UDPHY_MODE_DP, udphy_dp_phy_power_on() overwrites udphy->cur_mode = UDPHY_MODE_DP instead of setting the bit with |= UDPHY_MODE_DP. If UDPHY_MODE_USB was already set in udphy->cur_mode, that bit is lost and a subsequent cix_u3phy_exit() returns early without powering off the PHY or disabling udphy->apb_clk.

Second, cix_usbdp_phy_power_on() returns 0 without calling sky1_udphy_init() when udphy->cur_mode == UDPHY_MODE_DP and udphy->next_mode == UDPHY_MODE_DP_USB. If the PHY was initialized in 4-lane DP-only mode using sky1_udphy_dp_conf (where PHY_PMA_LANE_MAP is 0x51D9 and no USB3 lane registers are programmed) and then transitions to UDPHY_MODE_DP_USB, calling cix_u3phy_init() skips sky1_udphy_init() and leaves the USB3 lanes unconfigured.

Similarly, udphy_orien_sw_set() updates udphy->flip without updating udphy->usbphy_syscon or forcing re-initialization, so if udphy->flip changes while cix_usbdp_phy_power_on() takes one of the early return paths, the syscon orientation bit and PMA lane configuration remain in the previous orientation.

[ ... ]

drivers/phy/cix/phy-cix-usbdp.c line 948

Quoted 13 lines
drivers/phy/cix/phy-cix-usbdp.c new file +13 -0
+static int udphy_dp_phy_verify_config(struct cix_udphy *udphy,
+				      struct phy_configure_opts_dp *dp)
+{
+	int i;
+
+	switch (dp->lanes) {
+	case 1:
+	case 2:
+	case 4:
+		break;
+	default:
+		return -EINVAL;
+	}

[Severity: High]
What happens in udphy_dp_phy_verify_config() when a DisplayPort consumer calls phy_configure() with dp->lanes == 4 while the PHY is in 2-lane combo mode (UDPHY_MODE_DP_USB), or calls phy_configure() with dp->set_lanes == 0?

Because udphy_dp_phy_verify_config() does not check that dp->lanes is within udphy_dplane_get(udphy), passing dp->lanes == 4 while in UDPHY_MODE_DP_USB is accepted and causes udphy_dp_phy_set_rate() and udphy_dp_phy_set_voltages() to overwrite the PMA registers for all 4 lanes, clobbering the 2 lanes assigned to USB3.

Also, struct phy_configure_opts_dp gates lane reconfiguration on dp->set_lanes, so callers updating only link rate or voltage levels with dp->set_lanes == 0 may leave dp->lanes unset and fail this check with -EINVAL.

Quoted 47 lines
drivers/phy/cix/phy-cix-usbdp.c new file +47 -0
+
+	/*
+	 * If changing voltages is required, check swing and pre-emphasis
+	 * levels, per-lane.
+	 */
+	if (dp->set_voltages) {
+		for (i = 0; i < dp->lanes; i++) {
+			if (dp->voltage[i] > 3 || dp->pre[i] > 3)
+				return -EINVAL;
+
+			/*
+			 * Sum of voltage swing and pre-emphasis levels cannot
+			 * exceed 3.
+			 */
+			if (dp->voltage[i] + dp->pre[i] > 3)
+				return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
+static int udphy_dp_phy_set_rate(struct cix_udphy *udphy,
+				 struct phy_configure_opts_dp *dp)
+{
+	int ret;
+	const struct phy_link_cfg *conf = NULL;
+
+	dev_dbg(udphy->dev, "lane %d, rate %x\n", dp->lanes, dp->link_rate);
+
+	regmap_update_bits(udphy->phy_regmap, PHY_PMA_PLL_CTRL, BIT(1), 0x0);
+	usleep_range(10, 20);
+
+	switch (dp->link_rate) {
+	case 0x6:
+		conf = &link_cfg[0];
+		ret = regmap_multi_reg_write(udphy->phy_regmap, sky1_udphy_dp_partial_conf,
+					     ARRAY_SIZE(sky1_udphy_dp_partial_conf));
+		break;
+	case 0xa:
+		conf = &link_cfg[1];
+		ret = regmap_multi_reg_write(udphy->phy_regmap, sky1_udphy_dp_partial_conf,
+					     ARRAY_SIZE(sky1_udphy_dp_partial_conf));
+		break;
+	case 0x14:
+		conf = &link_cfg[2];
+		ret = regmap_multi_reg_write(udphy->phy_regmap, sky1_udphy_dp_partial_conf,

drivers/phy/cix/phy-cix-usbdp.c line 1005

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+					     ARRAY_SIZE(sky1_udphy_dp_partial_conf));
+		break;
+	case 0x1e:
+		conf = &link_cfg[3];
+		ret = regmap_multi_reg_write(udphy->phy_regmap, sky1_udphy_dp_8p1_conf,
+					     ARRAY_SIZE(sky1_udphy_dp_8p1_conf));
+		break;
+	default:
+		return -EINVAL;
+	}

[Severity: High]
Should udphy_dp_phy_set_rate() match dp->link_rate against link rates in Mb/s (1620, 2700, 5400, 8100) rather than raw DPCD link bandwidth codes (0x6, 0xa, 0x14, 0x1e)?

In include/linux/phy/phy-dp.h, struct phy_configure_opts_dp specifies link_rate in Mb/s. Standard DisplayPort controller drivers passing 1620, 2700, 5400, or 8100 Mb/s will hit the default case and fail with -EINVAL.

Additionally, because udphy_dp_phy_verify_config() does not validate dp->link_rate before udphy_dp_phy_set_rate() clears BIT(1) in PHY_PMA_PLL_CTRL, returning -EINVAL here (or on a regmap_multi_reg_write() failure) leaves PLL1 disabled in hardware.

[ ... ]

drivers/phy/cix/phy-cix-usbdp.c line 1072

Quoted 5 lines
drivers/phy/cix/phy-cix-usbdp.c new file +5 -0
+static int udphy_dp_phy_set_voltages(struct cix_udphy *udphy,
+				     struct phy_configure_opts_dp *dp)
+{
+	u32 index = dp->voltage[0] * 4 + dp->pre[0];
+	const struct phy_voltage_conf *cfg = volt_cfg;

[Severity: High]
Why does udphy_dp_phy_set_voltages() compute index only from dp->voltage[0] and dp->pre[0] and apply it to all lanes?

In udphy_dp_phy_verify_config(), dp->voltage[i] and dp->pre[i] are validated for each lane i up to dp->lanes, but udphy_dp_phy_set_voltages() ignores dp->voltage[1..3] and dp->pre[1..3] and programs lane 0's swing and pre-emphasis settings into every active lane in the 2-lane and 4-lane cases.

[ ... ]

Quoted 23 lines
drivers/phy/cix/phy-cix-usbdp.c new file +23 -0
+static int udphy_dp_phy_configure(struct phy *phy,
+				  union phy_configure_opts *opts)
+{
+	struct cix_udphy *udphy = phy_get_drvdata(phy);
+	int ret;
+
+	mutex_lock(&udphy->mutex);
+	ret = udphy_dp_phy_verify_config(udphy, &opts->dp);
+	if (ret)
+		goto unlock;
+
+	if (opts->dp.set_rate) {
+		ret = udphy_dp_phy_set_rate(udphy, &opts->dp);
+		if (ret) {
+			dev_err(udphy->dev, "failed to set DP link rate\n");
+			goto unlock;
+		}
+	}
+
+	if (opts->dp.set_voltages) {
+		ret = udphy_dp_phy_set_voltages(udphy, &opts->dp);
+		if (ret) {
+			dev_err(udphy->dev, "dp_phy_set_voltages failed\n");

drivers/phy/cix/phy-cix-usbdp.c line 1251

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+			goto unlock;
+		}
+	}
+	mutex_unlock(&udphy->mutex);
+	return 0;
+
+unlock:
+	mutex_unlock(&udphy->mutex);
+	return ret;
+}

[Severity: High]
Can udphy_dp_phy_configure() access PHY MMIO registers while udphy->apb_clk is disabled and udphy->preset is asserted?

In cix_udphy_probe() and sky1_udphy_exit(), udphy->reset and udphy->preset are asserted and udphy->apb_clk is disabled. If udphy_dp_phy_power_on() is called when UDPHY_MODE_DP is not set in udphy->next_mode (for example, when usbdp_typec_mux_set() sets udphy->next_mode = UDPHY_MODE_USB for TYPEC_STATE_SAFE or USB-only mode), udphy_dp_phy_power_on() returns 0 without enabling udphy->apb_clk or deasserting udphy->preset.

If the DisplayPort controller then calls phy_configure() (or calls phy_configure() before phy_power_on()), udphy_dp_phy_configure() does not check whether udphy->cur_mode & UDPHY_MODE_DP is active before accessing udphy->phy_regmap in udphy_dp_phy_set_rate() and udphy_dp_phy_set_voltages().

[ ... ]

drivers/phy/cix/phy-cix-usbdp.c line 1315

Quoted 13 lines
drivers/phy/cix/phy-cix-usbdp.c new file +13 -0
+static int cix_u3phy_set_mode(struct phy *phy, enum phy_mode mode, int submode)
+{
+	if (mode == PHY_MODE_INVALID)
+		return cix_u3phy_exit(phy);
+
+	return cix_u3phy_init(phy);
+}
+
+static const struct phy_ops cix_u3phy_ops = {
+	.set_mode       = cix_u3phy_set_mode,
+	.exit		= cix_u3phy_exit,
+	.owner		= THIS_MODULE,
+};

[Severity: High]
Is it intentional that cix_u3phy_ops defines .exit = cix_u3phy_exit without .init, .power_on, or .power_off, and instead wires cix_u3phy_init() and cix_u3phy_exit() into .set_mode?

Standard USB controller drivers (such as cdns3, dwc3, and xhci-plat) manage the PHY lifecycle through phy_init(), phy_power_on(), phy_power_off(), and phy_exit(). During system resume (for example in cdns3_controller_resume()), calling phy_exit() followed by phy_init() and phy_power_on() without calling phy_set_mode() will run cix_u3phy_exit() and leave the USB3 PHY powered off because .init and .power_on are NULL.

[ ... ]

Quoted 7 lines
drivers/phy/cix/phy-cix-usbdp.c new file +7 -0
+static void udphy_set_default_mode(struct cix_udphy *udphy)
+{
+	udphy->cur_mode = UDPHY_MODE_NONE;
+}
+
+static int cix_udphy_probe(struct platform_device *pdev)
+{

[ ... ]

Quoted 6 lines
drivers/phy/cix/phy-cix-usbdp.c new file +6 -0
+	ret = device_property_read_u8(dev, "cix,default-conf", &udphy->next_mode);
+	if (ret)
+		udphy->next_mode = UDPHY_MODE_DP_USB;
+
+	reset_control_assert(udphy->reset);
+	reset_control_assert(udphy->preset);

[ ... ]

drivers/phy/cix/phy-cix-usbdp.c line 1421

Quoted 1 line
drivers/phy/cix/phy-cix-usbdp.c new file +1 -0
+	udphy_set_default_mode(udphy);

[Severity: Medium]
The commit message states:

The bootloader may hand over the port already initialized; in that case the first power_on calls skip the re-initialization.

However, cix_udphy_probe() unconditionally asserts both udphy->reset and udphy->preset, and udphy_set_default_mode() sets udphy->cur_mode = UDPHY_MODE_NONE, so the first call to cix_usbdp_phy_power_on() will always re-initialize the PHY. Does the probe path or commit message need to be updated to match the intended bootloader handover behavior?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#5 lore raw

Re: [PATCH 2/3] phy: cix: add Sky1 USB/DP combo PHY driver

In reply to Gary Yang
Quoted 6 lines · Gary Yang

Add a driver for the USB/DP combo PHY found on the CIX Sky1 SoC. A single PHY instance drives one SuperSpeedPlus USB lane and one DisplayPort lane of a USB Type-C port, and exposes the two lanes as separate child PHYs so that the USB and DP controllers can bind to them independently.

Quoted 9 lines

The PHY supports Type-C plug orientation switching and lane muxing between USB and DP, both driven through the S5 system controller. It registers a Type-C switch and mux with the Type-C class, so the orientation and mode decisions are taken by the connector driver instead of the PHY.

The bootloader may hand over the port already initialized; in that case the first power_on calls skip the re-initialization.

How is this accomplished?

Quoted 21 lines
---
 MAINTAINERS                     |    1 +
 drivers/phy/Kconfig             |    1 +
 drivers/phy/Makefile            |    1 +
 drivers/phy/cix/Kconfig         |   22 +
 drivers/phy/cix/Makefile        |    2 +
 drivers/phy/cix/phy-cix-usbdp.c | 1477 +++++++++++++++++++++++++++++++
 drivers/phy/cix/phy-cix-usbdp.h |  265 ++++++
 7 files changed, 1769 insertions(+)
 create mode 100644 drivers/phy/cix/Kconfig
 create mode 100644 drivers/phy/cix/Makefile
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.c
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.h
MAINTAINERS +0 -0
index 8fb940a3ea3b..ed595861174b 100644

MAINTAINERS F: Documentation/devicetree/bindings/mailbox/cix,sky1-mbox.yaml · line 2909

Quoted 4 lines
MAINTAINERS +1 -0
@@ -2906,6 +2906,7 @@ F:	Documentation/devicetree/bindings/mailbox/cix,sky1-mbox.yaml
 F:	Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml
 F:	arch/arm64/boot/dts/cix/
 F:	drivers/mailbox/cix-mailbox.c
+F:	drivers/phy/cix/

This one is also trying to add a new CIX PHY entry:
https://lore.kernel.org/linux-phy/[email protected]

Can you please co-ordinate?

Quoted 69 lines
MAINTAINERS +0 -0
 K:	\bcix\b
 
 ARM/CLKDEV SUPPORT
drivers/phy/Kconfig +1 -0
index 105fbe408aa2..876e5857634c 100644
@@ -176,6 +176,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 c6dd02003bbe..5a31c5df1746 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_GENERIC_PHY)		+= allwinner/	\
 					   broadcom/	\
 					   cadence/	\
 					   canaan/	\
+					   cix/		\
 					   eswin/	\
 					   freescale/	\
 					   hisilicon/	\
drivers/phy/cix/Kconfig new file +22 -0
new file mode 100644
index 000000000000..769ec302657c
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Phy drivers for CIX platforms
+#
+
+config PHY_CIX_USBDP
+	tristate "CIX USB3/DP combo PHY driver"
+	depends on ARCH_CIX || COMPILE_TEST
+	depends on OF
+	depends on HAS_IOMEM
+	depends on RESET_CONTROLLER
+	depends on TYPEC
+	select GENERIC_PHY
+	select MFD_SYSCON
+	select REGMAP
+	help
+	  Enable this to support the CIX USB3/DP combo PHY, which provides
+	  one SuperSpeedPlus USB lane and one DisplayPort lane for a USB
+	  Type-C port.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called phy-cix-usbdp.
drivers/phy/cix/Makefile new file +2 -0
new file mode 100644
index 000000000000..68b5d7a029a8
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_PHY_CIX_USBDP)		+= phy-cix-usbdp.o
drivers/phy/cix/phy-cix-usbdp.c new file +0 -0
new file mode 100644
index 000000000000..d596e89c74f7

drivers/phy/cix/phy-cix-usbdp.c line 3

Quoted 3 lines
drivers/phy/cix/phy-cix-usbdp.c new file +3 -0
@@ -0,0 +1,1477 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * phy driver for cdn_sd0804_t7g_typec

No copyright?

Quoted 91 lines
drivers/phy/cix/phy-cix-usbdp.c new file +91 -0
+ */
+
+#include <linux/array_size.h>
+#include <linux/bits.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/phy/phy.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>
+#include <linux/usb/typec_dp.h>
+#include <linux/usb/typec_mux.h>
+
+#include "phy-cix-usbdp.h"
+
+enum {
+	UDPHY_MODE_NONE		= 0,
+	UDPHY_MODE_USB		= BIT(0),
+	UDPHY_MODE_DP		= BIT(1),
+	UDPHY_MODE_DP_USB	= BIT(1) | BIT(0),
+};
+
+#define PHY_LANE_MUX_USB			0
+#define PHY_LANE_MUX_DP				1
+
+struct cix_udphy;
+
+struct cix_udphy_con_dir {
+	u16 offset;
+	u8 bit;
+};
+
+struct cix_udphy_cfg {
+	const struct cix_udphy_con_dir *con_dir;
+	int (*udphy_init)(struct cix_udphy *udphy);
+	int (*udphy_exit)(struct cix_udphy *udphy);
+};
+
+/*
+ * USB 3.0/3.1 Type C Alt Mode
+ *   port 0: USB_TCAM; port 1, DP, 8.1 Gbps by default
+ */
+static const struct reg_sequence sky1_udphy_usbdp_conf_normal[] = {
+	{CMN_SSM_BIAS_TMR,              0x0018},
+	{CMN_PLLSM0_PLLPRE_TMR,         0x0030},
+	{CMN_PLLSM0_PLLLOCK_TMR,        0x00f0},
+	{CMN_PLLSM1_PLLPRE_TMR,         0x0030},
+	{CMN_PLLSM1_PLLLOCK_TMR,        0x00f0},
+	{CMN_BGCAL_INIT_TMR,            0x0078},
+	{CMN_BGCAL_ITER_TMR,            0x0078},
+	{CMN_IBCAL_INIT_TMR,            0x0018},
+	{CMN_TXPUCAL_INIT_TMR,          0x001d},
+	{CMN_TXPDCAL_INIT_TMR,          0x001d},
+	{CMN_RXCAL_INIT_TMR,            0x02d0},
+	{CMN_SD_CAL_PLLCNT_START,       0x0137},
+
+	{RX_SDCAL0_INIT_TMR_LANE0,      0x0018},
+	{RX_SDCAL0_INIT_TMR_LANE1,      0x0018},
+	{RX_SDCAL0_INIT_TMR_LANE2,      0x0018},
+	{RX_SDCAL0_INIT_TMR_LANE3,      0x0018},
+	{RX_SDCAL0_ITER_TMR_LANE0,      0x0078},
+	{RX_SDCAL0_ITER_TMR_LANE1,      0x0078},
+	{RX_SDCAL0_ITER_TMR_LANE2,      0x0078},
+	{RX_SDCAL0_ITER_TMR_LANE3,      0x0078},
+	{RX_SDCAL1_INIT_TMR_LANE0,      0x0018},
+	{RX_SDCAL1_INIT_TMR_LANE1,      0x0018},
+	{RX_SDCAL1_INIT_TMR_LANE2,      0x0018},
+	{RX_SDCAL1_INIT_TMR_LANE3,      0x0018},
+	{RX_SDCAL1_ITER_TMR_LANE0,      0x0078},
+	{RX_SDCAL1_ITER_TMR_LANE1,      0x0078},
+	{RX_SDCAL1_ITER_TMR_LANE2,      0x0078},
+	{RX_SDCAL1_ITER_TMR_LANE3,      0x0078},
+	{TX_RCVDET_ST_TMR_LANE0,        0x0960},
+	{TX_RCVDET_ST_TMR_LANE1,        0x0960},
+	{TX_RCVDET_ST_TMR_LANE2,        0x0960},
+	{TX_RCVDET_ST_TMR_LANE3,        0x0960},
+
+	{CMN_PDIAG_PLL0_CLK_SEL_M0,     0x8600},
+	{CMN_PDIAG_PLL1_CLK_SEL_M0,     0x0601},
+	{XCVR_DIAG_PLLDRC_CTRL_LANE0,   0x0041},
+	{XCVR_DIAG_PLLDRC_CTRL_LANE1,   0x0041},
+	{XCVR_DIAG_HSCLK_SEL_LANE2,     0x0001},
+	{XCVR_DIAG_HSCLK_SEL_LANE3,     0x0001},
+	{XCVR_DIAG_HSCLK_DIV_LANE2,     0x0000},
+	{XCVR_DIAG_HSCLK_DIV_LANE3,     0x0000},
+	{XCVR_DIAG_PLLDRC_CTRL_LANE2,   0x0019},
+	{XCVR_DIAG_PLLDRC_CTRL_LANE3,   0x0019},

drivers/phy/cix/phy-cix-usbdp.c line 104

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+
+	{CMN_PLL0_DSM_DIAG_M0,          0x0004},
+	{CMN_PLL1_DSM_DIAG_M0,          0x8004},
+	{CMN_PDIAG_PLL1_ITRIM_M0,       0x003f},
+	{CMN_PDIAG_PLL0_CP_PADJ_M0,     0x0B17},
+	{CMN_PDIAG_PLL1_CP_PADJ_M0,     0x0B17},
+	{CMN_PDIAG_PLL0_CP_IADJ_M0,     0x0E01},
+	{CMN_PDIAG_PLL1_CP_IADJ_M0,     0x0E01},
+	{CMN_PDIAG_PLL0_FILT_PADJ_M0,   0x0D05},
+	{CMN_PDIAG_PLL1_FILT_PADJ_M0,   0x0D05},

Use lower caps for hex.

Quoted 519 lines
drivers/phy/cix/phy-cix-usbdp.c new file +519 -0
+
+	{CMN_PLL0_INTDIV_M0,            0x01A0},
+	{CMN_PLL1_INTDIV_M0,            0x01C2},
+	{CMN_PLL0_FRACDIVL_M0,          0xAAAB},
+
+	{CMN_PLL1_FRACDIVL_M0,          0x0000}, /* reset value. */
+
+	{CMN_PLL0_FRACDIVH_M0,          0x0002},
+	{CMN_PLL1_FRACDIVH_M0,          0x0002},
+	{CMN_PLL0_HIGH_THR_M0,          0x0116},
+	{CMN_PLL1_HIGH_THR_M0,          0x012C},
+	{CMN_PDIAG_PLL0_CTRL_M0,        0x1002},
+	{CMN_PDIAG_PLL1_CTRL_M0,        0x1002},
+	{CMN_PLL0_SS_CTRL1_M0,          0x0001},
+	{CMN_PLL1_SS_CTRL1_M0,          0x0001},
+	{CMN_PLL0_SS_CTRL2_M0,          0x0416},
+	{CMN_PLL1_SS_CTRL2_M0,          0x044F},
+	{CMN_PLL0_SS_CTRL3_M0,          0x007C},
+	{CMN_PLL1_SS_CTRL3_M0,          0x007F},
+	{CMN_PLL0_SS_CTRL4_M0,          0x0003},
+	{CMN_PLL1_SS_CTRL4_M0,          0x0003},
+	{CMN_PLL0_VCOCAL_INIT_TMR,      0x00F0},
+	{CMN_PLL1_VCOCAL_INIT_TMR,      0x00F0},
+	{CMN_PLL0_VCOCAL_ITER_TMR,      0x0004},
+	{CMN_PLL1_VCOCAL_ITER_TMR,      0x0004},
+	{CMN_PLL0_VCOCAL_REFTIM_START,  0x02F8},
+	{CMN_PLL1_VCOCAL_REFTIM_START,  0x02F8},
+	{CMN_PLL0_VCOCAL_PLLCNT_START,  0x02F6},
+	{CMN_PLL1_VCOCAL_PLLCNT_START,  0x02F6},
+	{CMN_PLL0_VCOCAL_TCTRL,         0x0003},
+	{CMN_PLL1_VCOCAL_TCTRL,         0x0003},
+	{CMN_PLL0_LOCK_REFCNT_START,    0x00BF},
+	{CMN_PLL1_LOCK_REFCNT_START,    0x00BF},
+	{CMN_PLL0_LOCK_PLLCNT_START,    0x00BF},
+	{CMN_PLL1_LOCK_PLLCNT_START,    0x00BF},
+	{CMN_PLL0_LOCK_PLLCNT_THR,      0x0005},
+	{CMN_PLL1_LOCK_PLLCNT_THR,      0x0005},
+
+	/* usb_part */
+	{PHY_PMA_LANE_MAP,              0x5100},
+	{PHY_LANE_OFF_CTRL,             0x0100},
+	{PHY_PIPE_USB3_GEN2_PRE_CFG0,   0x0A0A},
+	{PHY_PIPE_USB3_GEN2_POST_CFG0,  0x1000},
+	{PHY_PIPE_USB3_GEN2_POST_CFG1,  0x0010},
+	{CMN_CDIAG_CDB_PWRI_OVRD,       0x8200},
+	{CMN_CDIAG_XCVRC_PWRI_OVRD,     0x8200},
+	{TX_PSC_A0_LANE0,               0x02FF},
+	{TX_PSC_A1_LANE0,               0x06AF},
+	{TX_PSC_A2_LANE0,               0x06AE},
+	{TX_PSC_A3_LANE0,               0x06AE},
+	{RX_PSC_A0_LANE1,               0x0D1D},
+	{RX_PSC_A1_LANE1,               0x0D1D},
+	{RX_PSC_A2_LANE1,               0x0D00},
+	{RX_PSC_A3_LANE1,               0x0500},
+	{TX_TXCC_CTRL_LANE0,            0x2A82},
+	{TX_TXCC_CPOST_MULT_01_LANE0,   0x0014},
+	{TX_TXCC_MGNFS_MULT_000_LANE0,  0x0007},
+	{RX_SIGDET_HL_FILT_TMR_LANE1,   0x0013},
+	{RX_REE_GCSM1_CTRL_LANE1,       0x0000},
+	{RX_REE_ATTEN_THR_LANE1,        0x0C02},
+	{RX_REE_SMGM_CTRL1_LANE1,       0x0330},
+	{RX_REE_SMGM_CTRL2_LANE1,       0x0300},
+	{XCVR_DIAG_PSC_OVRD_LANE1,      0x0003},
+	{RX_DIAG_SIGDET_TUNE_LANE1,     0x1004},
+	{RX_DIAG_NQST_CTRL_LANE1,       0x00F9},
+	{RX_DIAG_DFE_AMP_TUNE_2_LANE1,  0x0C01},
+	{RX_DIAG_DFE_AMP_TUNE_3_LANE1,  0x0002},
+	{RX_DIAG_PI_CAP_LANE1,          0x0000},
+	{RX_DIAG_PI_RATE_LANE1,         0x0031},
+	{RX_DIAG_ACYA_LANE0,            0x0002},
+	{RX_CDRLF_CNFG_LANE1,           0x018C},
+	{RX_CDRLF_CNFG3_LANE1,          0x0003},
+	/* usb adding to upspeed */
+	{XCVR_DIAG_BIDI_CTRL_LANE0,     0x000f}, /* new add */
+	{XCVR_DIAG_BIDI_CTRL_LANE1,     0x00F0}, /* new add */
+
+	/* dp_part */
+	{PHY_PMA_ISO_PLL_CTRL0,         0x000B},
+	{PHY_PMA_ISO_PLL_CTRL1,         0x2224},
+
+	{TX_PSC_A0_LANE2,              0x00FB},
+	{TX_PSC_A0_LANE3,              0x00FB},
+	{TX_PSC_A2_LANE2,              0x04AA},
+	{TX_PSC_A2_LANE3,              0x04AA},
+	{TX_PSC_A3_LANE2,              0x04AA},
+	{TX_PSC_A3_LANE3,              0x04AA},
+	{RX_PSC_A0_LANE2,              0x0000},
+	{RX_PSC_A0_LANE3,              0x0000},
+	{RX_PSC_A2_LANE2,              0x0000},
+	{RX_PSC_A2_LANE3,              0x0000},
+	{RX_PSC_A3_LANE2,              0x0000},
+	{RX_PSC_A3_LANE3,              0x0000},
+	{RX_PSC_CAL_LANE2,             0x0000},
+	{RX_PSC_CAL_LANE3,             0x0000},
+	{XCVR_DIAG_BIDI_CTRL_LANE2,    0x000F},
+	{XCVR_DIAG_BIDI_CTRL_LANE3,    0x000F},
+	{RX_REE_GCSM1_CTRL_LANE2,      0x0000},
+	{RX_REE_GCSM1_CTRL_LANE3,      0x0000},
+	{RX_REE_GCSM2_CTRL_LANE2,      0x0000},
+	{RX_REE_GCSM2_CTRL_LANE3,      0x0000},
+	{RX_REE_PERGCSM_CTRL_LANE2,    0x0000},
+	{RX_REE_PERGCSM_CTRL_LANE3,    0x0000},
+
+	{CMN_DIAG_GPANA_0,             0x0100}, /* new add */
+};
+
+/*
+ * TYPEC_ALT_MODE_DP
+ *   DP only
+ */
+static const struct reg_sequence sky1_udphy_dp_conf[] = {
+	{CMN_SSM_BIAS_TMR,              0x0018},
+	{CMN_PLLSM0_PLLPRE_TMR,         0x0030},
+	{CMN_PLLSM0_PLLLOCK_TMR,        0x00f0},
+	{CMN_PLLSM1_PLLPRE_TMR,         0x0030},
+	{CMN_PLLSM1_PLLLOCK_TMR,        0x00f0},
+	{CMN_BGCAL_INIT_TMR,            0x0078},
+	{CMN_BGCAL_ITER_TMR,            0x0078},
+	{CMN_IBCAL_INIT_TMR,            0x0018},
+	{CMN_TXPUCAL_INIT_TMR,          0x001d},
+	{CMN_TXPDCAL_INIT_TMR,          0x001d},
+	{CMN_RXCAL_INIT_TMR,            0x02d0},
+	{CMN_SD_CAL_PLLCNT_START,       0x0137},
+	{RX_SDCAL0_INIT_TMR_LANE0,      0x0018},
+	{RX_SDCAL0_INIT_TMR_LANE1,      0x0018},
+	{RX_SDCAL0_INIT_TMR_LANE2,      0x0018},
+	{RX_SDCAL0_INIT_TMR_LANE3,      0x0018},
+	{RX_SDCAL0_ITER_TMR_LANE0,      0x0078},
+	{RX_SDCAL0_ITER_TMR_LANE1,      0x0078},
+	{RX_SDCAL0_ITER_TMR_LANE2,      0x0078},
+	{RX_SDCAL0_ITER_TMR_LANE3,      0x0078},
+	{RX_SDCAL1_INIT_TMR_LANE0,      0x0018},
+	{RX_SDCAL1_INIT_TMR_LANE1,      0x0018},
+	{RX_SDCAL1_INIT_TMR_LANE2,      0x0018},
+	{RX_SDCAL1_INIT_TMR_LANE3,      0x0018},
+	{RX_SDCAL1_ITER_TMR_LANE0,      0x0078},
+	{RX_SDCAL1_ITER_TMR_LANE1,      0x0078},
+	{RX_SDCAL1_ITER_TMR_LANE2,      0x0078},
+	{RX_SDCAL1_ITER_TMR_LANE3,      0x0078},
+	{TX_RCVDET_ST_TMR_LANE0,        0x0960},
+	{TX_RCVDET_ST_TMR_LANE1,        0x0960},
+	{TX_RCVDET_ST_TMR_LANE2,        0x0960},
+	{TX_RCVDET_ST_TMR_LANE3,        0x0960},
+	{CMN_PDIAG_PLL0_CLK_SEL_M0,     0x8600},
+	{CMN_PDIAG_PLL1_CLK_SEL_M0,     0x0701},
+	{XCVR_DIAG_HSCLK_SEL_LANE0,     0x0001},
+	{XCVR_DIAG_HSCLK_SEL_LANE1,     0x0001},
+	{XCVR_DIAG_HSCLK_SEL_LANE2,     0x0001},
+	{XCVR_DIAG_HSCLK_SEL_LANE3,     0x0001},
+	{XCVR_DIAG_HSCLK_DIV_LANE0,     0x0001},
+	{XCVR_DIAG_HSCLK_DIV_LANE1,     0x0001},
+	{XCVR_DIAG_HSCLK_DIV_LANE2,     0x0001},
+	{XCVR_DIAG_HSCLK_DIV_LANE3,     0x0001},
+	{XCVR_DIAG_PLLDRC_CTRL_LANE0,   0x0019},
+	{XCVR_DIAG_PLLDRC_CTRL_LANE1,   0x0019},
+	{XCVR_DIAG_PLLDRC_CTRL_LANE2,   0x0019},
+	{XCVR_DIAG_PLLDRC_CTRL_LANE3,   0x0019},
+	{CMN_PLL0_DSM_DIAG_M0,          0x0004},
+	{CMN_PLL1_DSM_DIAG_M0,          0x8004},
+	{CMN_PDIAG_PLL1_ITRIM_M0,       0x003f},
+
+	{CMN_PDIAG_PLL0_CP_PADJ_M0,     0x0b17},
+	{CMN_PDIAG_PLL1_CP_PADJ_M0,     0x0b17},
+	{CMN_PDIAG_PLL0_CP_IADJ_M0,     0x0e01},
+	{CMN_PDIAG_PLL1_CP_IADJ_M0,     0x0e01},
+	{CMN_PDIAG_PLL0_FILT_PADJ_M0,   0x0d05},
+	{CMN_PDIAG_PLL1_FILT_PADJ_M0,   0x0d05},
+	{CMN_PLL0_INTDIV_M0,            0x01a0},
+	{CMN_PLL1_INTDIV_M0,            0x01c2},
+	{CMN_PLL0_FRACDIVL_M0,          0xaaab},
+	{CMN_PLL1_FRACDIVL_M0,          0x0000},
+	{CMN_PLL0_FRACDIVH_M0,          0x0002},
+	{CMN_PLL1_FRACDIVH_M0,          0x0002},
+	{CMN_PLL0_HIGH_THR_M0,          0x0116},
+	{CMN_PLL1_HIGH_THR_M0,          0x012c},
+	{CMN_PDIAG_PLL0_CTRL_M0,        0x1002},
+	{CMN_PDIAG_PLL1_CTRL_M0,        0x1002},
+
+	{CMN_PLL0_SS_CTRL1_M0,          0x0001},
+	{CMN_PLL1_SS_CTRL1_M0,          0x0001},
+	{CMN_PLL0_SS_CTRL2_M0,          0x0416},
+	{CMN_PLL1_SS_CTRL2_M0,          0x044F},
+	{CMN_PLL0_SS_CTRL3_M0,          0x007C},
+	{CMN_PLL1_SS_CTRL3_M0,          0x007F},
+	{CMN_PLL0_SS_CTRL4_M0,          0x0003},
+	{CMN_PLL1_SS_CTRL4_M0,          0x0003},
+
+	{CMN_PLL0_VCOCAL_INIT_TMR,      0x00f0},
+	{CMN_PLL1_VCOCAL_INIT_TMR,      0x00f0},
+	{CMN_PLL0_VCOCAL_ITER_TMR,      0x0004},
+	{CMN_PLL1_VCOCAL_ITER_TMR,      0x0004},
+	{CMN_PLL0_VCOCAL_REFTIM_START,  0x02f8},
+	{CMN_PLL1_VCOCAL_REFTIM_START,  0x02f8},
+	{CMN_PLL0_VCOCAL_PLLCNT_START,  0x02f6},
+	{CMN_PLL1_VCOCAL_PLLCNT_START,  0x02f6},
+	{CMN_PLL0_VCOCAL_TCTRL,         0x0003},
+	{CMN_PLL1_VCOCAL_TCTRL,         0x0003},
+	{CMN_PLL0_LOCK_REFCNT_START,    0x00bf},
+	{CMN_PLL1_LOCK_REFCNT_START,    0x00bf},
+	{CMN_PLL0_LOCK_PLLCNT_START,    0x00bf},
+	{CMN_PLL1_LOCK_PLLCNT_START,    0x00bf},
+	{CMN_PLL0_LOCK_PLLCNT_THR,      0x0005},
+	{CMN_PLL1_LOCK_PLLCNT_THR,      0x0005},
+	{PHY_PMA_LANE_MAP,              0x51D9},
+	{PHY_LANE_OFF_CTRL,             0x0100},
+	{PHY_PIPE_USB3_GEN2_PRE_CFG0,   0x0a0a},
+	{PHY_PIPE_USB3_GEN2_POST_CFG0,  0x1000},
+	{PHY_PIPE_USB3_GEN2_POST_CFG1,  0x0010},
+	{CMN_CDIAG_CDB_PWRI_OVRD,       0x8200},
+	{CMN_CDIAG_XCVRC_PWRI_OVRD,     0x8200},
+
+	{PHY_PMA_ISO_PLL_CTRL0,         0x000b},
+	{PHY_PMA_ISO_PLL_CTRL1,         0x2224},
+	{TX_PSC_A0_LANE0,               0x00fb},
+	{TX_PSC_A0_LANE1,               0x00fb},
+	{TX_PSC_A0_LANE2,               0x00fb},
+	{TX_PSC_A0_LANE3,               0x00fb},
+	{TX_PSC_A2_LANE0,               0x04aa},
+	{TX_PSC_A2_LANE1,               0x04aa},
+	{TX_PSC_A2_LANE2,               0x04aa},
+	{TX_PSC_A2_LANE3,               0x04aa},
+	{TX_PSC_A3_LANE0,               0x04aa},
+	{TX_PSC_A3_LANE1,               0x04aa},
+	{TX_PSC_A3_LANE2,               0x04aa},
+	{TX_PSC_A3_LANE3,               0x04aa},
+	{RX_PSC_A0_LANE0,               0x0000},
+	{RX_PSC_A0_LANE1,               0x0000},
+	{RX_PSC_A0_LANE2,               0x0000},
+	{RX_PSC_A0_LANE3,               0x0000},
+	{RX_PSC_A2_LANE0,               0x0000},
+	{RX_PSC_A2_LANE1,               0x0000},
+	{RX_PSC_A2_LANE2,               0x0000},
+	{RX_PSC_A2_LANE3,               0x0000},
+	{RX_PSC_A3_LANE0,               0x0000},
+	{RX_PSC_A3_LANE1,               0x0000},
+	{RX_PSC_A3_LANE2,               0x0000},
+	{RX_PSC_A3_LANE3,               0x0000},
+	{RX_PSC_CAL_LANE0,              0x0000},
+	{RX_PSC_CAL_LANE1,              0x0000},
+	{RX_PSC_CAL_LANE2,              0x0000},
+	{RX_PSC_CAL_LANE3,              0x0000},
+	{XCVR_DIAG_BIDI_CTRL_LANE0,     0x000f},
+	{XCVR_DIAG_BIDI_CTRL_LANE1,     0x000f},
+	{XCVR_DIAG_BIDI_CTRL_LANE2,     0x000f},
+	{XCVR_DIAG_BIDI_CTRL_LANE3,     0x000f},
+	{RX_REE_GCSM1_CTRL_LANE0,       0x0000},
+	{RX_REE_GCSM1_CTRL_LANE1,       0x0000},
+	{RX_REE_GCSM1_CTRL_LANE2,       0x0000},
+	{RX_REE_GCSM1_CTRL_LANE3,       0x0000},
+	{RX_REE_GCSM2_CTRL_LANE0,       0x0000},
+	{RX_REE_GCSM2_CTRL_LANE1,       0x0000},
+	{RX_REE_GCSM2_CTRL_LANE2,       0x0000},
+	{RX_REE_GCSM2_CTRL_LANE3,       0x0000},
+	{RX_REE_PERGCSM_CTRL_LANE0,     0x0000},
+	{RX_REE_PERGCSM_CTRL_LANE1,     0x0000},
+	{RX_REE_PERGCSM_CTRL_LANE2,     0x0000},
+	{RX_REE_PERGCSM_CTRL_LANE3,     0x0000},
+	{CMN_DIAG_GPANA_0,              0x0100},
+};
+
+static const struct reg_sequence sky1_udphy_dp_8p1_conf[] = {
+	{CMN_PDIAG_PLL1_ITRIM_M0,       0x007f},
+	{CMN_PLL1_SS_CTRL2_M0,          0x0430},
+	{CMN_PLL1_SS_CTRL3_M0,          0x0062},
+	{CMN_PLL1_SS_CTRL4_M0,          0x0004},
+};
+
+static const struct reg_sequence sky1_udphy_dp_partial_conf[] = {
+	{CMN_PDIAG_PLL1_ITRIM_M0,       0x003f},
+	{CMN_PLL1_SS_CTRL2_M0,          0x044F},
+	{CMN_PLL1_SS_CTRL3_M0,          0x007F},
+	{CMN_PLL1_SS_CTRL4_M0,          0x0003},
+};
+
+static const struct reg_sequence sky1_udphy_usbdp_conf_flip[] = {
+	/* common_part */
+	{CMN_SSM_BIAS_TMR,             0x0018},
+	{CMN_PLLSM0_PLLPRE_TMR,        0x0030},
+	{CMN_PLLSM0_PLLLOCK_TMR,       0x00F0},
+	{CMN_PLLSM1_PLLPRE_TMR,        0x0030},
+	{CMN_PLLSM1_PLLLOCK_TMR,       0x00F0},
+	{CMN_BGCAL_INIT_TMR,           0x0078},
+	{CMN_BGCAL_ITER_TMR,           0x0078},
+	{CMN_IBCAL_INIT_TMR,           0x0018},
+	{CMN_TXPUCAL_INIT_TMR,         0x001D},
+	{CMN_TXPDCAL_INIT_TMR,         0x001D},
+	{CMN_RXCAL_INIT_TMR,           0x02D0},
+	{CMN_SD_CAL_PLLCNT_START,      0x0137},
+	{RX_SDCAL0_INIT_TMR_LANE0,     0x0018},
+	{RX_SDCAL0_INIT_TMR_LANE1,     0x0018},
+	{RX_SDCAL0_INIT_TMR_LANE2,     0x0018},
+	{RX_SDCAL0_INIT_TMR_LANE3,     0x0018},
+	{RX_SDCAL0_ITER_TMR_LANE0,     0x0078},
+	{RX_SDCAL0_ITER_TMR_LANE1,     0x0078},
+	{RX_SDCAL0_ITER_TMR_LANE2,     0x0078},
+	{RX_SDCAL0_ITER_TMR_LANE3,     0x0078},
+	{RX_SDCAL1_INIT_TMR_LANE0,     0x0018},
+	{RX_SDCAL1_INIT_TMR_LANE1,     0x0018},
+	{RX_SDCAL1_INIT_TMR_LANE2,     0x0018},
+	{RX_SDCAL1_INIT_TMR_LANE3,     0x0018},
+	{RX_SDCAL1_ITER_TMR_LANE0,     0x0078},
+	{RX_SDCAL1_ITER_TMR_LANE1,     0x0078},
+	{RX_SDCAL1_ITER_TMR_LANE2,     0x0078},
+	{RX_SDCAL1_ITER_TMR_LANE3,     0x0078},
+	{TX_RCVDET_ST_TMR_LANE0,       0x0960},
+	{TX_RCVDET_ST_TMR_LANE1,       0x0960},
+	{TX_RCVDET_ST_TMR_LANE2,       0x0960},
+	{TX_RCVDET_ST_TMR_LANE3,       0x0960},
+	{CMN_PDIAG_PLL0_CLK_SEL_M0,    0x8600},
+	{CMN_PDIAG_PLL1_CLK_SEL_M0,    0x0601},
+	{XCVR_DIAG_PLLDRC_CTRL_LANE2,  0x0041},
+	{XCVR_DIAG_PLLDRC_CTRL_LANE3,  0x0041},
+	{XCVR_DIAG_HSCLK_SEL_LANE0,    0x0001},
+	{XCVR_DIAG_HSCLK_SEL_LANE1,    0x0001},
+	{XCVR_DIAG_HSCLK_DIV_LANE0,    0x0000},
+	{XCVR_DIAG_HSCLK_DIV_LANE1,    0x0000},
+	{XCVR_DIAG_PLLDRC_CTRL_LANE0,  0x0019},
+	{XCVR_DIAG_PLLDRC_CTRL_LANE1,  0x0019},
+	{CMN_PLL0_DSM_DIAG_M0,         0x0004},
+	{CMN_PLL1_DSM_DIAG_M0,         0x8004},
+	{CMN_PDIAG_PLL1_ITRIM_M0,      0x003f},
+	{CMN_PDIAG_PLL0_CP_PADJ_M0,    0x0B17},
+	{CMN_PDIAG_PLL1_CP_PADJ_M0,    0x0B17},
+	{CMN_PDIAG_PLL0_CP_IADJ_M0,    0x0E01},
+	{CMN_PDIAG_PLL1_CP_IADJ_M0,    0x0E01},
+	{CMN_PDIAG_PLL0_FILT_PADJ_M0,  0x0D05},
+	{CMN_PDIAG_PLL1_FILT_PADJ_M0,  0x0D05},
+
+	{CMN_PLL0_INTDIV_M0,           0x01A0},
+	{CMN_PLL1_INTDIV_M0,           0x01C2},
+	{CMN_PLL0_FRACDIVL_M0,         0xAAAB},
+
+	{CMN_PLL1_FRACDIVL_M0,         0x0000}, /* reset value */
+
+	{CMN_PLL0_FRACDIVH_M0,         0x0002},
+	{CMN_PLL1_FRACDIVH_M0,         0x0002},
+	{CMN_PLL0_HIGH_THR_M0,         0x0116},
+	{CMN_PLL1_HIGH_THR_M0,         0x012C},
+	{CMN_PDIAG_PLL0_CTRL_M0,       0x1002},
+	{CMN_PDIAG_PLL1_CTRL_M0,       0x1002},
+	{CMN_PLL0_SS_CTRL1_M0,         0x0001},
+	{CMN_PLL1_SS_CTRL1_M0,         0x0001},
+	{CMN_PLL0_SS_CTRL2_M0,         0x0416},
+	{CMN_PLL1_SS_CTRL2_M0,         0x044F},
+	{CMN_PLL0_SS_CTRL3_M0,         0x007C},
+	{CMN_PLL1_SS_CTRL3_M0,         0x007F},
+	{CMN_PLL0_SS_CTRL4_M0,         0x0003},
+	{CMN_PLL1_SS_CTRL4_M0,         0x0003},
+	{CMN_PLL0_VCOCAL_INIT_TMR,     0x00F0},
+	{CMN_PLL1_VCOCAL_INIT_TMR,     0x00F0},
+	{CMN_PLL0_VCOCAL_ITER_TMR,     0x0004},
+	{CMN_PLL1_VCOCAL_ITER_TMR,     0x0004},
+	{CMN_PLL0_VCOCAL_REFTIM_START, 0x02F8},
+	{CMN_PLL1_VCOCAL_REFTIM_START, 0x02F8},
+	{CMN_PLL0_VCOCAL_PLLCNT_START, 0x02F6},
+	{CMN_PLL1_VCOCAL_PLLCNT_START, 0x02F6},
+	{CMN_PLL0_VCOCAL_TCTRL,        0x0003},
+	{CMN_PLL1_VCOCAL_TCTRL,        0x0003},
+	{CMN_PLL0_LOCK_REFCNT_START,   0x00BF},
+	{CMN_PLL1_LOCK_REFCNT_START,   0x00BF},
+	{CMN_PLL0_LOCK_PLLCNT_START,   0x00BF},
+	{CMN_PLL1_LOCK_PLLCNT_START,   0x00BF},
+	{CMN_PLL0_LOCK_PLLCNT_THR,     0x0005},
+	{CMN_PLL1_LOCK_PLLCNT_THR,     0x0005},
+	/* usb_part */
+	{PHY_PMA_LANE_MAP,             0x5100},
+	{PHY_LANE_OFF_CTRL,            0x0100},
+	{PHY_PIPE_USB3_GEN2_PRE_CFG0,  0x0A0A},
+	{PHY_PIPE_USB3_GEN2_POST_CFG0, 0x1000},
+	{PHY_PIPE_USB3_GEN2_POST_CFG1, 0x0010},
+	{CMN_CDIAG_CDB_PWRI_OVRD,      0x8200},
+	{CMN_CDIAG_XCVRC_PWRI_OVRD,    0x8200},
+	{TX_PSC_A0_LANE3,              0x02FF},
+	{TX_PSC_A1_LANE3,              0x06AF},
+	{TX_PSC_A2_LANE3,              0x06AE},
+	{TX_PSC_A3_LANE3,              0x06AE},
+	{RX_PSC_A0_LANE2,              0x0D1D},
+	{RX_PSC_A1_LANE2,              0x0D1D},
+	{RX_PSC_A2_LANE2,              0x0D00},
+	{RX_PSC_A3_LANE2,              0x0500},
+	{TX_TXCC_CTRL_LANE3,           0x2A82},
+	{TX_TXCC_CPOST_MULT_01_LANE3,  0x0014},
+	{TX_TXCC_MGNFS_MULT_000_LANE3, 0x0007},
+	{RX_SIGDET_HL_FILT_TMR_LANE2,  0x0013},
+	{RX_REE_GCSM1_CTRL_LANE2,      0x0000},
+	{RX_REE_ATTEN_THR_LANE2,       0x0C02},
+	{RX_REE_SMGM_CTRL1_LANE2,      0x0330},
+	{RX_REE_SMGM_CTRL2_LANE2,      0x0300},
+	{XCVR_DIAG_PSC_OVRD_LANE2,     0x0003},
+	{RX_DIAG_SIGDET_TUNE_LANE2,    0x1004},
+	{RX_DIAG_NQST_CTRL_LANE2,      0x00F9},
+	{RX_DIAG_DFE_AMP_TUNE_2_LANE2, 0x0C01},
+	{RX_DIAG_DFE_AMP_TUNE_3_LANE2, 0x0002},
+	{RX_DIAG_PI_CAP_LANE2,         0x0000},
+	{RX_DIAG_PI_RATE_LANE2,        0x0031},
+	{RX_DIAG_ACYA_LANE3,           0x0002},
+	{RX_CDRLF_CNFG_LANE2,          0x018C},
+	{RX_CDRLF_CNFG3_LANE2,         0x0003},
+	/* usb adding to upspeed */
+	{XCVR_DIAG_BIDI_CTRL_LANE2,    0x00f0},
+	{XCVR_DIAG_BIDI_CTRL_LANE3,    0x000f},
+
+	/* dp_part */
+	{PHY_PMA_ISO_PLL_CTRL0,        0x000B},
+	{PHY_PMA_ISO_PLL_CTRL1,        0x2224},
+
+	/* lane0, lane1 */
+	{TX_PSC_A0_LANE0,              0x00FB},
+	{TX_PSC_A0_LANE1,              0x00FB},
+	{TX_PSC_A2_LANE0,              0x04AA},
+	{TX_PSC_A2_LANE1,              0x04AA},
+	{TX_PSC_A3_LANE0,              0x04AA},
+	{TX_PSC_A3_LANE1,              0x04AA},
+	{RX_PSC_A0_LANE0,              0x0000},
+	{RX_PSC_A0_LANE1,              0x0000},
+	{RX_PSC_A2_LANE0,              0x0000},
+	{RX_PSC_A2_LANE1,              0x0000},
+	{RX_PSC_A3_LANE0,              0x0000},
+	{RX_PSC_A3_LANE1,              0x0000},
+	{RX_PSC_CAL_LANE0,             0x0000},
+	{RX_PSC_CAL_LANE1,             0x0000},
+	{XCVR_DIAG_BIDI_CTRL_LANE0,    0x000F},
+	{XCVR_DIAG_BIDI_CTRL_LANE1,    0x000F},
+	{RX_REE_GCSM1_CTRL_LANE0,      0x0000},
+	{RX_REE_GCSM1_CTRL_LANE1,      0x0000},
+	{RX_REE_GCSM2_CTRL_LANE0,      0x0000},
+	{RX_REE_GCSM2_CTRL_LANE1,      0x0000},
+	{RX_REE_PERGCSM_CTRL_LANE0,    0x0000},
+	{RX_REE_PERGCSM_CTRL_LANE1,    0x0000},
+
+	{CMN_DIAG_GPANA_0,             0x100},
+};
+
+static const struct cix_udphy_con_dir sky1_udphy_con_dir[] = {
+	{0x420, 0},
+	{0x420, 1},
+	{0x420, 2},
+	{0x420, 3}
+};
+
+struct cix_udphy {
+	struct device *dev;
+	void __iomem *base;
+	struct regmap *phy_regmap;
+	struct regmap *usbphy_syscon;
+	struct reset_control *preset;
+	struct reset_control *reset;
+	struct clk *apb_clk;
+	struct typec_switch_dev *sw;
+	struct typec_mux_dev *mux;
+	struct mutex mutex; /* mutex to protect access to individual PHYs */
+	bool flip;
+	u8 cur_mode;
+	u8 next_mode;
+	u32 id;
+	const struct cix_udphy_cfg *cfg;
+};
+
+/* Link rate change */
+struct phy_link_cfg {
+	u32 hsclk_div;
+	u32 clk_sel;
+	u32 pll_intdiv;
+	u32 pll_fracdivl;
+	u32 pll_high_thr;
+};
+
+static const struct phy_link_cfg link_cfg[] = {
+	{ 0x0002, 0x0f01, 0x0195, 0x0000, 0x010e },  /* 1.62gbps */
+	{ 0x0001, 0x0701, 0x01c2, 0x0000, 0x012c },  /* 2.70gbps */
+	{ 0x0000, 0x0301, 0x01c2, 0x0000, 0x012c },  /* 5.40gbps */
+	{ 0x0000, 0x0200, 0x0151, 0x8000, 0x00e2 },  /* 8.10gbps */
+};
+
+struct phy_voltage_conf {
+	u32 tx_txcc_ctrl;
+	u32 drv_diag_tx_drv;
+	u32 tx_txcc_mgnfc_mult_000;
+	u32 tx_txcc_cpost_mult_00;
+};
+
+static const struct phy_voltage_conf volt_cfg[] = {
+	{ 0x08A4, 0x0003, 0x0028, 0x0000 }, /* swing level == 0 */
+	{ 0x08A4, 0x0003, 0x001f, 0x0014 },
+	{ 0x08A4, 0x0003, 0x0012, 0x0020 },
+	{ 0x08A4, 0x0003, 0x0000, 0x0027 },
+	{ 0x08A4, 0x0003, 0x001f, 0x0000 }, /* swing level == 1 */
+	{ 0x08A4, 0x0003, 0x0013, 0x0012 },
+	{ 0x08A4, 0x0003, 0x0000, 0x001f },
+	{ 0x08A4, 0x0003, 0x0000, 0x001f },
+	{ 0x08A4, 0x0003, 0x0013, 0x0000 }, /* swing level == 2 */
+	{ 0x08A4, 0x0003, 0x0000, 0x0013 },
+	{ 0x08A4, 0x0003, 0x0000, 0x0013 },
+	{ 0x08A4, 0x0003, 0x0000, 0x0013 },
+	{ 0x08A4, 0x0003, 0x0000, 0x0000 }, /* swing level == 3 */
+	{ 0x08A4, 0x0003, 0x0000, 0x0000 },
+	{ 0x08A4, 0x0003, 0x0000, 0x0000 },
+	{ 0x08A4, 0x0003, 0x0000, 0x0000 },
+};
+
+static int udphy_dplane_get(struct cix_udphy *udphy)
+{
+	int dp_lanes;
+
+	switch (udphy->next_mode) {
+	case UDPHY_MODE_DP:
+		dp_lanes = 4;
+		break;
+	case UDPHY_MODE_DP_USB:
+		dp_lanes = 2;
+		break;
+	case UDPHY_MODE_USB:
+		fallthrough;
+	default:
+		dp_lanes = 0;
+		break;
+	}
+
+	return dp_lanes;

drivers/phy/cix/phy-cix-usbdp.c line 633

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+}
+
+static int sky1_udphy_clk_enable(struct clk *clk)
+{
+	int i, ret = -EBUSY;
+
+	/*
+	 * If the clock could not enable 10 iterations,
+	 * it considers this clock is broken.
+	 */

Make use of 80 columns please.

Quoted 14 lines
drivers/phy/cix/phy-cix-usbdp.c new file +14 -0
+	for (i = 0; i < 10; i++) {
+		ret = clk_prepare_enable(clk);
+		if (!ret)
+			return 0;
+
+		usleep_range(5000, 6000);
+	}
+
+	return ret;
+}
+
+static int sky1_udphy_exit(struct cix_udphy *udphy)
+{
+	reset_control_assert(udphy->reset);

drivers/phy/cix/phy-cix-usbdp.c line 657

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+	reset_control_assert(udphy->preset);
+	clk_disable_unprepare(udphy->apb_clk);
+	return 0;
+}
+
+static int sky1_udphy_init(struct cix_udphy *udphy)
+{
+	int ret;
+	u32 value;
+	const struct cix_udphy_con_dir *con_dir = &udphy->cfg->con_dir[udphy->id];

Use reverse X-mas tree order for local variables.

Quoted 61 lines
drivers/phy/cix/phy-cix-usbdp.c new file +61 -0
+
+	regmap_update_bits(udphy->usbphy_syscon, con_dir->offset,
+			   GENMASK(con_dir->bit, con_dir->bit),
+			   udphy->flip << con_dir->bit);
+
+	usleep_range(10, 20);
+
+	regmap_read(udphy->usbphy_syscon, con_dir->offset, &value);
+
+	/* usb rcsu reset is default deassert */
+	reset_control_assert(udphy->reset);
+	reset_control_assert(udphy->preset);
+
+	ret = sky1_udphy_clk_enable(udphy->apb_clk);
+	if (ret) {
+		dev_err(udphy->dev, "Failed to prepare_enable udphy apb clock\n");
+		return ret;
+	}
+
+	reset_control_deassert(udphy->preset);
+
+	if (udphy->next_mode == UDPHY_MODE_DP) {
+		ret = regmap_multi_reg_write(udphy->phy_regmap, sky1_udphy_dp_conf,
+					     ARRAY_SIZE(sky1_udphy_dp_conf));
+
+		if (ret) {
+			dev_err(udphy->dev, "Failed to write the reg sequence\n");
+			goto assert_apb;
+		}
+	} else {
+		if (!udphy->flip) {
+			ret = regmap_multi_reg_write(udphy->phy_regmap,
+						     sky1_udphy_usbdp_conf_normal,
+						     ARRAY_SIZE(sky1_udphy_usbdp_conf_normal));
+			if (ret) {
+				dev_err(udphy->dev, "Failed to write the reg sequence\n");
+				goto assert_apb;
+			}
+		} else {
+			ret = regmap_multi_reg_write(udphy->phy_regmap,
+						     sky1_udphy_usbdp_conf_flip,
+						     ARRAY_SIZE(sky1_udphy_usbdp_conf_flip));
+			if (ret) {
+				dev_err(udphy->dev, "Failed to write the reg sequence\n");
+				goto assert_apb;
+			}
+		}
+	}
+
+	reset_control_deassert(udphy->reset);
+
+	return 0;
+
+assert_apb:
+	reset_control_assert(udphy->preset);
+	clk_disable_unprepare(udphy->apb_clk);
+	return ret;
+}
+
+static const struct cix_udphy_cfg sky1_udphy_cfg = {
+	.con_dir = sky1_udphy_con_dir,

drivers/phy/cix/phy-cix-usbdp.c line 728

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+	.udphy_init = sky1_udphy_init,
+	.udphy_exit = sky1_udphy_exit
+};
+
+static int udphy_regmap_write(void *context, unsigned int reg, unsigned int val)
+{
+	struct cix_udphy *udphy = context;
+	u32 offset = reg << 2;
+
+	writel(val, udphy->base + offset);

Please use writel/readl directly.

Quoted 20 lines
drivers/phy/cix/phy-cix-usbdp.c new file +20 -0
+
+	return 0;
+}
+
+static int udphy_regmap_read(void *context, unsigned int reg, unsigned int *val)
+{
+	struct cix_udphy *udphy = context;
+	u32 offset = reg << 2;
+
+	*val = readl(udphy->base + offset);
+
+	return 0;
+}
+
+static const struct regmap_config cix_udphy_regmap_cfg = {
+	.reg_bits = 32,
+	/* register width, if =2, then only reg 0 2 4 ...2^n can access */
+	.reg_stride = 1,
+	.val_bits = 16,
+	.fast_io = true,

drivers/phy/cix/phy-cix-usbdp.c line 758

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+	.reg_write = udphy_regmap_write,
+	.reg_read = udphy_regmap_read,
+};
+
+static int udphy_orien_sw_set(struct typec_switch_dev *sw,
+			      enum typec_orientation orien)
+{
+	struct cix_udphy *udphy = typec_switch_get_drvdata(sw);
+
+	mutex_lock(&udphy->mutex);

Can you use guard()?

Quoted 12 lines
drivers/phy/cix/phy-cix-usbdp.c new file +12 -0
+
+	if (orien == TYPEC_ORIENTATION_NONE)
+		goto unlock_ret;
+
+	udphy->flip = (orien == TYPEC_ORIENTATION_REVERSE) ? true : false;
+
+unlock_ret:
+	mutex_unlock(&udphy->mutex);
+	return 0;
+}
+
+static int udphy_setup_orien_switch(struct cix_udphy *udphy)

drivers/phy/cix/phy-cix-usbdp.c line 780

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+{
+	struct typec_switch_desc sw_desc = { };
+
+	sw_desc.drvdata = udphy;
+	sw_desc.fwnode = dev_fwnode(udphy->dev);
+	sw_desc.set = udphy_orien_sw_set;
+
+	udphy->sw = typec_switch_register(udphy->dev, &sw_desc);
+	if (IS_ERR(udphy->sw)) {
+		dev_err(udphy->dev, "Error register typec orientation switch: %ld\n",

s/register/registering

drivers/phy/cix/phy-cix-usbdp.c line 793

Quoted 13 lines
drivers/phy/cix/phy-cix-usbdp.c new file +13 -0
+			PTR_ERR(udphy->sw));
+		return PTR_ERR(udphy->sw);
+	}
+
+	return 0;
+}
+
+static int usbdp_typec_mux_set(struct typec_mux_dev *mux,
+			       struct typec_mux_state *state)
+{
+	struct cix_udphy *udphy = typec_mux_get_drvdata(mux);
+
+	mutex_lock(&udphy->mutex);

guard()? Consider using it everywhere where applicable.

Quoted 84 lines
drivers/phy/cix/phy-cix-usbdp.c new file +84 -0
+
+	switch (state->mode) {
+	case TYPEC_DP_STATE_C:
+		fallthrough;
+	case TYPEC_DP_STATE_E:
+		udphy->next_mode = UDPHY_MODE_DP;
+		break;
+	case TYPEC_DP_STATE_D:
+		udphy->next_mode = UDPHY_MODE_DP_USB;
+		break;
+	case TYPEC_STATE_SAFE:
+		udphy->next_mode = UDPHY_MODE_USB;
+		break;
+	default:
+		/* usb only handle as usb+dp mode */
+		udphy->next_mode = UDPHY_MODE_USB;
+		break;
+	}
+
+	/* TODO: check whether the HPD state needs software */
+	mutex_unlock(&udphy->mutex);
+
+	return 0;
+}
+
+static void udphy_orien_switch_unregister(void *data)
+{
+	struct cix_udphy *udphy = data;
+
+	typec_switch_unregister(udphy->sw);
+}
+
+static int udphy_setup_typec_mux(struct cix_udphy *udphy)
+{
+	struct typec_mux_desc mux_desc = {};
+
+	mux_desc.drvdata = udphy;
+	mux_desc.fwnode = dev_fwnode(udphy->dev);
+	mux_desc.set = usbdp_typec_mux_set;
+
+	udphy->mux = typec_mux_register(udphy->dev, &mux_desc);
+	if (IS_ERR(udphy->mux)) {
+		dev_err(udphy->dev, "Error register typec mux: %ld\n",
+			PTR_ERR(udphy->mux));
+		return PTR_ERR(udphy->mux);
+	}
+
+	return 0;
+}
+
+static void udphy_typec_mux_unregister(void *data)
+{
+	struct cix_udphy *udphy = data;
+
+	typec_mux_unregister(udphy->mux);
+}
+
+static int cix_usbdp_phy_power_on(struct cix_udphy *udphy)
+{
+	const struct cix_udphy_cfg *phy_cfgs = udphy->cfg;
+	int ret;
+
+	if (udphy->cur_mode == udphy->next_mode)
+		return 0;
+
+	if ((udphy->cur_mode == UDPHY_MODE_USB || udphy->cur_mode == UDPHY_MODE_DP) &&
+	    udphy->next_mode == UDPHY_MODE_DP_USB)
+		return 0;
+
+	if (phy_cfgs->udphy_init) {
+		ret = phy_cfgs->udphy_init(udphy);
+		if (ret) {
+			dev_err(udphy->dev, "failed to init udphy\n");
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static int cix_usbdp_phy_power_off(struct cix_udphy *udphy)
+{
+	const struct cix_udphy_cfg *phy_cfgs = udphy->cfg;
+	int ret;

drivers/phy/cix/phy-cix-usbdp.c line 887

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+
+	if (phy_cfgs->udphy_exit) {
+		ret = phy_cfgs->udphy_exit(udphy);
+		if (ret) {
+			dev_err(udphy->dev, "failed to exit udphy\n");
+			return ret;
+		}
+	}
+
+	udphy->cur_mode = UDPHY_MODE_NONE;

Newline before return.

Quoted 3 lines
drivers/phy/cix/phy-cix-usbdp.c new file +3 -0
+	return 0;
+}
+

[...]

Quoted 77 lines
drivers/phy/cix/phy-cix-usbdp.c new file +77 -0
+static int cix_u3phy_init(struct phy *phy)
+{
+	struct cix_udphy *udphy = phy_get_drvdata(phy);
+	int ret = 0;
+
+	mutex_lock(&udphy->mutex);
+	if (!(udphy->next_mode & UDPHY_MODE_USB))
+		goto unlock;
+
+	if (udphy->cur_mode & UDPHY_MODE_USB)
+		goto unlock;
+
+	ret = cix_usbdp_phy_power_on(udphy);
+	if (ret)
+		goto unlock;
+
+	udphy->cur_mode |= UDPHY_MODE_USB;
+
+unlock:
+	mutex_unlock(&udphy->mutex);
+	return ret;
+}
+
+static int cix_u3phy_exit(struct phy *phy)
+{
+	struct cix_udphy *udphy = phy_get_drvdata(phy);
+	int ret = 0;
+
+	mutex_lock(&udphy->mutex);
+
+	if (!(udphy->cur_mode & UDPHY_MODE_USB))
+		goto unlock;
+
+	udphy->cur_mode &= ~UDPHY_MODE_USB;
+
+	if (udphy->cur_mode == UDPHY_MODE_NONE)
+		ret = cix_usbdp_phy_power_off(udphy);
+
+unlock:
+	mutex_unlock(&udphy->mutex);
+	return ret;
+}
+
+static int cix_u3phy_set_mode(struct phy *phy, enum phy_mode mode, int submode)
+{
+	if (mode == PHY_MODE_INVALID)
+		return cix_u3phy_exit(phy);
+
+	return cix_u3phy_init(phy);
+}
+
+static const struct phy_ops cix_u3phy_ops = {
+	.set_mode       = cix_u3phy_set_mode,
+	.exit		= cix_u3phy_exit,
+	.owner		= THIS_MODULE,
+};
+
+/*
+ * PHY lane to PMA lane mapping for a normal plug orientation
+ *
+ * PMA LANE     C       D                 E
+ * 0          DP TX2   USB TX0          DP TX2
+ * 1          DP TX3   USB RX0          DP TX3
+ * 2          DP TX0   USB RX1/DP TX0   DP TX0
+ * 3          DP TX1   USB TX1/DP TX1   DP TX1
+ *
+ * PHY lane to PMA lane mapping for a flipped plug orientation
+ *
+ * PMA LANE     C       D                 E
+ * 0          DP TX1   USB TX1/DP TX1   DP TX1
+ * 1          DP TX0   USB RX1/DP TX0   DP TX0
+ * 2          DP TX3   USB RX0          DP TX3
+ * 3          DP TX2   USB TX0          DP TX2
+ */
+static void udphy_set_default_mode(struct cix_udphy *udphy)
+{
+	udphy->cur_mode = UDPHY_MODE_NONE;

drivers/phy/cix/phy-cix-usbdp.c line 1346

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+}
+
+static int cix_udphy_probe(struct platform_device *pdev)
+{
+	struct cix_udphy *udphy;
+	struct device *dev = &pdev->dev;
+	struct phy_provider *phy_provider;
+	struct device_node *np = dev->of_node;
+	u32 id;
+	int ret = 0;

Reverse X-mas order.

Quoted 11 lines
drivers/phy/cix/phy-cix-usbdp.c new file +11 -0
+
+	udphy = devm_kzalloc(dev, sizeof(*udphy), GFP_KERNEL);
+	if (!udphy)
+		return -ENOMEM;
+
+	dev_set_drvdata(dev, udphy);
+	udphy->dev = dev;
+
+	udphy->usbphy_syscon =
+		syscon_regmap_lookup_by_phandle_args(np, "cix,usbphy-syscon", 1,
+						     &id);

drivers/phy/cix/phy-cix-usbdp.c line 1367

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+	if (IS_ERR(udphy->usbphy_syscon))
+		return dev_err_probe(dev, PTR_ERR(udphy->usbphy_syscon),
+				     "failed to get usbphy syscon\n");
+	else if (id >= ARRAY_SIZE(sky1_udphy_con_dir))
+		return dev_err_probe(dev, -EINVAL, "failed to get id\n");
+	udphy->id = id;
+
+	udphy->cfg = device_get_match_data(dev);
+	if (!udphy->cfg) {
+		dev_err(dev, "no OF data can be matched with %pOF node\n", np);

Use dev_err_probe() consistently in probe().

- Mani

author maintainer
#6 lore raw

PATCH 3/3 arm64: dts: cix: add Sky1 USB/DP combo PHY

In reply to Gary Yang

Add the four USB/DP combo PHY nodes to the Sky1 SoC device tree and enable them on the Radxa Orion O6.

Each PHY node describes its USB and DisplayPort lanes as child nodes, points at the S5 system controller instance that controls lane muxing and plug orientation, and is disabled by default so that boards that do not route the port stay unaffected.

---
 arch/arm64/boot/dts/cix/sky1-orion-o6.dts | 28 +++++++
 arch/arm64/boot/dts/cix/sky1.dtsi         | 96 +++++++++++++++++++++++
 2 files changed, 124 insertions(+)
arch/arm64/boot/dts/cix/sky1-orion-o6.dts +28 -0
index e39c87774c12..76f75185b6a8 100644
@@ -117,3 +117,31 @@ &s5_gpio2 {
 &uart2 {
 	status = "okay";
 };
+
+&usbc_phy0 {
+	orientation-switch;
+	mode-switch;
+	cix,default-conf = /bits/ 8 <0x03>;
+	status = "okay";
+};
+
+&usbc_phy1 {
+	orientation-switch;
+	mode-switch;
+	cix,default-conf = /bits/ 8 <0x03>;
+	status = "okay";
+};
+
+&usbc_phy2 {
+	orientation-switch;
+	mode-switch;
+	cix,default-conf = /bits/ 8 <0x03>;
+	status = "okay";
+};
+
+&usbc_phy3 {
+	orientation-switch;
+	mode-switch;
+	cix,default-conf = /bits/ 8 <0x03>;
+	status = "okay";
+};
arch/arm64/boot/dts/cix/sky1.dtsi +96 -0

102 lines not on this page · raw message

Signature · 1 line
2.50.1
#7 lore raw

Re: [PATCH 3/3] arm64: dts: cix: add Sky1 USB/DP combo PHY

Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider: - [High] phy: cix: link rate unit mismatch and PLL disable in udphy_dp_phy_set_rate() - [High] phy: cix…

Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [High] phy: cix: link rate unit mismatch and PLL disable in udphy_dp_phy_set_rate()
- [High] phy: cix: unclocked MMIO and lane check in udphy_dp_phy_configure()
- [High] phy: cix: clock leak and skipped re-init in cix_usbdp_phy_power_on()
- [Medium] phy: cix: per-lane voltages ignored in udphy_dp_phy_set_voltages()
- [Medium] dt-bindings: phy: cix,sky1-usbdp-phy: missing OF graph port properties --

commit ffe7df98ad72d8c1a7362fd9f434e85648138040
Author: Gary Yang <[email protected]>

arm64: dts: cix: add Sky1 USB/DP combo PHY

This series adds the device tree binding, driver, and device tree nodes for the CIX Sky1 USB/DP combo PHY, supporting SuperSpeedPlus USB and DisplayPort lane muxing and Type-C orientation switching via the S5 system controller.

Quoted 6 lines
Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml new file +0 -0
new file mode 100644
index 0000000000000..a5b6943f84ebd
@@ -0,0 +1,150 @@

[ ... ]

Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml

Quoted 9 lines
Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml new file +9 -0
+  orientation-switch:
+    description:
+      The PHY handles Type-C plug orientation switching.
+    type: boolean
+
+  mode-switch:
+    description:
+      The PHY handles multiplexing of the USB and DisplayPort lanes.
+    type: boolean

[Severity: Medium]
When a board device tree connects a usb-c-connector node to this PHY for Type-C orientation and mode switching, the connector links to the provider via OF graph port or ports endpoints (matched by fwnode_graph_devcon_matches() in typec_switch_match() and typec_mux_match()).

Because this schema specifies additionalProperties: false without defining port or ports properties, won't board device trees that wire a Type-C connector to a cix,sky1-usbdp-phy node fail dtbs_check validation?

[ ... ]

Quoted 6 lines
drivers/phy/cix/phy-cix-usbdp.c new file +0 -0
new file mode 100644
index 0000000000000..d596e89c74f76
@@ -0,0 +1,1477 @@

[ ... ]

Quoted 23 lines
drivers/phy/cix/phy-cix-usbdp.c new file +23 -0
+static int sky1_udphy_init(struct cix_udphy *udphy)
+{
+	int ret;
+	u32 value;
+	const struct cix_udphy_con_dir *con_dir = &udphy->cfg->con_dir[udphy->id];
+
+	regmap_update_bits(udphy->usbphy_syscon, con_dir->offset,
+			   GENMASK(con_dir->bit, con_dir->bit),
+			   udphy->flip << con_dir->bit);
+
+	usleep_range(10, 20);
+
+	regmap_read(udphy->usbphy_syscon, con_dir->offset, &value);
+
+	/* usb rcsu reset is default deassert */
+	reset_control_assert(udphy->reset);
+	reset_control_assert(udphy->preset);
+
+	ret = sky1_udphy_clk_enable(udphy->apb_clk);
+	if (ret) {
+		dev_err(udphy->dev, "Failed to prepare_enable udphy apb clock\n");
+		return ret;
+	}

[ ... ]

Quoted 16 lines
drivers/phy/cix/phy-cix-usbdp.c new file +16 -0
+static int udphy_orien_sw_set(struct typec_switch_dev *sw,
+			      enum typec_orientation orien)
+{
+	struct cix_udphy *udphy = typec_switch_get_drvdata(sw);
+
+	mutex_lock(&udphy->mutex);
+
+	if (orien == TYPEC_ORIENTATION_NONE)
+		goto unlock_ret;
+
+	udphy->flip = (orien == TYPEC_ORIENTATION_REVERSE) ? true : false;
+
+unlock_ret:
+	mutex_unlock(&udphy->mutex);
+	return 0;
+}

[ ... ]

Quoted 22 lines
drivers/phy/cix/phy-cix-usbdp.c new file +22 -0
+static int cix_usbdp_phy_power_on(struct cix_udphy *udphy)
+{
+	const struct cix_udphy_cfg *phy_cfgs = udphy->cfg;
+	int ret;
+
+	if (udphy->cur_mode == udphy->next_mode)
+		return 0;
+
+	if ((udphy->cur_mode == UDPHY_MODE_USB || udphy->cur_mode == UDPHY_MODE_DP) &&
+	    udphy->next_mode == UDPHY_MODE_DP_USB)
+		return 0;
+
+	if (phy_cfgs->udphy_init) {
+		ret = phy_cfgs->udphy_init(udphy);
+		if (ret) {
+			dev_err(udphy->dev, "failed to init udphy\n");
+			return ret;
+		}
+	}
+
+	return 0;
+}

[ ... ]

Quoted 13 lines
drivers/phy/cix/phy-cix-usbdp.c new file +13 -0
+static int udphy_dp_phy_power_on(struct phy *phy)
+{
+	struct cix_udphy *udphy = phy_get_drvdata(phy);
+	int ret = 0;
+
+	mutex_lock(&udphy->mutex);
+	if (!(udphy->next_mode & UDPHY_MODE_DP))
+		goto unlock;
+
+	ret = cix_usbdp_phy_power_on(udphy);
+	if (ret)
+		goto unlock;
+

drivers/phy/cix/phy-cix-usbdp.c

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+	phy_set_bus_width(phy, udphy_dplane_get(udphy));
+	if (udphy->next_mode == UDPHY_MODE_DP)
+		udphy->cur_mode = UDPHY_MODE_DP;
+	else
+		udphy->cur_mode |= UDPHY_MODE_DP;
+
+unlock:
+	mutex_unlock(&udphy->mutex);
+	return ret;
+}

[Severity: High]
How are udphy->apb_clk and the hardware lane configuration kept in sync when transitioning between Type-C modes and orientations?

First, if USB powers on first (setting udphy->cur_mode = UDPHY_MODE_USB and enabling udphy->apb_clk once in sky1_udphy_init()), and the Type-C mux then selects 4-lane DP (udphy->next_mode = UDPHY_MODE_DP) followed by udphy_dp_phy_power_on():

  udphy_dp_phy_power_on()
    cix_usbdp_phy_power_on()
      sky1_udphy_init()
        sky1_udphy_clk_enable(udphy->apb_clk);
    udphy->cur_mode = UDPHY_MODE_DP;

sky1_udphy_init() calls clk_prepare_enable(udphy->apb_clk) a second time, and udphy_dp_phy_power_on() overwrites udphy->cur_mode = UDPHY_MODE_DP, dropping UDPHY_MODE_USB. When the PHYs later power off, sky1_udphy_exit() runs at most once, leaking a prepare/enable reference on udphy->apb_clk.

Second, if DP powers on first in 4-lane mode (udphy->cur_mode = UDPHY_MODE_DP, programmed with sky1_udphy_dp_conf) and udphy->next_mode later changes to UDPHY_MODE_DP_USB, cix_usbdp_phy_power_on() hits the early return:

	if ((udphy->cur_mode == UDPHY_MODE_USB || udphy->cur_mode == UDPHY_MODE_DP) &&
	    udphy->next_mode == UDPHY_MODE_DP_USB)
		return 0;

Doesn't that skip reprogramming the PHY from 4-lane DP to the USB+DP combo configuration when cix_u3phy_init() is called?

Third, if udphy_orien_sw_set() updates udphy->flip while one sub-PHY is already active in udphy->cur_mode, cix_usbdp_phy_power_on() also returns 0 without updating udphy->usbphy_syscon or loading the flipped register table (sky1_udphy_usbdp_conf_flip), while subsequent calls to udphy_dp_phy_set_rate() and udphy_dp_phy_set_voltages() program the flipped lanes.

[ ... ]

Quoted 13 lines
drivers/phy/cix/phy-cix-usbdp.c new file +13 -0
+static int udphy_dp_phy_verify_config(struct cix_udphy *udphy,
+				      struct phy_configure_opts_dp *dp)
+{
+	int i;
+
+	switch (dp->lanes) {
+	case 1:
+	case 2:
+	case 4:
+		break;
+	default:
+		return -EINVAL;
+	}

[ ... ]

Quoted 25 lines
drivers/phy/cix/phy-cix-usbdp.c new file +25 -0
+static int udphy_dp_phy_set_rate(struct cix_udphy *udphy,
+				 struct phy_configure_opts_dp *dp)
+{
+	int ret;
+	const struct phy_link_cfg *conf = NULL;
+
+	dev_dbg(udphy->dev, "lane %d, rate %x\n", dp->lanes, dp->link_rate);
+
+	regmap_update_bits(udphy->phy_regmap, PHY_PMA_PLL_CTRL, BIT(1), 0x0);
+	usleep_range(10, 20);
+
+	switch (dp->link_rate) {
+	case 0x6:
+		conf = &link_cfg[0];
+		ret = regmap_multi_reg_write(udphy->phy_regmap, sky1_udphy_dp_partial_conf,
+					     ARRAY_SIZE(sky1_udphy_dp_partial_conf));
+		break;
+	case 0xa:
+		conf = &link_cfg[1];
+		ret = regmap_multi_reg_write(udphy->phy_regmap, sky1_udphy_dp_partial_conf,
+					     ARRAY_SIZE(sky1_udphy_dp_partial_conf));
+		break;
+	case 0x14:
+		conf = &link_cfg[2];
+		ret = regmap_multi_reg_write(udphy->phy_regmap, sky1_udphy_dp_partial_conf,

drivers/phy/cix/phy-cix-usbdp.c

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+					     ARRAY_SIZE(sky1_udphy_dp_partial_conf));
+		break;
+	case 0x1e:
+		conf = &link_cfg[3];
+		ret = regmap_multi_reg_write(udphy->phy_regmap, sky1_udphy_dp_8p1_conf,
+					     ARRAY_SIZE(sky1_udphy_dp_8p1_conf));
+		break;
+	default:
+		return -EINVAL;
+	}

[Severity: High]
In include/linux/phy/phy-dp.h, struct phy_configure_opts_dp defines link_rate in Mb/s (1620, 2700, 5400, 8100), whereas udphy_dp_phy_set_rate() matches dp->link_rate against raw DPCD bandwidth codes (0x6, 0xa, 0x14, 0x1e).

Won't standard DisplayPort controller drivers passing link_rate in Mb/s to phy_configure() -> udphy_dp_phy_configure() -> udphy_dp_phy_set_rate() always hit the default case and fail with -EINVAL, while also leaving BIT(1) of PHY_PMA_PLL_CTRL cleared?

[ ... ]

drivers/phy/cix/phy-cix-usbdp.c

Quoted 8 lines
drivers/phy/cix/phy-cix-usbdp.c new file +8 -0
+static int udphy_dp_phy_set_voltages(struct cix_udphy *udphy,
+				     struct phy_configure_opts_dp *dp)
+{
+	u32 index = dp->voltage[0] * 4 + dp->pre[0];
+	const struct phy_voltage_conf *cfg = volt_cfg;
+
+	dev_dbg(udphy->dev, "lane %d, vs %d, pe %d\n", dp->lanes, dp->voltage[0],
+		dp->pre[0]);

[Severity: Medium]
udphy_dp_phy_verify_config() validates dp->voltage[i] and dp->pre[i] for each lane i < dp->lanes, but udphy_dp_phy_set_voltages() computes index solely from dp->voltage[0] and dp->pre[0] and writes that configuration to all active lanes.

Should udphy_dp_phy_set_voltages() compute the volt_cfg index per lane using each lane's own dp->voltage[i] and dp->pre[i] values so per-lane link training adjustments are applied?

[ ... ]

Quoted 8 lines
drivers/phy/cix/phy-cix-usbdp.c new file +8 -0
+static int udphy_dp_phy_configure(struct phy *phy,
+				  union phy_configure_opts *opts)
+{
+	struct cix_udphy *udphy = phy_get_drvdata(phy);
+	int ret;
+
+	mutex_lock(&udphy->mutex);
+	ret = udphy_dp_phy_verify_config(udphy, &opts->dp);

drivers/phy/cix/phy-cix-usbdp.c

Quoted 10 lines
drivers/phy/cix/phy-cix-usbdp.c new file +10 -0
+	if (ret)
+		goto unlock;
+
+	if (opts->dp.set_rate) {
+		ret = udphy_dp_phy_set_rate(udphy, &opts->dp);
+		if (ret) {
+			dev_err(udphy->dev, "failed to set DP link rate\n");
+			goto unlock;
+		}
+	}

[Severity: High]
What happens if udphy_dp_phy_configure() is called when UDPHY_MODE_DP is not active in udphy->cur_mode, or with more lanes than allocated to DP?

In udphy_dp_phy_power_on(), if !(udphy->next_mode & UDPHY_MODE_DP) (for example when Type-C is in TYPEC_STATE_SAFE or USB-only mode, or when cix,default-conf is 0 or 1), udphy_dp_phy_power_on() returns 0 without enabling udphy->apb_clk or deasserting udphy->preset. A subsequent call to udphy_dp_phy_configure() will then perform MMIO reads and writes through udphy->phy_regmap while the APB clock is disabled and APB reset is asserted.

In addition, udphy_dp_phy_verify_config() accepts dp->lanes == 4 without checking against udphy_dplane_get(udphy), so a 4-lane DP configuration in 2-lane UDPHY_MODE_DP_USB mode will overwrite the active USB lane registers in udphy_dp_phy_set_rate() and udphy_dp_phy_set_voltages().

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
author maintainer
#8 lore raw

v2 cover phy: cix: add Sky1 USB/DP combo PHY support

In reply to Gary Yang

This series adds support for the USB/DP combo PHY of the CIX Sky1 SoC. Each PHY instance drives one SuperSpeedPlus USB lane and up to four DisplayPort lanes of a USB Type-C port. The USB and the DP controller get their own PHY through the PHY_TYPE_USB3 and PHY_TYPE_DP cells. Plug orientation and the USB/DP mode decision are taken by the Type-C connector driver; the PHY consumes them through the Type-C switch and mux API.

The USB and the DisplayPort controllers and the Type-C connector are not yet described in the CIX device trees. The graph links and the consumers will be added together with them.

Patch 1 adds the binding and patch 2 the driver. The SoC and board nodes are sent separately as a follow-up, since they go through the SoC tree.

Patch 2 builds on Luo Liu's "Add Sky1 DisplayPort PHY support" series:

https://lore.kernel.org/linux-phy/[email protected]

That series creates drivers/phy/cix/ together with the PHY_CIX_DP Kconfig symbol and the CIX SKY1 DISPLAYPORT PHY DRIVER MAINTAINERS entry. This series adds the PHY_CIX_USBDP symbol and the new binding, and renames the entry to CIX SKY1 PHY DRIVERS. It should be applied on top of Luo's series to avoid conflicts in drivers/phy/cix/{Kconfig,Makefile} and MAINTAINERS.

Changes in v2:
- Replace the hand-written regmap backend over the PHY registers with direct writel()/readl() access.
- Take the DP link rate in Mb/s, as defined by struct phy_configure_opts_dp, and select the register table from the link configuration entry instead of repeating it per case.
- Protect the PHY state with guard(mutex) and drop the goto-based unlock paths.
- Use dev_err_probe() consistently in probe().
- Fix local variable ordering in probe() and sky1_udphy_init(), and drop the unused register read.
- Lowercase hex constants, fix overlong lines, add the missing copyright header and a missing newline before return.
- Move the driver out of ARM/CIX SOC SUPPORT into the CIX SKY1 PHY DRIVERS entry, and drop the commit message claim about the bootloader handing over an initialized port.
- Validate the DP link rate before the PLL is touched, so that an unsupported rate no longer leaves PLL1 disabled.
- Honour set_rate, set_lanes and set_voltages independently, and keep the negotiated lane count in the driver, so that a caller that only updates the voltage swing and pre-emphasis levels, as dw-dp does, works with an uninitialised lanes field. Validate all of the options before any of them is applied.
- Program the TX voltage swing and pre-emphasis levels per lane instead of applying the settings of lane 0 to all lanes.
- Add .init to the USB3 PHY ops and only touch the PHY registers while the PHY is powered.
- Track the active and the requested mode separately and reprogram the PHY on the next power-on only when the alt mode or the plug orientation has changed, instead of enabling the APB clock a second time.
- Reset the PHY when it is reprogrammed, and only reprogram it when the register table actually changes, so that an active USB link is left alone when the mode changes between USB and USB+DisplayPort.
- Handle the deprecated DisplayPort pin assignment F as a USB+DP state, like the other Type-C mux drivers do.
- Report the DisplayPort lane count only after the PHY has been powered on.
- Ignore Type-C mux states of alt modes other than DisplayPort, which used to be mistaken for a DisplayPort state because the state numbers overlap.
- Describe the two PHYs with #phy-cells = <1> instead of child nodes, reference the common USB switch binding, describe the Type-C graph connection, and drop the cix,default-conf property.
- Keep the binding example limited to the PHY node and its graph ports, and drop the stubbed USB and DisplayPort consumers.

Gary Yang (2):
dt-bindings: phy: add CIX Sky1 USB/DP combo PHY
phy: cix: add Sky1 USB/DP combo PHY driver

 .../bindings/phy/cix,sky1-usbdp-phy.yaml      |  150 ++
 MAINTAINERS                                   |    4 +-
 drivers/phy/cix/Kconfig                       |   16 +
 drivers/phy/cix/Makefile                      |    1 +
 drivers/phy/cix/phy-cix-usbdp.c               | 1422 +++++++++++++++++
 drivers/phy/cix/phy-cix-usbdp.h               |  257 +++
 6 files changed, 1849 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.c
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.h

--
2.50.1

author maintainer
#9 lore raw

PATCH v2 1/2 dt-bindings: phy: add CIX Sky1 USB/DP combo PHY

Document the USB/DP combo PHY of the CIX Sky1 SoC. One PHY instance provides one SuperSpeedPlus USB lane and up to four DisplayPort lanes of a USB Type-C port; consumers select the part they need with a PHY type cell, using PHY_TYPE_USB3 or PHY_TYPE_DP.

The PHY performs Type-C plug orientation switching and USB/DP lane muxing in hardware and is therefore described with the properties of the common USB switch binding. The plug orientation is switched through the S5 system controller, identified by the "cix,usbphy-syscon" phandle followed by the PHY instance index.

---
 .../bindings/phy/cix,sky1-usbdp-phy.yaml      | 150 ++++++++++++++++++
 1 file changed, 150 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml
Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml new file +150 -0
new file mode 100644
index 000000000000..9bdd01e348b2
@@ -0,0 +1,150 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/cix,sky1-usbdp-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: CIX Sky1 USB/DP Combo PHY
+
+maintainers:
+  - Gary Yang <[email protected]>
+
+description:
+  The CIX Sky1 USB/DP combo PHY provides one SuperSpeedPlus USB lane and
+  up to four DisplayPort lanes for a USB Type-C port. Which of the two
+  functions is in use depends on the Type-C alt mode and on the plug
+  orientation.
+
+allOf:
+  - $ref: /schemas/usb/usb-switch.yaml#
+
+properties:
+  compatible:
+    const: cix,sky1-usbdp-phy
+
+  reg:
+    maxItems: 1
+
+  "#phy-cells":
+    description: |
+      Cell allows setting the type of the PHY. Possible values are:
+      - PHY_TYPE_USB3
+      - PHY_TYPE_DP
+    const: 1
+
+  clocks:
+    maxItems: 1
+    description: PHY APB clock.
+
+  resets:
+    items:
+      - description: PHY core reset
+      - description: PHY APB preset
+
+  reset-names:
+    items:
+      - const: core
+      - const: apb
+
+  orientation-switch:
+    description:
+      The PHY handles Type-C plug orientation switching.
+    type: boolean
+
+  mode-switch:
+    description:
+      The PHY handles multiplexing of the USB and DisplayPort lanes.
+    type: boolean
+
+  cix,usbphy-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      - items:
+          - description: phandle to the S5 system controller
+          - description: PHY instance index within the system controller
+    description:
+      Phandle to the system controller used for Type-C plug orientation
+      control, followed by the PHY instance index.
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description:
+          Output endpoint of the PHY for USB, or for DisplayPort when
+          configured into 4-lane mode, which should point to the
+          SuperSpeed port of a USB Type-C connector.
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Incoming endpoint from the USB controller.
+      port@2:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Incoming endpoint from the DisplayPort controller.
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - "#phy-cells"
+  - clocks
+  - resets
+  - reset-names
+  - cix,usbphy-syscon
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/cix,sky1.h>
+    #include <dt-bindings/reset/cix,sky1-s5-system-control.h>
+
+    usbc_phy0: phy@9030000 {
+        compatible = "cix,sky1-usbdp-phy";
+        reg = <0x09030000 0x40000>;
+        #phy-cells = <1>;
+        clocks = <&scmi_clk CLK_TREE_USB3C_DRD_PHY3_GATE>;
+        resets = <&s5_syscon SKY1_USB_DP_PHY0_RST_N>,
+                 <&s5_syscon SKY1_USB_DP_PHY0_PRST_N>;
+        reset-names = "core", "apb";
+        cix,usbphy-syscon = <&s5_syscon 0>;
+        orientation-switch;
+        mode-switch;
+
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            port@0 {
+                reg = <0>;
+
+                endpoint {
+                    remote-endpoint = <&usb_c_connector>;
+                };
+            };
+
+            port@1 {
+                reg = <1>;
+
+                endpoint {
+                    remote-endpoint = <&usb3_controller>;
+                };
+            };
+
+            port@2 {
+                reg = <2>;
+
+                endpoint {
+                    remote-endpoint = <&dp_controller>;
+                };
+            };
+        };
+    };
author maintainer
#10 lore raw

PATCH v2 2/2 phy: cix: add Sky1 USB/DP combo PHY driver

In reply to Gary Yang

Add a driver for the USB/DP combo PHY found on the CIX Sky1 SoC. A single PHY instance drives one SuperSpeedPlus USB lane and up to four DisplayPort lanes of a USB Type-C port, and exposes them as two PHYs selected by PHY_TYPE_USB3 and PHY_TYPE_DP, so that the USB and DP controllers can bind to them independently.

The PHY supports Type-C plug orientation switching, which is driven through the S5 system controller, and muxing of the PHY lanes between USB and DP, which is programmed in the PHY registers. It registers a Type-C switch and mux with the Type-C class, so the orientation and mode decisions are taken by the connector driver instead of the PHY.

The shared PHY is programmed once per mode combination: the driver tracks the current and requested USB/DP mode as well as the plug orientation, and reprograms the PHY on the next power-on only when the mode combination or the orientation has changed.

---
 MAINTAINERS                     |    4 +-
 drivers/phy/cix/Kconfig         |   16 +
 drivers/phy/cix/Makefile        |    1 +
 drivers/phy/cix/phy-cix-usbdp.c | 1422 +++++++++++++++++++++++++++++++
 drivers/phy/cix/phy-cix-usbdp.h |  257 ++++++
 5 files changed, 1699 insertions(+), 1 deletion(-)
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.c
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.h
MAINTAINERS +3 -1
index d05771fe5bb2..f53c2d9de226 100644
@@ -6522,12 +6522,14 @@ M:	Satish Kharat <[email protected]>
 S:	Supported
 F:	drivers/infiniband/hw/usnic/
 
-CIX SKY1 DISPLAYPORT PHY DRIVER
+CIX SKY1 PHY DRIVERS
+M:	Gary Yang <[email protected]>
 M:	Luo Liu <[email protected]>
 R:	CIX Linux Kernel Upstream Group <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/phy/cix,sky1-dp-phy.yaml
+F:	Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml
 F:	drivers/phy/cix/
 
 CLANG CONTEXT ANALYSIS
drivers/phy/cix/Kconfig +16 -0
index fd3becae2b23..84853a99f42f 100644
@@ -16,3 +16,19 @@ config PHY_CIX_DP
 
 	  To compile this driver as a module, choose M here. The module will
 	  be called phy-cix-dp.
+
+config PHY_CIX_USBDP
+	tristate "CIX Sky1 USB3/DP combo PHY driver"
+	depends on OF && HAS_IOMEM && COMMON_CLK
+	depends on ARCH_CIX || COMPILE_TEST
+	depends on RESET_CONTROLLER
+	depends on TYPEC
+	select GENERIC_PHY
+	select MFD_SYSCON
+	help
+	  Enable this to support the CIX Sky1 USB3/DP combo PHY, which
+	  provides one SuperSpeedPlus USB lane and up to four DisplayPort
+	  lanes for a USB Type-C port.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called phy-cix-usbdp.
drivers/phy/cix/Makefile +1 -0
index cc56c7586ec5..a1bc2b3d7ea2 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PHY_CIX_DP) += phy-cix-dp.o
+obj-$(CONFIG_PHY_CIX_USBDP) += phy-cix-usbdp.o
drivers/phy/cix/phy-cix-usbdp.c new file +1422 -0

1,422 lines not on this page · raw message

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

257 lines not on this page · raw message