Skip to contentSkip to conversation

cpufreq: Add a cpufreq driver for Marvell Dove

PATCH Superseded Andrew Lunn 4 participants 14 messages Oct 31, 2013 – Nov 24, 2013

Subsystems (5)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Andrew Lunn

author maintainer
#0 lore raw

PATCH v3 1/4 cpufreq: Add a cpufreq driver for Marvell Dove

The Marvell Dove SoC can run the CPU at two frequencies. The high frequencey is from a PLL, while the lower is the same as the DDR clock. Add a cpufreq driver to swap between these frequences.

---
Sort header files
Remove unneeded header files
Notify only on change
Use get_cpu_device(0), devm_clk_get()
Use platform_get_resource_byname()
Error check clk_prepare_enable()
Comment the interrupt handler

Add more comments to the interrupt handler.

---
 drivers/cpufreq/Kconfig.arm    |   5 +
 drivers/cpufreq/Makefile       |   1 +
 drivers/cpufreq/dove-cpufreq.c | 280 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 286 insertions(+)
 create mode 100644 drivers/cpufreq/dove-cpufreq.c
drivers/cpufreq/Kconfig.arm +5 -0
index 701ec95ce954..9560384ef59f 100644
@@ -8,6 +8,11 @@ config ARM_BIG_LITTLE_CPUFREQ
 	help
 	  This enables the Generic CPUfreq driver for ARM big.LITTLE platforms.
 
+config ARM_DOVE_CPUFREQ
+	def_bool ARCH_DOVE && OF
+	help
+	  This adds the CPUFreq driver for Marvell Dove SoCs.
+
 config ARM_DT_BL_CPUFREQ
 	tristate "Generic probing via DT for ARM big LITTLE CPUfreq driver"
 	depends on ARM_BIG_LITTLE_CPUFREQ && OF
drivers/cpufreq/Makefile +1 -0
index b7948bbbbf1f..5956661b8d60 100644
@@ -49,6 +49,7 @@ obj-$(CONFIG_ARM_DT_BL_CPUFREQ)		+= arm_big_little_dt.o
 
 obj-$(CONFIG_ARCH_DAVINCI_DA850)	+= davinci-cpufreq.o
 obj-$(CONFIG_UX500_SOC_DB8500)		+= dbx500-cpufreq.o
+obj-$(CONFIG_ARM_DOVE_CPUFREQ)		+= dove-cpufreq.o
 obj-$(CONFIG_ARM_EXYNOS_CPUFREQ)	+= exynos-cpufreq.o
 obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ)	+= exynos4210-cpufreq.o
 obj-$(CONFIG_ARM_EXYNOS4X12_CPUFREQ)	+= exynos4x12-cpufreq.o
drivers/cpufreq/dove-cpufreq.c new file +280 -0

280 lines not on this page · raw message

Signature · 1 line
1.8.4.rc3
author maintainer
#1 lore raw

PATCH v3 2/4 mvebu: Dove: Instantiate cpufreq driver.

Add a platform driver definition to instantiate the dove cpufreq driver. Also indicate the ARCH has cpufreq support, so allowing the cpufreq framework to be enabled.

---
Make resource names consistent.
Fix length of ranges

---
 arch/arm/Kconfig                       |  1 +
 arch/arm/mach-dove/board-dt.c          |  2 ++
 arch/arm/mach-dove/common.c            | 36 ++++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/common.h            |  1 +
 arch/arm/mach-dove/include/mach/dove.h |  1 +
 5 files changed, 41 insertions(+)
arch/arm/Kconfig +1 -0
index 1ad6fb6c094d..774441504092 100644
@@ -495,6 +495,7 @@ config ARCH_IXP4XX
 
 config ARCH_DOVE
 	bool "Marvell Dove"
+	select ARCH_HAS_CPUFREQ
 	select ARCH_REQUIRE_GPIOLIB
 	select CPU_PJ4
 	select GENERIC_CLOCKEVENTS
arch/arm/mach-dove/board-dt.c +2 -0
index 49f72a848423..98202de399c0 100644
@@ -70,6 +70,8 @@ static void __init dove_dt_init(void)
 	/* Setup clocks for legacy devices */
 	dove_legacy_clk_init();
 
+	dove_cpufreq_init();
+
 	/* Internal devices not ported to DT yet */
 	dove_pcie_init(1, 1);
 
arch/arm/mach-dove/common.c +36 -0
index c122bcff9f7c..323fcd4b27b6 100644
@@ -344,6 +344,42 @@ void __init dove_sdio1_init(void)
 	platform_device_register(&dove_sdio1);
 }
 
+/*****************************************************************************
+ * CPU Frequency
+ ****************************************************************************/
+static struct resource dove_cpufreq_resources[] = {
+	[0] = {
+		.start  = DOVE_PMU_PHYS_BASE,
+		.end    = DOVE_PMU_PHYS_BASE + 0x7,
+		.flags  = IORESOURCE_MEM,
+		.name   = "cpufreq: DFS"
+	},
+	[1] = {
+		.start  = DOVE_PMU_PHYS_BASE + 0x8000,
+		.end    = DOVE_PMU_PHYS_BASE + 0x8003,
+		.flags  = IORESOURCE_MEM,
+		.name   = "cpufreq: PMU CR"
+	},
+	[2] = {
+		.start  = DOVE_PMU_PHYS_BASE + 0x0044,
+		.end    = DOVE_PMU_PHYS_BASE + 0x0047,
+		.flags  = IORESOURCE_MEM,
+		.name   = "cpufreq: PMU Clk Div"
+	},
+};
+
+static struct platform_device dove_cpufreq_device = {
+	.name		= "dove-cpufreq",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(dove_cpufreq_resources),
+	.resource	= dove_cpufreq_resources,
+};
+
+void __init dove_cpufreq_init(void)
+{
+	platform_device_register(&dove_cpufreq_device);
+}
+
 void __init dove_setup_cpu_wins(void)
 {
 	/*
arch/arm/mach-dove/common.h +1 -0
index 1d725224d146..5c9a77bdd442 100644
@@ -44,6 +44,7 @@ void dove_spi1_init(void);
 void dove_i2c_init(void);
 void dove_sdio0_init(void);
 void dove_sdio1_init(void);
+void dove_cpufreq_init(void);
 void dove_restart(enum reboot_mode, const char *);
 
 #endif
arch/arm/mach-dove/include/mach/dove.h +1 -0
index 0c4b35f4ee5b..48db186ae6bc 100644
@@ -144,6 +144,7 @@
 #define  DOVE_SD0_GPIO_SEL		(1 << 0)
 
 /* Power Management */
+#define DOVE_PMU_PHYS_BASE	(DOVE_SB_REGS_PHYS_BASE + 0xd0000)
 #define DOVE_PMU_VIRT_BASE	(DOVE_SB_REGS_VIRT_BASE + 0xd0000)
 #define DOVE_PMU_SIG_CTRL	(DOVE_PMU_VIRT_BASE + 0x802c)
 
Signature · 1 line
1.8.4.rc3
author maintainer
#3 lore raw

PATCH v3 3/4 mvebu: Dove: Enable cpufreq driver in defconfig

In reply to Andrew Lunn

Add cpufreq to dove_defconfig, so it is built by default.

---
 arch/arm/configs/dove_defconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/dove_defconfig +2 -0
index 110105476848..3d9235017e89 100644
@@ -22,6 +22,8 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ARM_APPENDED_DTB=y
 CONFIG_ARM_ATAG_DTB_COMPAT=y
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
 CONFIG_VFP=y
 CONFIG_NET=y
 CONFIG_PACKET=y
Signature · 1 line
1.8.4.rc3
author maintainer
#5 lore raw

PATCH v3 4/4 mvebu: Dove: Add clocks and DFS interrupt to cpu node in DT.

In reply to Andrew Lunn

The dove-cpufreq driver needs access to the DDR and CPU clock. There is also an interrupt generated when the DFS hardware completes a change of frequencey. Add these to the cpu node in DT.

---
 arch/arm/boot/dts/dove.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/dove.dtsi +4 -0
index 1fd615d27532..e96d7a6a2fb8 100644
@@ -19,6 +19,10 @@
 			device_type = "cpu";
 			next-level-cache = <&l2>;
 			reg = <0>;
+			clocks = <&core_clk 1>, <&core_clk 3>;
+			clock-names = "cpu_clk", "ddrclk";
+			interrupt-parent = <&pmu_intc>;
+			interrupts = <0>;
 		};
 	};
 
Signature · 1 line
1.8.4.rc3
#6 lore raw

PATCH v3 4/4 mvebu: Dove: Add clocks and DFS interrupt to cpu node in DT.

Quoted 6 lines · Andrew Lunn

The dove-cpufreq driver needs access to the DDR and CPU clock. There is also an interrupt generated when the DFS hardware completes a change of frequencey. Add these to the cpu node in DT.

I need someone with DT bindings knowledge to ACK this for me.

Thanks!

Quoted 20 lines
---
 arch/arm/boot/dts/dove.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/dove.dtsi +4 -0
index 1fd615d27532..e96d7a6a2fb8 100644
@@ -19,6 +19,10 @@
 			device_type = "cpu";
 			next-level-cache = <&l2>;
 			reg = <0>;
+			clocks = <&core_clk 1>, <&core_clk 3>;
+			clock-names = "cpu_clk", "ddrclk";
+			interrupt-parent = <&pmu_intc>;
+			interrupts = <0>;
 		};
 	};
 
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
maintainer
#7 lore raw

PATCH v3 4/4 mvebu: Dove: Add clocks and DFS interrupt to cpu node in DT.

Quoted 9 lines · Rafael J. Wysocki
Quoted 6 lines · Andrew Lunn

The dove-cpufreq driver needs access to the DDR and CPU clock. There is also an interrupt generated when the DFS hardware completes a change of frequencey. Add these to the cpu node in DT.

I need someone with DT bindings knowledge to ACK this for me.

I can do that, but this set has to be rebased over all the latest developments in cpufreq core before getting posted again..

@Andrew: you can add my: Acked-by: Viresh Kumar <[email protected]> for this patch..

author maintainer
#8 lore raw

PATCH v3 4/4 mvebu: Dove: Add clocks and DFS interrupt to cpu node in DT.

Quoted 6 lines · Viresh Kumar
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines · Andrew Lunn

The dove-cpufreq driver needs access to the DDR and CPU clock. There is also an interrupt generated when the DFS hardware completes a change of frequencey. Add these to the cpu node in DT.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I need someone with DT bindings knowledge to ACK this for me.

I can do that

Thanks.

, but this set has to be rebased over all the latest developments

Quoted 1 line

in cpufreq core before getting posted again..

I will wait for -rc1 and rebase.

Thanks
Andrew

#9 lore raw

PATCH v3 4/4 mvebu: Dove: Add clocks and DFS interrupt to cpu node in DT.

Quoted 12 lines · Andrew Lunn
Quoted 11 lines · Viresh Kumar
Quoted 9 lines · Rafael J. Wysocki
Quoted 6 lines · Andrew Lunn

The dove-cpufreq driver needs access to the DDR and CPU clock. There is also an interrupt generated when the DFS hardware completes a change of frequencey. Add these to the cpu node in DT.

I need someone with DT bindings knowledge to ACK this for me.

Quoted 8 lines
Quoted 1 line

I can do that

Thanks.

, but this set has to be rebased over all the latest developments

Quoted 1 line

in cpufreq core before getting posted again..

I will wait for -rc1 and rebase.

Actually, it is possible that 3.12-rc8 will be released this weekend. If that happens, please rebase your patchset on top of the current linux-next and resubmit it next week.

Thanks!

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
author maintainer
#10 lore raw

PATCH v3 4/4 mvebu: Dove: Add clocks and DFS interrupt to cpu node in DT.

Quoted 17 lines · Rafael J. Wysocki
Quoted 16 lines · Andrew Lunn
Quoted 6 lines · Viresh Kumar
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines · Andrew Lunn

The dove-cpufreq driver needs access to the DDR and CPU clock. There is also an interrupt generated when the DFS hardware completes a change of frequencey. Add these to the cpu node in DT.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I need someone with DT bindings knowledge to ACK this for me.

I can do that

Thanks.

Quoted 8 lines
Quoted 4 lines

, but this set has to be rebased over all the latest developments

Quoted 1 line

in cpufreq core before getting posted again..

I will wait for -rc1 and rebase.

Actually, it is possible that 3.12-rc8 will be released this weekend. If that happens, please rebase your patchset on top of the current linux-next and resubmit it next week.

Hi Rafael

Just be to sure, since we have had problems with terminology before. Do you mean the The linux-next, or your linux next branch?

Thanks
Andrew

#11 lore raw

PATCH v3 4/4 mvebu: Dove: Add clocks and DFS interrupt to cpu node in DT.

Quoted 23 lines · Andrew Lunn
Quoted 22 lines · Rafael J. Wysocki
Quoted 20 lines · Andrew Lunn
Quoted 6 lines · Viresh Kumar
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines · Andrew Lunn

The dove-cpufreq driver needs access to the DDR and CPU clock. There is also an interrupt generated when the DFS hardware completes a change of frequencey. Add these to the cpu node in DT.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I need someone with DT bindings knowledge to ACK this for me.

I can do that

Thanks.

, but this set has to be rebased over all the latest developments

Quoted 1 line

in cpufreq core before getting posted again..

I will wait for -rc1 and rebase.

Quoted 8 lines
Quoted 3 lines

Actually, it is possible that 3.12-rc8 will be released this weekend. If that happens, please rebase your patchset on top of the current linux-next and resubmit it next week.

Hi Rafael

Just be to sure, since we have had problems with terminology before. Do you mean the The linux-next, or your linux next branch?

That shouldn't matter a lot at this point I think. Generally, if I'm supposed to take the patches, it's safer to rebase them against my linux-next branch.

Thanks!

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#12 lore raw

PATCH v3 4/4 mvebu: Dove: Add clocks and DFS interrupt to cpu node in DT.

In reply to Andrew Lunn
Quoted 12 lines · Andrew Lunn
Quoted 11 lines · Viresh Kumar
Quoted 9 lines · Rafael J. Wysocki
Quoted 6 lines · Andrew Lunn

The dove-cpufreq driver needs access to the DDR and CPU clock. There is also an interrupt generated when the DFS hardware completes a change of frequencey. Add these to the cpu node in DT.

I need someone with DT bindings knowledge to ACK this for me.

Quoted 8 lines
Quoted 1 line

I can do that

Thanks.

Quoted 2 lines

, but this set has to be rebased over all the latest developments in cpufreq core before getting posted again..

I will wait for -rc1 and rebase.

ping.

thx,

Jason.

maintainer
#13 lore raw

PATCH v3 1/4 cpufreq: Add a cpufreq driver for Marvell Dove

In reply to Andrew Lunn
Quoted 6 lines · Andrew Lunn

The Marvell Dove SoC can run the CPU at two frequencies. The high frequencey is from a PLL, while the lower is the same as the DDR clock. Add a cpufreq driver to swap between these frequences.

As I have said early, you need to rebase this now over linux-next, which has got over 150 patches for cpufreq for 3.13..

Over that following patchset would be included in linux-next as soon as 3.13-rc1 or rc2 is going to be released and so probably before your patch makes it:

https://lkml.org/lkml/2013/10/30/553

So, please rebase your driver over linux-next & above patchset and resend again..