Skip to contentSkip to conversation

arm64: dts: rockchip: fix PCIe2 regulators for Radxa ROCK 3A

PATCH Superseded FUKAUMI Naoki 2 participants 3 messages Sep 13, 2024 – Sep 14, 2024

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 arm64: dts: rockchip: fix PCIe2 regulators for Radxa ROCK 3A

currently "vcc3v3_pcie" regulator is used for PCIe2 M.2 E key connector, but, by schematic[1], it's incorrect. "vcc3v3_wf" regulator is correct one. add it and fix related vin-supply.

changes for pinctrl are to claim all 3 pins instead of only reset pin as like as rk3568-rock-3b.dts.

[1] https://dl.radxa.com/rock3/docs/hw/3a/radxa_rock_3a_v1310_schematic.pdf

Fixes 0fbbfb0b00d1 ("arm64: dts: rockchip: Enable PCIe controller on rock3a")

---
Changes in v2:
- split patches for PCIe2 and PCIe3
- fix pinctrl node name to overwrite rk3568-pinctrl.dtsi

---
 .../boot/dts/rockchip/rk3568-rock-3a.dts      | 28 +++++++++++++++----
 1 file changed, 23 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +23 -5
index 59f1403b4fa56..6f6b31b4442cd 100644
@@ -136,7 +136,17 @@ vcc3v3_sys: vcc3v3-sys-regulator {
 		regulator-boot-on;
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
-		vin-supply = <&vcc12v_dcin>;
+		vin-supply = <&vcc5v0_sys>;
+	};
+
+	vcc3v3_wf: vcc3v3-wf-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3_wf";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&vcc3v3_sys>;
 	};
 
 	vcc5v0_sys: vcc5v0-sys-regulator {
@@ -592,9 +602,9 @@ rgmii_phy1: ethernet-phy@0 {
 
 &pcie2x1 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&pcie_reset_h>;
+	pinctrl-0 = <&pcie20m1_pins>;
 	reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_HIGH>;
-	vpcie3v3-supply = <&vcc3v3_pcie>;
+	vpcie3v3-supply = <&vcc3v3_wf>;
 	status = "okay";
 };
 
@@ -646,9 +656,17 @@ pcie {
 		pcie_enable_h: pcie-enable-h {
 			rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
+	};
 
-		pcie_reset_h: pcie-reset-h {
-			rockchip,pins = <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
+	pcie20 {
+		pcie20m1_pins: pcie20m1-pins {
+			rockchip,pins =
+				/* pcie20_clkreqnm1 */
+				<2 RK_PD0 4 &pcfg_pull_none>,
+				/* pcie20_perstnm1 */
+				<3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>,
+				/* pcie20_wakenm1 */
+				<2 RK_PD1 4 &pcfg_pull_none>;
 		};
 	};
 
Signature · 7 lines
2.43.0


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#1 lore raw

PATCH v2 2/2 arm64: dts: rockchip: make PCIe3 (M.2 M key) work for Radxa ROCK 3A

on Radxa ROCK 3A, GPIO0_D4 is used to enable both pi6c PCIe clock generator and "vcc3v3_pcie" regulator (PCIe3 M.2 M key connector).

since pi6c needs to be enabled before using PCIe3, GPIO0_D4 need to be controlled by "vcc3v3_pi6c_03" regulator. then, make "vcc3v3_pi6c_03" vin-supply for "vcc3v3_pcie30x1".

also, "pcie30_avdd0v9" and "pcie30_avdd1v8" are unused. remove them.

changes for pinctrl are to claim all 3 pins instead of only reset pin as like as rk3568-rock-3b.dts.

Fixes 0522cd811220 ("arm64: dts: rockchip: Add PCIe v3 nodes to rock-3a")

---
Changes in v2:
- split patches for PCIe2 and PCIe3
- change regulator name from "vcc3v3_pcie" to "vcc3v3_pcie30x1"
- add comment for vin-supply of "vcc3v3_pcie30x1" regulator
- remove unused "pcie30_avdd0v9" and "pcie30_avdd1v8"
- fix pinctrl node name to overwrite rk3568-pinctrl.dtsi

---
 .../boot/dts/rockchip/rk3568-rock-3a.dts      | 51 ++++++++-----------
 1 file changed, 22 insertions(+), 29 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +22 -29
index 6f6b31b4442cd..14193b638518c 100644
@@ -86,29 +86,13 @@ vcc12v_dcin: vcc12v-dcin-regulator {
 		regulator-boot-on;
 	};
 
-	pcie30_avdd0v9: pcie30-avdd0v9-regulator {
-		compatible = "regulator-fixed";
-		regulator-name = "pcie30_avdd0v9";
-		regulator-always-on;
-		regulator-boot-on;
-		regulator-min-microvolt = <900000>;
-		regulator-max-microvolt = <900000>;
-		vin-supply = <&vcc3v3_sys>;
-	};
-
-	pcie30_avdd1v8: pcie30-avdd1v8-regulator {
-		compatible = "regulator-fixed";
-		regulator-name = "pcie30_avdd1v8";
-		regulator-always-on;
-		regulator-boot-on;
-		regulator-min-microvolt = <1800000>;
-		regulator-max-microvolt = <1800000>;
-		vin-supply = <&vcc3v3_sys>;
-	};
-
 	/* pi6c pcie clock generator */
 	vcc3v3_pi6c_03: vcc3v3-pi6c-03-regulator {
 		compatible = "regulator-fixed";
+		enable-active-high;
+		gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pcie_pwren_h>;
 		regulator-name = "vcc3v3_pi6c_03";
 		regulator-always-on;
 		regulator-boot-on;
@@ -117,16 +101,13 @@ vcc3v3_pi6c_03: vcc3v3-pi6c-03-regulator {
 		vin-supply = <&vcc5v0_sys>;
 	};
 
-	vcc3v3_pcie: vcc3v3-pcie-regulator {
+	/* actually fed by vcc5v0_sys, dependent on pi6c clock generator */
+	vcc3v3_pcie30x1: vcc3v3-pcie30x1-regulator {
 		compatible = "regulator-fixed";
-		enable-active-high;
-		gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&pcie_enable_h>;
-		regulator-name = "vcc3v3_pcie";
+		regulator-name = "vcc3v3_pcie30x1";
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
-		vin-supply = <&vcc5v0_sys>;
+		vin-supply = <&vcc3v3_pi6c_03>;
 	};
 
 	vcc3v3_sys: vcc3v3-sys-regulator {
@@ -617,7 +598,7 @@ &pcie3x2 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pcie30x2m1_pins>;
 	reset-gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>;
-	vpcie3v3-supply = <&vcc3v3_pcie>;
+	vpcie3v3-supply = <&vcc3v3_pcie30x1>;
 	status = "okay";
 };
 
@@ -653,7 +634,7 @@ led_user_en: led_user_en {
 	};
 
 	pcie {
-		pcie_enable_h: pcie-enable-h {
+		pcie_pwren_h: pcie-pwren-h {
 			rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 	};
@@ -670,6 +651,18 @@ pcie20m1_pins: pcie20m1-pins {
 		};
 	};
 
+	pcie30x2 {
+		pcie30x2m1_pins: pcie30x2m1-pins {
+			rockchip,pins =
+				/* pcie30x2_clkreqnm1 */
+				<2 RK_PD4 4 &pcfg_pull_none>,
+				/* pcie30x2_perstnm1 */
+				<2 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>,
+				/* pcie30x2_wakenm1 */
+				<2 RK_PD5 4 &pcfg_pull_none>;
+		};
+	};
+
 	pmic {
 		pmic_int: pmic_int {
 			rockchip,pins =
Signature · 7 lines
2.43.0


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#2 lore raw
In reply to FUKAUMI Naoki

Hi Naoki,

Quoted 3 lines · FUKAUMI Naoki

currently "vcc3v3_pcie" regulator is used for PCIe2 M.2 E key connector, but, by schematic[1], it's incorrect. "vcc3v3_wf" regulator is correct one. add it and fix related vin-supply.

The fix is fine.

Quoted 2 lines

changes for pinctrl are to claim all 3 pins instead of only reset pin as like as rk3568-rock-3b.dts.

I may missing some discussion about this, any help about this?

Seems the rk3568-rock-3b.dts is from Jonas, so I add Jonas to the mail.

Quoted 50 lines

[1]https://dl.radxa.com/rock3/docs/hw/3a/radxa_rock_3a_v1310_schematic.pdf

Fixes 0fbbfb0b00d1 ("arm64: dts: rockchip: Enable PCIe controller on rock3a")

---
Changes in v2:
- split patches for PCIe2 and PCIe3
- fix pinctrl node name to overwrite rk3568-pinctrl.dtsi

---
  .../boot/dts/rockchip/rk3568-rock-3a.dts      | 28 +++++++++++++++----
  1 file changed, 23 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +13 -3
index 59f1403b4fa56..6f6b31b4442cd 100644
@@ -136,7 +136,17 @@ vcc3v3_sys: vcc3v3-sys-regulator {
  		regulator-boot-on;
  		regulator-min-microvolt = <3300000>;
  		regulator-max-microvolt = <3300000>;
-		vin-supply = <&vcc12v_dcin>;
+		vin-supply = <&vcc5v0_sys>;
+	};
+
+	vcc3v3_wf: vcc3v3-wf-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3_wf";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&vcc3v3_sys>;
  	};
 
  	vcc5v0_sys: vcc5v0-sys-regulator {
@@ -592,9 +602,9 @@ rgmii_phy1: ethernet-phy@0 {
 
  &pcie2x1 {
  	pinctrl-names = "default";
-	pinctrl-0 = <&pcie_reset_h>;
+	pinctrl-0 = <&pcie20m1_pins>;
  	reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_HIGH>;
-	vpcie3v3-supply = <&vcc3v3_pcie>;
+	vpcie3v3-supply = <&vcc3v3_wf>;
  	status = "okay";
  };
 
@@ -646,9 +656,17 @@ pcie {
  		pcie_enable_h: pcie-enable-h {
  			rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;

arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts pcie { · line 665

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +6 -2
  		};
+	};
 
-		pcie_reset_h: pcie-reset-h {
-			rockchip,pins = <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
+	pcie20 {
+		pcie20m1_pins: pcie20m1-pins {
+			rockchip,pins =
+				/* pcie20_clkreqnm1 */
+				<2 RK_PD0 4 &pcfg_pull_none>,

The CLKREQ is used when L1 Substate is enabled, and seems like we don't actually use this feature,

we may need an "supports-clkreq" like nvidia platform to support the clkreq signal.

Keep the CLKREQ as default GPIO function is a better choice before we really need it.

arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts pcie { · line 669

Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +4 -0
+				/* pcie20_perstnm1 */
+				<3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>,
+				/* pcie20_wakenm1 */
+				<2 RK_PD1 4 &pcfg_pull_none>;

I believe no one is using the wake up function with mainline code, because this is a sideband wakeup

by GPIO interrupt to CPU, not by PCIe controller.

So the SoC default setting as GPIO should be correct instead of set it as PCIe function.

Thanks,
- Kever

arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts pcie { · line 672

Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +0 -0
  		};
  	};
 

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip