Skip to contentSkip to conversation

Move to gated-fixed-clock for Theobroma/Cherry boards

PATCH Applied Heiko Stuebner 3 participants 12 messages Feb 10 – Mar 2

Subsystems (2)
lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

v2 cover Move to gated-fixed-clock for Theobroma/Cherry boards

Both Tiger and Jaguar currently use a fixed-clock and gpio-gate-clock to model the PCIe clock generator they have.

Ever since I wrote the gated-fixed-clock binding + driver, I carry around conversion patches for those boards to use the new binding and describe actual hardware.

I submitted different versions in the initial submission of the then still named "clock-generator" binding, but have reworked them now to use the gated-fixed-clock binding that actually landed.

changes in v2:
- trim down comment block on generator node (Quentin)
- re-use old clock-name (Quentin)
- update commit message about added regulator (Quentin)
- add patch fixing the pinconf of the Jaguar clkreq_m0 (Quentin)

Heiko Stuebner (4):
arm64: dts: rockchip: use gated-fixed-clock for pcie-refclk on

    rk3588-jaguar
  arm64: dts: rockchip: use gated-fixed-clock for pcie-refclk on
    rk3588-tiger
  arm64: dts: rockchip: add pinctrl for clk-generator GPIO on
    rk3588-tiger

arm64: dts: rockchip: Make Jaguar PCIe-refclk pin use pull-up config

 .../arm64/boot/dts/rockchip/rk3588-jaguar.dts | 21 +++++----------
 .../arm64/boot/dts/rockchip/rk3588-tiger.dtsi | 27 +++++++++----------
 2 files changed, 19 insertions(+), 29 deletions(-)
Signature · 1 line
2.47.2
author maintainer
#1 lore raw

PATCH v2 1/4 arm64: dts: rockchip: use gated-fixed-clock for pcie-refclk on rk3588-jaguar

From: Heiko Stuebner <[email protected]>

Using a combination of fixed clock and gpio-gate clock works but does not describe the actual hardware. Use the gated-fixed-clock binding to describe this in a nicer way.

---
 .../arm64/boot/dts/rockchip/rk3588-jaguar.dts | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts +5 -14
index 952affaf455c..e21ad7575cb6 100644
@@ -86,25 +86,16 @@ led-1 {
 		};
 	};
 
-	/*
-	 * 100MHz reference clock for PCIe peripherals from PI6C557-05BLE
-	 * clock generator.
-	 * The clock output is gated via the OE pin on the clock generator.
-	 * This is modeled as a fixed-clock plus a gpio-gate-clock.
-	 */
-	pcie_refclk_gen: pcie-refclk-gen-clock {
-		compatible = "fixed-clock";
+	/* 100MHz PCIe reference clock from PI6C557-05BLE */
+	pcie_refclk: pcie-clock-generator {
+		compatible = "gated-fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <100000000>;
-	};
-
-	pcie_refclk: pcie-refclk-clock {
-		compatible = "gpio-gate-clock";
-		clocks = <&pcie_refclk_gen>;
-		#clock-cells = <0>;
+		clock-output-names = "pcie-refclk-clock";
 		enable-gpios = <&gpio0 RK_PC6 GPIO_ACTIVE_LOW>; /* PCIE30X4_CLKREQN_M0 */
 		pinctrl-names = "default";
 		pinctrl-0 = <&pcie30x4_clkreqn_m0>;
+		vdd-supply = <&vcca_3v3_s0>;
 	};
 
 	pps {
Signature · 1 line
2.47.2
Reviewed-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] arm64: dts: rockchip: use gated-fixed-clock for pcie-refclk on rk3588-jaguar

Hi Heiko,

Quoted 6 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

Using a combination of fixed clock and gpio-gate clock works but does not describe the actual hardware. Use the gated-fixed-clock binding to describe this in a nicer way.

Thanks!
Quentin

Reviewed-by on v2 1/4
#3 lore raw

Re: [PATCH v2 1/4] arm64: dts: rockchip: use gated-fixed-clock for pcie-refclk on rk3588-jaguar

In reply to Heiko Stuebner

Hi Heiko

Quoted 32 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

Using a combination of fixed clock and gpio-gate clock works but does not describe the actual hardware. Use the gated-fixed-clock binding to describe this in a nicer way.

---
  .../arm64/boot/dts/rockchip/rk3588-jaguar.dts | 19 +++++--------------
  1 file changed, 5 insertions(+), 14 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts +3 -8
index 952affaf455c..e21ad7575cb6 100644
@@ -86,25 +86,16 @@ led-1 {
  		};
  	};
 
-	/*
-	 * 100MHz reference clock for PCIe peripherals from PI6C557-05BLE
-	 * clock generator.
-	 * The clock output is gated via the OE pin on the clock generator.
-	 * This is modeled as a fixed-clock plus a gpio-gate-clock.
-	 */
-	pcie_refclk_gen: pcie-refclk-gen-clock {
-		compatible = "fixed-clock";
+	/* 100MHz PCIe reference clock from PI6C557-05BLE */
+	pcie_refclk: pcie-clock-generator {
+		compatible = "gated-fixed-clock";
  		#clock-cells = <0>;
  		clock-frequency = <100000000>;

arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts led-1 { · line 97

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts +1 -6
-	};
-
-	pcie_refclk: pcie-refclk-clock {
-		compatible = "gpio-gate-clock";
-		clocks = <&pcie_refclk_gen>;
-		#clock-cells = <0>;
+		clock-output-names = "pcie-refclk-clock";
  		enable-gpios = <&gpio0 RK_PC6 GPIO_ACTIVE_LOW>; /* PCIE30X4_CLKREQN_M0 */
  		pinctrl-names = "default";
  		pinctrl-0 = <&pcie30x4_clkreqn_m0>;

This looks fine,

Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts +1 -0
+		vdd-supply = <&vcca_3v3_s0>;
  	};
 
  	pps {
author maintainer
#4 lore raw

PATCH v2 2/4 arm64: dts: rockchip: use gated-fixed-clock for pcie-refclk on rk3588-tiger

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

Using a combination of fixed clock and gpio-gate clock works but does not describe the actual hardware. Use the gated-fixed-clock binding to describe this in a nicer way.

---
 .../arm64/boot/dts/rockchip/rk3588-tiger.dtsi | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi +5 -14
index 27269b7b08aa..b4b8f305935f 100644
@@ -47,23 +47,14 @@ led-1 {
 		};
 	};
 
-	/*
-	 * 100MHz reference clock for PCIe peripherals from PI6C557-05BLE
-	 * clock generator.
-	 * The clock output is gated via the OE pin on the clock generator.
-	 * This is modeled as a fixed-clock plus a gpio-gate-clock.
-	 */
-	pcie_refclk_gen: pcie-refclk-gen-clock {
-		compatible = "fixed-clock";
+	/* 100MHz PCIe reference clock from PI6C557-05BLE */
+	pcie_refclk: pcie-clock-generator {
+		compatible = "gated-fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <100000000>;
-	};
-
-	pcie_refclk: pcie-refclk-clock {
-		compatible = "gpio-gate-clock";
-		clocks = <&pcie_refclk_gen>;
-		#clock-cells = <0>;
+		clock-output-names = "pcie-refclk-clock";
 		enable-gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; /* PCIE30X4_CLKREQN_M1_L */
+		vdd-supply = <&vcca_3v3_s0>;
 	};
 
 	vcc_1v1_nldo_s3: regulator-vcc-1v1-nldo-s3 {
Signature · 1 line
2.47.2
Reviewed-by on v2 2/4
#5 lore raw

Re: [PATCH v2 2/4] arm64: dts: rockchip: use gated-fixed-clock for pcie-refclk on rk3588-tiger

Hi Heiko,

Quoted 6 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

Using a combination of fixed clock and gpio-gate clock works but does not describe the actual hardware. Use the gated-fixed-clock binding to describe this in a nicer way.

Thanks!
Quentin

Reviewed-by on v2 2/4
#6 lore raw

Re: [PATCH v2 2/4] arm64: dts: rockchip: use gated-fixed-clock for pcie-refclk on rk3588-tiger

In reply to Heiko Stuebner
Quoted 30 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

Using a combination of fixed clock and gpio-gate clock works but does not describe the actual hardware. Use the gated-fixed-clock binding to describe this in a nicer way.

---
  .../arm64/boot/dts/rockchip/rk3588-tiger.dtsi | 19 +++++--------------
  1 file changed, 5 insertions(+), 14 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi +3 -8
index 27269b7b08aa..b4b8f305935f 100644
@@ -47,23 +47,14 @@ led-1 {
  		};
  	};
 
-	/*
-	 * 100MHz reference clock for PCIe peripherals from PI6C557-05BLE
-	 * clock generator.
-	 * The clock output is gated via the OE pin on the clock generator.
-	 * This is modeled as a fixed-clock plus a gpio-gate-clock.
-	 */
-	pcie_refclk_gen: pcie-refclk-gen-clock {
-		compatible = "fixed-clock";
+	/* 100MHz PCIe reference clock from PI6C557-05BLE */
+	pcie_refclk: pcie-clock-generator {
+		compatible = "gated-fixed-clock";

arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi led-1 { · line 56

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi +1 -6
  		#clock-cells = <0>;
  		clock-frequency = <100000000>;
-	};
-
-	pcie_refclk: pcie-refclk-clock {
-		compatible = "gpio-gate-clock";
-		clocks = <&pcie_refclk_gen>;
-		#clock-cells = <0>;
+		clock-output-names = "pcie-refclk-clock";
  		enable-gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; /* PCIE30X4_CLKREQN_M1_L */

The change itself looks fine , so

However, if it's designed as active high, I would say Tiger is against the the PCIe spec about how L1 substate work. Perhaps you could check PCIe spec v7.0, Figure 5-16 Example: L1.2 Waveforms Illustrating Upstream Port Initiated Exit.. When in L1.2, clkreq# should be released by both ends, and the pull-up register by whatevery way will make it into high, and thus refclk is gated automatically.

arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi led-1 { · line 60

Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi +1 -0
+		vdd-supply = <&vcca_3v3_s0>;
  	};
 
  	vcc_1v1_nldo_s3: regulator-vcc-1v1-nldo-s3 {

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

author maintainer
#7 lore raw

PATCH v2 3/4 arm64: dts: rockchip: add pinctrl for clk-generator GPIO on rk3588-tiger

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

While specific driver in the Linux-Kernel handles GPIOs gracefully without matching pinctrl entries, this might not be true for other operating systems. So having pinctrl entries makes the hardware-description more complete.

The somewhat similar rk3588-jaguar board has a pinctrl entry already, so also add one for rk3588-tiger.

---
 arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi +8 -0
index b4b8f305935f..a0e97481afb7 100644
@@ -54,6 +54,8 @@ pcie_refclk: pcie-clock-generator {
 		clock-frequency = <100000000>;
 		clock-output-names = "pcie-refclk-clock";
 		enable-gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; /* PCIE30X4_CLKREQN_M1_L */
+		pinctrl-names = "default";
+		pinctrl-0 = <&pcie30x4_clkreqn_m1_l>;
 		vdd-supply = <&vcca_3v3_s0>;
 	};
 
@@ -353,6 +355,12 @@ module_led_pin: module-led-pin {
 		};
 	};
 
+	pcie30x4 {
+		pcie30x4_clkreqn_m1_l: pcie30x4-clkreqn-m1-l {
+			rockchip,pins = <4 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
 	usb3 {
 		usb3_id: usb3-id {
 			rockchip,pins =
Signature · 1 line
2.47.2
author maintainer
#8 lore raw

PATCH v2 4/4 arm64: dts: rockchip: Make Jaguar PCIe-refclk pin use pull-up config

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

Different to RK3588-Tiger, on RK3588-Jaguar the signal enabling the PCIe-refclk generator controls a transistor which in turn controls the output-enable input of the PI6C557 and there's no external Pull-Up or Pull-Down between the SoC and the transistor gate.

On Tiger the pin is directly connected to the PDn input which has an internal pull up.

So match that behaviour on Jaguar by changing the pin config to enable the SoC's pull-up config.

Fixes 0ec7e1096332 ("arm64: dts: rockchip: add PCIe3 support on rk3588-jaguar")
---
 arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts +1 -1
index e21ad7575cb6..5f5d89a33a4a 100644
@@ -579,7 +579,7 @@ led1_pin: led1-pin {
 
 	pcie30x4 {
 		pcie30x4_clkreqn_m0: pcie30x4-clkreqn-m0 {
-			rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
+			rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>;
 		};
 
 		pcie30x4_perstn_m0: pcie30x4-perstn-m0 {
Signature · 1 line
2.47.2
Reviewed-by on v2 4/4
#9 lore raw

Re: [PATCH v2 4/4] arm64: dts: rockchip: Make Jaguar PCIe-refclk pin use pull-up config

Hi Heiko,

Quoted 7 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

Different to RK3588-Tiger, on RK3588-Jaguar the signal enabling the PCIe-refclk generator controls a transistor which in turn controls the output-enable input of the PI6C557 and there's no external Pull-Up or Pull-Down between the SoC and the transistor gate.

Quoted 6 lines

On Tiger the pin is directly connected to the PDn input which has an internal pull up.

So match that behaviour on Jaguar by changing the pin config to enable the SoC's pull-up config.

I think we've a different behavior on Jaguar and Tiger (see polarity of enable-gpios), so this is a bit misleading. I would simply say this matches the default PU/PD pinconf of the SoC after reset according to the TRM. It also means we keep the clock generator in reset until the device driver drives the enable pin. On Tiger, since we would need a pull-down to have it disabled by default, but that it's only an internal pull-down on RK3588-side and a pull-up on the clock generator IC-side, I don't know if that would work and reliably at that if we were to have opposite internal pull-up/down resistors on each side of the line, hence the no PU/PD on RK3588 side.

With the commit log reworked:

Thanks!
Quentin

Reviewed-by on v2 4/4
#10 lore raw

Re: [PATCH v2 4/4] arm64: dts: rockchip: Make Jaguar PCIe-refclk pin use pull-up config

In reply to Heiko Stuebner
Quoted 25 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

Different to RK3588-Tiger, on RK3588-Jaguar the signal enabling the PCIe-refclk generator controls a transistor which in turn controls the output-enable input of the PI6C557 and there's no external Pull-Up or Pull-Down between the SoC and the transistor gate.

On Tiger the pin is directly connected to the PDn input which has an internal pull up.

So match that behaviour on Jaguar by changing the pin config to enable the SoC's pull-up config.

Fixes 0ec7e1096332 ("arm64: dts: rockchip: add PCIe3 support on rk3588-jaguar")
---
  arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts +0 -0
index e21ad7575cb6..5f5d89a33a4a 100644

arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts led1_pin: led1-pin { · line 582

Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts +1 -1
@@ -579,7 +579,7 @@ led1_pin: led1-pin {
 
  	pcie30x4 {
  		pcie30x4_clkreqn_m0: pcie30x4-clkreqn-m0 {
-			rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
+			rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>;

If Jaguar need support L1 substate, I guess it should be changed to fucntion IO again instead of GPIO. From the refclk design which uses pcie30x4_clkreqn_m0 as enable control in active low mode , it's fine to support these low power mode.

Otherwise, fine with me

Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts +0 -0
  		};
 
  		pcie30x4_perstn_m0: pcie30x4-perstn-m0 {
author maintainer Applied
#11 lore raw
In reply to Heiko Stuebner
Quoted 8 lines · Heiko Stuebner

Both Tiger and Jaguar currently use a fixed-clock and gpio-gate-clock to model the PCIe clock generator they have.

Ever since I wrote the gated-fixed-clock binding + driver, I carry around conversion patches for those boards to use the new binding and describe actual hardware.

[...]

Applied, thanks!

[1/4] arm64: dts: rockchip: use gated-fixed-clock for pcie-refclk on rk3588-jaguar

      commit: f5e52701725c5c5c54d6511ca633a7566d1661a8
[2/4] arm64: dts: rockchip: use gated-fixed-clock for pcie-refclk on rk3588-tiger
      commit: cfe2d65332eff95ac7308478897760888f957aeb
[3/4] arm64: dts: rockchip: add pinctrl for clk-generator GPIO on rk3588-tiger
      commit: 603921cf88952c456bff8f22e48a822a077341b8
[4/4] arm64: dts: rockchip: Make Jaguar PCIe-refclk pin use pull-up config
      commit: f45d4356feeba1c8dac3414b688f59292ddfc9f9

Reworded commit description in patch4, as suggested by Quentin.

Best regards,

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