Skip to contentSkip to conversation

Add cpufreq-dt support i.MX8MQ

RFC Superseded Abel Vesa 3 participants 17 messages Feb 13, 2019 – Feb 15, 2019

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Abel Vesa

author
#0 lore raw

cover Add cpufreq-dt support i.MX8MQ

I'm sending this as a patchseries (RFC) just to show all the changes needed for this to work. I'll resend separately once I get some feedback on the entire thing.

One thing that is missing compared to the earlier work (here: https://patchwork.kernel.org/patch/10807821/ ) is the speed grading. That can be done as a separate change once I figure out how to do it with cpufreq-dt.

Unfortumately, there is a need to update the dt-bindings once again in order to add missing ARM clock from patches 1 and 2.

Abel Vesa (5):
clk: imx: imx8mq: Fix the rate propagation for arm pll
dt-bindings: imx8mq-clock: Add the missing ARM clock
clk: imx8mq: Add the missing ARM clock
arm64: dts: imx8mq: Add the clocks and the latencies for the A53 cores
arm64: dts: imx8mq: Add the opp table and the cpu-supply nodes

 arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 17 +++++++++++++++
 arch/arm64/boot/dts/freescale/imx8mq.dtsi    | 31 ++++++++++++++++++++++++++++
 drivers/clk/imx/clk-imx8mq.c                 |  8 ++++++-
 include/dt-bindings/clock/imx8mq-clock.h     |  4 +++-
 4 files changed, 58 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

RFC 1/5 clk: imx: imx8mq: Fix the rate propagation for arm pll

The arm pll bypass needs to propagate the rate upwards in order for the cpufreq to work.

Fixes b80522040cd3f ("clk: imx: Add clock driver for i.MX8MQ CCM")
---
 drivers/clk/imx/clk-imx8mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-imx8mq.c +1 -1
index 398ab0b..57499ed 100644
@@ -340,7 +340,7 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
 	clks[IMX8MQ_DRAM_PLL2_DIV] = imx_clk_divider("dram_pll2_div", "dram_pll2", base + 0x68, 1, 6);
 
 	/* PLL bypass out */
-	clks[IMX8MQ_ARM_PLL_BYPASS] = imx_clk_mux("arm_pll_bypass", base + 0x28, 14, 1, arm_pll_bypass_sels, ARRAY_SIZE(arm_pll_bypass_sels));
+	clks[IMX8MQ_ARM_PLL_BYPASS] = imx_clk_mux_flags("arm_pll_bypass", base + 0x28, 14, 1, arm_pll_bypass_sels, ARRAY_SIZE(arm_pll_bypass_sels), CLK_SET_RATE_PARENT);
 	clks[IMX8MQ_GPU_PLL_BYPASS] = imx_clk_mux("gpu_pll_bypass", base + 0x18, 14, 1, gpu_pll_bypass_sels, ARRAY_SIZE(gpu_pll_bypass_sels));
 	clks[IMX8MQ_VPU_PLL_BYPASS] = imx_clk_mux("vpu_pll_bypass", base + 0x20, 14, 1, vpu_pll_bypass_sels, ARRAY_SIZE(vpu_pll_bypass_sels));
 	clks[IMX8MQ_AUDIO_PLL1_BYPASS] = imx_clk_mux("audio_pll1_bypass", base + 0x0, 14, 1, audio_pll1_bypass_sels, ARRAY_SIZE(audio_pll1_bypass_sels));
Signature · 1 line
2.7.4
Reviewed-by on v1 1/5
#2 lore raw

Re: [RFC 1/5] clk: imx: imx8mq: Fix the rate propagation for arm pll

Am Mittwoch, den 13.02.2019, 19:05 +0000 schrieb Abel Vesa:

Quoted 5 lines

The arm pll bypass needs to propagate the rate upwards in order for the cpufreq to work.

Fixes b80522040cd3f ("clk: imx: Add clock driver for i.MX8MQ CCM")
Quoted 17 lines

---
 drivers/clk/imx/clk-imx8mq.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-imx8mq.c +0 -0
index 398ab0b..57499ed 100644
@@ -340,7 +340,7 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
  	clks[IMX8MQ_DRAM_PLL2_DIV] = imx_clk_divider("dram_pll2_div", "dram_pll2", base + 0x68, 1, 6);


  /* PLL bypass out */

drivers/clk/imx/clk-imx8mq.c +1 -1
-	clks[IMX8MQ_ARM_PLL_BYPASS] = imx_clk_mux("arm_pll_bypass", base + 0x28, 14, 1, arm_pll_bypass_sels, ARRAY_SIZE(arm_pll_bypass_sels));
+	clks[IMX8MQ_ARM_PLL_BYPASS] = imx_clk_mux_flags("arm_pll_bypass", base + 0x28, 14, 1, arm_pll_bypass_sels, ARRAY_SIZE(arm_pll_bypass_sels), CLK_SET_RATE_PARENT);

  clks[IMX8MQ_GPU_PLL_BYPASS] = imx_clk_mux("gpu_pll_bypass", base + 0x18, 14, 1, gpu_pll_bypass_sels, ARRAY_SIZE(gpu_pll_bypass_sels)); clks[IMX8MQ_VPU_PLL_BYPASS] = imx_clk_mux("vpu_pll_bypass", base + 0x20, 14, 1, vpu_pll_bypass_sels, ARRAY_SIZE(vpu_pll_bypass_sels)); clks[IMX8MQ_AUDIO_PLL1_BYPASS] = imx_clk_mux("audio_pll1_bypass", base + 0x0, 14, 1, audio_pll1_bypass_sels, ARRAY_SIZE(audio_pll1_bypass_sels));

author
#3 lore raw

RFC 2/5 dt-bindings: imx8mq-clock: Add the missing ARM clock

In reply to Abel Vesa

Add the missing ARM clock which will be used by cpufreq

---
 include/dt-bindings/clock/imx8mq-clock.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/dt-bindings/clock/imx8mq-clock.h +3 -1
index 04f7ac3..47c790c 100644
@@ -391,5 +391,7 @@
 
 #define IMX8MQ_CLK_NAND_USDHC_BUS_RAWNAND_CLK	267
 
-#define IMX8MQ_CLK_END				268
+#define IMX8MQ_CLK_ARM				268
+
+#define IMX8MQ_CLK_END				269
 #endif /* __DT_BINDINGS_CLOCK_IMX8MQ_H */
Signature · 1 line
2.7.4
Reviewed-by on v1 2/5
#4 lore raw

Re: [RFC 2/5] dt-bindings: imx8mq-clock: Add the missing ARM clock

Am Mittwoch, den 13.02.2019, 19:05 +0000 schrieb Abel Vesa:

Quoted 3 lines

Add the missing ARM clock which will be used by cpufreq

Quoted 18 lines

---
 include/dt-bindings/clock/imx8mq-clock.h | 4 +++-

 1 file changed, 3 insertions(+), 1 deletion(-)
include/dt- renamed from include/dt-bindings/clock/imx8mq-clock.h +0 -0

bindings/clock/imx8mq-clock.h
index 04f7ac3..47c790c 100644

include/dt-bindings/clock/imx8mq-clock.h +0 -0
@@ -391,5 +391,7 @@


 #define IMX8MQ_CLK_NAND_USDHC_BUS_RAWNAND_CLK 267

include/dt-bindings/clock/imx8mq-clock.h +3 -1
-#define IMX8MQ_CLK_END				268
+#define IMX8MQ_CLK_ARM				268
+
+#define IMX8MQ_CLK_END				269

 #endif /* __DT_BINDINGS_CLOCK_IMX8MQ_H */

author
#5 lore raw

RFC 3/5 clk: imx8mq: Add the missing ARM clock

In reply to Abel Vesa

Add the ARM clock as imx_clk_cpu type.
Will be used by cpufreq.

---
 drivers/clk/imx/clk-imx8mq.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/clk/imx/clk-imx8mq.c +6 -0
index 57499ed..8a283cb 100644
@@ -558,6 +558,12 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
 	clks[IMX8MQ_GPT_3M_CLK] = imx_clk_fixed_factor("gpt_3m", "osc_25m", 1, 8);
 	clks[IMX8MQ_CLK_DRAM_ALT_ROOT] = imx_clk_fixed_factor("dram_alt_root", "dram_alt", 1, 4);
 
+	clks[IMX8MQ_CLK_ARM] = imx_clk_cpu("arm", "arm_a53_div",
+					   clks[IMX8MQ_CLK_A53_DIV],
+					   clks[IMX8MQ_CLK_A53_SRC],
+					   clks[IMX8MQ_ARM_PLL_OUT],
+					   clks[IMX8MQ_SYS1_PLL_800M]);
+
 	for (i = 0; i < IMX8MQ_CLK_END; i++)
 		if (IS_ERR(clks[i]))
 			pr_err("i.MX8mq clk %u register failed with %ld\n",
Signature · 1 line
2.7.4
Reviewed-by on v1 3/5
#6 lore raw

Re: [RFC 3/5] clk: imx8mq: Add the missing ARM clock

Am Mittwoch, den 13.02.2019, 19:05 +0000 schrieb Abel Vesa:

Quoted 4 lines

Add the ARM clock as imx_clk_cpu type.
Will be used by cpufreq.

Quoted 21 lines

---
 drivers/clk/imx/clk-imx8mq.c | 6 ++++++

 1 file changed, 6 insertions(+)
drivers/clk/imx/clk-imx8mq.c +0 -0
index 57499ed..8a283cb 100644
@@ -558,6 +558,12 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
  	clks[IMX8MQ_GPT_3M_CLK] = imx_clk_fixed_factor("gpt_3m", "osc_25m", 1, 8);
  	clks[IMX8MQ_CLK_DRAM_ALT_ROOT] = imx_clk_fixed_factor("dram_alt_root", "dram_alt", 1, 4);

drivers/clk/imx/clk-imx8mq.c +6 -0
+	clks[IMX8MQ_CLK_ARM] = imx_clk_cpu("arm", "arm_a53_div",
+					   clks[IMX8MQ_CLK_A53_DIV],
+					   clks[IMX8MQ_CLK_A53_SRC],
+					   clks[IMX8MQ_ARM_PLL_OUT],
+					   clks[IMX8MQ_SYS1_PLL_800M]);
+

  for (i = 0; i < IMX8MQ_CLK_END; i++)
  if (IS_ERR(clks[i]))
  pr_err("i.MX8mq clk %u register failed with %ld\n",

author
#7 lore raw

RFC 4/5 arm64: dts: imx8mq: Add the clocks and the latencies for the A53 cores

In reply to Abel Vesa

The clocks and their latencies will be used by cpufreq-dt.

---
 arch/arm64/boot/dts/freescale/imx8mq.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq.dtsi +8 -0
index 9155bd4..1a89062 100644
@@ -87,6 +87,8 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a53";
 			reg = <0x0>;
+			clock-latency = <61036>; /* two CLK32 periods */
+			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
 		};
@@ -95,6 +97,8 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a53";
 			reg = <0x1>;
+			clock-latency = <61036>; /* two CLK32 periods */
+			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
 		};
@@ -103,6 +107,8 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a53";
 			reg = <0x2>;
+			clock-latency = <61036>; /* two CLK32 periods */
+			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
 		};
@@ -111,6 +117,8 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a53";
 			reg = <0x3>;
+			clock-latency = <61036>; /* two CLK32 periods */
+			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
 		};
Signature · 1 line
2.7.4
author
#8 lore raw

RFC 5/5 arm64: dts: imx8mq: Add the opp table and the cpu-supply nodes

In reply to Abel Vesa

Add the opp table containing only non over drive opps. Also add the cpu-supply nodes for the A53 cores in the EVK board.

---
 arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 17 +++++++++++++++++
 arch/arm64/boot/dts/freescale/imx8mq.dtsi    | 23 +++++++++++++++++++++++
 2 files changed, 40 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +17 -0
index 54737bf..114359e 100644
@@ -31,6 +31,23 @@
 		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
 		enable-active-high;
 	};
+
+};
+
+&A53_0 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_1 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_2 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_3 {
+	cpu-supply = <&sw1a_reg>;
 };
 
 &fec1 {
arch/arm64/boot/dts/freescale/imx8mq.dtsi +23 -0
index 1a89062..89b2d5f 100644
@@ -91,6 +91,7 @@
 			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
 		};
 
 		A53_1: cpu@1 {
@@ -101,6 +102,7 @@
 			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
 		};
 
 		A53_2: cpu@2 {
@@ -111,6 +113,7 @@
 			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
 		};
 
 		A53_3: cpu@3 {
@@ -121,6 +124,7 @@
 			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
 		};
 
 		A53_L2: l2-cache0 {
@@ -666,6 +670,25 @@
 			status = "disabled";
 		};
 
+
+		a53_0_opp_table: opp-table {
+			compatible = "operating-points-v2";
+			opp-shared;
+
+			opp-800000000 {
+				opp-hz = /bits/ 64 <800000000>;
+				opp-microvolt = <900000>;
+				clock-latency-ns = <150000>;
+			};
+
+			opp-1000000000 {
+				opp-hz = /bits/ 64 <1000000000>;
+				opp-microvolt = <900000>;
+				clock-latency-ns = <150000>;
+				opp-suspend;
+			};
+		};
+
 		gic: interrupt-controller@38800000 {
 			compatible = "arm,gic-v3";
 			reg = <0x38800000 0x10000>,	/* GIC Dist */
Signature · 1 line
2.7.4
#9 lore raw

Re: [RFC 5/5] arm64: dts: imx8mq: Add the opp table and the cpu-supply nodes

Hi Abel

Am Mittwoch, den 13.02.2019, 19:05 +0000 schrieb Abel Vesa:

Quoted 26 lines

Add the opp table containing only non over drive opps. Also add the cpu-supply nodes for the A53 cores in the EVK board.

---
 arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 17 +++++++++++++++++ arch/arm64/boot/dts/freescale/imx8mq.dtsi    | 23 +++++++++++++++++++++++

 2 files changed, 40 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +8 -0
index 54737bf..114359e 100644
@@ -31,6 +31,23 @@
  		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
  		enable-active-high;
  	};
+
+};
+
+&A53_0 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_1 {

arch/arm64/boot/dts/freescale/imx8mq-evk.dts line 51

Quoted 10 lines
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +9 -0
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_2 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_3 {
+	cpu-supply = <&sw1a_reg>;
  };

This should be a separate patch.

And AFAICS this is wrong, sw1a on the MX8M-EVK is the GPU supply, the CPU is supplied by a dedicated switcher that is controlled via a GPIO.

Regards,
Lucas

Quoted 65 lines
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +0 -0
  &fec1 {
arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -0
index 1a89062..89b2d5f 100644
@@ -91,6 +91,7 @@
  			clocks = <&clk IMX8MQ_CLK_ARM>;
  			enable-method = "psci";
  			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
  		};


  A53_1: cpu@1 {

arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -0
@@ -101,6 +102,7 @@
  			clocks = <&clk IMX8MQ_CLK_ARM>;
  			enable-method = "psci";
  			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
  		};


  A53_2: cpu@2 {

arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -0
@@ -111,6 +113,7 @@
  			clocks = <&clk IMX8MQ_CLK_ARM>;
  			enable-method = "psci";
  			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
  		};


  A53_3: cpu@3 {

arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -0
@@ -121,6 +124,7 @@
  			clocks = <&clk IMX8MQ_CLK_ARM>;
  			enable-method = "psci";
  			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
  		};


  A53_L2: l2-cache0 {

arch/arm64/boot/dts/freescale/imx8mq.dtsi +0 -0
@@ -666,6 +670,25 @@
  			status = "disabled";
  		};

arch/arm64/boot/dts/freescale/imx8mq.dtsi +19 -0
+
+		a53_0_opp_table: opp-table {
+			compatible = "operating-points-v2";
+			opp-shared;
+
+			opp-800000000 {
+				opp-hz = /bits/ 64 <800000000>;
+				opp-microvolt = <900000>;
+				clock-latency-ns = <150000>;
+			};
+
+			opp-1000000000 {
+				opp-hz = /bits/ 64 <1000000000>;
+				opp-microvolt = <900000>;
+				clock-latency-ns = <150000>;
+				opp-suspend;
+			};
+		};
+

  gic: interrupt-controller@38800000 { compatible = "arm,gic-v3";
  reg = <0x38800000 0x10000>, /* GIC
Dist */

author
#10 lore raw

Re: [RFC 5/5] arm64: dts: imx8mq: Add the opp table and the cpu-supply nodes

Quoted 33 lines · Lucas Stach

Hi Abel

Am Mittwoch, den 13.02.2019, 19:05 +0000 schrieb Abel Vesa:

Quoted 30 lines

Add the opp table containing only non over drive opps. Also add the cpu-supply nodes for the A53 cores in the EVK board.

---
 arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 17 +++++++++++++++++ arch/arm64/boot/dts/freescale/imx8mq.dtsi    | 23 +++++++++++++++++++++++

 2 files changed, 40 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +12 -0
index 54737bf..114359e 100644
@@ -31,6 +31,23 @@
  		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
  		enable-active-high;
  	};
+
+};
+
+&A53_0 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_1 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_2 {
Quoted 9 lines

arch/arm64/boot/dts/freescale/imx8mq-evk.dts line 51

Quoted 6 lines
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +5 -0
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_3 {
+	cpu-supply = <&sw1a_reg>;
  };

This should be a separate patch.

OK, will send as separate patches in the next version.

Quoted 3 lines

And AFAICS this is wrong, sw1a on the MX8M-EVK is the GPU supply, the CPU is supplied by a dedicated switcher that is controlled via a GPIO.

Hmm, I think you're right. At least this is what the following document says.

https://www.mouser.com/ds/2/302/IMX8MDQLQEVKHUG-1280333.pdf

So I guess this means there will not be any cpu-supply properties.

Thanks,
Abel

Quoted 68 lines

Regards,
Lucas

Quoted 65 lines
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +0 -0
  &fec1 {
arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -0
index 1a89062..89b2d5f 100644
@@ -91,6 +91,7 @@
  			clocks = <&clk IMX8MQ_CLK_ARM>;
  			enable-method = "psci";
  			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
  		};


  A53_1: cpu@1 {

arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -0
@@ -101,6 +102,7 @@
  			clocks = <&clk IMX8MQ_CLK_ARM>;
  			enable-method = "psci";
  			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
  		};


  A53_2: cpu@2 {

arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -0
@@ -111,6 +113,7 @@
  			clocks = <&clk IMX8MQ_CLK_ARM>;
  			enable-method = "psci";
  			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
  		};


  A53_3: cpu@3 {

arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -0
@@ -121,6 +124,7 @@
  			clocks = <&clk IMX8MQ_CLK_ARM>;
  			enable-method = "psci";
  			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
  		};


  A53_L2: l2-cache0 {

arch/arm64/boot/dts/freescale/imx8mq.dtsi +0 -0
@@ -666,6 +670,25 @@
  			status = "disabled";
  		};

arch/arm64/boot/dts/freescale/imx8mq.dtsi +19 -0
+
+		a53_0_opp_table: opp-table {
+			compatible = "operating-points-v2";
+			opp-shared;
+
+			opp-800000000 {
+				opp-hz = /bits/ 64 <800000000>;
+				opp-microvolt = <900000>;
+				clock-latency-ns = <150000>;
+			};
+
+			opp-1000000000 {
+				opp-hz = /bits/ 64 <1000000000>;
+				opp-microvolt = <900000>;
+				clock-latency-ns = <150000>;
+				opp-suspend;
+			};
+		};
+

  gic: interrupt-controller@38800000 { compatible = "arm,gic-v3";
  reg = <0x38800000 0x10000>, /* GIC
Dist */

#11 lore raw

Re: [RFC 5/5] arm64: dts: imx8mq: Add the opp table and the cpu-supply nodes

Am Donnerstag, den 14.02.2019, 17:18 +0000 schrieb Abel Vesa:

Quoted 54 lines · Lucas Stach
Quoted 35 lines

Hi Abel

Am Mittwoch, den 13.02.2019, 19:05 +0000 schrieb Abel Vesa:

Quoted 32 lines

Add the opp table containing only non over drive opps. Also add the cpu-supply nodes for the A53 cores in the EVK board.

---
 arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 17
+++++++++++++++++
 arch/arm64/boot/dts/freescale/imx8mq.dtsi    | 23
+++++++++++++++++++++++

 2 files changed, 40 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +12 -0
index 54737bf..114359e 100644
@@ -31,6 +31,23 @@
  		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
  		enable-active-high;
  	};
+
+};
+
+&A53_0 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_1 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_2 {
Quoted 9 lines

arch/arm64/boot/dts/freescale/imx8mq-evk.dts line 51

Quoted 6 lines
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +5 -0
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_3 {
+	cpu-supply = <&sw1a_reg>;
  };

This should be a separate patch.

OK, will send as separate patches in the next version.

Quoted 5 lines

And AFAICS this is wrong, sw1a on the MX8M-EVK is the GPU supply, the
CPU is supplied by a dedicated switcher that is controlled via a GPIO.

Quoted 6 lines

Hmm, I think you're right. At least this is what the following document says.

https://www.mouser.com/ds/2/302/IMX8MDQLQEVKHUG-1280333.pdf

So I guess this means there will not be any cpu-supply properties.

There is a variable voltage CPU supply, but you need to model it as a gpio-regulator in the DT, it's not part of the PMIC provided rails.

Regards,
Lucas

#12 lore raw

Re: [RFC 5/5] arm64: dts: imx8mq: Add the opp table and the cpu-supply nodes

Am Donnerstag, den 14.02.2019, 18:26 +0100 schrieb Lucas Stach:

Quoted 59 lines

Am Donnerstag, den 14.02.2019, 17:18 +0000 schrieb Abel Vesa:

Quoted 58 lines · Lucas Stach
Quoted 36 lines

Hi Abel

Am Mittwoch, den 13.02.2019, 19:05 +0000 schrieb Abel Vesa:

Quoted 33 lines

Add the opp table containing only non over drive opps. Also add the cpu-supply nodes for the A53 cores in the EVK board.

---
 arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 17
+++++++++++++++++
 arch/arm64/boot/dts/freescale/imx8mq.dtsi    | 23
+++++++++++++++++++++++

 2 files changed, 40 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +12 -0
index 54737bf..114359e 100644
@@ -31,6 +31,23 @@
  		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
  		enable-active-high;
  	};
+
+};
+
+&A53_0 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_1 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_2 {
Quoted 9 lines

arch/arm64/boot/dts/freescale/imx8mq-evk.dts line 51

Quoted 6 lines
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +5 -0
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_3 {
+	cpu-supply = <&sw1a_reg>;
  };

This should be a separate patch.

OK, will send as separate patches in the next version.

Quoted 5 lines

And AFAICS this is wrong, sw1a on the MX8M-EVK is the GPU supply, the
CPU is supplied by a dedicated switcher that is controlled via a GPIO.

Hmm, I think you're right. At least this is what the following document says.

Quoted 6 lines
Quoted 3 lines

https://www.mouser.com/ds/2/302/IMX8MDQLQEVKHUG-1280333.pdf

So I guess this means there will not be any cpu-supply properties.

There is a variable voltage CPU supply, but you need to model it as a gpio-regulator in the DT, it's not part of the PMIC provided rails.

In the schematics it's the line called PWM_LED (actually it's just GPIO1_IO13) that controls the voltage. This changes the feedback of the DCDC switcher, so it can toggle between 0.9V and 1.0V.

Regards,
Lucas

author
#13 lore raw

Re: [RFC 5/5] arm64: dts: imx8mq: Add the opp table and the cpu-supply nodes

Quoted 62 lines · Lucas Stach

Am Donnerstag, den 14.02.2019, 18:26 +0100 schrieb Lucas Stach:

Quoted 61 lines

Am Donnerstag, den 14.02.2019, 17:18 +0000 schrieb Abel Vesa:

Quoted 60 lines · Lucas Stach
Quoted 36 lines

Hi Abel

Am Mittwoch, den 13.02.2019, 19:05 +0000 schrieb Abel Vesa:

Quoted 33 lines

Add the opp table containing only non over drive opps. Also add the cpu-supply nodes for the A53 cores in the EVK board.

---
 arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 17
+++++++++++++++++
 arch/arm64/boot/dts/freescale/imx8mq.dtsi    | 23
+++++++++++++++++++++++

 2 files changed, 40 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +12 -0
index 54737bf..114359e 100644
@@ -31,6 +31,23 @@
  		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
  		enable-active-high;
  	};
+
+};
+
+&A53_0 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_1 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_2 {
Quoted 9 lines

arch/arm64/boot/dts/freescale/imx8mq-evk.dts line 51

Quoted 6 lines
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +5 -0
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_3 {
+	cpu-supply = <&sw1a_reg>;
  };

This should be a separate patch.

OK, will send as separate patches in the next version.

Quoted 5 lines

And AFAICS this is wrong, sw1a on the MX8M-EVK is the GPU supply, the
CPU is supplied by a dedicated switcher that is controlled via a GPIO.

Hmm, I think you're right. At least this is what the following document says.

https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.mouser.com%2Fds%2F2%2F302%2FIMX8MDQLQEVKHUG-1280333.pdf&amp;data=02%7C01%7Cabel.vesa%40nxp.com%7Cf7666164aff84f6f975d08d692a26c2a%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C636857623628438873&amp;sdata=EJJdfD8ewEXVQSTf2FqjEeUqGJd%2BwW94OQag428lszY%3D&amp;reserved=0

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

So I guess this means there will not be any cpu-supply properties.

There is a variable voltage CPU supply, but you need to model it as a gpio-regulator in the DT, it's not part of the PMIC provided rails.

In the schematics it's the line called PWM_LED (actually it's just GPIO1_IO13) that controls the voltage. This changes the feedback of the DCDC switcher, so it can toggle between 0.9V and 1.0V.

Thanks, will look into it tomorrow when I get back at the office.

Quoted 2 lines

Regards,
Lucas

#14 lore raw

Re: [RFC 5/5] arm64: dts: imx8mq: Add the opp table and the cpu-supply nodes

In reply to Abel Vesa
Quoted 84 lines · Abel Vesa

Add the opp table containing only non over drive opps. Also add the cpu-supply nodes for the A53 cores in the EVK board.

---
 arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 17 +++++++++++++++++
 arch/arm64/boot/dts/freescale/imx8mq.dtsi    | 23 
+++++++++++++++++++++++
 2 files changed, 40 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +17 -0
index 54737bf..114359e 100644
@@ -31,6 +31,23 @@
 		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
 		enable-active-high;
 	};
+
+};
+
+&A53_0 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_1 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_2 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_3 {
+	cpu-supply = <&sw1a_reg>;
 };
 
 &fec1 {
arch/arm64/boot/dts/freescale/imx8mq.dtsi +8 -0
index 1a89062..89b2d5f 100644
@@ -91,6 +91,7 @@
 			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
 		};
 
 		A53_1: cpu@1 {
@@ -101,6 +102,7 @@
 			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
 		};
 
 		A53_2: cpu@2 {
@@ -111,6 +113,7 @@
 			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
 		};
 
 		A53_3: cpu@3 {
@@ -121,6 +124,7 @@
 			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
 		};
 
 		A53_L2: l2-cache0 {
@@ -666,6 +670,25 @@
 			status = "disabled";
 		};
 
+
+		a53_0_opp_table: opp-table {
+			compatible = "operating-points-v2";
+			opp-shared;

arch/arm64/boot/dts/freescale/imx8mq.dtsi line 686

Quoted 10 lines
arch/arm64/boot/dts/freescale/imx8mq.dtsi +10 -0
+
+			opp-800000000 {
+				opp-hz = /bits/ 64 <800000000>;
+				opp-microvolt = <900000>;
+				clock-latency-ns = <150000>;
+			};
+
+			opp-1000000000 {
+				opp-hz = /bits/ 64 <1000000000>;
+				opp-microvolt = <900000>;

Shouldn't this be

opp-microvolt = <1000000>;

Quoted 8 lines
arch/arm64/boot/dts/freescale/imx8mq.dtsi +5 -0
+				clock-latency-ns = <150000>;
+				opp-suspend;
+			};
+		};
+
 		gic: interrupt-controller@38800000 {
 			compatible = "arm,gic-v3";
 			reg = <0x38800000 0x10000>,	/* GIC Dist */
author
#15 lore raw

Re: [RFC 5/5] arm64: dts: imx8mq: Add the opp table and the cpu-supply nodes

Quoted 98 lines · Angus Ainslie
Quoted 84 lines · Abel Vesa

Add the opp table containing only non over drive opps. Also add the cpu-supply nodes for the A53 cores in the EVK board.

---
 arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 17 +++++++++++++++++
 arch/arm64/boot/dts/freescale/imx8mq.dtsi    | 23
+++++++++++++++++++++++
 2 files changed, 40 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +17 -0
index 54737bf..114359e 100644
@@ -31,6 +31,23 @@
 		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
 		enable-active-high;
 	};
+
+};
+
+&A53_0 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_1 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_2 {
+	cpu-supply = <&sw1a_reg>;
+};
+
+&A53_3 {
+	cpu-supply = <&sw1a_reg>;
 };
 
 &fec1 {
arch/arm64/boot/dts/freescale/imx8mq.dtsi +8 -0
index 1a89062..89b2d5f 100644
@@ -91,6 +91,7 @@
 			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
 		};
 
 		A53_1: cpu@1 {
@@ -101,6 +102,7 @@
 			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
 		};
 
 		A53_2: cpu@2 {
@@ -111,6 +113,7 @@
 			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
 		};
 
 		A53_3: cpu@3 {
@@ -121,6 +124,7 @@
 			clocks = <&clk IMX8MQ_CLK_ARM>;
 			enable-method = "psci";
 			next-level-cache = <&A53_L2>;
+			operating-points-v2 = <&a53_0_opp_table>;
 		};
 
 		A53_L2: l2-cache0 {
@@ -666,6 +670,25 @@
 			status = "disabled";
 		};
 
+
+		a53_0_opp_table: opp-table {
+			compatible = "operating-points-v2";
+			opp-shared;

arch/arm64/boot/dts/freescale/imx8mq.dtsi line 686

Quoted 10 lines
arch/arm64/boot/dts/freescale/imx8mq.dtsi +10 -0
+
+			opp-800000000 {
+				opp-hz = /bits/ 64 <800000000>;
+				opp-microvolt = <900000>;
+				clock-latency-ns = <150000>;
+			};
+
+			opp-1000000000 {
+				opp-hz = /bits/ 64 <1000000000>;
+				opp-microvolt = <900000>;

Shouldn't this be

Quoted 2 lines

opp-microvolt = <1000000>;

Hmm, I looked into some older datasheet which said the maximum non overdrive is 1GHz.

But the latest one I could find:

https://www.nxp.com/docs/en/data-sheet/IMX8MDQLQIEC.pdf

says it's 0.8GHz.

So I'll fix it in the next version.

Thanks.

Quoted 9 lines
Quoted 8 lines
arch/arm64/boot/dts/freescale/imx8mq.dtsi +5 -0
+				clock-latency-ns = <150000>;
+				opp-suspend;
+			};
+		};
+
 		gic: interrupt-controller@38800000 {
 			compatible = "arm,gic-v3";
 			reg = <0x38800000 0x10000>,	/* GIC Dist */
#16 lore raw
In reply to Abel Vesa

Am Mittwoch, den 13.02.2019, 19:05 +0000 schrieb Abel Vesa:

Quoted 5 lines

I'm sending this as a patchseries (RFC) just to show all the changes needed for this to work. I'll resend separately once I get some feedback
on the entire thing.

Quoted 7 lines

One thing that is missing compared to the earlier work (here: https://patchwork.kernel.org/patch/10807821/ ) is the speed grading. That can be done as a separate change once I figure out how to do it with cpufreq-dt.

Unfortumately, there is a need to update the dt-bindings once again in order to add missing ARM clock from patches 1 and 2.

Which isn't much of a problem as it's a backward compatible change. A new kernel with cpufreq support will not find the clock when started with an old DT and thus not expose cpufreq support. I.e. it's working with exactly the same functionality level as a kernel matching the old DT.

Regards,
Lucas

Quoted 15 lines

Abel Vesa (5):
  clk: imx: imx8mq: Fix the rate propagation for arm pll
  dt-bindings: imx8mq-clock: Add the missing ARM clock
  clk: imx8mq: Add the missing ARM clock
  arm64: dts: imx8mq: Add the clocks and the latencies for the A53 cores
  arm64: dts: imx8mq: Add the opp table and the cpu-supply nodes

 arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 17 +++++++++++++++ arch/arm64/boot/dts/freescale/imx8mq.dtsi    | 31
++++++++++++++++++++++++++++
 drivers/clk/imx/clk-imx8mq.c                 |  8 ++++++- include/dt-bindings/clock/imx8mq-clock.h     |  4 +++-

 4 files changed, 58 insertions(+), 2 deletions(-)