Skip to contentSkip to conversation

ARM: dts: renesas: r8a73a4: Clock fixes and improvements

PATCH In review Geert Uytterhoeven 2 participants 5 messages Jan 15, 2024

Subsystems (2)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

cover ARM: dts: renesas: r8a73a4: Clock fixes and improvements

Hi all,

This patch series contains fixes and improvements for clock descriptions of the Renesas R-Mobile APE6 SoC and the APE6-EVM development board.

After comparing CPU core performance over a wide range of SoCs, I had been wondering for a long time why DMIPS/MHZ for the Cortex-A15 CPU cores on R-Mobile APE6 is slightly higher than on R-Car Gen2 SoCs. It turned out to be untrue, as the R-Mobile APE6 DTS contains a wrong crystal osciallator freqency, causing the CPU cores on R-Mobile APE6 to run 4% faster than assumed by Linux. The first patch fixes this. The two other patches contain small improvements and a small fix, none of which have any functional impact.

I plan to queue this in renesas-devel for v6.9.

Thanks for your comments!

Geert Uytterhoeven (3):
ARM: dts: renesas: r8a73a4: Fix external clocks and clock rate
ARM: dts: renesas: r8a73a4: Add cp clock
ARM: dts: renesas: r8a73a4: Fix thermal parent clock

 arch/arm/boot/dts/renesas/r8a73a4-ape6evm.dts | 12 ++++++++++
 arch/arm/boot/dts/renesas/r8a73a4.dtsi        | 23 +++++++++++++------
 2 files changed, 28 insertions(+), 7 deletions(-)
Signature · 12 lines
2.34.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
author maintainer
#1 lore raw

PATCH 1/3 ARM: dts: renesas: r8a73a4: Fix external clocks and clock rate

External clocks should be defined as zero-Hz clocks in the SoC .dtsi, and overridden in the board .dts when present.

Correct the clock rate of extal1 from 25 to 26 MHz, to match the crystal oscillator present on the APE6-EVM board.

Fixes a76809a329d6ebae ("ARM: shmobile: r8a73a4: Common clock framework DT description")

---
Before, DMIPS/MHZ for the Cortex-A15 CPU cores was slightly higher than on R-Car M2-W, due to most clocks running 4% faster than assumed.

Also verified by measuring I2C clock rates using a logic analyzer.

---
 arch/arm/boot/dts/renesas/r8a73a4-ape6evm.dts | 12 ++++++++++++
 arch/arm/boot/dts/renesas/r8a73a4.dtsi        |  9 ++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)
arch/arm/boot/dts/renesas/r8a73a4-ape6evm.dts +12 -0
index de87f2682e323866..ae656ee27124c745 100644
@@ -223,6 +223,18 @@ &cmt1 {
 	status = "okay";
 };
 
+&extal1_clk {
+	clock-frequency = <26000000>;
+};
+
+&extal2_clk {
+	clock-frequency = <48000000>;
+};
+
+&extalr_clk {
+	clock-frequency = <32768>;
+};
+
 &pfc {
 	scifa0_pins: scifa0 {
 		groups = "scifa0_data";
arch/arm/boot/dts/renesas/r8a73a4.dtsi +6 -3
index 704b0e4acb4dedf6..b9c20e8ac14f2156 100644
@@ -553,17 +553,20 @@ clocks {
 		extalr_clk: extalr {
 			compatible = "fixed-clock";
 			#clock-cells = <0>;
-			clock-frequency = <32768>;
+			/* This value must be overridden by the board. */
+			clock-frequency = <0>;
 		};
 		extal1_clk: extal1 {
 			compatible = "fixed-clock";
 			#clock-cells = <0>;
-			clock-frequency = <25000000>;
+			/* This value must be overridden by the board. */
+			clock-frequency = <0>;
 		};
 		extal2_clk: extal2 {
 			compatible = "fixed-clock";
 			#clock-cells = <0>;
-			clock-frequency = <48000000>;
+			/* This value must be overridden by the board. */
+			clock-frequency = <0>;
 		};
 		fsiack_clk: fsiack {
 			compatible = "fixed-clock";
Signature · 1 line
2.34.1
author maintainer
#2 lore raw

PATCH 2/3 ARM: dts: renesas: r8a73a4: Add cp clock

In reply to Geert Uytterhoeven

Add the Common Peripheral (CP) clock, which is driven by the main clock / 2 during normal system operation, but may be driven by EXTALR during early system boot, when SYSCLK_EN is still low. As the latter is irrelevant to Linux, just model it as a fixed clock driven from main_div2_clk.

Switch all users of main_div2_clk that are documented to be clocked by the CP clock to cp_clk, to better reflect the actual clock topology.

---
 arch/arm/boot/dts/renesas/r8a73a4.dtsi | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm/boot/dts/renesas/r8a73a4.dtsi +9 -3
index b9c20e8ac14f2156..6847acaecc809eaa 100644
@@ -727,6 +727,13 @@ main_div2_clk: main_div2 {
 			clock-div = <2>;
 			clock-mult = <1>;
 		};
+		cp_clk: cp {
+			compatible = "fixed-factor-clock";
+			clocks = <&main_div2_clk>;
+			#clock-cells = <0>;
+			clock-div = <1>;
+			clock-mult = <1>;
+		};
 		pll0_div2_clk: pll0_div2 {
 			compatible = "fixed-factor-clock";
 			clocks = <&cpg_clocks R8A73A4_CLK_PLL0>;
@@ -792,9 +799,8 @@ R8A73A4_CLK_CMT1
 		mstp4_clks: mstp4_clks@e6150140 {
 			compatible = "renesas,r8a73a4-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-			clocks = <&main_div2_clk>, <&cpg_clocks R8A73A4_CLK_ZS>,
-				 <&main_div2_clk>,
-				 <&cpg_clocks R8A73A4_CLK_HP>,
+			clocks = <&cp_clk>, <&cpg_clocks R8A73A4_CLK_ZS>,
+				 <&cp_clk>, <&cpg_clocks R8A73A4_CLK_HP>,
 				 <&cpg_clocks R8A73A4_CLK_HP>;
 			#clock-cells = <1>;
 			clock-indices = <
Signature · 1 line
2.34.1
author maintainer
#3 lore raw

PATCH 3/3 ARM: dts: renesas: r8a73a4: Fix thermal parent clock

In reply to Geert Uytterhoeven

According to Table 8.1, "Summary of Module Power, Reset condition and Clock assignment" of the R-Mobile APE6 Hardware Manual Rev. 0.7, the parent clock of the thermal sensor clock is the Common Peripheral (CP) clock, which runs at 13 MHz (main clock / 2).

As the R-Car Thermal driver does not use the clock rate, this change has no functional impact.

---
 arch/arm/boot/dts/renesas/r8a73a4.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/renesas/r8a73a4.dtsi +1 -1
index 6847acaecc809eaa..b3d5c154cfc1b8c1 100644
@@ -814,7 +814,7 @@ R8A73A4_CLK_IIC3
 		mstp5_clks: mstp5_clks@e6150144 {
 			compatible = "renesas,r8a73a4-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>;
-			clocks = <&extal2_clk>, <&cpg_clocks R8A73A4_CLK_HP>;
+			clocks = <&cp_clk>, <&cpg_clocks R8A73A4_CLK_HP>;
 			#clock-cells = <1>;
 			clock-indices = <
 				R8A73A4_CLK_THERMAL R8A73A4_CLK_IIC8
Signature · 1 line
2.34.1
Reviewed-by on the v1 series
#4 lore raw
In reply to Geert Uytterhoeven

Hi Geert,

Thanks for your work.

Quoted 14 lines · Geert Uytterhoeven

Hi all,

This patch series contains fixes and improvements for clock descriptions of the Renesas R-Mobile APE6 SoC and the APE6-EVM development board.

After comparing CPU core performance over a wide range of SoCs, I had been wondering for a long time why DMIPS/MHZ for the Cortex-A15 CPU cores on R-Mobile APE6 is slightly higher than on R-Car Gen2 SoCs. It turned out to be untrue, as the R-Mobile APE6 DTS contains a wrong crystal osciallator freqency, causing the CPU cores on R-Mobile APE6 to run 4% faster than assumed by Linux. The first patch fixes this. The two other patches contain small improvements and a small fix, none of which have any functional impact.

Quoted 1 line

I plan to queue this in renesas-devel for v6.9.

For the whole series,

Quoted 27 lines

Thanks for your comments!

Geert Uytterhoeven (3):
ARM: dts: renesas: r8a73a4: Fix external clocks and clock rate
ARM: dts: renesas: r8a73a4: Add cp clock
ARM: dts: renesas: r8a73a4: Fix thermal parent clock

 arch/arm/boot/dts/renesas/r8a73a4-ape6evm.dts | 12 ++++++++++
 arch/arm/boot/dts/renesas/r8a73a4.dtsi        | 23 +++++++++++++------
 2 files changed, 28 insertions(+), 7 deletions(-)
Signature · 12 lines
2.34.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
Signature · 2 lines
Kind Regards,
Niklas Söderlund