arm64: dts: rockchip: add USB-C PD and DP altmode to LubanCat 4
Subsystems (2)
cover arm64: dts: rockchip: add USB-C PD and DP altmode to LubanCat 4
This series enables the front-panel USB Type-C port on the EmbedFire LubanCat 4 single-board computer, covering USB Power Delivery, dual-role data/power, and DisplayPort alternate mode.
The port is backed by a Fairchild FUSB302 controller on I2C1 (0x22), a fixed 5V VBUS regulator enabled by GPIO1_C1 (limited to 2A by an LPW5209 switch), the RK3588 combo PHY usbdp_phy0, and two DC switches on GPIO4_B3/B4 for the SBU1/SBU2 lines.
The series is organized into two steps:
1. Basic Type-C and USB PD support:
Adds the FUSB302 node, VBUS regulator, dual-role power (source 5V/2A, sink 5V/1A) and dual-role data connector. Sets usb_host0_xhci to OTG mode with usb-role-switch, wires HS data to the host controller and SS data to usbdp_phy0, and adds orientation-switch on the PHY.
2. DisplayPort alternate mode:
Adds the DisplayPort altmode entry (SVID 0xff01) to the connector, wires connector SBU (port@2) to usbdp_phy0 (port@3), and connects the display pipeline: VOP2 VP1 -> dp0 -> usbdp_phy0 (port@2).
Validation and hardware test status:
- 'make dtbs' builds cleanly without warnings.
- 'make dtbs_check' against usb-connector, phy-rockchip-usbdp, rockchip,dw-dp, and fcs,fusb302 schemas passes with 0 warnings.
- Patch 1 has been verified on a physical LubanCat 4 board:
* tcpm and fusb302 probe cleanly;
* Host mode: USB 2.0 and USB 3.0 peripherals enumerate; USB 3.0 operates at SuperSpeed in normal orientation (reverse-orientation SuperSpeed is subject to the known upstream phy-rockchip-usbdp bug);
* Device mode: ConfigFS CDC ACM serial gadget successfully enumerates
on a host PC at high-speed with bidirectional data communication;
* VBUS power switch correctly enables in source mode and remains disabled in sink mode with reverse current blocked.
- Patch 2 driver stack registration has been verified on board:
dw_dp binds to the display subsystem, DRM connector card2-DP-1 is registered, usbdp phy-mux and phy-switch are registered, and typec_displayport binds to the altmode. Display output / link training is disclosed as pending physical verification due to lack of a USB-C to DP monitor/cable at this time.
Pufan Jin (2):
arm64: dts: rockchip: add USB-C PD support to LubanCat 4
arm64: dts: rockchip: add USB-C DP altmode support to LubanCat 4
.../boot/dts/rockchip/rk3588s-lubancat-4.dts | 172 +++++++++++++++++- 1 file changed, 171 insertions(+), 1 deletion(-)
Signature · 1 line
2.56.0
PATCH 1/2 arm64: dts: rockchip: add USB-C PD support to LubanCat 4
The EmbedFire LubanCat 4 has a Type-C port on the front panel backed by a Fairchild FUSB302 Type-C controller connected to I2C1 (at 0x22). VBUS 5V power is supplied through a fixed regulator enabled by GPIO1_C1 (active high), current-limited to 2A by an LPW5209 switch.
Add the FUSB302 node, the fixed VBUS regulator, and the USB-C connector with dual-role power (source 5V/2A, sink 5V/1A) and dual-role data. Wire the HighSpeed data endpoint to usb_host0_xhci and the SuperSpeed data endpoint to usbdp_phy0. Set usb_host0_xhci to OTG mode with usb-role-switch enabled, and add orientation-switch on usbdp_phy0.
DisplayPort alternate mode support is added in a subsequent patch.
Tested on LubanCat 4 hardware:
- fusb302 and tcpm probe cleanly;
- USB host mode verified with USB 2.0 and USB 3.0 peripherals;
- USB 2.0 devices enumerate and transfer data in both orientations;
- USB 3.0 devices enumerate at SuperSpeed (5Gbps) in normal orientation; reverse-orientation SuperSpeed is subject to the known upstream phy-rockchip-usbdp driver reinit limitation;
- USB device mode verified via ConfigFS CDC ACM serial gadget connected to a host PC with successful high-speed enumeration and bidirectional data communication;
- VBUS switch (LPW5209) enables in source mode and remains disabled in sink mode with reverse current blocked.
--- .../boot/dts/rockchip/rk3588s-lubancat-4.dts | 115 +++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3588s-lubancat-4.dts +114 -1
@@ -8,9 +8,11 @@ /dts-v1/; #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/interrupt-controller/irq.h> #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 "rk3588s.dtsi" / {
@@ -116,6 +118,18 @@ vcc5v0_usb30_host: regulator-vcc5v0-usb30-host { vin-supply = <&vcc5v0_sys>; }; + vbus5v0_typec: regulator-vbus5v0-typec { + compatible = "regulator-fixed"; + regulator-name = "vbus5v0_typec"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&typec_vbus_en>; + vin-supply = <&vcc5v0_sys>; + }; + fan: pwm-fan { compatible = "pwm-fan"; cooling-levels = <0 100 150 200 255>;
@@ -286,6 +300,51 @@ regulator-state-mem { regulator-off-in-suspend; }; }; + + usbc0: usb-typec@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio0>; + interrupts = <RK_PC6 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&fusb302_int>; + vbus-supply = <&vbus5v0_typec>; + status = "okay"; + + usb_con: connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + power-role = "dual"; + try-power-role = "source"; + op-sink-microwatt = <1000000>; + sink-pdos = + <PDO_FIXED(5000, 1000, PDO_FIXED_USB_COMM)>; + source-pdos = + <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + usbc0_hs: endpoint { + remote-endpoint = <&usb_host0_xhci_hs>; + }; + }; + + port@1 { + reg = <1>; + + usbc0_ss: endpoint { + remote-endpoint = <&usbdp_phy0_ss_out>; + }; + }; + }; + }; + }; }; &mdio1 {
@@ -346,6 +405,16 @@ usb30_host_pwr_en: usb30-host-pwr-en { rockchip,pins = <1 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>; }; }; + + usb-typec { + fusb302_int: fusb302-int { + rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + typec_vbus_en: typec-vbus-en { + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; }; &pwm0 {
@@ -748,8 +817,30 @@ &usb_host0_ohci { }; &usb_host0_xhci { - dr_mode = "host"; + dr_mode = "otg"; + usb-role-switch; status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + usb_host0_xhci_hs: endpoint { + remote-endpoint = <&usbc0_hs>; + }; + }; + + port@1 { + reg = <1>; + + usb_host0_xhci_ss: endpoint { + remote-endpoint = <&usbdp_phy0_ss_in>; + }; + }; + }; }; &usb_host1_ehci {
@@ -765,7 +856,29 @@ &usb_host2_xhci { }; &usbdp_phy0 { + orientation-switch; status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + usbdp_phy0_ss_out: endpoint { + remote-endpoint = <&usbc0_ss>; + }; + }; + + port@1 { + reg = <1>; + + usbdp_phy0_ss_in: endpoint { + remote-endpoint = <&usb_host0_xhci_ss>; + }; + }; + }; }; &vop {
Signature · 1 line
2.56.0
PATCH 2/2 arm64: dts: rockchip: add USB-C DP altmode support to LubanCat 4
In reply to Pufan JinThe Type-C port on the EmbedFire LubanCat 4 supports DisplayPort alternate mode through the RK3588 usbdp combo PHY (usbdp_phy0). The sideband use (SBU1/SBU2) AUX signals are routed through two DC switches controlled by GPIO4_B3 and GPIO4_B4.
Add the DisplayPort alternate mode entry (SVID 0xff01) to the USB-C connector and connect connector port@2 (SBU) to usbdp_phy0 port@3. Configure usbdp_phy0 with mode-switch and sbu{1,2}-dc-gpios. Enable dp0 and connect dp0_out to usbdp_phy0 port@2, with dp0_in fed from VOP2 VP1.
Tested driver stack registration on LubanCat 4 hardware:
- dw_dp bounds successfully to display-subsystem;
- DRM DP connector card2-DP-1 is registered and reports disconnected;
- typec_displayport registers the DisplayPort altmode driver;
- usbdp_phy0 registers the phy-switch and phy-mux.
Physical DisplayPort link training and monitor video output are pending verification with a physical USB-C to DP sink/cable.
--- .../boot/dts/rockchip/rk3588s-lubancat-4.dts | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+)
arch/arm64/boot/dts/rockchip/rk3588s-lubancat-4.dts +57 -0
@@ -323,6 +323,13 @@ usb_con: connector { source-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)>; + altmodes { + displayport { + svid = /bits/ 16 <0xff01>; + vdo = <0xffffffff>; + }; + }; + ports { #address-cells = <1>; #size-cells = <0>;
@@ -342,6 +349,14 @@ usbc0_ss: endpoint { remote-endpoint = <&usbdp_phy0_ss_out>; }; }; + + port@2 { + reg = <2>; + + usbc0_sbu: endpoint { + remote-endpoint = <&usbdp_phy0_dp_out>; + }; + }; }; }; };
@@ -857,6 +872,9 @@ &usb_host2_xhci { &usbdp_phy0 { orientation-switch; + mode-switch; + sbu1-dc-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>; + sbu2-dc-gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; status = "okay"; ports {
@@ -878,6 +896,22 @@ usbdp_phy0_ss_in: endpoint { remote-endpoint = <&usb_host0_xhci_ss>; }; }; + + port@2 { + reg = <2>; + + usbdp_phy0_dp_in: endpoint { + remote-endpoint = <&dp0_out_con>; + }; + }; + + port@3 { + reg = <3>; + + usbdp_phy0_dp_out: endpoint { + remote-endpoint = <&usbc0_sbu>; + }; + }; }; };
@@ -895,3 +929,26 @@ vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { remote-endpoint = <&hdmi0_in_vp0>; }; }; + +&dp0 { + status = "okay"; +}; + +&dp0_in { + dp0_in_vp1: endpoint { + remote-endpoint = <&vp1_out_dp0>; + }; +}; + +&dp0_out { + dp0_out_con: endpoint { + remote-endpoint = <&usbdp_phy0_dp_in>; + }; +}; + +&vp1 { + vp1_out_dp0: endpoint@a { + reg = <ROCKCHIP_VOP2_EP_DP0>; + remote-endpoint = <&dp0_in_vp1>; + }; +};
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH 2/2] arm64: dts: rockchip: add USB-C DP altmode support to LubanCat 4
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] arm64: dts: rockchip: unsorted &dp0 nodes and properties in rk3588s-lubancat-4 --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] arm64: dts: rockchip: unsorted &dp0 nodes and properties in rk3588s-lubancat-4
--
commit 261397db3cd2b33e2c023e8478bf7780b94572b6
Author: Pufan Jin <[email protected]>
arm64: dts: rockchip: add USB-C DP altmode support to LubanCat 4
This commit adds DisplayPort alternate mode support on the USB-C connector of the EmbedFire LubanCat 4 by wiring the USB-C connector, usbdp_phy0, dp0, and VOP2 VP1 in the device tree.
Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3588s-lubancat-4.dts +0
-0
[ ... ]
Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk3588s-lubancat-4.dts +3
-0@@ -857,6 +872,9 @@ &usb_host2_xhci { &usbdp_phy0 { orientation-switch; + mode-switch; + sbu1-dc-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>; + sbu2-dc-gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; status = "okay";
[ ... ]
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3588s-lubancat-4.dts +6
-0@@ -895,3 +929,26 @@ vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { remote-endpoint = <&hdmi0_in_vp0>; }; }; + +&dp0 { + status = "okay"; +}; + +&dp0_in {
arch/arm64/boot/dts/rockchip/rk3588s-lubancat-4.dts vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { · line 947
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3588s-lubancat-4.dts +10
-0+ dp0_in_vp1: endpoint { + remote-endpoint = <&vp1_out_dp0>; + }; +}; + +&dp0_out { + dp0_out_con: endpoint { + remote-endpoint = <&usbdp_phy0_dp_in>; + }; +};
[Severity: Low]
This isn't a bug, but per the devicetree coding style and the rest of this file, label reference nodes are sorted alphabetically, so &dp0, &dp0_in, and &dp0_out should be placed between &cpu_l3 and &gmac1 rather than between &vp0 and &vp1. Similarly, in &usbdp_phy0, mode-switch should be placed before orientation-switch.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Quoted 10 lines · Pufan Jin
This series enables the front-panel USB Type-C port on the EmbedFire LubanCat 4 single-board computer, covering USB Power Delivery, dual-role data/power, and DisplayPort alternate mode.
The port is backed by a Fairchild FUSB302 controller on I2C1 (
0x22), a fixed 5V VBUS regulator enabled byGPIO1_C1(limited to 2A by an LPW5209 switch), the RK3588 combo PHYusbdp_phy0, and two DC switches on GPIO4_B3/B4 for the SBU1/SBU2 lines.[...]
Applied, thanks!
[1/2] arm64: dts: rockchip: add USB-C PD support to LubanCat 4
commit: 42c1e1db2ac799921819851237f22055c0af15ff
[2/2] arm64: dts: rockchip: add USB-C DP altmode support to LubanCat 4
commit: dbc094626a087d379ea6ab2bf6c730965a87fb80Best regards,
Signature · 1 line
Heiko Stuebner <[email protected]>