Skip to contentSkip to conversation

ARM: imx-cpufreq cleanups and imx27 support

PATCH New Markus Pargmann 1 participant 5 messages Feb 25, 2013

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

PATCH 1/1 ARM: imx-cpufreq cleanups and imx27 support

Hi,

This patch series contains some cleanups and bugfixes for imx-cpufreq and support for imx27 cpufreq.

Markus

#1 lore raw

PATCH 1/4 ARM: imx: Add cpufreq support for i.MX27

From: Christian Hemp <[email protected]>

Adding cpu scaling support for the i.MX27. It supports 399MHz and 133MHz now.

[mpa: rebase to 3.8-rc, adaption for clock framework, cleanup]

---
 arch/arm/mach-imx/Kconfig       |  1 +
 arch/arm/mach-imx/Makefile      |  3 +++
 arch/arm/mach-imx/clk-imx27.c   |  5 +++++
 arch/arm/mach-imx/cpu_op-mx27.c | 37 +++++++++++++++++++++++++++++++++++++
 arch/arm/mach-imx/cpu_op-mx27.h | 19 +++++++++++++++++++
 5 files changed, 65 insertions(+)
 create mode 100644 arch/arm/mach-imx/cpu_op-mx27.c
 create mode 100644 arch/arm/mach-imx/cpu_op-mx27.h
arch/arm/mach-imx/Kconfig +1 -0
index 0a2349d..5184f12 100644
@@ -131,6 +131,7 @@ config SOC_IMX25
 
 config SOC_IMX27
 	bool
+	select ARCH_HAS_CPUFREQ
 	select COMMON_CLK
 	select CPU_ARM926T
 	select IMX_HAVE_IOMUX_V1
arch/arm/mach-imx/Makefile +3 -0
index 0634b31..3118ed4 100644
@@ -7,6 +7,9 @@ obj-$(CONFIG_SOC_IMX25) += clk-imx25.o mm-imx25.o ehci-imx25.o cpu-imx25.o
 
 obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o
 obj-$(CONFIG_SOC_IMX27) += clk-imx27.o mm-imx27.o ehci-imx27.o
+ifdef CONFIG_SOC_IMX27
+obj-$(CONFIG_CPU_FREQ_IMX) += cpu_op-mx27.o
+endif
 
 obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o clk-imx31.o iomux-imx31.o ehci-imx31.o pm-imx3.o
 obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clk-imx35.o ehci-imx35.o pm-imx3.o
arch/arm/mach-imx/clk-imx27.c +5 -0
index 1ffe3b534..d98bfb0 100644
@@ -9,6 +9,7 @@
 #include "clk.h"
 #include "common.h"
 #include "hardware.h"
+#include "cpu_op-mx27.h"
 
 #define IO_ADDR_CCM(off)	(MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR + (off)))
 
@@ -91,6 +92,10 @@ int __init mx27_clocks_init(unsigned long fref)
 {
 	int i;
 
+#if defined(CONFIG_CPU_FREQ_IMX)
+	get_cpu_op = mx27_get_cpu_op;
+#endif
+
 	clk[dummy] = imx_clk_fixed("dummy", 0);
 	clk[ckih] = imx_clk_fixed("ckih", fref);
 	clk[ckil] = imx_clk_fixed("ckil", 32768);
arch/arm/mach-imx/cpu_op-mx27.c new file +37 -0
new file mode 100644
index 0000000..fa2d743
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2011 Teresa G?mez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include <linux/bug.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+
+#include "hardware.h"
+
+static struct cpu_op mx27_cpu_op[] = {
+	{
+		.cpu_rate = 133000000,
+	}, {
+		.cpu_rate = 399000000,
+	},
+};
+
+struct cpu_op *mx27_get_cpu_op(int *op)
+{
+	*op = ARRAY_SIZE(mx27_cpu_op);
+	return mx27_cpu_op;
+}
arch/arm/mach-imx/cpu_op-mx27.h new file +19 -0
new file mode 100644
index 0000000..4e9162a
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2011 Teresa G?mez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+extern struct cpu_op *mx27_get_cpu_op(int *op);
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 2/4 ARM: imx: Cleanup cpufreq i.MX5

In reply to Markus Pargmann

Build only if cpufreq driver is enabled.
Cleanup cpu_op files.

---
 arch/arm/mach-imx/Makefile      | 5 ++++-
 arch/arm/mach-imx/cpu_op-mx51.c | 6 ++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
arch/arm/mach-imx/Makefile +4 -1
index 3118ed4..288e748 100644
@@ -15,7 +15,10 @@ obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o clk-imx31.o iomux-imx31.o ehci-
 obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clk-imx35.o ehci-imx35.o pm-imx3.o
 
 imx5-pm-$(CONFIG_PM) += pm-imx5.o
-obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o mm-imx5.o clk-imx51-imx53.o ehci-imx5.o $(imx5-pm-y) cpu_op-mx51.o
+obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o mm-imx5.o clk-imx51-imx53.o ehci-imx5.o $(imx5-pm-y)
+ifdef CONFIG_SOC_IMX5
+obj-$(CONFIG_CPU_FREQ_IMX) += cpu_op-mx51.o
+endif
 
 obj-$(CONFIG_COMMON_CLK) += clk-pllv1.o clk-pllv2.o clk-pllv3.o clk-gate2.o \
 			    clk-pfd.o clk-busy.o clk.o
arch/arm/mach-imx/cpu_op-mx51.c +4 -2
index b9ef692..a7f28fd 100644
@@ -19,9 +19,11 @@
 
 static struct cpu_op mx51_cpu_op[] = {
 	{
-	.cpu_rate = 160000000,},
+		.cpu_rate = 160000000,
+	},
 	{
-	.cpu_rate = 800000000,},
+		.cpu_rate = 800000000,
+	},
 };
 
 struct cpu_op *mx51_get_cpu_op(int *op)
Signature · 1 line
1.8.1.2
#3 lore raw

PATCH 3/4 ARM: bugfix i.MX cpufreq clock id

In reply to Markus Pargmann

The clock id changed some time ago with the new clock framework. The cpufreq driver still uses "cpu_clk" while all devices register their cpu clock devices as "cpu".

---
 arch/arm/mach-imx/cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/cpufreq.c +1 -1
index d8c75c3..9dae54e 100644
@@ -111,7 +111,7 @@ static int mxc_cpufreq_init(struct cpufreq_policy *policy)
 	if (!get_cpu_op)
 		return -EINVAL;
 
-	cpu_clk = clk_get(NULL, "cpu_clk");
+	cpu_clk = clk_get(NULL, "cpu");
 	if (IS_ERR(cpu_clk)) {
 		printk(KERN_ERR "%s: failed to get cpu clock\n", __func__);
 		return PTR_ERR(cpu_clk);
Signature · 1 line
1.8.1.2
#4 lore raw

PATCH 4/4 ARM: imx: cpufreq doesn't work as module

In reply to Markus Pargmann

The function get_cpu_op is always set with initialization of the specific architecture. A module is always loaded after that init code, so it does not work.

---
 arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
index 67874b8..d8ad11d 100644
@@ -2128,7 +2128,7 @@ if ARCH_HAS_CPUFREQ
 source "drivers/cpufreq/Kconfig"
 
 config CPU_FREQ_IMX
-	tristate "CPUfreq driver for i.MX CPUs"
+	bool "CPUfreq driver for i.MX CPUs"
 	depends on ARCH_MXC && CPU_FREQ
 	select CPU_FREQ_TABLE
 	help
Signature · 1 line
1.8.1.2