arm64: dts: rockchip: Describe the Type-C port on RK3576 EVB1
Subsystems (2)
PATCH 1/1 arm64: dts: rockchip: Describe the Type-C port on RK3576 EVB1
RK3576 EVB1 has its USBDP PHY routed to a Type-C port with a HUSB311 CC controller and a fixed-voltage VBUS supply.
Describe it in the device tree, including the wiring for both the USB and the DP side.
This makes the data roles follow the Type-C port's negotiation, so the port stops being host only. It also leaves the VBUS regulator to be managed by TCPM instead of being hardwired via the tangentially related phy-supply on a USB controller. DP lanes are also muxed dynamically by the USBDP PHY based on the Type-C port's negotiation, so the hacky fixed lane muxing also goes away.
--- arch/arm64/boot/dts/rockchip/rk3576-evb1-v10.dts | 150 ++++++++++++++++++++++- 1 file changed, 147 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/rockchip/rk3576-evb1-v10.dts +147 -3
@@ -11,6 +11,7 @@ #include <dt-bindings/leds/common.h> #include <dt-bindings/pinctrl/rockchip.h> #include <dt-bindings/soc/rockchip,vop2.h> +#include <dt-bindings/usb/pd.h> #include "rk3576.dtsi" / {
@@ -334,6 +335,22 @@ &combphy1_psu { status = "okay"; }; +&dp { + status = "okay"; +}; + +&dp0_in { + dp0_in_vp1: endpoint { + remote-endpoint = <&vp1_out_dp>; + }; +}; + +&dp0_out { + dp0_out_con: endpoint { + remote-endpoint = <&usbdp_phy_dp_in>; + }; +}; + &gmac0 { clock_in_out = "output"; phy-mode = "rgmii-rxid";
@@ -772,6 +789,58 @@ regulator-state-mem { &i2c2 { status = "okay"; + usbc0: typec-portc@4e { + compatible = "hynetek,husb311", "richtek,rt1711h"; + reg = <0x4e>; + interrupt-parent = <&gpio0>; + interrupts = <RK_PA5 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&usbc0_int>; + vbus-supply = <&vbus5v0_typec>; + + connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + power-role = "source"; + source-pdos = <PDO_FIXED(5000, 2000, + PDO_FIXED_USB_COMM | PDO_FIXED_DATA_SWAP)>; + + altmodes { + displayport { + svid = /bits/ 16 <0xff01>; + vdo = <0x00001c46>; + }; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usbc0_hs: endpoint { + remote-endpoint = <&usb_drd0_hs_ep>; + }; + }; + + port@1 { + reg = <1>; + usbc0_ss: endpoint { + remote-endpoint = <&usbdp_phy_ss_out>; + }; + }; + + port@2 { + reg = <2>; + usbc0_sbu: endpoint { + remote-endpoint = <&usbdp_phy_dp_out>; + }; + }; + }; + }; + }; + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>;
@@ -944,6 +1013,14 @@ usb_otg0_pwren: usb-otg0-pwren { usbc0_int: usbc0-int { rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; }; + + usbc0_sbu1: usbc0-sbu1 { + rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + usbc0_sbu2: usbc0-sbu2 { + rockchip,pins = <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; }; wifi {
@@ -1008,7 +1085,6 @@ &u2phy0 { }; &u2phy0_otg { - phy-supply = <&vbus5v0_typec>; status = "okay"; };
@@ -1051,13 +1127,74 @@ &ufshc { }; &usbdp_phy { - rockchip,dp-lane-mux = <2 3>; + mode-switch; + orientation-switch; + pinctrl-names = "default"; + pinctrl-0 = <&usbc0_sbu1 &usbc0_sbu2>; + sbu1-dc-gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_HIGH>; + sbu2-dc-gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_HIGH>; status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + usbdp_phy_ss_out: endpoint { + remote-endpoint = <&usbc0_ss>; + }; + }; + + port@1 { + reg = <1>; + + usbdp_phy_ss_in: endpoint { + remote-endpoint = <&usb_drd0_ss_ep>; + }; + }; + + port@2 { + reg = <2>; + + usbdp_phy_dp_in: endpoint { + remote-endpoint = <&dp0_out_con>; + }; + }; + + port@3 { + reg = <3>; + + usbdp_phy_dp_out: endpoint { + remote-endpoint = <&usbc0_sbu>; + }; + }; + }; }; &usb_drd0_dwc3 { - dr_mode = "host"; + usb-role-switch; status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usb_drd0_hs_ep: endpoint { + remote-endpoint = <&usbc0_hs>; + }; + }; + + port@1 { + reg = <1>; + usb_drd0_ss_ep: endpoint { + remote-endpoint = <&usbdp_phy_ss_in>; + }; + }; + }; }; &usb_drd1_dwc3 {
@@ -1079,3 +1216,10 @@ vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { remote-endpoint = <&hdmi_in_vp0>; }; }; + +&vp1 { + vp1_out_dp: endpoint@a { + reg = <ROCKCHIP_VOP2_EP_DP0>; + remote-endpoint = <&dp0_in_vp1>; + }; +};
---
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
change-id: 20261106-rk3576-evb1-husb311-00efcff4a808
Best regards,
Signature · 1 line
Alexey Charkov <[email protected]>
Hi Alexey,
Quoted 6 lines · Alexey Charkov
RK3576 EVB1 has its USBDP PHY routed to a Type-C port with a HUSB311 CC controller and a fixed-voltage VBUS supply.
Describe it in the device tree, including the wiring for both the USB and the DP side.
Quoted 7 lines
This makes the data roles follow the Type-C port's negotiation, so the port stops being host only. It also leaves the VBUS regulator to be managed by TCPM instead of being hardwired via the tangentially related phy-supply on a USB controller. DP lanes are also muxed dynamically by the USBDP PHY based on the Type-C port's negotiation, so the hacky fixed lane muxing also goes away.
Have you tested this? As far as I know, dw-dp driver does not support Type-C HPD yet.
Quoted 218 lines
Signed-off-by Alexey Charkov <[email protected]>--- arch/arm64/boot/dts/rockchip/rk3576-evb1-v10.dts | 150 ++++++++++++++++++++++- 1 file changed, 147 insertions(+), 3 deletions(-)arch/arm64/boot/dts/rockchip/rk3576-evb1-v10.dts +147
-4@@ -11,6 +11,7 @@ #include <dt-bindings/leds/common.h> #include <dt-bindings/pinctrl/rockchip.h> #include <dt-bindings/soc/rockchip,vop2.h> +#include <dt-bindings/usb/pd.h> #include "rk3576.dtsi" / {@@ -334,6 +335,22 @@ &combphy1_psu { status = "okay"; }; +&dp { + status = "okay"; +}; + +&dp0_in { + dp0_in_vp1: endpoint { + remote-endpoint = <&vp1_out_dp>; + }; +}; + +&dp0_out { + dp0_out_con: endpoint { + remote-endpoint = <&usbdp_phy_dp_in>; + }; +}; + &gmac0 { clock_in_out = "output"; phy-mode = "rgmii-rxid";@@ -772,6 +789,58 @@ regulator-state-mem { &i2c2 { status = "okay"; + usbc0: typec-portc@4e { + compatible = "hynetek,husb311", "richtek,rt1711h"; + reg = <0x4e>; + interrupt-parent = <&gpio0>; + interrupts = <RK_PA5 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&usbc0_int>; + vbus-supply = <&vbus5v0_typec>; + + connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + power-role = "source"; + source-pdos = <PDO_FIXED(5000, 2000, + PDO_FIXED_USB_COMM | PDO_FIXED_DATA_SWAP)>; + + altmodes { + displayport { + svid = /bits/ 16 <0xff01>; + vdo = <0x00001c46>; + }; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usbc0_hs: endpoint { + remote-endpoint = <&usb_drd0_hs_ep>; + }; + }; + + port@1 { + reg = <1>; + usbc0_ss: endpoint { + remote-endpoint = <&usbdp_phy_ss_out>; + }; + }; + + port@2 { + reg = <2>; + usbc0_sbu: endpoint { + remote-endpoint = <&usbdp_phy_dp_out>; + }; + }; + }; + }; + }; + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>;@@ -944,6 +1013,14 @@ usb_otg0_pwren: usb-otg0-pwren { usbc0_int: usbc0-int { rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; }; + + usbc0_sbu1: usbc0-sbu1 { + rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + usbc0_sbu2: usbc0-sbu2 { + rockchip,pins = <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; }; wifi {@@ -1008,7 +1085,6 @@ &u2phy0 { }; &u2phy0_otg { - phy-supply = <&vbus5v0_typec>; status = "okay"; };@@ -1051,13 +1127,74 @@ &ufshc { }; &usbdp_phy { - rockchip,dp-lane-mux = <2 3>; + mode-switch; + orientation-switch; + pinctrl-names = "default"; + pinctrl-0 = <&usbc0_sbu1 &usbc0_sbu2>; + sbu1-dc-gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_HIGH>; + sbu2-dc-gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_HIGH>; status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + usbdp_phy_ss_out: endpoint { + remote-endpoint = <&usbc0_ss>; + }; + }; + + port@1 { + reg = <1>; + + usbdp_phy_ss_in: endpoint { + remote-endpoint = <&usb_drd0_ss_ep>; + }; + }; + + port@2 { + reg = <2>; + + usbdp_phy_dp_in: endpoint { + remote-endpoint = <&dp0_out_con>; + }; + }; + + port@3 { + reg = <3>; + + usbdp_phy_dp_out: endpoint { + remote-endpoint = <&usbc0_sbu>; + }; + }; + }; }; &usb_drd0_dwc3 { - dr_mode = "host"; + usb-role-switch; status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usb_drd0_hs_ep: endpoint { + remote-endpoint = <&usbc0_hs>; + }; + }; + + port@1 { + reg = <1>; + usb_drd0_ss_ep: endpoint { + remote-endpoint = <&usbdp_phy_ss_in>; + }; + }; + }; }; &usb_drd1_dwc3 {@@ -1079,3 +1216,10 @@ vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { remote-endpoint = <&hdmi_in_vp0>; }; }; + +&vp1 { + vp1_out_dp: endpoint@a { + reg = <ROCKCHIP_VOP2_EP_DP0>; + remote-endpoint = <&dp0_in_vp1>; + }; +}; ---base-commit:
ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
change-id: 20261106-rk3576-evb1-husb311-00efcff4a808Best regards,
Signature · 1 line
Alexey Charkov <[email protected]>
Signature · 2 lines
Best, Chaoyi
Hi Chaoyi,
Quoted 18 lines · Chaoyi Chen
Hi Alexey,
Quoted 6 lines · Alexey Charkov
RK3576 EVB1 has its USBDP PHY routed to a Type-C port with a HUSB311 CC controller and a fixed-voltage VBUS supply.
Describe it in the device tree, including the wiring for both the USB and the DP side.
Quoted 7 lines
This makes the data roles follow the Type-C port's negotiation, so the port stops being host only. It also leaves the VBUS regulator to be managed by TCPM instead of being hardwired via the tangentially related phy-supply on a USB controller. DP lanes are also muxed dynamically by the USBDP PHY based on the Type-C port's negotiation, so the hacky fixed lane muxing also goes away.
Quoted 2 lines
Have you tested this? As far as I know, dw-dp driver does not support Type-C HPD yet.
I did - it works fine for me under Linux with Sebastian's patches. My primary motivation, however, was U-Boot, where the current phy-supply hack breaks USB data role switching, due to VBUS being forced always-on. With this patch it works, and now the DT actually describes the hardware, as it is supposed to.
Best regards,
Alexey