arm64: dts: rockchip: orangepi-5-plus: Enable USB 3.0 ports
Subsystems (2)
PATCH 1/1 arm64: dts: rockchip: orangepi-5-plus: Enable USB 3.0 ports
From: Chen-Yu Tsai <[email protected]>
The Orange Pi 5 Plus has its first USB 3.0 interface on the SoC wired directly to the USB type C port next to the MASKROM button, and the second interface wired to a USB 3.0 hub which in turn is connected to the USB 3.0 host ports on the board, as well as the USB 2.0 connection on the M.2 E-key slot.
--- .../dts/rockchip/rk3588-orangepi-5-plus.dts | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+)
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +132 -0
@@ -177,6 +177,18 @@ daicodec: simple-audio-card,codec { }; }; + vbus_typec: vbus-typec-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&typec5v_pwren>; + regulator-name = "vbus_typec"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + vcc3v3_pcie30: vcc3v3-pcie30-regulator { compatible = "regulator-fixed"; enable-active-high;
@@ -339,6 +351,56 @@ &i2c6 { clock-frequency = <400000>; status = "okay"; + usbc0: usb-typec@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio0>; + interrupts = <RK_PD3 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&usbc0_int>; + vbus-supply = <&vbus_typec>; + status = "okay"; + + usb_con: connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + op-sink-microwatt = <1000000>; + power-role = "dual"; + sink-pdos = + <PDO_FIXED(5000, 1000, PDO_FIXED_USB_COMM)>; + source-pdos = + <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>; + try-power-role = "source"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usbc0_hs: endpoint { + remote-endpoint = <&usb_host0_xhci_drd_sw>; + }; + }; + + port@1 { + reg = <1>; + usbc0_ss: endpoint { + remote-endpoint = <&usbdp_phy0_typec_ss>; + }; + }; + + port@2 { + reg = <2>; + usbc0_sbu: endpoint { + remote-endpoint = <&usbdp_phy0_typec_sbu>; + }; + }; + }; + }; + }; + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>;
@@ -480,6 +542,16 @@ vcc5v0_usb20_en: vcc5v0-usb20-en { rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; }; }; + + usb-typec { + usbc0_int: usbc0-int { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + typec5v_pwren: typec5v-pwren { + rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; }; &pwm2 {
@@ -871,6 +943,22 @@ &tsadc { status = "okay"; }; +&u2phy0 { + status = "okay"; +}; + +&u2phy0_otg { + status = "okay"; +}; + +&u2phy1 { + status = "okay"; +}; + +&u2phy1_otg { + status = "okay"; +}; + &u2phy2 { status = "okay"; };
@@ -899,6 +987,33 @@ &uart9 { status = "okay"; }; +&usbdp_phy0 { + mode-switch; + orientation-switch; + sbu1-dc-gpios = <&gpio4 RK_PA6 GPIO_ACTIVE_HIGH>; + sbu2-dc-gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; + status = "okay"; + + port { + #address-cells = <1>; + #size-cells = <0>; + + usbdp_phy0_typec_ss: endpoint@0 { + reg = <0>; + remote-endpoint = <&usbc0_ss>; + }; + + usbdp_phy0_typec_sbu: endpoint@1 { + reg = <1>; + remote-endpoint = <&usbc0_sbu>; + }; + }; +}; + +&usbdp_phy1 { + status = "okay"; +}; + &usb_host0_ehci { status = "okay"; };
@@ -907,6 +1022,18 @@ &usb_host0_ohci { status = "okay"; }; +&usb_host0_xhci { + dr_mode = "otg"; + usb-role-switch; + status = "okay"; + + port { + usb_host0_xhci_drd_sw: endpoint { + remote-endpoint = <&usbc0_hs>; + }; + }; +}; + &usb_host1_ehci { status = "okay"; };
@@ -915,6 +1042,11 @@ &usb_host1_ohci { status = "okay"; }; +&usb_host1_xhci { + dr_mode = "host"; + status = "okay"; +}; + &vop_mmu { status = "okay"; };
Signature · 1 line
2.39.5
Hello Chen-Yu,
Quoted 9 lines · Chen-Yu Tsai
From: Chen-Yu Tsai <[email protected]>
The Orange Pi 5 Plus has its first USB 3.0 interface on the SoC wired directly to the USB type C port next to the MASKROM button, and the second interface wired to a USB 3.0 hub which in turn is connected to the USB 3.0 host ports on the board, as well as the USB 2.0 connection on the M.2 E-key slot.
Signed-off-by Chen-Yu Tsai <[email protected]>
CCing the DTS author would be nice. :)
Thanks for submitting this. I found a few issues. See below:
Quoted 9 lines
--- .../dts/rockchip/rk3588-orangepi-5-plus.dts | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+)arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +0
-0
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts daicodec: simple-audio-card,codec { · line 186
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +7
-0@@ -177,6 +177,18 @@ daicodec: simple-audio-card,codec { }; }; + vbus_typec: vbus-typec-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&typec5v_pwren>; + regulator-name = "vbus_typec";
This is named vbus5v0_typec in the schematic.
Quoted 20 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +13
-0+ regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + vcc3v3_pcie30: vcc3v3-pcie30-regulator { compatible = "regulator-fixed"; enable-active-high;@@ -339,6 +351,56 @@ &i2c6 { clock-frequency = <400000>; status = "okay"; + usbc0: usb-typec@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio0>; + interrupts = <RK_PD3 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&usbc0_int>; + vbus-supply = <&vbus_typec>;
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts &i2c6 { · line 371
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +10
-0+ status = "okay"; + + usb_con: connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + op-sink-microwatt = <1000000>; + power-role = "dual"; + sink-pdos = + <PDO_FIXED(5000, 1000, PDO_FIXED_USB_COMM)>;
The board can't sink power from this port. It's a source only port. So sink-pdos can be lower, so that if you plug this into type-c hub as a peripheral, the hub doesn't need to reserve 5W for this port.
op-sink-microwat can also be lower. The port will not sink any power when connected to 5V VBUS externally.
Otherwise you can probably keep power-role = "dual";
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts &i2c6 { · line 373
Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +2
-0+ source-pdos = + <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
This port can't source 3A. U22 (SY6280AAC) is configured via Rset for 1.44A limit. So let's say 1.5A.
Quoted 57 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +43
-0+ try-power-role = "source"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usbc0_hs: endpoint { + remote-endpoint = <&usb_host0_xhci_drd_sw>; + }; + }; + + port@1 { + reg = <1>; + usbc0_ss: endpoint { + remote-endpoint = <&usbdp_phy0_typec_ss>; + }; + }; + + port@2 { + reg = <2>; + usbc0_sbu: endpoint { + remote-endpoint = <&usbdp_phy0_typec_sbu>; + }; + }; + }; + }; + }; + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>;@@ -480,6 +542,16 @@ vcc5v0_usb20_en: vcc5v0-usb20-en { rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; }; }; + + usb-typec { + usbc0_int: usbc0-int { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + typec5v_pwren: typec5v-pwren { + rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; }; &pwm2 {@@ -871,6 +943,22 @@ &tsadc { status = "okay"; }; +&u2phy0 { + status = "okay"; +};
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts &tsadc { · line 958
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +10
-0+ +&u2phy0_otg { + status = "okay"; +}; + +&u2phy1 { + status = "okay"; +}; + +&u2phy1_otg {
Needs:
phy-supply = <&vcc5v0_host>;
Quoted 41 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +30
-0+ status = "okay"; +}; + &u2phy2 { status = "okay"; };@@ -899,6 +987,33 @@ &uart9 { status = "okay"; }; +&usbdp_phy0 { + mode-switch; + orientation-switch; + sbu1-dc-gpios = <&gpio4 RK_PA6 GPIO_ACTIVE_HIGH>; + sbu2-dc-gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; + status = "okay"; + + port { + #address-cells = <1>; + #size-cells = <0>; + + usbdp_phy0_typec_ss: endpoint@0 { + reg = <0>; + remote-endpoint = <&usbc0_ss>; + }; + + usbdp_phy0_typec_sbu: endpoint@1 { + reg = <1>; + remote-endpoint = <&usbc0_sbu>; + }; + }; +}; + +&usbdp_phy1 { + status = "okay"; +}; + &usb_host0_ehci { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts &usb_host0_ohci { · line 1026
Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +2
-0@@ -907,6 +1022,18 @@ &usb_host0_ohci { status = "okay"; }; +&usb_host0_xhci { + dr_mode = "otg";
This is the default. No need to have it here.
Kind regards,
o.
Quoted 28 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +15
-0+ usb-role-switch; + status = "okay"; + + port { + usb_host0_xhci_drd_sw: endpoint { + remote-endpoint = <&usbc0_hs>; + }; + }; +}; + &usb_host1_ehci { status = "okay"; };@@ -915,6 +1042,11 @@ &usb_host1_ohci { status = "okay"; }; +&usb_host1_xhci { + dr_mode = "host"; + status = "okay"; +}; + &vop_mmu { status = "okay"; };Signature · 1 line
2.39.5
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Quoted 12 lines · Ondřej Jirman
Hello Chen-Yu,
Quoted 8 lines · Chen-Yu Tsai
From: Chen-Yu Tsai <[email protected]>
The Orange Pi 5 Plus has its first USB 3.0 interface on the SoC wired directly to the USB type C port next to the MASKROM button, and the second interface wired to a USB 3.0 hub which in turn is connected to the USB 3.0 host ports on the board, as well as the USB 2.0 connection on the M.2 E-key slot.
Quoted 3 lines
Quoted 1 line
Signed-off-by Chen-Yu Tsai <[email protected]>CCing the DTS author would be nice. :)
Ack.
Quoted 14 lines
Thanks for submitting this. I found a few issues. See below:
Quoted 12 lines
--- .../dts/rockchip/rk3588-orangepi-5-plus.dts | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+)arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +0
-0@@ -177,6 +177,18 @@ daicodec: simple-audio-card,codec { }; };
Quoted 9 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts daicodec: simple-audio-card,codec { · line 186
Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +7
-0+ vbus_typec: vbus-typec-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&typec5v_pwren>; + regulator-name = "vbus_typec";This is named
vbus5v0_typecin the schematic.
Ack.
Quoted 35 lines
Quoted 20 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +13
-0+ regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + vcc3v3_pcie30: vcc3v3-pcie30-regulator { compatible = "regulator-fixed"; enable-active-high;@@ -339,6 +351,56 @@ &i2c6 { clock-frequency = <400000>; status = "okay"; + usbc0: usb-typec@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio0>; + interrupts = <RK_PD3 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&usbc0_int>; + vbus-supply = <&vbus_typec>;arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts &i2c6 { · line 371
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +10
-0+ status = "okay"; + + usb_con: connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + op-sink-microwatt = <1000000>; + power-role = "dual"; + sink-pdos = + <PDO_FIXED(5000, 1000, PDO_FIXED_USB_COMM)>;The board can't sink power from this port. It's a source only port. So sink-pdos can be lower, so that if you plug this into type-c hub as a peripheral, the hub doesn't need to reserve 5W for this port.
Quoted 4 lines
op-sink-microwat can also be lower. The port will not sink any power when connected to 5V VBUS externally.
Otherwise you can probably keep power-role = "dual";
I guess it should just be power-role = "source";
And then drop all the sink related properties.
Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts &i2c6 { · line 373
Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +2
-0+ source-pdos = + <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;This port can't source 3A. U22 (SY6280AAC) is configured via Rset for 1.44A limit. So let's say 1.5A.
Probably 1.4A to be safe?
Quoted 69 lines
Quoted 57 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +43
-0+ try-power-role = "source"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usbc0_hs: endpoint { + remote-endpoint = <&usb_host0_xhci_drd_sw>; + }; + }; + + port@1 { + reg = <1>; + usbc0_ss: endpoint { + remote-endpoint = <&usbdp_phy0_typec_ss>; + }; + }; + + port@2 { + reg = <2>; + usbc0_sbu: endpoint { + remote-endpoint = <&usbdp_phy0_typec_sbu>; + }; + }; + }; + }; + }; + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>;@@ -480,6 +542,16 @@ vcc5v0_usb20_en: vcc5v0-usb20-en { rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; }; }; + + usb-typec { + usbc0_int: usbc0-int { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + typec5v_pwren: typec5v-pwren { + rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; }; &pwm2 {@@ -871,6 +943,22 @@ &tsadc { status = "okay"; }; +&u2phy0 { + status = "okay"; +};arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts &tsadc { · line 958
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +10
-0+ +&u2phy0_otg { + status = "okay"; +}; + +&u2phy1 { + status = "okay"; +}; + +&u2phy1_otg {Needs:
Quoted 1 line
phy-supply = <&vcc5v0_host>;
You probably mean vcc5v0_sys?
The power switch that feeds the ports is controlled by the hub directly. The hub is powered off vcc5v0_sys.
Quoted 44 lines
Quoted 44 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +30
-0+ status = "okay"; +}; + &u2phy2 { status = "okay"; };@@ -899,6 +987,33 @@ &uart9 { status = "okay"; }; +&usbdp_phy0 { + mode-switch; + orientation-switch; + sbu1-dc-gpios = <&gpio4 RK_PA6 GPIO_ACTIVE_HIGH>; + sbu2-dc-gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; + status = "okay"; + + port { + #address-cells = <1>; + #size-cells = <0>; + + usbdp_phy0_typec_ss: endpoint@0 { + reg = <0>; + remote-endpoint = <&usbc0_ss>; + }; + + usbdp_phy0_typec_sbu: endpoint@1 { + reg = <1>; + remote-endpoint = <&usbc0_sbu>; + }; + }; +}; + +&usbdp_phy1 { + status = "okay"; +}; + &usb_host0_ehci { status = "okay"; };@@ -907,6 +1022,18 @@ &usb_host0_ohci { status = "okay"; };
Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts &usb_host0_ohci { · line 1026
Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +2
-0+&usb_host0_xhci { + dr_mode = "otg";This is the default. No need to have it here.
Ack.
Thanks
ChenYu
Quoted 31 lines
Kind regards,
o.Quoted 28 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +15
-1+ usb-role-switch; + status = "okay"; + + port { + usb_host0_xhci_drd_sw: endpoint { + remote-endpoint = <&usbc0_hs>; + }; + }; +}; + &usb_host1_ehci { status = "okay"; };@@ -915,6 +1042,11 @@ &usb_host1_ohci { status = "okay"; }; +&usb_host1_xhci { + dr_mode = "host"; + status = "okay"; +}; + &vop_mmu { status = "okay"; }; --2.39.5
Hi,
Quoted 16 lines · Chen-Yu Tsai
Quoted 15 lines · Ondřej Jirman
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts &i2c6 { · line 371
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +9
-0+ + usb_con: connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + op-sink-microwatt = <1000000>; + power-role = "dual"; + sink-pdos = + <PDO_FIXED(5000, 1000, PDO_FIXED_USB_COMM)>;The board can't sink power from this port. It's a source only port. So sink-pdos can be lower, so that if you plug this into type-c hub as a peripheral, the hub doesn't need to reserve 5W for this port.
Quoted 7 lines
Quoted 4 lines
op-sink-microwat can also be lower. The port will not sink any power when connected to 5V VBUS externally.
Otherwise you can probably keep power-role = "dual";
I guess it should just be power-role = "source";
And then drop all the sink related properties.
Probably not. The board is not powered from that port, but I should still be able to plug it via that port to a PC, and in that case it should not act as power source (vbus should be disabled), because PC's port will provide power. (say via USB-A <-> USB-C cable connected to PC's USB host port)
It should still be capable of being in power sink mode on that port, but it will just not physically sink anything. Just the board's vbus will be disabled.
We should just describe that in sink mode it will not sink much of anything.
Quoted 7 lines
Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts &i2c6 { · line 373
Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +2
-0+ source-pdos = + <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;This port can't source 3A. U22 (SY6280AAC) is configured via Rset for 1.44A limit. So let's say 1.5A.
Probably 1.4A to be safe?
Ok.
Quoted 10 lines
Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts &tsadc { · line 958
Quoted 5 lines
+&u2phy1 {
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +4
-0+ status = "okay"; +}; + +&u2phy1_otg {Needs:
phy-supply = <&vcc5v0_host>;You probably mean
vcc5v0_sys?
Sorry, ignore this request completely. I was mis-looking at quartzpro DTS, when reviewing this part of the patch.
Thank you,
o.
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip