Skip to contentSkip to conversation

cpufreq: spacemit: Add cpufreq support for K1 SoC

PATCH Applied Shuwei Wu 7 participants 11 messages Jun 26 – Jul 14

Subsystems (4)
lore
Share & tools
lore

Shuwei Wu

author
#0 lore raw

v4 cover cpufreq: spacemit: Add cpufreq support for K1 SoC

This series enables CPU DVFS for the SpacemiT K1 SoC using the generic cpufreq-dt driver.

K1 has two CPU clock clusters. The two clusters have separate CPU clocks, so they are represented as two cpufreq policies: policy0 for CPUs 0-3 and policy4 for CPUs 4-7.

The CPU voltage rail is shared between the clusters. To model this with two policies, the OPP entries describe voltage ranges instead of a single fixed voltage, so the shared regulator can keep the rail within a range acceptable for the active OPP constraints.

Tested on Banana Pi BPI-F3:

~ # cat /sys/devices/system/cpu/online
0-7

~ # ls /sys/devices/system/cpu/cpufreq/
policy0 policy4

~ # cat /sys/devices/system/cpu/cpufreq/policy0/scaling_driver cpufreq-dt
~ # cat /sys/devices/system/cpu/cpufreq/policy0/affected_cpus 0 1 2 3

~ # cat /sys/devices/system/cpu/cpufreq/policy4/scaling_driver cpufreq-dt
~ # cat /sys/devices/system/cpu/cpufreq/policy4/affected_cpus 4 5 6 7

Both policies expose the same OPP frequencies:

~ # cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies 614400 819000 1000000 1228800 1600000

~ # cat /sys/devices/system/cpu/cpufreq/policy4/scaling_available_frequencies 614400 819000 1000000 1228800 1600000

For each policy, scaling_setspeed was set to each supported OPP and the workload was pinned to one CPU covered by that policy with taskset. CPU0 was used for policy0, and CPU4 was used for policy4. The clock rates below are from /sys/kernel/debug/clk/clk_summary.

policy0 / CPU0:
----------------------------------------------------------

Frequency    |  cpu_c0_core_clk  |  Real (s)  |  User (s)
(kHz)        |  (Hz)             |            |
-------------+-------------------+------------+-----------
1,600,000    |  1,600,000,000    |    1.81    |    1.80
1,228,800    |  1,228,800,000    |    2.37    |    2.37
1,000,000    |  1,000,000,000    |    2.89    |    2.89
  819,000    |    819,200,000    |    3.56    |    3.55
  614,400    |    614,400,000    |    4.71    |    4.71

----------------------------------------------------------

policy4 / CPU4:
----------------------------------------------------------

Frequency    |  cpu_c1_core_clk  |  Real (s)  |  User (s)
(kHz)        |  (Hz)             |            |
-------------+-------------------+------------+-----------
1,600,000    |  1,600,000,000    |    1.81    |    1.80
1,228,800    |  1,228,800,000    |    2.36    |    2.36
1,000,000    |  1,000,000,000    |    2.89    |    2.89
  819,000    |    819,200,000    |    3.55    |    3.55
  614,400    |    614,400,000    |    4.71    |    4.70

----------------------------------------------------------

---
Changes in v4:
- Represent K1 as two cpufreq-dt policies, one per CPU clock cluster
- Use OPP voltage ranges for the shared CPU supply
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Add a K1-specific cpufreq driver for the shared-rail, dual-clock topology
- Use one shared CPU OPP table and one cpufreq policy for all CPUs
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Move OPP tables to dedicated k1-opp.dtsi
- Enable OPP only on BPI-F3 with cpu-supply present
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Shuwei Wu (2):
cpufreq: dt-platdev: Add SpacemiT K1 SoC to the allowlist
riscv: dts: spacemit: Add cpu scaling for K1 SoC

 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts |  35 +++++++-
 arch/riscv/boot/dts/spacemit/k1-opp.dtsi        | 105 ++++++++++++++++++++++++
 arch/riscv/boot/dts/spacemit/k1.dtsi            |   8 ++
 drivers/cpufreq/cpufreq-dt-platdev.c            |   2 +
 4 files changed, 149 insertions(+), 1 deletion(-)

---
base-commit: 5164e95565d3fd508ca8a95351323f5716dfb695
change-id: 20260307-shadow-deps-3582a78aa756
prerequisite-patch-id: 154bd4f720ce5065d58b988de8f273207b44572e
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: 5da3e75b18291a5540d4f66d7a0600fb8975ef62
prerequisite-patch-id: bcf41917414ecef8cf743095d130f6004c32f6a5
prerequisite-patch-id: cfe3800f8c791ec4c63e070af9628e88e0fc31b9
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: 7c7fb9f87dba019ece4c97c45750349a7cd28f3a

Best regards,

Signature · 1 line
Shuwei Wu <[email protected]>
author
#1 lore raw

PATCH v4 1/2 cpufreq: dt-platdev: Add SpacemiT K1 SoC to the allowlist

Add the compatible string for supporting the generic cpufreq driver on the SpacemiT K1 SoC.

---
Changes in v4:
- Drop the K1-specific cpufreq driver and use cpufreq-dt again
- Add spacemit,k1 back to the cpufreq-dt allowlist

Changes in v3:
- Add a K1-specific cpufreq driver for the shared-rail, dual-clock topology
- Add spacemit,k1 to the cpufreq-dt blocklist
---

---
 drivers/cpufreq/cpufreq-dt-platdev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/cpufreq-dt-platdev.c +2 -0
index 25fd3b191b7e..e262394b56f9 100644
@@ -81,6 +81,8 @@ static const struct of_device_id allowlist[] __initconst = {
 		{ .have_governor_per_policy = true, },
 	},
 
+	{ .compatible = "spacemit,k1", },
+
 	{ .compatible = "st-ericsson,u8500", },
 	{ .compatible = "st-ericsson,u8540", },
 	{ .compatible = "st-ericsson,u9500", },
Signature · 1 line
2.53.0
maintainer Acked-by on v4 1/2
#2 lore raw

Re: [PATCH v4 1/2] cpufreq: dt-platdev: Add SpacemiT K1 SoC to the allowlist

Quoted 22 lines · Shuwei Wu

Add the compatible string for supporting the generic cpufreq driver on the SpacemiT K1 SoC.

---
Changes in v4:
- Drop the K1-specific cpufreq driver and use cpufreq-dt again
- Add spacemit,k1 back to the cpufreq-dt allowlist

Changes in v3:
- Add a K1-specific cpufreq driver for the shared-rail, dual-clock topology
- Add spacemit,k1 to the cpufreq-dt blocklist
---

---
 drivers/cpufreq/cpufreq-dt-platdev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/cpufreq-dt-platdev.c +0 -0
index 25fd3b191b7e..e262394b56f9 100644

drivers/cpufreq/cpufreq-dt-platdev.c static const struct of_device_id allowlist[] __initconst = { · line 88

Quoted 8 lines
drivers/cpufreq/cpufreq-dt-platdev.c +2 -0
@@ -81,6 +81,8 @@ static const struct of_device_id allowlist[] __initconst = {
 		{ .have_governor_per_policy = true, },
 	},
 
+	{ .compatible = "spacemit,k1", },
+
 	{ .compatible = "st-ericsson,u8500", },
 	{ .compatible = "st-ericsson,u8540", },
 	{ .compatible = "st-ericsson,u9500", },

Please take this via arch tree.

Signature · 1 line
viresh
maintainer Reviewed-by
#3 lore raw

Re: [PATCH v4 1/2] cpufreq: dt-platdev: Add SpacemiT K1 SoC to the allowlist

Hi Viresh,

Quoted 26 lines · Viresh Kumar
Quoted 25 lines · Shuwei Wu

Add the compatible string for supporting the generic cpufreq driver on the SpacemiT K1 SoC.

---
Changes in v4:
- Drop the K1-specific cpufreq driver and use cpufreq-dt again
- Add spacemit,k1 back to the cpufreq-dt allowlist

Changes in v3:
- Add a K1-specific cpufreq driver for the shared-rail, dual-clock topology
- Add spacemit,k1 to the cpufreq-dt blocklist
---

---
 drivers/cpufreq/cpufreq-dt-platdev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/cpufreq-dt-platdev.c +0 -0
index 25fd3b191b7e..e262394b56f9 100644
@@ -81,6 +81,8 @@ static const struct of_device_id allowlist[] __initconst = {
 		{ .have_governor_per_policy = true, },
 	},
 
Quoted 8 lines

drivers/cpufreq/cpufreq-dt-platdev.c static const struct of_device_id allowlist[] __initconst = { · line 88

Quoted 5 lines
drivers/cpufreq/cpufreq-dt-platdev.c +2 -0
+	{ .compatible = "spacemit,k1", },
+
 	{ .compatible = "st-ericsson,u8500", },
 	{ .compatible = "st-ericsson,u8540", },
 	{ .compatible = "st-ericsson,u9500", },

Please take this via arch tree.

Ok, in this case, I will take it via SpacemiT SoC tree along with DT patch [2/2]

Quoted 4 lines
Signature · 1 line
viresh
Signature · 1 line
Yixun Lan (dlan)
author
#4 lore raw

PATCH v4 2/2 riscv: dts: spacemit: Add cpu scaling for K1 SoC

In reply to Shuwei Wu

Add CPU clock properties and OPP tables for the two CPU clusters in the SpacemiT K1 SoC. The OPP entries use voltage ranges because the CPU supply is shared by both clusters.

Enable CPU DVFS on Banana Pi BPI-F3 by including the OPP tables and wiring the CPU nodes to the CPU regulator supply.

---
Changes in v4:
- Use separate OPP tables for the two CPU clock clusters
- Use voltage ranges for the shared CPU supply

Changes in v3:
- Use one shared CPU OPP table for all CPUs

Changes in v2:
- Add k1-opp.dtsi with OPP tables for both CPU clusters
- Assign CPU supplies and include OPP table for Banana Pi BPI-F3
---

---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts |  35 +++++++-
 arch/riscv/boot/dts/spacemit/k1-opp.dtsi        | 105 ++++++++++++++++++++++++
 arch/riscv/boot/dts/spacemit/k1.dtsi            |   8 ++
 3 files changed, 147 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +34 -1
index 444c3b1e6f44..487179f7b9b9 100644
@@ -4,6 +4,7 @@
  */
 
 #include "k1.dtsi"
+#include "k1-opp.dtsi"
 #include "k1-pinctrl.dtsi"
 
 / {
@@ -86,6 +87,38 @@ &combo_phy {
 	status = "okay";
 };
 
+&cpu_0 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_1 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_2 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_3 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_4 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_5 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_6 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_7 {
+	cpu-supply = <&buck1_0v9>;
+};
+
 &emmc {
 	bus-width = <8>;
 	mmc-hs400-1_8v;
@@ -201,7 +234,7 @@ pmic@41 {
 		dldoin2-supply = <&buck5>;
 
 		regulators {
-			buck1 {
+			buck1_0v9: buck1 {
 				regulator-min-microvolt = <500000>;
 				regulator-max-microvolt = <3450000>;
 				regulator-ramp-delay = <5000>;
arch/riscv/boot/dts/spacemit/k1-opp.dtsi new file +105 -0

105 lines not on this page · raw message

arch/riscv/boot/dts/spacemit/k1.dtsi +8 -0
index 529ec68e9c23..bdd109b81730 100644
@@ -54,6 +54,7 @@ cpu_0: cpu@0 {
 			compatible = "spacemit,x60", "riscv";
 			device_type = "cpu";
 			reg = <0>;
+			clocks = <&syscon_apmu CLK_CPU_C0_CORE>;
 			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
 			riscv,isa-base = "rv64i";
 			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -84,6 +85,7 @@ cpu_1: cpu@1 {
 			compatible = "spacemit,x60", "riscv";
 			device_type = "cpu";
 			reg = <1>;
+			clocks = <&syscon_apmu CLK_CPU_C0_CORE>;
 			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
 			riscv,isa-base = "rv64i";
 			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -114,6 +116,7 @@ cpu_2: cpu@2 {
 			compatible = "spacemit,x60", "riscv";
 			device_type = "cpu";
 			reg = <2>;
+			clocks = <&syscon_apmu CLK_CPU_C0_CORE>;
 			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
 			riscv,isa-base = "rv64i";
 			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -144,6 +147,7 @@ cpu_3: cpu@3 {
 			compatible = "spacemit,x60", "riscv";
 			device_type = "cpu";
 			reg = <3>;
+			clocks = <&syscon_apmu CLK_CPU_C0_CORE>;
 			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
 			riscv,isa-base = "rv64i";
 			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -174,6 +178,7 @@ cpu_4: cpu@4 {
 			compatible = "spacemit,x60", "riscv";
 			device_type = "cpu";
 			reg = <4>;
+			clocks = <&syscon_apmu CLK_CPU_C1_CORE>;
 			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
 			riscv,isa-base = "rv64i";
 			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -204,6 +209,7 @@ cpu_5: cpu@5 {
 			compatible = "spacemit,x60", "riscv";
 			device_type = "cpu";
 			reg = <5>;
+			clocks = <&syscon_apmu CLK_CPU_C1_CORE>;
 			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
 			riscv,isa-base = "rv64i";
 			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -234,6 +240,7 @@ cpu_6: cpu@6 {
 			compatible = "spacemit,x60", "riscv";
 			device_type = "cpu";
 			reg = <6>;
+			clocks = <&syscon_apmu CLK_CPU_C1_CORE>;
 			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
 			riscv,isa-base = "rv64i";
 			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -264,6 +271,7 @@ cpu_7: cpu@7 {
 			compatible = "spacemit,x60", "riscv";
 			device_type = "cpu";
 			reg = <7>;
+			clocks = <&syscon_apmu CLK_CPU_C1_CORE>;
 			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
 			riscv,isa-base = "rv64i";
 			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
Signature · 1 line
2.53.0
Tested-by on v4 2/2
#5 lore raw

Re: [PATCH v4 2/2] riscv: dts: spacemit: Add cpu scaling for K1 SoC

Quoted 8 lines · Shuwei Wu

Add CPU clock properties and OPP tables for the two CPU clusters in the SpacemiT K1 SoC. The OPP entries use voltage ranges because the CPU supply is shared by both clusters.

Enable CPU DVFS on Banana Pi BPI-F3 by including the OPP tables and wiring the CPU nodes to the CPU regulator supply.

With the musepi-pro dts enablement patch [0] on top, this is

Works as advertised, I get two policies, matching the clusters:

$ cat /sys/devices/system/cpu/cpufreq/policy0/related_cpus
0 1 2 3
$ cat /sys/devices/system/cpu/cpufreq/policy4/related_cpus
4 5 6 7

Some time after boot:

$ cat /sys/devices/system/cpu/cpufreq/policy0/stats/time_in_state
614400 31124
819000 185
1000000 158
1228800 341
1600000 1148
$ cat /sys/devices/system/cpu/cpufreq/policy4/stats/time_in_state
614400 29232
819000 198
1000000 212
1228800 443
1600000 3428

Creating one single-threaded load increases max freq time_in_state in one policy (4 here):

$ yes > /dev/null &
(...after some time)
$ cat /sys/devices/system/cpu/cpufreq/policy0/stats/time_in_state
614400 45244
819000 187
1000000 169
1228800 345
1600000 1148
$ cat /sys/devices/system/cpu/cpufreq/policy4/stats/time_in_state
614400 38794
819000 201
1000000 226
1228800 450
1600000 7580

Creating load for all 8 cores in both:

$ yes > /dev/null &
$ yes > /dev/null &
$ yes > /dev/null &
$ yes > /dev/null &
$ yes > /dev/null &
$ yes > /dev/null &
$ yes > /dev/null &
$ yes > /dev/null &
$ cat /sys/devices/system/cpu/cpufreq/policy0/stats/time_in_state
614400 51371
819000 190
1000000 171
1228800 352
1600000 4391
$ cat /sys/devices/system/cpu/cpufreq/policy4/stats/time_in_state
614400 44121
819000 203
1000000 244
1228800 452
1600000 11812

Thanks!
Andre

[0] https://lore.kernel.org/all/[email protected]/

Quoted 258 lines

---
Changes in v4:
- Use separate OPP tables for the two CPU clock clusters
- Use voltage ranges for the shared CPU supply

Changes in v3:
- Use one shared CPU OPP table for all CPUs

Changes in v2:
- Add k1-opp.dtsi with OPP tables for both CPU clusters
- Assign CPU supplies and include OPP table for Banana Pi BPI-F3
---

---
  arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts |  35 +++++++-
  arch/riscv/boot/dts/spacemit/k1-opp.dtsi        | 105 ++++++++++++++++++++++++
  arch/riscv/boot/dts/spacemit/k1.dtsi            |   8 ++
  3 files changed, 147 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +34 -1
index 444c3b1e6f44..487179f7b9b9 100644
@@ -4,6 +4,7 @@
   */
 
  #include "k1.dtsi"
+#include "k1-opp.dtsi"
  #include "k1-pinctrl.dtsi"
 
  / {
@@ -86,6 +87,38 @@ &combo_phy {
  	status = "okay";
  };
 
+&cpu_0 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_1 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_2 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_3 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_4 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_5 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_6 {
+	cpu-supply = <&buck1_0v9>;
+};
+
+&cpu_7 {
+	cpu-supply = <&buck1_0v9>;
+};
+
  &emmc {
  	bus-width = <8>;
  	mmc-hs400-1_8v;
@@ -201,7 +234,7 @@ pmic@41 {
  		dldoin2-supply = <&buck5>;
 
  		regulators {
-			buck1 {
+			buck1_0v9: buck1 {
  				regulator-min-microvolt = <500000>;
  				regulator-max-microvolt = <3450000>;
  				regulator-ramp-delay = <5000>;
arch/riscv/boot/dts/spacemit/k1-opp.dtsi new file +105 -0
new file mode 100644
index 000000000000..4cebfcd87485
@@ -0,0 +1,105 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/ {
+	cluster0_opp_table: opp-table-cluster0 {
+		compatible = "operating-points-v2";
+		opp-shared;
+
+		opp-614400000 {
+			opp-hz = /bits/ 64 <614400000>;
+			opp-microvolt = <950000 950000 1050000>;
+			clock-latency-ns = <200000>;
+		};
+
+		opp-819000000 {
+			opp-hz = /bits/ 64 <819000000>;
+			opp-microvolt = <950000 950000 1050000>;
+			clock-latency-ns = <200000>;
+		};
+
+		opp-1000000000 {
+			opp-hz = /bits/ 64 <1000000000>;
+			opp-microvolt = <950000 950000 1050000>;
+			clock-latency-ns = <200000>;
+		};
+
+		opp-1228800000 {
+			opp-hz = /bits/ 64 <1228800000>;
+			opp-microvolt = <950000 950000 1050000>;
+			clock-latency-ns = <200000>;
+		};
+
+		opp-1600000000 {
+			opp-hz = /bits/ 64 <1600000000>;
+			opp-microvolt = <1050000 1050000 1050000>;
+			clock-latency-ns = <200000>;
+		};
+	};
+
+	cluster1_opp_table: opp-table-cluster1 {
+		compatible = "operating-points-v2";
+		opp-shared;
+
+		opp-614400000 {
+			opp-hz = /bits/ 64 <614400000>;
+			opp-microvolt = <950000 950000 1050000>;
+			clock-latency-ns = <200000>;
+		};
+
+		opp-819000000 {
+			opp-hz = /bits/ 64 <819000000>;
+			opp-microvolt = <950000 950000 1050000>;
+			clock-latency-ns = <200000>;
+		};
+
+		opp-1000000000 {
+			opp-hz = /bits/ 64 <1000000000>;
+			opp-microvolt = <950000 950000 1050000>;
+			clock-latency-ns = <200000>;
+		};
+
+		opp-1228800000 {
+			opp-hz = /bits/ 64 <1228800000>;
+			opp-microvolt = <950000 950000 1050000>;
+			clock-latency-ns = <200000>;
+		};
+
+		opp-1600000000 {
+			opp-hz = /bits/ 64 <1600000000>;
+			opp-microvolt = <1050000 1050000 1050000>;
+			clock-latency-ns = <200000>;
+		};
+	};
+};
+
+&cpu_0 {
+	operating-points-v2 = <&cluster0_opp_table>;
+};
+
+&cpu_1 {
+	operating-points-v2 = <&cluster0_opp_table>;
+};
+
+&cpu_2 {
+	operating-points-v2 = <&cluster0_opp_table>;
+};
+
+&cpu_3 {
+	operating-points-v2 = <&cluster0_opp_table>;
+};
+
+&cpu_4 {
+	operating-points-v2 = <&cluster1_opp_table>;
+};
+
+&cpu_5 {
+	operating-points-v2 = <&cluster1_opp_table>;
+};
+
+&cpu_6 {
+	operating-points-v2 = <&cluster1_opp_table>;
+};
+
+&cpu_7 {
+	operating-points-v2 = <&cluster1_opp_table>;
+};
arch/riscv/boot/dts/spacemit/k1.dtsi +8 -0
index 529ec68e9c23..bdd109b81730 100644
@@ -54,6 +54,7 @@ cpu_0: cpu@0 {
  			compatible = "spacemit,x60", "riscv";
  			device_type = "cpu";
  			reg = <0>;
+			clocks = <&syscon_apmu CLK_CPU_C0_CORE>;
  			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
  			riscv,isa-base = "rv64i";
  			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -84,6 +85,7 @@ cpu_1: cpu@1 {
  			compatible = "spacemit,x60", "riscv";
  			device_type = "cpu";
  			reg = <1>;
+			clocks = <&syscon_apmu CLK_CPU_C0_CORE>;
  			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
  			riscv,isa-base = "rv64i";
  			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -114,6 +116,7 @@ cpu_2: cpu@2 {
  			compatible = "spacemit,x60", "riscv";
  			device_type = "cpu";
  			reg = <2>;
+			clocks = <&syscon_apmu CLK_CPU_C0_CORE>;
  			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
  			riscv,isa-base = "rv64i";
  			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -144,6 +147,7 @@ cpu_3: cpu@3 {
  			compatible = "spacemit,x60", "riscv";
  			device_type = "cpu";
  			reg = <3>;
+			clocks = <&syscon_apmu CLK_CPU_C0_CORE>;
  			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
  			riscv,isa-base = "rv64i";
  			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -174,6 +178,7 @@ cpu_4: cpu@4 {
  			compatible = "spacemit,x60", "riscv";
  			device_type = "cpu";
  			reg = <4>;
+			clocks = <&syscon_apmu CLK_CPU_C1_CORE>;
  			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
  			riscv,isa-base = "rv64i";
  			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -204,6 +209,7 @@ cpu_5: cpu@5 {
  			compatible = "spacemit,x60", "riscv";
  			device_type = "cpu";
  			reg = <5>;
+			clocks = <&syscon_apmu CLK_CPU_C1_CORE>;
  			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
  			riscv,isa-base = "rv64i";
  			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -234,6 +240,7 @@ cpu_6: cpu@6 {
  			compatible = "spacemit,x60", "riscv";
  			device_type = "cpu";
  			reg = <6>;
+			clocks = <&syscon_apmu CLK_CPU_C1_CORE>;
  			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
  			riscv,isa-base = "rv64i";
  			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
@@ -264,6 +271,7 @@ cpu_7: cpu@7 {
  			compatible = "spacemit,x60", "riscv";
  			device_type = "cpu";
  			reg = <7>;
+			clocks = <&syscon_apmu CLK_CPU_C1_CORE>;
  			riscv,isa = "rv64imafdcbv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_zkt_zvfh_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt";
  			riscv,isa-base = "rv64i";
  			riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "b", "v", "zicbom",
maintainer Reviewed-by on v4 2/2
#6 lore raw

Re: [PATCH v4 2/2] riscv: dts: spacemit: Add cpu scaling for K1 SoC

In reply to Shuwei Wu

Hi Shuwei,

Quoted 8 lines · Shuwei Wu

Add CPU clock properties and OPP tables for the two CPU clusters in the SpacemiT K1 SoC. The OPP entries use voltage ranges because the CPU supply is shared by both clusters.

Enable CPU DVFS on Banana Pi BPI-F3 by including the OPP tables and wiring the CPU nodes to the CPU regulator supply.

Looks good, thanks for working on this

Signature · 1 line
Yixun Lan (dlan)
Tested-by on the v4 series
#7 lore raw
In reply to Shuwei Wu
Quoted 65 lines · Shuwei Wu

This series enables CPU DVFS for the SpacemiT K1 SoC using the generic cpufreq-dt driver.

K1 has two CPU clock clusters. The two clusters have separate CPU clocks, so they are represented as two cpufreq policies: policy0 for CPUs 0-3 and policy4 for CPUs 4-7.

The CPU voltage rail is shared between the clusters. To model this with two policies, the OPP entries describe voltage ranges instead of a single fixed voltage, so the shared regulator can keep the rail within a range acceptable for the active OPP constraints.

Tested on Banana Pi BPI-F3:

~ # cat /sys/devices/system/cpu/online
0-7

~ # ls /sys/devices/system/cpu/cpufreq/
policy0 policy4

~ # cat /sys/devices/system/cpu/cpufreq/policy0/scaling_driver cpufreq-dt
~ # cat /sys/devices/system/cpu/cpufreq/policy0/affected_cpus 0 1 2 3

~ # cat /sys/devices/system/cpu/cpufreq/policy4/scaling_driver cpufreq-dt
~ # cat /sys/devices/system/cpu/cpufreq/policy4/affected_cpus 4 5 6 7

Both policies expose the same OPP frequencies:

~ # cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies 614400 819000 1000000 1228800 1600000

~ # cat /sys/devices/system/cpu/cpufreq/policy4/scaling_available_frequencies 614400 819000 1000000 1228800 1600000

For each policy, scaling_setspeed was set to each supported OPP and the workload was pinned to one CPU covered by that policy with taskset. CPU0 was used for policy0, and CPU4 was used for policy4. The clock rates below are from /sys/kernel/debug/clk/clk_summary.

policy0 / CPU0:
----------------------------------------------------------

Frequency    |  cpu_c0_core_clk  |  Real (s)  |  User (s)
(kHz)        |  (Hz)             |            |
-------------+-------------------+------------+-----------
1,600,000    |  1,600,000,000    |    1.81    |    1.80
1,228,800    |  1,228,800,000    |    2.37    |    2.37
1,000,000    |  1,000,000,000    |    2.89    |    2.89
   819,000    |    819,200,000    |    3.56    |    3.55
   614,400    |    614,400,000    |    4.71    |    4.71

----------------------------------------------------------

policy4 / CPU4:
----------------------------------------------------------

Frequency    |  cpu_c1_core_clk  |  Real (s)  |  User (s)
(kHz)        |  (Hz)             |            |
-------------+-------------------+------------+-----------
1,600,000    |  1,600,000,000    |    1.81    |    1.80
1,228,800    |  1,228,800,000    |    2.36    |    2.36
1,000,000    |  1,000,000,000    |    2.89    |    2.89
   819,000    |    819,200,000    |    3.55    |    3.55
   614,400    |    614,400,000    |    4.71    |    4.70
Quoted 3 lines

----------------------------------------------------------

Hi Shuwei,

Thanks for your work.

I have tested this series on the OrangePi RV2 4GB board on top of next-20260626, with Vincent's patch for OrangePi RV2 applied.

# uname -a
Linux orangepi-rv2 7.1.0-next-20260626-00005-g66ef697be46d #1 SMP PREEMPT Sat Jun 27 14:53:02 CST 2026 riscv64 GNU/Linux
# ls /sys/devices/system/cpu/cpufreq/
boost    policy0  policy4
# cat /sys/devices/system/cpu/cpufreq/policy*/scaling_driver
cpufreq-dt
cpufreq-dt
# cat /sys/devices/system/cpu/cpufreq/policy0/affected_cpus
0 1 2 3
# cat /sys/devices/system/cpu/cpufreq/policy4/affected_cpus
4 5 6 7
# cat /sys/devices/system/cpu/cpufreq/policy*/scaling_available_frequencies
614400 819000 1000000 1228800 1600000
614400 819000 1000000 1228800 1600000

I used the following test script to verify cpufreq functionality:

```bash
#!/bin/sh

echo userspace > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo userspace > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor

echo "--- same frequency test ---"
for freq in 614400 819000 1000000 1228800 1600000; do
    echo $freq > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed
    echo $freq > /sys/devices/system/cpu/cpufreq/policy4/scaling_setspeed
    sleep 1
    t=$(taskset -c 0 time -f "%e" dd if=/dev/zero of=/dev/null bs=1M count=1000 2>&1 | tail -1)
    echo "$freq kHz: ${t}s"
done

echo "--- mixed frequency test ---"
echo 614400 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed
echo 1600000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_setspeed
sleep 1
t0=$(taskset -c 0 time -f "%e" dd if=/dev/zero of=/dev/null bs=1M count=1000 2>&1 | tail -1)
t4=$(taskset -c 4 time -f "%e" dd if=/dev/zero of=/dev/null bs=1M count=1000 2>&1 | tail -1)
echo "p0=614400 p4=1600000 -> cpu0=${t0}s cpu4=${t4}s"

echo 1600000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed
echo 614400 > /sys/devices/system/cpu/cpufreq/policy4/scaling_setspeed
sleep 1
t0=$(taskset -c 0 time -f "%e" dd if=/dev/zero of=/dev/null bs=1M count=1000 2>&1 | tail -1)
t4=$(taskset -c 4 time -f "%e" dd if=/dev/zero of=/dev/null bs=1M count=1000 2>&1 | tail -1)
echo "p0=1600000 p4=614400 -> cpu0=${t0}s cpu4=${t4}s"

echo 1000000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed
echo 1228800 > /sys/devices/system/cpu/cpufreq/policy4/scaling_setspeed
sleep 1
t0=$(taskset -c 0 time -f "%e" dd if=/dev/zero of=/dev/null bs=1M count=1000 2>&1 | tail -1)
t4=$(taskset -c 4 time -f "%e" dd if=/dev/zero of=/dev/null bs=1M count=1000 2>&1 | tail -1)
echo "p0=1000000 p4=1228800 -> cpu0=${t0}s cpu4=${t4}s"
```

Results:

# ./test_cpufreq_userspace.sh
--- same frequency test ---
614400 kHz: 0.90s
819000 kHz: 0.67s
1000000 kHz: 0.55s
1228800 kHz: 0.45s
1600000 kHz: 0.34s
--- mixed frequency test ---
p0=614400 p4=1600000 -> cpu0=0.90s cpu4=0.34s
p0=1600000 p4=614400 -> cpu0=0.34s cpu4=0.90s
p0=1000000 p4=1228800 -> cpu0=0.55s cpu4=0.45s

Regards,
Shuai

Quoted 38 lines

---
Changes in v4:
- Represent K1 as two cpufreq-dt policies, one per CPU clock cluster
- Use OPP voltage ranges for the shared CPU supply
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Add a K1-specific cpufreq driver for the shared-rail, dual-clock topology
- Use one shared CPU OPP table and one cpufreq policy for all CPUs
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Move OPP tables to dedicated k1-opp.dtsi
- Enable OPP only on BPI-F3 with cpu-supply present
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Shuwei Wu (2):
cpufreq: dt-platdev: Add SpacemiT K1 SoC to the allowlist
riscv: dts: spacemit: Add cpu scaling for K1 SoC

  arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts |  35 +++++++-
  arch/riscv/boot/dts/spacemit/k1-opp.dtsi        | 105 ++++++++++++++++++++++++
  arch/riscv/boot/dts/spacemit/k1.dtsi            |   8 ++
  drivers/cpufreq/cpufreq-dt-platdev.c            |   2 +
  4 files changed, 149 insertions(+), 1 deletion(-)

---
base-commit: 5164e95565d3fd508ca8a95351323f5716dfb695
change-id: 20260307-shadow-deps-3582a78aa756
prerequisite-patch-id: 154bd4f720ce5065d58b988de8f273207b44572e
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: 5da3e75b18291a5540d4f66d7a0600fb8975ef62
prerequisite-patch-id: bcf41917414ecef8cf743095d130f6004c32f6a5
prerequisite-patch-id: cfe3800f8c791ec4c63e070af9628e88e0fc31b9
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: 7c7fb9f87dba019ece4c97c45750349a7cd28f3a

Best regards,

Tested-by Reviewed-by on the v4 series
#8 lore raw
In reply to Shuwei Wu

Hi Shuwei,

Quoted 89 lines · Shuwei Wu

This series enables CPU DVFS for the SpacemiT K1 SoC using the generic cpufreq-dt driver.

K1 has two CPU clock clusters. The two clusters have separate CPU clocks, so they are represented as two cpufreq policies: policy0 for CPUs 0-3 and policy4 for CPUs 4-7.

The CPU voltage rail is shared between the clusters. To model this with two policies, the OPP entries describe voltage ranges instead of a single fixed voltage, so the shared regulator can keep the rail within a range acceptable for the active OPP constraints.

Tested on Banana Pi BPI-F3:

~ # cat /sys/devices/system/cpu/online
0-7

~ # ls /sys/devices/system/cpu/cpufreq/
policy0 policy4

~ # cat /sys/devices/system/cpu/cpufreq/policy0/scaling_driver cpufreq-dt
~ # cat /sys/devices/system/cpu/cpufreq/policy0/affected_cpus 0 1 2 3

~ # cat /sys/devices/system/cpu/cpufreq/policy4/scaling_driver cpufreq-dt
~ # cat /sys/devices/system/cpu/cpufreq/policy4/affected_cpus 4 5 6 7

Both policies expose the same OPP frequencies:

~ # cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies 614400 819000 1000000 1228800 1600000

~ # cat /sys/devices/system/cpu/cpufreq/policy4/scaling_available_frequencies 614400 819000 1000000 1228800 1600000

For each policy, scaling_setspeed was set to each supported OPP and the workload was pinned to one CPU covered by that policy with taskset. CPU0 was used for policy0, and CPU4 was used for policy4. The clock rates below are from /sys/kernel/debug/clk/clk_summary.

policy0 / CPU0:
----------------------------------------------------------

Frequency    |  cpu_c0_core_clk  |  Real (s)  |  User (s)
(kHz)        |  (Hz)             |            |
-------------+-------------------+------------+-----------
1,600,000    |  1,600,000,000    |    1.81    |    1.80
1,228,800    |  1,228,800,000    |    2.37    |    2.37
1,000,000    |  1,000,000,000    |    2.89    |    2.89
  819,000    |    819,200,000    |    3.56    |    3.55
  614,400    |    614,400,000    |    4.71    |    4.71

----------------------------------------------------------

policy4 / CPU4:
----------------------------------------------------------

Frequency    |  cpu_c1_core_clk  |  Real (s)  |  User (s)
(kHz)        |  (Hz)             |            |
-------------+-------------------+------------+-----------
1,600,000    |  1,600,000,000    |    1.81    |    1.80
1,228,800    |  1,228,800,000    |    2.36    |    2.36
1,000,000    |  1,000,000,000    |    2.89    |    2.89
  819,000    |    819,200,000    |    3.55    |    3.55
  614,400    |    614,400,000    |    4.71    |    4.70

----------------------------------------------------------

---
Changes in v4:
- Represent K1 as two cpufreq-dt policies, one per CPU clock cluster
- Use OPP voltage ranges for the shared CPU supply
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Add a K1-specific cpufreq driver for the shared-rail, dual-clock topology
- Use one shared CPU OPP table and one cpufreq policy for all CPUs
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Move OPP tables to dedicated k1-opp.dtsi
- Enable OPP only on BPI-F3 with cpu-supply present
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Shuwei Wu (2):
cpufreq: dt-platdev: Add SpacemiT K1 SoC to the allowlist
riscv: dts: spacemit: Add cpu scaling for K1 SoC

Quoted 5 lines
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts |  35 +++++++-
 arch/riscv/boot/dts/spacemit/k1-opp.dtsi        | 105 ++++++++++++++++++++++++
 arch/riscv/boot/dts/spacemit/k1.dtsi            |   8 ++
 drivers/cpufreq/cpufreq-dt-platdev.c            |   2 +
 4 files changed, 149 insertions(+), 1 deletion(-)

Thanks for this new version. I have tested it successfully on a Banana Pi BPI-F3. The CPU clock and voltages you have defined match the vendor version. Therefore for both commits:

BTW, I have done a few additional research on the discussion we got on an earlier version of this patchset. On all the SpacemiT K1 boards, the output of buck1 and buck2 are connected together, so there is the question about what do do with voltage of buck2. We discussed about marking buck1 and buck2 as coupled through regulator-coupled-with.

It appears that buck1 and buck2 are configured in "Dual-Phase Mode" as the bit BUCK_12_DUAL (bit 0) of register BUCK_LDO_CFG (reg 0x46) of the P1 chip. I haven't found any code changing it in the kernel or U-Boot, so I guess the value is configured as default in the MTP. The datasheet is not clear about what controls the voltage in Dual-Phase Mode, but given both U-Boot and kernel code (vendor or upstream) only change the voltage of buck1, it makes sense that there is no need to change the voltage of buck2 in that mode. And it also sounds logic given that the P1 chip is aware of the coupling.

I therefore believe there is not need to mark buck1 and buck2 as coupled, and that your patch is fully correct on that aspect.

Regards
Aurelien

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
Tested-by on the v4 series
#9 lore raw
In reply to Shuwei Wu
Quoted 79 lines · Shuwei Wu

This series enables CPU DVFS for the SpacemiT K1 SoC using the generic cpufreq-dt driver.

K1 has two CPU clock clusters. The two clusters have separate CPU clocks, so they are represented as two cpufreq policies: policy0 for CPUs 0-3 and policy4 for CPUs 4-7.

The CPU voltage rail is shared between the clusters. To model this with two policies, the OPP entries describe voltage ranges instead of a single fixed voltage, so the shared regulator can keep the rail within a range acceptable for the active OPP constraints.

Tested on Banana Pi BPI-F3:

~ # cat /sys/devices/system/cpu/online
0-7

~ # ls /sys/devices/system/cpu/cpufreq/
policy0 policy4

~ # cat /sys/devices/system/cpu/cpufreq/policy0/scaling_driver cpufreq-dt
~ # cat /sys/devices/system/cpu/cpufreq/policy0/affected_cpus 0 1 2 3

~ # cat /sys/devices/system/cpu/cpufreq/policy4/scaling_driver cpufreq-dt
~ # cat /sys/devices/system/cpu/cpufreq/policy4/affected_cpus 4 5 6 7

Both policies expose the same OPP frequencies:

~ # cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies 614400 819000 1000000 1228800 1600000

~ # cat /sys/devices/system/cpu/cpufreq/policy4/scaling_available_frequencies 614400 819000 1000000 1228800 1600000

For each policy, scaling_setspeed was set to each supported OPP and the workload was pinned to one CPU covered by that policy with taskset. CPU0 was used for policy0, and CPU4 was used for policy4. The clock rates below are from /sys/kernel/debug/clk/clk_summary.

policy0 / CPU0:
----------------------------------------------------------

Frequency    |  cpu_c0_core_clk  |  Real (s)  |  User (s)
(kHz)        |  (Hz)             |            |
-------------+-------------------+------------+-----------
1,600,000    |  1,600,000,000    |    1.81    |    1.80
1,228,800    |  1,228,800,000    |    2.37    |    2.37
1,000,000    |  1,000,000,000    |    2.89    |    2.89
  819,000    |    819,200,000    |    3.56    |    3.55
  614,400    |    614,400,000    |    4.71    |    4.71

----------------------------------------------------------

policy4 / CPU4:
----------------------------------------------------------

Frequency    |  cpu_c1_core_clk  |  Real (s)  |  User (s)
(kHz)        |  (Hz)             |            |
-------------+-------------------+------------+-----------
1,600,000    |  1,600,000,000    |    1.81    |    1.80
1,228,800    |  1,228,800,000    |    2.36    |    2.36
1,000,000    |  1,000,000,000    |    2.89    |    2.89
  819,000    |    819,200,000    |    3.55    |    3.55
  614,400    |    614,400,000    |    4.71    |    4.70

----------------------------------------------------------

---
Changes in v4:
- Represent K1 as two cpufreq-dt policies, one per CPU clock cluster
- Use OPP voltage ranges for the shared CPU supply
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Add a K1-specific cpufreq driver for the shared-rail, dual-clock topology
- Use one shared CPU OPP table and one cpufreq policy for all CPUs
- Link to v2: https://lore.kernel.org/r/[email protected]

Quoted 5 lines

Changes in v2:
- Move OPP tables to dedicated k1-opp.dtsi
- Enable OPP only on BPI-F3 with cpu-supply present
- Link to v1: https://lore.kernel.org/r/[email protected]

Tested on bananapi-F3 and Musebook, works fine.

Quoted 1 line

---

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

maintainer Applied
#10 lore raw
In reply to Shuwei Wu
Quoted 8 lines · Shuwei Wu

This series enables CPU DVFS for the SpacemiT K1 SoC using the generic cpufreq-dt driver.

K1 has two CPU clock clusters. The two clusters have separate CPU clocks, so they are represented as two cpufreq policies: policy0 for CPUs 0-3 and policy4 for CPUs 4-7.

[...]

Applied, thanks!

[1/2] cpufreq: dt-platdev: Add SpacemiT K1 SoC to the allowlist

      https://git.kernel.org/pub/scm/linux/kernel/git/spacemit/linux.git/commit/?id=6f6369ada94038b189096b7a98330dee9814082a
[2/2] riscv: dts: spacemit: Add cpu scaling for K1 SoC
      https://git.kernel.org/pub/scm/linux/kernel/git/spacemit/linux.git/commit/?id=199380e4d8cd22e539a08d4949e9582b09390bd5

Best regards,

Signature · 1 line
Yixun Lan <[email protected]>