linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: richard.zhao@linaro.org (Richard Zhao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/7] arm/imx6q: add cpufreq support
Date: Mon, 12 Dec 2011 11:42:31 +0800	[thread overview]
Message-ID: <1323661352-10291-7-git-send-email-richard.zhao@linaro.org> (raw)
In-Reply-To: <1323661352-10291-1-git-send-email-richard.zhao@linaro.org>

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/mach-imx/Kconfig        |    1 +
 arch/arm/mach-imx/Makefile       |    2 +-
 arch/arm/mach-imx/cpu_op-imx6q.c |   78 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-imx/cpu_op-imx6q.c

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index fbd414b..7d813a3 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -837,6 +837,7 @@ config SOC_IMX6Q
 	select ARM_GIC
 	select CACHE_L2X0
 	select CPU_V7
+	select ARCH_HAS_CPUFREQ
 	select HAVE_ARM_SCU
 	select HAVE_IMX_GPC
 	select HAVE_IMX_MMDC
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 9cf630a..2dfe4a7 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -72,7 +72,7 @@ AFLAGS_head-v7.o :=-Wa,-march=armv7-a
 obj-$(CONFIG_SMP) += platsmp.o
 obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
 obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
-obj-$(CONFIG_SOC_IMX6Q) += clock-imx6q.o mach-imx6q.o pm-imx6q.o
+obj-$(CONFIG_SOC_IMX6Q) += clock-imx6q.o mach-imx6q.o pm-imx6q.o cpu_op-imx6q.o
 
 # i.MX5 based machines
 obj-$(CONFIG_MACH_MX51_BABBAGE) += mach-mx51_babbage.o
diff --git a/arch/arm/mach-imx/cpu_op-imx6q.c b/arch/arm/mach-imx/cpu_op-imx6q.c
new file mode 100644
index 0000000..8807b96
--- /dev/null
+++ b/arch/arm/mach-imx/cpu_op-imx6q.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ */
+
+/*
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <mach/hardware.h>
+
+static u32 arm_max_freq;
+static int num_cpu_op;
+
+/* working point(wp): 0 - 1GHzMHz; 1 - 800MHz, 3 - 400MHz, 4  - 160MHz */
+static struct cpu_op mx6q_cpu_op_1G[] = {
+	{
+	 .cpu_rate = 996000000,
+	 .cpu_voltage = 1225000,},
+	{
+	 .cpu_rate = 792000000,
+	 .cpu_voltage = 1100000,},
+	{
+	  .cpu_rate = 396000000,
+	  .cpu_voltage = 950000,},
+	{
+	 .cpu_rate = 198000000,
+	 .cpu_voltage = 850000,},
+};
+
+static struct cpu_op mx6q_cpu_op[] = {
+	{
+	 .cpu_rate = 792000000,
+	 .cpu_voltage = 1100000,},
+	{
+	  .cpu_rate = 396000000,
+	  .cpu_voltage = 950000,},
+	{
+	 .cpu_rate = 198000000,
+	 .cpu_voltage = 850000,},
+};
+
+struct cpu_op *mx6q_get_cpu_op(int *op)
+{
+	if (arm_max_freq == 1000) {
+		*op =  num_cpu_op = ARRAY_SIZE(mx6q_cpu_op_1G);
+		return mx6q_cpu_op_1G;
+	} else {
+		*op =  num_cpu_op = ARRAY_SIZE(mx6q_cpu_op);
+		return mx6q_cpu_op;
+	}
+}
+
+static int __init mx6q_cpu_op_init(void)
+{
+	get_cpu_op = mx6q_get_cpu_op;
+	return 0;
+}
+
+core_initcall(mx6q_cpu_op_init);
+
+static int __init set_arm_max_freq(char *p)
+{
+	if (strncmp(p, "1000", 4) == 0)
+		arm_max_freq = 1000;
+	else if (strncmp(p, "800", 3) == 0)
+		arm_max_freq = 800;
+	return 0;
+}
+
+early_param("arm_freq", set_arm_max_freq);
-- 
1.7.5.4

  parent reply	other threads:[~2011-12-12  3:42 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12  3:42 [PATCH 0/7] arm/imx6: add imx6q sabrelite board and imx6q cpufreq support Richard Zhao
2011-12-12  3:42 ` [PATCH 1/7] arm/imx6: add imx6q sabrelite board support Richard Zhao
2011-12-12  5:40   ` Shawn Guo
2011-12-12  5:50     ` Richard Zhao
2011-12-12  6:08       ` Shawn Guo
2011-12-12  7:50         ` Richard Zhao
2011-12-12  8:56           ` Shawn Guo
2011-12-12 10:12     ` Sascha Hauer
2011-12-12 10:18       ` Richard Zhao
2011-12-12 10:26         ` Sascha Hauer
2011-12-12 13:41     ` Rob Herring
2011-12-12 13:49       ` Richard Zhao
2011-12-12 14:44         ` Shawn Guo
2011-12-13  0:54           ` Richard Zhao
2011-12-12 20:39     ` Troy Kisky
2011-12-13  0:52       ` Richard Zhao
2011-12-13  1:28         ` Shawn Guo
2011-12-13  1:32           ` Richard Zhao
2011-12-12  3:42 ` [PATCH 2/7] arm/imx: cpufreq: add multi-core support Richard Zhao
2011-12-12  3:42 ` [PATCH 3/7] ARM: imx: fix cpufreq build errors Richard Zhao
2011-12-12  4:47   ` Richard Zhao
2011-12-12  3:42 ` [PATCH 4/7] arm/imx: fix cpufreq section mismatch Richard Zhao
2011-12-12  3:42 ` [PATCH 5/7] arm/imx: add cpu_voltage to cpu_op Richard Zhao
2011-12-12  3:42 ` Richard Zhao [this message]
2011-12-12 12:44   ` [PATCH 6/7] arm/imx6q: add cpufreq support Sascha Hauer
2011-12-12 13:46     ` Richard Zhao
2011-12-12 14:28       ` Sascha Hauer
2011-12-12 14:10   ` Russell King - ARM Linux
2011-12-12 14:15     ` Richard Zhao
2011-12-12  3:42 ` [PATCH 7/7] arm/imx6q: register arm_clk to clkdev Richard Zhao
2011-12-13  1:34   ` Shawn Guo
2011-12-13  1:33     ` Richard Zhao
2011-12-12  5:48 ` [PATCH 0/7] arm/imx6: add imx6q sabrelite board and imx6q cpufreq support Shawn Guo
2011-12-12  5:56   ` Richard Zhao
2011-12-12 10:56     ` Richard Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1323661352-10291-7-git-send-email-richard.zhao@linaro.org \
    --to=richard.zhao@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).