Skip to contentSkip to conversation

arm64: dts: rockchip: Use GPIO function for PCIe reset on Orange Pi 5 Pro

PATCH Applied Dennis Gilmore 2 participants 2 messages Oct 2 – Oct 4

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: dts: rockchip: Use GPIO function for PCIe reset on Orange Pi 5 Pro

The PERST# pins of pcie2x1l1 and pcie2x1l2 are used as reset-gpios, but the default pinctrl state muxes them to the controllers' dedicated PERST# function instead of GPIO.

Linux happens to work because the pin is switched to GPIO function when it is requested as a GPIO, but the devicetree should describe the pin function the board actually uses. Bootloaders such as U-Boot apply the pinctrl state as described and do not change the function when the GPIO is requested, and probing pcie2x1l2 then hangs.

Add GPIO pinctrl nodes for both reset pins and use them in place of the PERST# function, like other RK3588 boards do.

Fixes f47af8ebbe53 ("arm64: dts: rockchip: Add Orange Pi 5 Pro board support")
---
 .../boot/dts/rockchip/rk3588s-orangepi-5-pro.dts   | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5-pro.dts +12 -2
index c9679bac1db7..783675337ab9 100644
@@ -188,7 +188,7 @@ package_fan1: package-fan1 {
 /* NVMe */
 &pcie2x1l1 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&pcie30x1m1_1_perstn>, <&pcie30x1m1_1_clkreqn>,
+	pinctrl-0 = <&pcie2_1_rst>, <&pcie30x1m1_1_clkreqn>,
 		    <&pcie30x1m1_1_waken>;
 	reset-gpios = <&gpio4 RK_PA2 GPIO_ACTIVE_HIGH>;
 	supports-clkreq;
@@ -199,7 +199,7 @@ &pcie2x1l1 {
 /* NIC */
 &pcie2x1l2 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&pcie20x1m0_perstn>, <&pcie20x1m0_clkreqn>,
+	pinctrl-0 = <&pcie2_2_rst>, <&pcie20x1m0_clkreqn>,
 		    <&pcie20x1m0_waken>;
 	reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>;
 	vpcie3v3-supply = <&vcc3v3_eth>;
@@ -223,6 +223,16 @@ ethernet_en: ethernet-en {
 		};
 	};
 
+	pcie {
+		pcie2_1_rst: pcie2-1-rst {
+			rockchip,pins = <4 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+		pcie2_2_rst: pcie2-2-rst {
+			rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
 	usb {
 		vcc5v0_otg_en: vcc5v0-otg-en {
 			rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_down>;
Signature · 1 line
2.55.0
maintainer Applied
#1 lore raw
Quoted 11 lines · Dennis Gilmore

The PERST# pins of pcie2x1l1 and pcie2x1l2 are used as reset-gpios, but the default pinctrl state muxes them to the controllers' dedicated PERST# function instead of GPIO.

Linux happens to work because the pin is switched to GPIO function when it is requested as a GPIO, but the devicetree should describe the pin function the board actually uses. Bootloaders such as U-Boot apply the pinctrl state as described and do not change the function when the GPIO is requested, and probing pcie2x1l2 then hangs.

[...]

Applied, thanks!

[1/1] arm64: dts: rockchip: Use GPIO function for PCIe reset on Orange Pi 5 Pro

      commit: e95e4fcdc4541e999888f297174e8f6f5f5f899a

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>