ARM: da850: enable cpufreq in DT mode
cover ARM: da850: enable cpufreq in DT mode
From: Bartosz Golaszewski <[email protected]>
This series adds cpufreq-dt operating points for da850 boards supported with device tree (da850-lcdk, da850-lego-ev3, da850-evm) and also includes a fix for the da850-evm boardfile which checks an unset variable to determine the highest available frequency for cpufreq.
Last patch enables CPUFREQ_DT in davinci_all_defconfig.
Bartosz Golaszewski (2):
ARM: davinci: fix cpufreq registration on da850-evm
ARM: dts: da850-evm: enable cpufreq
David Lechner (2):
ARM: dts: da850: add cpu node and operating points to DT
ARM: davinci_all_defconfig: Enable CPUFREQ_DT
arch/arm/boot/dts/da850-evm.dts | 30 +++++++++++++ arch/arm/boot/dts/da850-lcdk.dts | 31 ++++++++++++++ arch/arm/boot/dts/da850-lego-ev3.dts | 30 +++++++++++++ arch/arm/boot/dts/da850.dtsi | 56 +++++++++++++++++++++++++ arch/arm/configs/davinci_all_defconfig | 1 + arch/arm/mach-davinci/board-da850-evm.c | 12 +----- 6 files changed, 149 insertions(+), 11 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/4 ARM: davinci: fix cpufreq registration on da850-evm
From: Bartosz Golaszewski <[email protected]>
The system_rev variable is never set on davinci and is always 0, so we're using the default max operating point of 300MHz. The cvdd supply is fixed at 1.2V however, so we can go up to 372MHz. Remove the switch and always set da850_max_speed to 372000.
--- arch/arm/mach-davinci/board-da850-evm.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +1 -11
@@ -1155,17 +1155,7 @@ static struct edma_rsv_info *da850_edma_rsv[2] = {#ifdef CONFIG_CPU_FREQ static __init int da850_evm_init_cpufreq (void ) { -switch (system_rev &0xF ) { -case 3 : - da850_max_speed =456000 ; -break ; -case 2 : - da850_max_speed =408000 ; -break ; -case 1 : - da850_max_speed =372000 ; -break ; - } + da850_max_speed =372000 ;return da850_register_cpufreq ("pll0_sysclk3" ); }
Signature · 1 line
2.20.1
PATCH 2/4 ARM: dts: da850: add cpu node and operating points to DT
In reply to Bartosz GolaszewskiFrom: David Lechner <[email protected]>
This adds a cpu node and operating points to the common da850.dtsi file.
Additionally, a regulator is added to the LEGO EV3 board along with some board-specific CPU configuration.
Regulators need to be hooked up on other boards to get them working.
--- arch/arm/boot/dts/da850-lcdk.dts | 31 +++++++++++++++ arch/arm/boot/dts/da850-lego-ev3.dts | 30 +++++++++++++++ arch/arm/boot/dts/da850.dtsi | 56 ++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+)
arch/arm/boot/dts/da850-lcdk.dts +31 -0
@@ -155,12 +155,43 @@ }; }; }; + + cvdd: regulator0 { + compatible = "regulator-fixed"; + regulator-name = "cvdd"; + regulator-min-microvolt = <1300000>; + regulator-max-microvolt = <1300000>; + regulator-always-on; + regulator-boot-on; + }; }; &ref_clk { clock-frequency = <24000000>; }; +&cpu { + cpu-supply = <&cvdd>; +}; + +/* LCDK has a fixed CVDD of 1.3V, so only op points >= 300MHz are valid */ + +&opp_100 { + status = "disabled"; +}; + +&opp_200 { + status = "disabled"; +}; + +&opp_375 { + status = "okay"; +}; + +&opp_456 { + status = "okay"; +}; + &pmx_core { status = "okay";
arch/arm/boot/dts/da850-lego-ev3.dts +30 -0
@@ -125,6 +125,15 @@ amp-supply = <&>; }; + cvdd: regulator0 { + compatible = "regulator-fixed"; + regulator-name = "cvdd"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + regulator-boot-on; + }; + /* * This is a 5V current limiting regulator that is shared by USB, * the sensor (input) ports, the motor (output) ports and the A/DC.
@@ -204,6 +213,27 @@ clock-frequency = <24000000>; }; +&cpu { + cpu-supply = <&cvdd>; +}; + +/* since we have a fixed regulator, we can't run at these points */ +&opp_100 { + status = "disabled"; +}; + +&opp_200 { + status = "disabled"; +}; + +/* + * The SoC is actually the 456MHz version, but because of the fixed regulator + * This is the fastest we can go. + */ +&opp_375 { + status = "okay"; +}; + &pmx_core { status = "okay";
arch/arm/boot/dts/da850.dtsi +56 -0
62 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 3/4 ARM: dts: da850-evm: enable cpufreq
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Enable cpufreq-dt support for da850-evm. The cvdd regulator is fixed at 1.2V on this board so disable the lower operating points and enable the 375MHz opp.
--- arch/arm/boot/dts/da850-evm.dts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
arch/arm/boot/dts/da850-evm.dts +30 -0
@@ -151,6 +151,15 @@ system-clock-frequency = <24576000>; }; }; + + cvdd: regulator0 { + compatible = "regulator-fixed"; + regulator-name = "cvdd"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + regulator-boot-on; + }; }; &ecap2 {
@@ -191,6 +200,27 @@ }; }; +&cpu { + cpu-supply = <&cvdd>; +}; + +/* + * DA850-EVM has a fixed CVDD of 1.2V - we cannot go below 300MHz or + * above 375MHz. + */ + +&opp_100 { + status = "disabled"; +}; + +&opp_200 { + status = "disabled"; +}; + +&opp_375 { + status = "okay"; +}; + &sata { status = "okay"; };
Signature · 1 line
2.20.1
PATCH 4/4 ARM: davinci_all_defconfig: Enable CPUFREQ_DT
In reply to Bartosz GolaszewskiFrom: David Lechner <[email protected]>
This sets CONFIG_CPUFREQ_DT=m in davinci_all_defconfig. This is used for frequency scaling on device tree boards.
--- arch/arm/configs/davinci_all_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/davinci_all_defconfig +1 -0
@@ -45,6 +45,7 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=m CONFIG_CPU_FREQ_GOV_POWERSAVE=m CONFIG_CPU_FREQ_GOV_ONDEMAND=m +CONFIG_CPUFREQ_DT=m CONFIG_CPU_IDLE=y CONFIG_NET=y CONFIG_PACKET=y
Signature · 1 line
2.20.1
Quoted 6 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
This series adds cpufreq-dt operating points for da850 boards supported with device tree (da850-lcdk, da850-lego-ev3, da850-evm) and also includes a fix for the da850-evm boardfile which checks an unset variable to determine the highest available frequency for cpufreq.
I can't find any old threads about this, but I recall that there was a problem with the USB OHCI controller breaking when switching frequencies. It didn't happen all of the time, but often enough that it made using cpufreq unusable for me. Is this still a problem?
Also, a big-picture question. On boards with fixed regulators, what is the benefit of enabling frequency scaling? The power savings aspect seems negligible (< 1% in my tests) since the voltage cannot be changed.
czw., 21 mar 2019 o 16:29 David Lechner <[email protected]> napisał(a):
Quoted 10 lines · Bartosz Golaszewski
Quoted 6 lines
From: Bartosz Golaszewski <[email protected]>
This series adds cpufreq-dt operating points for da850 boards supported with device tree (da850-lcdk, da850-lego-ev3, da850-evm) and also includes a fix for the da850-evm boardfile which checks an unset variable to determine the highest available frequency for cpufreq.
Quoted 5 lines
I can't find any old threads about this, but I recall that there was a problem with the USB OHCI controller breaking when switching frequencies. It didn't happen all of the time, but often enough that it made using cpufreq unusable for me. Is this still a problem?
Yes, it's still a problem, but it's bug-compatible with the legacy BSP from TI (project arago). I've spent some time trying to figure out the culprit at the time you were working on the clock driver, but eventually gave up. I think it's some kind of a HW issue. The controller would simple die after a couple transitions.
Bart
Quoted 3 lines
Also, a big-picture question. On boards with fixed regulators, what is the benefit of enabling frequency scaling? The power savings aspect seems negligible (< 1% in my tests) since the voltage cannot be changed.
Re: [PATCH 3/4] ARM: dts: da850-evm: enable cpufreq
In reply to Bartosz GolaszewskiQuoted 5 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Enable cpufreq-dt support for da850-evm. The cvdd regulator is fixed at 1.2V on this board so disable the lower operating points and enable the 375MHz opp.
The board-da850-evm.c file seems to indicate that this regulator is variable and comes from the tps65070. This regulator seems to be missing from the device tree though, even though it has device tree bindings.
Quoted 55 lines
Signed-off-by Bartosz Golaszewski <[email protected]>--- arch/arm/boot/dts/da850-evm.dts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)arch/arm/boot/dts/da850-evm.dts +30
-0@@ -151,6 +151,15 @@ system-clock-frequency = <24576000>; }; }; + + cvdd: regulator0 { + compatible = "regulator-fixed"; + regulator-name = "cvdd"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + regulator-boot-on; + }; }; &ecap2 {@@ -191,6 +200,27 @@ }; }; +&cpu { + cpu-supply = <&cvdd>; +}; + +/* + * DA850-EVM has a fixed CVDD of 1.2V - we cannot go below 300MHz or + * above 375MHz. + */ + +&opp_100 { + status = "disabled"; +}; + +&opp_200 { + status = "disabled"; +}; + +&opp_375 { + status = "okay"; +}; + &sata { status = "okay"; };
Re: [PATCH 2/4] ARM: dts: da850: add cpu node and operating points to DT
In reply to Bartosz GolaszewskiQuoted 6 lines · Bartosz Golaszewski
From: David Lechner <[email protected]>
This adds a cpu node and operating points to the common
da850.dtsifile.Additionally, a regulator is added to the LEGO EV3 board along with some board-specific CPU configuration.
Should mention the LCDK board here as well since it is included in this patch.
Quoted 153 lines
Regulators need to be hooked up on other boards to get them working.
Signed-off-by David Lechner <[email protected]>Signed-off-by Bartosz Golaszewski <[email protected]>--- arch/arm/boot/dts/da850-lcdk.dts | 31 +++++++++++++++ arch/arm/boot/dts/da850-lego-ev3.dts | 30 +++++++++++++++ arch/arm/boot/dts/da850.dtsi | 56 ++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+)arch/arm/boot/dts/da850-lcdk.dts +31
-0@@ -155,12 +155,43 @@ }; }; }; + + cvdd: regulator0 { + compatible = "regulator-fixed"; + regulator-name = "cvdd"; + regulator-min-microvolt = <1300000>; + regulator-max-microvolt = <1300000>; + regulator-always-on; + regulator-boot-on; + }; }; &ref_clk { clock-frequency = <24000000>; }; +&cpu { + cpu-supply = <&cvdd>; +}; + +/* LCDK has a fixed CVDD of 1.3V, so only op points >= 300MHz are valid */ + +&opp_100 { + status = "disabled"; +}; + +&opp_200 { + status = "disabled"; +}; + +&opp_375 { + status = "okay"; +}; + +&opp_456 { + status = "okay"; +}; + &pmx_core { status = "okay";arch/arm/boot/dts/da850-lego-ev3.dts +30
-0@@ -125,6 +125,15 @@ amp-supply = <&>; }; + cvdd: regulator0 { + compatible = "regulator-fixed"; + regulator-name = "cvdd"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + regulator-boot-on; + }; + /* * This is a 5V current limiting regulator that is shared by USB, * the sensor (input) ports, the motor (output) ports and the A/DC.@@ -204,6 +213,27 @@ clock-frequency = <24000000>; }; +&cpu { + cpu-supply = <&cvdd>; +}; + +/* since we have a fixed regulator, we can't run at these points */ +&opp_100 { + status = "disabled"; +}; + +&opp_200 { + status = "disabled"; +}; + +/* + * The SoC is actually the 456MHz version, but because of the fixed regulator + * This is the fastest we can go. + */ +&opp_375 { + status = "okay"; +}; + &pmx_core { status = "okay";arch/arm/boot/dts/da850.dtsi +38
-0@@ -20,6 +20,62 @@ reg = <0xc0000000 0x0>; }; + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu: cpu@0 { + compatible = "arm,arm926ej-s"; + device_type = "cpu"; + reg = <0>; + clocks = <&psc0 14>; + operating-points-v2 = <&opp_table>; + }; + }; + + opp_table: opp-table { + compatible = "operating-points-v2"; + + opp_100: opp100-100000000 { + opp-hz = /bits/ 64 <100000000>; + opp-microvolt = <1000000 950000 1050000>; + }; + + opp_200: opp110-200000000 { + opp-hz = /bits/ 64 <200000000>; + opp-microvolt = <1100000 1050000 1160000>; + }; + + opp_300: opp120-300000000 { + opp-hz = /bits/ 64 <300000000>; + opp-microvolt = <1200000 1140000 1320000>; + }; + + /* + * Original silicon was 300MHz max, so higher frequencies + * need to be enabled on a per-board basis if the chip is + * capable. + */ + + opp_375: opp120-375000000 {
arch/arm/boot/dts/da850.dtsi line 70
Quoted 10 lines
arch/arm/boot/dts/da850.dtsi +10
-0+ status = "disabled"; + opp-hz = /bits/ 64 <375000000>; + opp-microvolt = <1200000 1140000 1320000>; + }; + + opp_415: opp130-415000000 { + status = "disabled"; + opp-hz = /bits/ 64 <415000000>; + opp-microvolt = <1300000 1250000 1350000>; + };
I just made this point (415MHz) up for experimenting with undervolting before going all the way to 456MHz at 1.2V. I'm not sure if it is actually useful to anyone else.
Quoted 12 lines
arch/arm/boot/dts/da850.dtsi +8
-0+ + opp_456: opp130-456000000 { + status = "disabled"; + opp-hz = /bits/ 64 <456000000>; + opp-microvolt = <1300000 1250000 1350000>; + }; + }; + arm { #address-cells = <1>; #size-cells = <1>;
Re: [PATCH 3/4] ARM: dts: da850-evm: enable cpufreq
In reply to David Lechnerczw., 21 mar 2019 o 16:53 David Lechner <[email protected]> napisał(a):
Quoted 13 lines · Bartosz Golaszewski
Quoted 5 lines
From: Bartosz Golaszewski <[email protected]>
Enable cpufreq-dt support for da850-evm. The cvdd regulator is fixed at 1.2V on this board so disable the lower operating points and enable the 375MHz opp.
The
board-da850-evm.cfile seems to indicate that this regulator is variable and comes from the tps65070. This regulator seems to be missing from the device tree though, even though it has device tree bindings.
Oh snap, you're right. I glanced over the 1.2V comment and thought it's the same as other boards, but actually it specifies: .min_uV = 950000, .max_uV = 1350000, so all the operating points should work on that one.
Bart
Quoted 59 lines
Cc Adam FordQuoted 55 lines
Signed-off-by Bartosz Golaszewski <[email protected]>--- arch/arm/boot/dts/da850-evm.dts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)arch/arm/boot/dts/da850-evm.dts +30
-0@@ -151,6 +151,15 @@ system-clock-frequency = <24576000>; }; }; + + cvdd: regulator0 { + compatible = "regulator-fixed"; + regulator-name = "cvdd"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + regulator-boot-on; + }; }; &ecap2 {@@ -191,6 +200,27 @@ }; }; +&cpu { + cpu-supply = <&cvdd>; +}; + +/* + * DA850-EVM has a fixed CVDD of 1.2V - we cannot go below 300MHz or + * above 375MHz. + */ + +&opp_100 { + status = "disabled"; +}; + +&opp_200 { + status = "disabled"; +}; + +&opp_375 { + status = "okay"; +}; + &sata { status = "okay"; };
Re: [PATCH 3/4] ARM: dts: da850-evm: enable cpufreq
czw., 21 mar 2019 o 17:36 Bartosz Golaszewski
<[email protected]> napisał(a):
Quoted 16 lines
czw., 21 mar 2019 o 16:53 David Lechner <[email protected]> napisał(a):
Quoted 13 lines · Bartosz Golaszewski
Quoted 5 lines
From: Bartosz Golaszewski <[email protected]>
Enable cpufreq-dt support for da850-evm. The cvdd regulator is fixed at 1.2V on this board so disable the lower operating points and enable the 375MHz opp.
The
board-da850-evm.cfile seems to indicate that this regulator is variable and comes from the tps65070. This regulator seems to be missing from the device tree though, even though it has device tree bindings.
Quoted 5 lines
Oh snap, you're right. I glanced over the 1.2V comment and thought it's the same as other boards, but actually it specifies: .min_uV = 950000, .max_uV = 1350000, so all the operating points should work on that one.
It seems this pmic is defined here[1] and a skeleton included here[2] and then the regulator constraints follow.
Bart
[1] https://elixir.bootlin.com/linux/latest/source/arch/arm/boot/dts/da850-evm.dts#L224
[2] https://elixir.bootlin.com/linux/latest/source/arch/arm/boot/dts/da850-evm.dts#L326
Quoted 61 lines
Bart
Quoted 59 lines
Cc Adam FordQuoted 55 lines
Signed-off-by Bartosz Golaszewski <[email protected]>--- arch/arm/boot/dts/da850-evm.dts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)arch/arm/boot/dts/da850-evm.dts +30
-0@@ -151,6 +151,15 @@ system-clock-frequency = <24576000>; }; }; + + cvdd: regulator0 { + compatible = "regulator-fixed"; + regulator-name = "cvdd"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + regulator-boot-on; + }; }; &ecap2 {@@ -191,6 +200,27 @@ }; }; +&cpu { + cpu-supply = <&cvdd>; +}; + +/* + * DA850-EVM has a fixed CVDD of 1.2V - we cannot go below 300MHz or + * above 375MHz. + */ + +&opp_100 { + status = "disabled"; +}; + +&opp_200 { + status = "disabled"; +}; + +&opp_375 { + status = "okay"; +}; + &sata { status = "okay"; };
Re: [PATCH 3/4] ARM: dts: da850-evm: enable cpufreq
czw., 21 mar 2019 o 17:44 Bartosz Golaszewski
<[email protected]> napisał(a):
Quoted 25 lines
czw., 21 mar 2019 o 17:36 Bartosz Golaszewski
<[email protected]> napisał(a):Quoted 16 lines
czw., 21 mar 2019 o 16:53 David Lechner <[email protected]> napisał(a):
Quoted 13 lines · Bartosz Golaszewski
Quoted 5 lines
From: Bartosz Golaszewski <[email protected]>
Enable cpufreq-dt support for da850-evm. The cvdd regulator is fixed at 1.2V on this board so disable the lower operating points and enable the 375MHz opp.
The
board-da850-evm.cfile seems to indicate that this regulator is variable and comes from the tps65070. This regulator seems to be missing from the device tree though, even though it has device tree bindings.Quoted 5 lines
Oh snap, you're right. I glanced over the 1.2V comment and thought it's the same as other boards, but actually it specifies: .min_uV = 950000, .max_uV = 1350000, so all the operating points should work on that one.
Quoted 8 lines
It seems this pmic is defined here[1] and a skeleton included here[2] and then the regulator constraints follow.
Bart
[1] https://elixir.bootlin.com/linux/latest/source/arch/arm/boot/dts/da850-evm.dts#L224
[2] https://elixir.bootlin.com/linux/latest/source/arch/arm/boot/dts/da850-evm.dts#L326
Ok I retested and the patch will look like this:
arch/arm/boot/dts/da850-evm.dts +12 -0
@@ -191,6 +191,18 @@ }; }; +&cpu { + cpu-supply = <&vdcdc3_reg>; +}; + +&opp_375 { + status = "okay"; +}; + +&opp_456 { + status = "okay"; +}; + &sata { status = "okay"; };
I'll resend the whole series tomorrow to not spam Sekhar's mailbox anymore.
Bartosz
Quoted 61 lines
Quoted 61 lines
Bart
Quoted 59 lines
Cc Adam FordQuoted 55 lines
Signed-off-by Bartosz Golaszewski <[email protected]>--- arch/arm/boot/dts/da850-evm.dts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)arch/arm/boot/dts/da850-evm.dts +30
-0@@ -151,6 +151,15 @@ system-clock-frequency = <24576000>; }; }; + + cvdd: regulator0 { + compatible = "regulator-fixed"; + regulator-name = "cvdd"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + regulator-boot-on; + }; }; &ecap2 {@@ -191,6 +200,27 @@ }; }; +&cpu { + cpu-supply = <&cvdd>; +}; + +/* + * DA850-EVM has a fixed CVDD of 1.2V - we cannot go below 300MHz or + * above 375MHz. + */ + +&opp_100 { + status = "disabled"; +}; + +&opp_200 { + status = "disabled"; +}; + +&opp_375 { + status = "okay"; +}; + &sata { status = "okay"; };