Skip to contentSkip to conversation

Add CPU Frequency scaling support on Armada 37xx

PATCH New Gregory CLEMENT 3 participants 9 messages Dec 14, 2017 – Dec 17, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover Add CPU Frequency scaling support on Armada 37xx

Hi,

This is the forth version of a series adding the CPU Frequency support on Armada 37xx using DVFS. It is based on the initial work of Evan Wang and Victor Gu.

This time the only change is fixing the last white space issues found by Viresh. This was not mandatory but it is good to start with a clean new file.

The last patch is for arm-soc the arm-soc subsystem through mvebu and update the device tree to support the CPU frequency scaling.

An update on the CPU clock driver is needed in order to take into account the DVFS setting. It's the purpose of an other series already sent, but is no dependencies between the series (for building or at runtime).

Thanks,

Gregory

Changelog:

v1 -> v2:

- using syscon instead of nb_pm for the binding of the North bridge power management unit: reported by Rob Herring

- fix sorting inside the big LITTLE section for the Kconfig: reported by Viresh Kumar

- fix the bogus freq calculation in armada37xx_cpufreq_driver_init, bug reported by Andre Heider

- use dev_pm_opp_remove() on the previous opp if dev_pm_opp_add() failed, reported by Viresh Kumar

- add the Tested-by flag from Andre Heider on "cpufreq: Add DVFS support for Armada 37xx" patch

v2 -> v3:

- move patches "cpufreq: ARM: sort the Kconfig menu", " cpufreq:
sort the drivers in ARM part", "cpufreq: mvebu: Use dev_pm_opp_remove()" in separate series

- add reviewed-by and acked-by flags on the commits

- use space instead of tab in the #define in the armada-37xx-cpufreq.c file.

v3 -> v4

- fix white space in the armada-37xx-cpufreq.c file.

Gregory CLEMENT (4):
dt-bindings: marvell: Add documentation for the North Bridge PM on
Armada 37xx
MAINTAINERS: add new entries for Armada 37xx cpufreq driver
cpufreq: Add DVFS support for Armada 37xx
arm64: dts: marvell: armada-37xx: add nodes allowing cpufreq support

 .../bindings/arm/marvell/armada-37xx.txt           |  19 ++
 MAINTAINERS                                        |   1 +
 arch/arm64/boot/dts/marvell/armada-372x.dtsi       |   1 +
 arch/arm64/boot/dts/marvell/armada-37xx.dtsi       |   7 +
 drivers/cpufreq/Kconfig.arm                        |   7 +
 drivers/cpufreq/Makefile                           |   1 +
 drivers/cpufreq/armada-37xx-cpufreq.c              | 241 +++++++++++++++++++++
 7 files changed, 277 insertions(+)
 create mode 100644 drivers/cpufreq/armada-37xx-cpufreq.c
Signature · 1 line
2.15.1
#1 lore raw

PATCH v4 1/4 dt-bindings: marvell: Add documentation for the North Bridge PM on Armada 37xx

Extend the documentation of the Armada 37xx SoC with the the North Bridge Power Management component.

---
 .../devicetree/bindings/arm/marvell/armada-37xx.txt   | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
Documentation/devicetree/bindings/arm/marvell/armada-37xx.txt +19 -0
index 51336e5fc761..35c3c3460d17 100644
@@ -14,3 +14,22 @@ following property before the previous one:
 Example:
 
 compatible = "marvell,armada-3720-db", "marvell,armada3720", "marvell,armada3710";
+
+
+Power management
+----------------
+
+For power management (particularly DVFS and AVS), the North Bridge
+Power Management component is needed:
+
+Required properties:
+- compatible     : should contain "marvell,armada-3700-nb-pm", "syscon";
+- reg            : the register start and length for the North Bridge
+		    Power Management
+
+Example:
+
+nb_pm: syscon at 14000 {
+	compatible = "marvell,armada-3700-nb-pm", "syscon";
+	reg = <0x14000 0x60>;
+}
Signature · 1 line
2.15.1
#2 lore raw

PATCH v4 2/4 MAINTAINERS: add new entries for Armada 37xx cpufreq driver

In reply to Gregory CLEMENT

This new driver belongs to the mvebu family, update the MAINTAINER file to document it.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index aa71ab52fd76..98dcee849481 100644
@@ -1582,6 +1582,7 @@ F:	arch/arm/boot/dts/kirkwood*
 F:	arch/arm/configs/mvebu_*_defconfig
 F:	arch/arm/mach-mvebu/
 F:	arch/arm64/boot/dts/marvell/armada*
+F:	drivers/cpufreq/armada-37xx-cpufreq.c
 F:	drivers/cpufreq/mvebu-cpufreq.c
 F:	drivers/irqchip/irq-armada-370-xp.c
 F:	drivers/irqchip/irq-mvebu-*
Signature · 1 line
2.15.1
#3 lore raw

PATCH v4 3/4 cpufreq: Add DVFS support for Armada 37xx

In reply to Gregory CLEMENT

This patch adds DVFS support for the Armada 37xx SoCs

There are up to four CPU frequency loads for Armada 37xx controlled by the hardware.

This driver associates the CPU load level to a frequency, then the hardware will switch while selecting a load level.

The hardware also can associate a voltage for each level (AVS support) but it is not yet supported

---
 drivers/cpufreq/Kconfig.arm           |   7 +
 drivers/cpufreq/Makefile              |   1 +
 drivers/cpufreq/armada-37xx-cpufreq.c | 241 ++++++++++++++++++++++++++++++++++
 3 files changed, 249 insertions(+)
 create mode 100644 drivers/cpufreq/armada-37xx-cpufreq.c
drivers/cpufreq/Kconfig.arm +7 -0
index beb8826afbb1..3a88e33b0cfe 100644
@@ -18,6 +18,13 @@ config ACPI_CPPC_CPUFREQ
 
 	  If in doubt, say N.
 
+config ARM_ARMADA_37XX_CPUFREQ
+	tristate "Armada 37xx CPUFreq support"
+	depends on ARCH_MVEBU
+	help
+	  This adds the CPUFreq driver support for Marvell Armada 37xx SoCs.
+	  The Armada 37xx PMU supports 4 frequency and VDD levels.
+
 # big LITTLE core layer and glue drivers
 config ARM_BIG_LITTLE_CPUFREQ
 	tristate "Generic ARM big LITTLE CPUfreq driver"
drivers/cpufreq/Makefile +1 -0
index d762e76887e7..e07715ce8844 100644
@@ -52,6 +52,7 @@ obj-$(CONFIG_ARM_BIG_LITTLE_CPUFREQ)	+= arm_big_little.o
 # LITTLE drivers, so that it is probed last.
 obj-$(CONFIG_ARM_DT_BL_CPUFREQ)		+= arm_big_little_dt.o
 
+obj-$(CONFIG_ARM_ARMADA_37XX_CPUFREQ)	+= armada-37xx-cpufreq.o
 obj-$(CONFIG_ARM_BRCMSTB_AVS_CPUFREQ)	+= brcmstb-avs-cpufreq.o
 obj-$(CONFIG_ACPI_CPPC_CPUFREQ)		+= cppc_cpufreq.o
 obj-$(CONFIG_ARCH_DAVINCI)		+= davinci-cpufreq.o
drivers/cpufreq/armada-37xx-cpufreq.c new file +241 -0

241 lines not on this page · raw message

Signature · 1 line
2.15.1
maintainer
#4 lore raw

PATCH v4 3/4 cpufreq: Add DVFS support for Armada 37xx

Quoted 14 lines · Gregory CLEMENT

This patch adds DVFS support for the Armada 37xx SoCs

There are up to four CPU frequency loads for Armada 37xx controlled by the hardware.

This driver associates the CPU load level to a frequency, then the hardware will switch while selecting a load level.

The hardware also can associate a voltage for each level (AVS support) but it is not yet supported

Quoted 6 lines
---
 drivers/cpufreq/Kconfig.arm           |   7 +
 drivers/cpufreq/Makefile              |   1 +
 drivers/cpufreq/armada-37xx-cpufreq.c | 241 ++++++++++++++++++++++++++++++++++
 3 files changed, 249 insertions(+)
 create mode 100644 drivers/cpufreq/armada-37xx-cpufreq.c

Thanks for taking care of very minor review comments I had. All the patches look good now to me :)

Signature · 1 line
viresh
#5 lore raw

PATCH v4 3/4 cpufreq: Add DVFS support for Armada 37xx

Quoted 22 lines · CET Viresh Kumar
Quoted 14 lines · Gregory CLEMENT

This patch adds DVFS support for the Armada 37xx SoCs

There are up to four CPU frequency loads for Armada 37xx controlled by the hardware.

This driver associates the CPU load level to a frequency, then the hardware will switch while selecting a load level.

The hardware also can associate a voltage for each level (AVS support) but it is not yet supported

Quoted 6 lines
---
 drivers/cpufreq/Kconfig.arm           |   7 +
 drivers/cpufreq/Makefile              |   1 +
 drivers/cpufreq/armada-37xx-cpufreq.c | 241 ++++++++++++++++++++++++++++++++++
 3 files changed, 249 insertions(+)
 create mode 100644 drivers/cpufreq/armada-37xx-cpufreq.c
Quoted 2 lines

Thanks for taking care of very minor review comments I had. All the patches look good now to me :)

All applied, thanks!

#6 lore raw

PATCH v4 3/4 cpufreq: Add DVFS support for Armada 37xx

Quoted 23 lines · CET Rafael J. Wysocki
Quoted 22 lines · CET Viresh Kumar
Quoted 20 lines · Gregory CLEMENT

This patch adds DVFS support for the Armada 37xx SoCs

There are up to four CPU frequency loads for Armada 37xx controlled by the hardware.

This driver associates the CPU load level to a frequency, then the hardware will switch while selecting a load level.

The hardware also can associate a voltage for each level (AVS support) but it is not yet supported

---
 drivers/cpufreq/Kconfig.arm           |   7 +
 drivers/cpufreq/Makefile              |   1 +
 drivers/cpufreq/armada-37xx-cpufreq.c | 241 ++++++++++++++++++++++++++++++++++
 3 files changed, 249 insertions(+)
 create mode 100644 drivers/cpufreq/armada-37xx-cpufreq.c
Quoted 5 lines
Quoted 2 lines

Thanks for taking care of very minor review comments I had. All the patches look good now to me :)

All applied, thanks!

Actually, all except for the [4/4] as you applied it earlier.

Thanks!

#7 lore raw

PATCH v4 4/4 arm64: dts: marvell: armada-37xx: add nodes allowing cpufreq support

In reply to Gregory CLEMENT

In order to be able to use cpu freq, we need to associate a clock to each CPU and to expose the power management registers.

---
 arch/arm64/boot/dts/marvell/armada-372x.dtsi | 1 +
 arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 7 +++++++
 2 files changed, 8 insertions(+)
arch/arm64/boot/dts/marvell/armada-372x.dtsi +1 -0
index 59d7557d3b1b..2554e0baea6b 100644
@@ -56,6 +56,7 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a53","arm,armv8";
 			reg = <0x1>;
+			clocks = <&nb_periph_clk 16>;
 			enable-method = "psci";
 		};
 	};
arch/arm64/boot/dts/marvell/armada-37xx.dtsi +7 -0
index 90c26d616a54..3056d7168e0b 100644
@@ -65,6 +65,7 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a53", "arm,armv8";
 			reg = <0>;
+			clocks = <&nb_periph_clk 16>;
 			enable-method = "psci";
 		};
 	};
@@ -234,6 +235,12 @@
 				};
 			};
 
+			nb_pm: syscon at 14000 {
+				compatible = "marvell,armada-3700-nb-pm",
+					     "syscon";
+				reg = <0x14000 0x60>;
+			};
+
 			pinctrl_sb: pinctrl at 18800 {
 				compatible = "marvell,armada3710-sb-pinctrl",
 					     "syscon", "simple-mfd";
Signature · 1 line
2.15.1
#8 lore raw

PATCH v4 4/4 arm64: dts: marvell: armada-37xx: add nodes allowing cpufreq support

Hi,

Quoted 4 lines · Gregory CLEMENT

In order to be able to use cpu freq, we need to associate a clock to each CPU and to expose the power management registers.

Applied on mvebu/dt64

Gregory

Quoted 45 lines
---
 arch/arm64/boot/dts/marvell/armada-372x.dtsi | 1 +
 arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 7 +++++++
 2 files changed, 8 insertions(+)
arch/arm64/boot/dts/marvell/armada-372x.dtsi +1 -0
index 59d7557d3b1b..2554e0baea6b 100644
@@ -56,6 +56,7 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a53","arm,armv8";
 			reg = <0x1>;
+			clocks = <&nb_periph_clk 16>;
 			enable-method = "psci";
 		};
 	};
arch/arm64/boot/dts/marvell/armada-37xx.dtsi +7 -0
index 90c26d616a54..3056d7168e0b 100644
@@ -65,6 +65,7 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a53", "arm,armv8";
 			reg = <0>;
+			clocks = <&nb_periph_clk 16>;
 			enable-method = "psci";
 		};
 	};
@@ -234,6 +235,12 @@
 				};
 			};
 
+			nb_pm: syscon at 14000 {
+				compatible = "marvell,armada-3700-nb-pm",
+					     "syscon";
+				reg = <0x14000 0x60>;
+			};
+
 			pinctrl_sb: pinctrl at 18800 {
 				compatible = "marvell,armada3710-sb-pinctrl",
 					     "syscon", "simple-mfd";
Signature · 1 line
2.15.1
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com