Add support for Allwinner H6 DVFS
Subsystems (2)
v5 cover Add support for Allwinner H6 DVFS
Hi,
This is the same as v4 and v3 on top.
I have also fix the commit title for Pine H64 as we now only enable CPU DVFS.
Sorry for the noise,
Clément
Clément Péron (6):
arm64: configs: Enable sun50i cpufreq nvmem
arm64: dts: allwinner: h6: Enable CPU opp tables for Beelink GS1
arm64: dts: allwinner: h6: Enable CPU opp tables for Orange Pi 3
arm64: dts: allwinner: h6: Enable CPU opp tables for Tanix TX6
arm64: dts: allwinner: Sort Pine H64 device-tree nodes
arm64: dts: allwinner: h6: Enable CPU opp tables for Pine H64
Ondrej Jirman (2):
arm64: dts: allwinner: h6: Add thermal trip points/cooling map
arm64: dts: allwinner: h6: Add CPU Operating Performance Points table
Yangtao Li (1):
arm64: dts: allwinner: h6: Add clock to CPU cores
.../dts/allwinner/sun50i-h6-beelink-gs1.dts | 9 +- .../boot/dts/allwinner/sun50i-h6-cpu-opp.dtsi | 121 ++++++++++++++++++ .../dts/allwinner/sun50i-h6-orangepi-3.dts | 3 + .../boot/dts/allwinner/sun50i-h6-pine-h64.dts | 43 ++++--- .../dts/allwinner/sun50i-h6-tanix-tx6.dts | 13 ++ arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 36 ++++++ arch/arm64/configs/defconfig | 1 + 7 files changed, 207 insertions(+), 19 deletions(-) create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h6-cpu-opp.dtsi
Signature · 1 line
2.20.1
PATCH v5 1/9 arm64: dts: allwinner: h6: Add clock to CPU cores
From: Yangtao Li <[email protected]>
The ARM CPU cores are fed by the CPU clock from the CCU. Add a reference to the clock for each CPU core, along with the clock transition latency.
--- arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +8 -0
@@ -25,6 +25,8 @@ device_type = "cpu"; reg = <0>; enable-method = "psci"; + clocks = <&ccu CLK_CPUX>; + clock-latency-ns = <244144>; /* 8 32k periods */ }; cpu1: cpu@1 {
@@ -32,6 +34,8 @@ device_type = "cpu"; reg = <1>; enable-method = "psci"; + clocks = <&ccu CLK_CPUX>; + clock-latency-ns = <244144>; /* 8 32k periods */ }; cpu2: cpu@2 {
@@ -39,6 +43,8 @@ device_type = "cpu"; reg = <2>; enable-method = "psci"; + clocks = <&ccu CLK_CPUX>; + clock-latency-ns = <244144>; /* 8 32k periods */ }; cpu3: cpu@3 {
@@ -46,6 +52,8 @@ device_type = "cpu"; reg = <3>; enable-method = "psci"; + clocks = <&ccu CLK_CPUX>; + clock-latency-ns = <244144>; /* 8 32k periods */ }; };
Signature · 1 line
2.20.1
PATCH v5 2/9 arm64: dts: allwinner: h6: Add thermal trip points/cooling map
In reply to Clément PéronFrom: Ondrej Jirman <[email protected]>
This enables passive cooling by down-regulating CPU voltage and frequency.
--- arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +24 -0
@@ -964,6 +964,30 @@ polling-delay-passive = <0>; polling-delay = <0>; thermal-sensors = <&ths 0>; + + trips { + cpu_alert: cpu-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu-crit { + temperature = <100000>; + hysteresis = <0>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&cpu_alert>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; }; gpu-thermal {
Signature · 1 line
2.20.1
PATCH v5 6/9 arm64: dts: allwinner: h6: Enable CPU opp tables for Orange Pi 3
In reply to Clément PéronEnable CPU opp tables for Orange Pi 3.
This needs to change the CPU regulator max voltage to fit the OPP table.
Also add the ramp-delay information to avoid any out of spec running as the regulator is slower at reaching the voltage requested compare to the PLL reaching the frequency.
There is no such information for AXP805 but similar PMIC (AXP813) has a DVM (Dynamic Voltage scaling Management) ramp rate equal to 2500uV/us.
--- arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts +3 -0
@@ -4,6 +4,7 @@ /dts-v1/; #include "sun50i-h6.dtsi" +#include "sun50i-h6-cpu-opp.dtsi" #include <dt-bindings/gpio/gpio.h>
@@ -257,6 +258,7 @@ regulator-always-on; regulator-min-microvolt = <800000>; regulator-max-microvolt = <1160000>; + regulator-ramp-delay = <2500>; regulator-name = "vdd-cpu"; };
@@ -264,6 +266,7 @@ regulator-enable-ramp-delay = <32000>; regulator-min-microvolt = <810000>; regulator-max-microvolt = <1080000>; + regulator-ramp-delay = <2500>; regulator-name = "vdd-gpu"; };
Signature · 1 line
2.20.1
PATCH v5 7/9 arm64: dts: allwinner: h6: Enable CPU opp tables for Tanix TX6
In reply to Clément PéronEnable CPU opp tables for Tanix TX6.
Also add the fixed regulator that provided vdd-cpu-gpu required for CPU opp tables.
This voltage has been found using a voltmeter and could be wrong.
--- .../boot/dts/allwinner/sun50i-h6-tanix-tx6.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts +13 -0
@@ -4,6 +4,7 @@ /dts-v1/; #include "sun50i-h6.dtsi" +#include "sun50i-h6-cpu-opp.dtsi" #include <dt-bindings/gpio/gpio.h>
@@ -37,6 +38,17 @@ regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; + + reg_vdd_cpu_gpu: vdd-cpu-gpu { + compatible = "regulator-fixed"; + regulator-name = "vdd-cpu-gpu"; + regulator-min-microvolt = <1135000>; + regulator-max-microvolt = <1135000>; + }; +}; + +&cpu0 { + cpu-supply = <®_vdd_cpu_gpu>; }; &de {
@@ -56,6 +68,7 @@ }; &gpu { + mali-supply = <®_vdd_cpu_gpu>; status = "okay"; };
Signature · 1 line
2.20.1
PATCH v5 9/9 arm64: dts: allwinner: h6: Enable CPU opp tables for Pine H64
In reply to Clément PéronEnable CPU and GPU opp tables for Pine H64.
This needs to change the CPU regulator max voltage to fit the OPP table.
Also add the ramp-delay information to avoid any out of spec running as the regulator is slower at reaching the voltage requested compare to the PLL reaching the frequency.
There is no such information for AXP805 but similar PMIC (AXP813) has a DVM (Dynamic Voltage scaling Management) ramp rate equal to 2500uV/us.
--- arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts +8 -1
@@ -4,6 +4,7 @@ /dts-v1/; #include "sun50i-h6.dtsi" +#include "sun50i-h6-cpu-opp.dtsi" #include <dt-bindings/gpio/gpio.h>
@@ -80,6 +81,10 @@ }; }; +&cpu0 { + cpu-supply = <®_dcdca>; +}; + &de { status = "okay"; };
@@ -238,7 +243,8 @@ reg_dcdca: dcdca { regulator-always-on; regulator-min-microvolt = <810000>; - regulator-max-microvolt = <1080000>; + regulator-max-microvolt = <1160000>; + regulator-ramp-delay = <2500>; regulator-name = "vdd-cpu"; };
@@ -246,6 +252,7 @@ regulator-enable-ramp-delay = <32000>; regulator-min-microvolt = <810000>; regulator-max-microvolt = <1080000>; + regulator-ramp-delay = <2500>; regulator-name = "vdd-gpu"; };
Signature · 1 line
2.20.1
PATCH v5 8/9 arm64: dts: allwinner: Sort Pine H64 device-tree nodes
In reply to Clément PéronPine H64 device-tree have some nodes not properly sorted.
Fix this.
--- .../boot/dts/allwinner/sun50i-h6-pine-h64.dts | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts +17 -17
@@ -80,6 +80,18 @@ }; }; +&de { + status = "okay"; +}; + +&ehci0 { + status = "okay"; +}; + +&ehci3 { + status = "okay"; +}; + &emac { pinctrl-names = "default"; pinctrl-0 = <&ext_rgmii_pins>;
@@ -91,17 +103,6 @@ status = "okay"; }; -&mdio { - ext_rgmii_phy: ethernet-phy@1 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <1>; - }; -}; - -&de { - status = "okay"; -}; - &gpu { mali-supply = <®_dcdcc>; status = "okay";
@@ -117,12 +118,11 @@ }; }; -&ehci0 { - status = "okay"; -}; - -&ehci3 { - status = "okay"; +&mdio { + ext_rgmii_phy: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; }; &mmc0 {
Signature · 1 line
2.20.1
PATCH v5 5/9 arm64: dts: allwinner: h6: Enable CPU opp tables for Beelink GS1
In reply to Clément PéronEnable CPU opp tables for Beelink GS1.
This needs to change the CPU regulator max voltage to fit the OPP table.
Also add the ramp-delay information to avoid any out of spec running as the regulator is slower at reaching the voltage requested compare to the PLL reaching the frequency.
There is no such information for AXP805 but similar PMIC (AXP813) has a DVM (Dynamic Voltage scaling Management) ramp rate equal to 2500uV/us.
--- arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts +8 -1
@@ -4,6 +4,7 @@ /dts-v1/; #include "sun50i-h6.dtsi" +#include "sun50i-h6-cpu-opp.dtsi" #include <dt-bindings/gpio/gpio.h>
@@ -77,6 +78,10 @@ }; }; +&cpu0 { + cpu-supply = <®_dcdca>; +}; + &de { status = "okay"; };
@@ -234,7 +239,8 @@ reg_dcdca: dcdca { regulator-always-on; regulator-min-microvolt = <810000>; - regulator-max-microvolt = <1080000>; + regulator-max-microvolt = <1160000>; + regulator-ramp-delay = <2500>; regulator-name = "vdd-cpu"; };
@@ -242,6 +248,7 @@ regulator-enable-ramp-delay = <32000>; regulator-min-microvolt = <810000>; regulator-max-microvolt = <1080000>; + regulator-ramp-delay = <2500>; regulator-name = "vdd-gpu"; };
Signature · 1 line
2.20.1
PATCH v5 3/9 arm64: dts: allwinner: h6: Add CPU Operating Performance Points table
In reply to Clément PéronFrom: Ondrej Jirman <[email protected]>
Add an Operating Performance Points table for the CPU cores to enable Dynamic Voltage & Frequency Scaling on the H6.
--- .../boot/dts/allwinner/sun50i-h6-cpu-opp.dtsi | 121 ++++++++++++++++++ arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 4 + 2 files changed, 125 insertions(+) create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h6-cpu-opp.dtsi
arch/arm64/boot/dts/allwinner/sun50i-h6-cpu-opp.dtsi new file +121 -0
@@ -0,0 +1,121 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +// Copyright (C) 2020 Ondrej Jirman <[email protected]> +// Copyright (C) 2020 Clément Péron <[email protected]> + +/ { + cpu_opp_table: cpu-opp-table { + compatible = "allwinner,sun50i-h6-operating-points"; + nvmem-cells = <&cpu_speed_grade>; + opp-shared; + + opp@480000000 { + clock-latency-ns = <244144>; /* 8 32k periods */ + opp-hz = /bits/ 64 <480000000>; + + opp-microvolt-speed0 = <880000>; + opp-microvolt-speed1 = <820000>; + opp-microvolt-speed2 = <820000>; + }; + + opp@720000000 { + clock-latency-ns = <244144>; /* 8 32k periods */ + opp-hz = /bits/ 64 <720000000>; + + opp-microvolt-speed0 = <880000>; + opp-microvolt-speed1 = <820000>; + opp-microvolt-speed2 = <820000>; + }; + + opp@816000000 { + clock-latency-ns = <244144>; /* 8 32k periods */ + opp-hz = /bits/ 64 <816000000>; + + opp-microvolt-speed0 = <880000>; + opp-microvolt-speed1 = <820000>; + opp-microvolt-speed2 = <820000>; + }; + + opp@888000000 { + clock-latency-ns = <244144>; /* 8 32k periods */ + opp-hz = /bits/ 64 <888000000>; + + opp-microvolt-speed0 = <880000>; + opp-microvolt-speed1 = <820000>; + opp-microvolt-speed2 = <820000>; + }; + + opp@1080000000 { + clock-latency-ns = <244144>; /* 8 32k periods */ + opp-hz = /bits/ 64 <1080000000>; + + opp-microvolt-speed0 = <940000>; + opp-microvolt-speed1 = <880000>; + opp-microvolt-speed2 = <880000>; + }; + + opp@1320000000 { + clock-latency-ns = <244144>; /* 8 32k periods */ + opp-hz = /bits/ 64 <1320000000>; + + opp-microvolt-speed0 = <1000000>; + opp-microvolt-speed1 = <940000>; + opp-microvolt-speed2 = <940000>; + }; + + opp@1488000000 { + clock-latency-ns = <244144>; /* 8 32k periods */ + opp-hz = /bits/ 64 <1488000000>; + + opp-microvolt-speed0 = <1060000>; + opp-microvolt-speed1 = <1000000>; + opp-microvolt-speed2 = <1000000>; + }; + + opp@1608000000 { + clock-latency-ns = <244144>; /* 8 32k periods */ + opp-hz = /bits/ 64 <1608000000>; + + opp-microvolt-speed0 = <1090000>; + opp-microvolt-speed1 = <1030000>; + opp-microvolt-speed2 = <1030000>; + }; + + opp@1704000000 { + clock-latency-ns = <244144>; /* 8 32k periods */ + opp-hz = /bits/ 64 <1704000000>; + + opp-microvolt-speed0 = <1120000>; + opp-microvolt-speed1 = <1060000>; + opp-microvolt-speed2 = <1060000>; + }; + + opp@1800000000 { + clock-latency-ns = <244144>; /* 8 32k periods */ + opp-hz = /bits/ 64 <1800000000>; + + opp-microvolt-speed0 = <1160000>; + opp-microvolt-speed1 = <1100000>; + opp-microvolt-speed2 = <1100000>; + }; + }; +}; + +&cpu0 { + operating-points-v2 = <&cpu_opp_table>; + #cooling-cells = <2>; +}; + +&cpu1 { + operating-points-v2 = <&cpu_opp_table>; + #cooling-cells = <2>; +}; + +&cpu2 { + operating-points-v2 = <&cpu_opp_table>; + #cooling-cells = <2>; +}; + +&cpu3 { + operating-points-v2 = <&cpu_opp_table>; + #cooling-cells = <2>; +};
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +4 -0
@@ -258,6 +258,10 @@ ths_calibration: thermal-sensor-calibration@14 { reg = <0x14 0x8>; }; + + cpu_speed_grade: cpu-speed-grade@1c { + reg = <0x1c 0x4>; + }; }; watchdog: watchdog@30090a0 {
Signature · 1 line
2.20.1
PATCH v5 4/9 arm64: configs: Enable sun50i cpufreq nvmem
In reply to Clément PéronAllwinner H6 needs this driver to be able to get
the correct speed_bin required for DVFS.
Enable this option in arm64 defconfig.
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -84,6 +84,7 @@ CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y CONFIG_CPUFREQ_DT=y CONFIG_ACPI_CPPC_CPUFREQ=m +CONFIG_ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM=m CONFIG_ARM_ARMADA_37XX_CPUFREQ=y CONFIG_ARM_SCPI_CPUFREQ=y CONFIG_ARM_IMX_CPUFREQ_DT=m
Signature · 1 line
2.20.1
Quoted 7 lines · Clément Péron
Hi,
This is the same as v4 and v3 on top.
I have also fix the commit title for Pine H64 as we now only enable CPU DVFS.Sorry for the noise,
Clément
I dropped the previous ones and applied, thanks!
Maxime
Re: [PATCH v5 2/9] arm64: dts: allwinner: h6: Add thermal trip points/cooling map
In reply to Clément PéronHi,
Quoted 4 lines · Clément Péron
From: Ondrej Jirman <[email protected]>
This enables passive cooling by down-regulating CPU voltage and frequency.
Does this not produce a lot of warnings for you during compilation?
regards,
o.
Quoted 44 lines
Signed-off-by Ondrej Jirman <[email protected]>Signed-off-by Clément Péron <[email protected]>--- arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +24
-0@@ -964,6 +964,30 @@ polling-delay-passive = <0>; polling-delay = <0>; thermal-sensors = <&ths 0>; + + trips { + cpu_alert: cpu-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu-crit { + temperature = <100000>; + hysteresis = <0>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&cpu_alert>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; }; gpu-thermal {Signature · 1 line
2.20.1
Re: [PATCH v5 2/9] arm64: dts: allwinner: h6: Add thermal trip points/cooling map
Hi Ondrej,
Quoted 10 lines · Ondřej Jirman
Hi,
Quoted 4 lines · Clément Péron
From: Ondrej Jirman <[email protected]>
This enables passive cooling by down-regulating CPU voltage and frequency.
Does this not produce a lot of warnings for you during compilation?
I got flooded by lots of warnings, from sun50i-a64, stringray-usb, ipq6018 and didn't see but two are from sun50i-h6.
The #cooling-cells property is missing for CPU.
Will send a patch for noticing.
Regard,
Clement
Quoted 48 lines
regards,
o.Quoted 44 lines
Signed-off-by Ondrej Jirman <[email protected]>Signed-off-by Clément Péron <[email protected]>--- arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +24
-1@@ -964,6 +964,30 @@ polling-delay-passive = <0>; polling-delay = <0>; thermal-sensors = <&ths 0>; + + trips { + cpu_alert: cpu-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu-crit { + temperature = <100000>; + hysteresis = <0>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&cpu_alert>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; }; gpu-thermal { --2.20.1