summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq
diff options
context:
space:
mode:
authorKoen Kooi <koen@dominion.thruhere.net>2011-05-21 20:31:36 +0200
committerKoen Kooi <koen@dominion.thruhere.net>2011-05-23 09:34:57 +0200
commitd697ad0981c5e1d44ab7dd071e61c1d70e0bfe72 (patch)
tree64b02849035cc5dbd73f273859d7ca13e879d1cb /recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq
parent1735237550d85da337ea57cb5d6be9ccc8c0355c (diff)
downloadmeta-ti-d697ad0981c5e1d44ab7dd071e61c1d70e0bfe72.tar.gz
linux-omap 2.6.39: add cpufreq support and tweak beagleboard expansionboard patches
make it the default for beagleboard Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq')
-rw-r--r--recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0044-OMAP-CPUfreq-ensure-driver-initializes-after-cpufreq.patch27
-rw-r--r--recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0045-OMAP-CPUfreq-ensure-policy-is-fully-initialized.patch31
-rw-r--r--recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0046-OMAP3-PM-CPUFreq-driver-for-OMAP3.patch263
-rw-r--r--recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0047-OMAP-PM-CPUFREQ-Fix-conditional-compilation.patch32
-rw-r--r--recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0048-cpufreq-fixup-after-new-OPP-layer-merged.patch33
-rw-r--r--recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0049-OMAP-cpufreq-Split-OMAP1-and-OMAP2PLUS-CPUfreq-drive.patch669
-rw-r--r--recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0050-OMAP2PLUS-cpufreq-Add-SMP-support-to-cater-OMAP4430.patch170
-rw-r--r--recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0051-OMAP2PLUS-cpufreq-Fix-typo-when-attempting-to-set-mp.patch29
8 files changed, 1254 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0044-OMAP-CPUfreq-ensure-driver-initializes-after-cpufreq.patch b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0044-OMAP-CPUfreq-ensure-driver-initializes-after-cpufreq.patch
new file mode 100644
index 00000000..a8da2573
--- /dev/null
+++ b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0044-OMAP-CPUfreq-ensure-driver-initializes-after-cpufreq.patch
@@ -0,0 +1,27 @@
1From 48ec8ab4a64104f7ecc9dabb9e23e2c3d0d1feee Mon Sep 17 00:00:00 2001
2From: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
3Date: Wed, 11 Aug 2010 17:02:43 -0700
4Subject: [PATCH 44/59] OMAP: CPUfreq: ensure driver initializes after cpufreq framework and governors
5
6Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
7Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
8---
9 arch/arm/plat-omap/cpu-omap.c | 2 +-
10 1 files changed, 1 insertions(+), 1 deletions(-)
11
12diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
13index da4f68d..cd09d4b 100644
14--- a/arch/arm/plat-omap/cpu-omap.c
15+++ b/arch/arm/plat-omap/cpu-omap.c
16@@ -160,7 +160,7 @@ static int __init omap_cpufreq_init(void)
17 return cpufreq_register_driver(&omap_driver);
18 }
19
20-arch_initcall(omap_cpufreq_init);
21+late_initcall(omap_cpufreq_init);
22
23 /*
24 * if ever we want to remove this, upon cleanup call:
25--
261.6.6.1
27
diff --git a/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0045-OMAP-CPUfreq-ensure-policy-is-fully-initialized.patch b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0045-OMAP-CPUfreq-ensure-policy-is-fully-initialized.patch
new file mode 100644
index 00000000..132aeec6
--- /dev/null
+++ b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0045-OMAP-CPUfreq-ensure-policy-is-fully-initialized.patch
@@ -0,0 +1,31 @@
1From 56cee7bf023af728c952f692f4c24822392882a1 Mon Sep 17 00:00:00 2001
2From: Kevin Hilman <khilman@deeprootsystems.com>
3Date: Wed, 11 Aug 2010 17:05:38 -0700
4Subject: [PATCH 45/59] OMAP: CPUfreq: ensure policy is fully initialized
5
6Ensure policy min/max/cur values are initialized when OMAP
7CPUfreq driver starts.
8
9Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
10---
11 arch/arm/plat-omap/cpu-omap.c | 4 ++++
12 1 files changed, 4 insertions(+), 0 deletions(-)
13
14diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
15index cd09d4b..1b36664 100644
16--- a/arch/arm/plat-omap/cpu-omap.c
17+++ b/arch/arm/plat-omap/cpu-omap.c
18@@ -126,6 +126,10 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
19 VERY_HI_RATE) / 1000;
20 }
21
22+ policy->min = policy->cpuinfo.min_freq;
23+ policy->max = policy->cpuinfo.max_freq;
24+ policy->cur = omap_getspeed(0);
25+
26 /* FIXME: what's the actual transition time? */
27 policy->cpuinfo.transition_latency = 300 * 1000;
28
29--
301.6.6.1
31
diff --git a/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0046-OMAP3-PM-CPUFreq-driver-for-OMAP3.patch b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0046-OMAP3-PM-CPUFreq-driver-for-OMAP3.patch
new file mode 100644
index 00000000..371ad292
--- /dev/null
+++ b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0046-OMAP3-PM-CPUFreq-driver-for-OMAP3.patch
@@ -0,0 +1,263 @@
1From a5072bdf333b8fb1080aac5d2b986553ea8de0f9 Mon Sep 17 00:00:00 2001
2From: Rajendra Nayak <rnayak@ti.com>
3Date: Mon, 10 Nov 2008 17:00:25 +0530
4Subject: [PATCH 46/59] OMAP3 PM: CPUFreq driver for OMAP3
5
6CPUFreq driver for OMAP3
7
8With additional fixes and cleanups from Tero Kristo:
9- Fix rate calculation bug in omap3_select_table_rate
10- Refreshed DVFS VDD1 control against latest clock fw
11
12Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
13Signed-off-by: Rajendra Nayak <rnayak@ti.com>
14
15OMAP3: PM: CPUFreq: Fix omap_getspeed.
16
17Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
18
19Make sure omap cpufreq driver initializes after cpufreq framework and governors
20
21Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
22
23merge: CPUFreq: remove obsolete funcs
24
25OMAP3 clock: Update cpufreq driver
26
27This patch removes all refrences to virtual clock
28nodes in CPUFreq driver.
29
30Signed-off-by: Rajendra Nayak <rnayak@ti.com>
31Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
32Signed-off-by: Jean Pihet <jpihet@mvista.com>
33
34PM: Prevent direct cpufreq scaling during initialization
35
36It is seen that the OMAP specific cpufreq initialization code tries to
37scale the MPU frequency to the highest possible without taking care of
38the voltage level. On power on reset the power IC does not provide the
39necessary voltage for the highest available MPU frequency (that would
40satisfy all Si families). This potentially is an window of opportunity
41for things to go wrong.
42
43Signed-off-by: Romit Dasgupta <romit@ti.com>
44Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
45
46OMAP3: PM: enable 600MHz (overdrive) OPP
47
48Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
49
50omap3: introduce cpufreq
51
52OMAP OPP layer functions now have dependencies of CONFIG_CPU_FREQ only.
53
54With this patch, omap opp layer now has its compilation flags
55bound to CONFIG_CPU_FREQ. Also its code has been removed from pm34xx.c.
56
57A new file has been created to contain cpu freq code related to
58OMAP3: cpufreq34xx.c
59
60OMAP34xx and OMAP36xx family OPPs are made available
61
62Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
63Signed-off-by: Paul Walmsley <paul@pwsan.com>
64Signed-off-by: Nishanth Menon <nm@ti.com>
65Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
66Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
67Signed-off-by: Romit Dasgupta <romit@ti.com>
68Signed-off-by: Rajendra Nayak <rnayak@ti.com>
69
70omap3: cpufreq: allow default opp table init
71
72For board files which choose to override the defaults, the existing
73mechanism will work, for boards that would like to work with defaults,
74allow init_common_hw to call init_opp_table to initialize if not
75already initialized. this will allow all omap boards which have opp
76tables predefined for a silicon to use the same.
77
78Originally reported for overo:
79http://marc.info/?t=127265269400004&r=1&w=2
80
81Signed-off-by: Nishanth Menon <nm@ti.com>
82Reported-by: Peter Tseng <tsenpet09@gmail.com>
83Cc: Cliff Brake <cliff.brake@gmail.com>
84Cc: Kevin Hilman <khilman@deeprootsystems.com>
85
86OMAP2: update OPP data to be device based
87
88Cc: Nishanth Menon <nm@ti.com>
89Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
90
91OMAP3: CPUfreq: update to device-based OPP API
92
93Update usage of OPP API to use new device-based API. This requires
94getting the 'struct device' for the MPU and using that with the OPP
95API.
96
97Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
98
99omap3: opp: make independent of cpufreq
100
101Make opp3xx data which is registered with the opp layer
102dependent purely on CONFIG_PM as opp layer and pm.c users
103are CONFIG_PM dependent not cpufreq dependent.
104so we rename the data definition to opp3xxx_data.c (inline with what
105we have for omap2), also move the build definition to be under
106the existing CONFIG_PM build instead of CPUFREQ.
107
108Cc: Eduardo Valentin <eduardo.valentin@nokia.com>
109Cc: Kevin Hilman <khilman@deeprootsystems.com>
110Cc: Paul Walmsley <paul@pwsan.com>
111Cc: Rajendra Nayak <rnayak@ti.com>
112Cc: Sanjeev Premi <premi@ti.com>
113Cc: Thara Gopinath <thara@ti.com>
114Cc: Tony Lindgren <tony@atomide.com>
115
116Signed-off-by: Nishanth Menon <nm@ti.com>
117---
118 arch/arm/mach-omap2/clock.h | 14 +++++++++++++-
119 arch/arm/mach-omap2/clock34xx.c | 2 ++
120 arch/arm/plat-omap/cpu-omap.c | 34 +++++++++++++++++++++++++++++++---
121 3 files changed, 46 insertions(+), 4 deletions(-)
122
123diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
124index e10ff2b..0a07e50 100644
125--- a/arch/arm/mach-omap2/clock.h
126+++ b/arch/arm/mach-omap2/clock.h
127@@ -141,7 +141,9 @@ extern const struct clksel_rate gpt_sys_rates[];
128 extern const struct clksel_rate gfx_l3_rates[];
129 extern const struct clksel_rate dsp_ick_rates[];
130
131-#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_CPU_FREQ)
132+#ifdef CONFIG_CPU_FREQ
133+
134+#ifdef CONFIG_ARCH_OMAP2
135 extern void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
136 extern void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
137 #else
138@@ -149,6 +151,16 @@ extern void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
139 #define omap2_clk_exit_cpufreq_table 0
140 #endif
141
142+#ifdef CONFIG_ARCH_OMAP3
143+extern void omap3_clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
144+extern void omap3_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
145+#else
146+#define omap3_clk_init_cpufreq_table 0
147+#define omap3_clk_exit_cpufreq_table 0
148+#endif
149+
150+#endif /* CONFIG_CPU_FREQ */
151+
152 extern const struct clkops clkops_omap2_iclk_dflt_wait;
153 extern const struct clkops clkops_omap2_iclk_dflt;
154 extern const struct clkops clkops_omap2_iclk_idle_only;
155diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
156index 1fc96b9..119e135 100644
157--- a/arch/arm/mach-omap2/clock34xx.c
158+++ b/arch/arm/mach-omap2/clock34xx.c
159@@ -20,6 +20,8 @@
160 #include <linux/kernel.h>
161 #include <linux/clk.h>
162 #include <linux/io.h>
163+#include <linux/err.h>
164+#include <linux/cpufreq.h>
165
166 #include <plat/clock.h>
167
168diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
169index 1b36664..f0f9430 100644
170--- a/arch/arm/plat-omap/cpu-omap.c
171+++ b/arch/arm/plat-omap/cpu-omap.c
172@@ -8,6 +8,10 @@
173 *
174 * Based on cpu-sa1110.c, Copyright (C) 2001 Russell King
175 *
176+ * Copyright (C) 2007-2008 Texas Instruments, Inc.
177+ * Updated to support OMAP3
178+ * Rajendra Nayak <rnayak@ti.com>
179+ *
180 * This program is free software; you can redistribute it and/or modify
181 * it under the terms of the GNU General Public License version 2 as
182 * published by the Free Software Foundation.
183@@ -26,12 +30,19 @@
184 #include <plat/clock.h>
185 #include <asm/system.h>
186
187+#if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE)
188+#include <plat/omap-pm.h>
189+#include <plat/opp.h>
190+#endif
191+
192 #define VERY_HI_RATE 900000000
193
194 static struct cpufreq_frequency_table *freq_table;
195
196 #ifdef CONFIG_ARCH_OMAP1
197 #define MPU_CLK "mpu"
198+#elif CONFIG_ARCH_OMAP3
199+#define MPU_CLK "arm_fck"
200 #else
201 #define MPU_CLK "virt_prcm_set"
202 #endif
203@@ -73,7 +84,13 @@ static int omap_target(struct cpufreq_policy *policy,
204 unsigned int target_freq,
205 unsigned int relation)
206 {
207+#ifdef CONFIG_ARCH_OMAP1
208 struct cpufreq_freqs freqs;
209+#endif
210+#if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE)
211+ unsigned long freq;
212+ struct device *mpu_dev = omap2_get_mpuss_device();
213+#endif
214 int ret = 0;
215
216 /* Ensure desired rate is within allowed range. Some govenors
217@@ -83,13 +100,13 @@ static int omap_target(struct cpufreq_policy *policy,
218 if (target_freq > policy->max)
219 target_freq = policy->max;
220
221+#ifdef CONFIG_ARCH_OMAP1
222 freqs.old = omap_getspeed(0);
223 freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
224 freqs.cpu = 0;
225
226 if (freqs.old == freqs.new)
227 return ret;
228-
229 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
230 #ifdef CONFIG_CPU_FREQ_DEBUG
231 printk(KERN_DEBUG "cpufreq-omap: transition: %u --> %u\n",
232@@ -97,7 +114,11 @@ static int omap_target(struct cpufreq_policy *policy,
233 #endif
234 ret = clk_set_rate(mpu_clk, freqs.new * 1000);
235 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
236-
237+#elif defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE)
238+ freq = target_freq * 1000;
239+ if (opp_find_freq_ceil(mpu_dev, &freq))
240+ omap_pm_cpu_set_freq(freq);
241+#endif
242 return ret;
243 }
244
245@@ -114,7 +135,14 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
246
247 policy->cur = policy->min = policy->max = omap_getspeed(0);
248
249- clk_init_cpufreq_table(&freq_table);
250+ if (!cpu_is_omap34xx()) {
251+ clk_init_cpufreq_table(&freq_table);
252+ } else {
253+ struct device *mpu_dev = omap2_get_mpuss_device();
254+
255+ opp_init_cpufreq_table(mpu_dev, &freq_table);
256+ }
257+
258 if (freq_table) {
259 result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
260 if (!result)
261--
2621.6.6.1
263
diff --git a/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0047-OMAP-PM-CPUFREQ-Fix-conditional-compilation.patch b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0047-OMAP-PM-CPUFREQ-Fix-conditional-compilation.patch
new file mode 100644
index 00000000..5d7b02ab
--- /dev/null
+++ b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0047-OMAP-PM-CPUFREQ-Fix-conditional-compilation.patch
@@ -0,0 +1,32 @@
1From 4b4c71142858947f540b337873caf5c1436b4d73 Mon Sep 17 00:00:00 2001
2From: Silesh C V <silesh@ti.com>
3Date: Wed, 29 Sep 2010 14:52:54 +0530
4Subject: [PATCH 47/59] OMAP: PM: CPUFREQ: Fix conditional compilation
5
6Fix conditional compilation. A conditional expresiion
7should follow "#elif", in this case #elif clause should
8check whether CONFIG_ARCH_OMAP3 is defined or not
9(ie. defined(CONFIG_ARCH_OMAP3)) rather than checking for
10the value of the macro.
11
12Signed-off-by: Silesh C V <silesh@ti.com>
13---
14 arch/arm/plat-omap/cpu-omap.c | 2 +-
15 1 files changed, 1 insertions(+), 1 deletions(-)
16
17diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
18index f0f9430..c3ac065 100644
19--- a/arch/arm/plat-omap/cpu-omap.c
20+++ b/arch/arm/plat-omap/cpu-omap.c
21@@ -41,7 +41,7 @@ static struct cpufreq_frequency_table *freq_table;
22
23 #ifdef CONFIG_ARCH_OMAP1
24 #define MPU_CLK "mpu"
25-#elif CONFIG_ARCH_OMAP3
26+#elif defined(CONFIG_ARCH_OMAP3)
27 #define MPU_CLK "arm_fck"
28 #else
29 #define MPU_CLK "virt_prcm_set"
30--
311.6.6.1
32
diff --git a/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0048-cpufreq-fixup-after-new-OPP-layer-merged.patch b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0048-cpufreq-fixup-after-new-OPP-layer-merged.patch
new file mode 100644
index 00000000..4bbaeedf
--- /dev/null
+++ b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0048-cpufreq-fixup-after-new-OPP-layer-merged.patch
@@ -0,0 +1,33 @@
1From 6dac35adbd97f167ddbf26fd1bcea66d1e8a6c6f Mon Sep 17 00:00:00 2001
2From: Kevin Hilman <khilman@deeprootsystems.com>
3Date: Tue, 16 Nov 2010 11:48:41 -0800
4Subject: [PATCH 48/59] cpufreq: fixup after new OPP layer merged
5
6---
7 arch/arm/plat-omap/cpu-omap.c | 3 ++-
8 1 files changed, 2 insertions(+), 1 deletions(-)
9
10diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
11index c3ac065..9cd2709 100644
12--- a/arch/arm/plat-omap/cpu-omap.c
13+++ b/arch/arm/plat-omap/cpu-omap.c
14@@ -25,6 +25,7 @@
15 #include <linux/err.h>
16 #include <linux/clk.h>
17 #include <linux/io.h>
18+#include <linux/opp.h>
19
20 #include <mach/hardware.h>
21 #include <plat/clock.h>
22@@ -32,7 +33,7 @@
23
24 #if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE)
25 #include <plat/omap-pm.h>
26-#include <plat/opp.h>
27+#include <plat/common.h>
28 #endif
29
30 #define VERY_HI_RATE 900000000
31--
321.6.6.1
33
diff --git a/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0049-OMAP-cpufreq-Split-OMAP1-and-OMAP2PLUS-CPUfreq-drive.patch b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0049-OMAP-cpufreq-Split-OMAP1-and-OMAP2PLUS-CPUfreq-drive.patch
new file mode 100644
index 00000000..9fedb6c0
--- /dev/null
+++ b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0049-OMAP-cpufreq-Split-OMAP1-and-OMAP2PLUS-CPUfreq-drive.patch
@@ -0,0 +1,669 @@
1From 989bfeaacfc9eb39762aefbfb5f25ecbd05892cc Mon Sep 17 00:00:00 2001
2From: Santosh Shilimkar <santosh.shilimkar@ti.com>
3Date: Mon, 14 Mar 2011 17:08:48 +0530
4Subject: [PATCH 49/59] OMAP: cpufreq: Split OMAP1 and OMAP2PLUS CPUfreq drivers.
5
6This patch is an attempt to cleanup the #ifdeferry in the
7omap CPUfreq drivers.
8
9The split betwenn OMAP1 and OMAP2PLUS is logical because
10 - OMAP1 doesn't support opp layer.
11 - OMAP1 build is seperate from omap2plus.
12
13Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
14Cc: Kevin Hilman <khilman@ti.com>
15Cc: Vishwanath BS <vishwanath.bs@ti.com>
16---
17 arch/arm/mach-omap1/Makefile | 3 +
18 arch/arm/mach-omap1/omap1-cpufreq.c | 176 ++++++++++++++++++++++++++
19 arch/arm/mach-omap2/Makefile | 3 +
20 arch/arm/mach-omap2/omap2plus-cpufreq.c | 201 ++++++++++++++++++++++++++++++
21 arch/arm/plat-omap/Makefile | 1 -
22 arch/arm/plat-omap/cpu-omap.c | 204 -------------------------------
23 6 files changed, 383 insertions(+), 205 deletions(-)
24 create mode 100644 arch/arm/mach-omap1/omap1-cpufreq.c
25 create mode 100644 arch/arm/mach-omap2/omap2plus-cpufreq.c
26 delete mode 100644 arch/arm/plat-omap/cpu-omap.c
27
28diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
29index af98117..e5082b0 100644
30--- a/arch/arm/mach-omap1/Makefile
31+++ b/arch/arm/mach-omap1/Makefile
32@@ -10,6 +10,9 @@ obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
33
34 obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o
35
36+# CPUFREQ driver
37+obj-$(CONFIG_CPU_FREQ) += omap1-cpufreq.o
38+
39 # Power Management
40 obj-$(CONFIG_PM) += pm.o sleep.o pm_bus.o
41
42diff --git a/arch/arm/mach-omap1/omap1-cpufreq.c b/arch/arm/mach-omap1/omap1-cpufreq.c
43new file mode 100644
44index 0000000..682cdc8
45--- /dev/null
46+++ b/arch/arm/mach-omap1/omap1-cpufreq.c
47@@ -0,0 +1,176 @@
48+/*
49+ * OMAP1 cpufreq driver
50+ *
51+ * CPU frequency scaling for OMAP
52+ *
53+ * Copyright (C) 2005 Nokia Corporation
54+ * Written by Tony Lindgren <tony@atomide.com>
55+ *
56+ * Based on cpu-sa1110.c, Copyright (C) 2001 Russell King
57+ *
58+ * Copyright (C) 2007-2008 Texas Instruments, Inc.
59+ * Updated to support OMAP3
60+ * Rajendra Nayak <rnayak@ti.com>
61+ *
62+ * This program is free software; you can redistribute it and/or modify
63+ * it under the terms of the GNU General Public License version 2 as
64+ * published by the Free Software Foundation.
65+ */
66+#include <linux/types.h>
67+#include <linux/kernel.h>
68+#include <linux/sched.h>
69+#include <linux/cpufreq.h>
70+#include <linux/delay.h>
71+#include <linux/init.h>
72+#include <linux/err.h>
73+#include <linux/clk.h>
74+#include <linux/io.h>
75+#include <linux/opp.h>
76+
77+#include <asm/system.h>
78+
79+#include <plat/clock.h>
80+#include <plat/omap-pm.h>
81+
82+#include <mach/hardware.h>
83+
84+#define VERY_HI_RATE 900000000
85+
86+static struct cpufreq_frequency_table *freq_table;
87+static struct clk *mpu_clk;
88+
89+static int omap_verify_speed(struct cpufreq_policy *policy)
90+{
91+ if (freq_table)
92+ return cpufreq_frequency_table_verify(policy, freq_table);
93+
94+ if (policy->cpu)
95+ return -EINVAL;
96+
97+ cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
98+ policy->cpuinfo.max_freq);
99+
100+ policy->min = clk_round_rate(mpu_clk, policy->min * 1000) / 1000;
101+ policy->max = clk_round_rate(mpu_clk, policy->max * 1000) / 1000;
102+ cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
103+ policy->cpuinfo.max_freq);
104+ return 0;
105+}
106+
107+static unsigned int omap_getspeed(unsigned int cpu)
108+{
109+ unsigned long rate;
110+
111+ if (cpu)
112+ return 0;
113+
114+ rate = clk_get_rate(mpu_clk) / 1000;
115+ return rate;
116+}
117+
118+static int omap_target(struct cpufreq_policy *policy,
119+ unsigned int target_freq,
120+ unsigned int relation)
121+{
122+ struct cpufreq_freqs freqs;
123+ int ret = 0;
124+
125+ /* Ensure desired rate is within allowed range. Some govenors
126+ * (ondemand) will just pass target_freq=0 to get the minimum. */
127+ if (target_freq < policy->min)
128+ target_freq = policy->min;
129+ if (target_freq > policy->max)
130+ target_freq = policy->max;
131+
132+ freqs.old = omap_getspeed(0);
133+ freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
134+ freqs.cpu = 0;
135+
136+ if (freqs.old == freqs.new)
137+ return ret;
138+
139+ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
140+
141+#ifdef CONFIG_CPU_FREQ_DEBUG
142+ pr_info("cpufreq-omap: transition: %u --> %u\n", freqs.old, freqs.new);
143+#endif
144+ ret = clk_set_rate(mpu_clk, freqs.new * 1000);
145+
146+ cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
147+
148+ return ret;
149+}
150+
151+static int __init omap_cpu_init(struct cpufreq_policy *policy)
152+{
153+ int result = 0;
154+
155+ mpu_clk = clk_get(NULL, "mpu");
156+ if (IS_ERR(mpu_clk))
157+ return PTR_ERR(mpu_clk);
158+
159+ if (policy->cpu != 0)
160+ return -EINVAL;
161+
162+ policy->cur = policy->min = policy->max = omap_getspeed(0);
163+
164+ clk_init_cpufreq_table(&freq_table);
165+
166+ if (freq_table) {
167+ result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
168+ if (!result)
169+ cpufreq_frequency_table_get_attr(freq_table,
170+ policy->cpu);
171+ } else {
172+ policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000;
173+ policy->cpuinfo.max_freq = clk_round_rate(mpu_clk,
174+ VERY_HI_RATE) / 1000;
175+ }
176+
177+ policy->min = policy->cpuinfo.min_freq;
178+ policy->max = policy->cpuinfo.max_freq;
179+ policy->cur = omap_getspeed(0);
180+
181+ /* FIXME: what's the actual transition time? */
182+ policy->cpuinfo.transition_latency = 300 * 1000;
183+
184+ return 0;
185+}
186+
187+static int omap_cpu_exit(struct cpufreq_policy *policy)
188+{
189+ clk_exit_cpufreq_table(&freq_table);
190+ clk_put(mpu_clk);
191+ return 0;
192+}
193+
194+static struct freq_attr *omap_cpufreq_attr[] = {
195+ &cpufreq_freq_attr_scaling_available_freqs,
196+ NULL,
197+};
198+
199+static struct cpufreq_driver omap_driver = {
200+ .flags = CPUFREQ_STICKY,
201+ .verify = omap_verify_speed,
202+ .target = omap_target,
203+ .get = omap_getspeed,
204+ .init = omap_cpu_init,
205+ .exit = omap_cpu_exit,
206+ .name = "omap1",
207+ .attr = omap_cpufreq_attr,
208+};
209+
210+static int __init omap_cpufreq_init(void)
211+{
212+ return cpufreq_register_driver(&omap_driver);
213+}
214+
215+static void __exit omap_cpufreq_exit(void)
216+{
217+ cpufreq_unregister_driver(&omap_driver);
218+}
219+
220+MODULE_DESCRIPTION("cpufreq driver for OMAP1 SOCs");
221+MODULE_LICENSE("GPL");
222+module_init(omap_cpufreq_init);
223+module_exit(omap_cpufreq_exit);
224diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
225index 512b152..42924f3 100644
226--- a/arch/arm/mach-omap2/Makefile
227+++ b/arch/arm/mach-omap2/Makefile
228@@ -56,6 +56,9 @@ obj-$(CONFIG_ARCH_OMAP3) += opp3xxx_data.o
229 obj-$(CONFIG_ARCH_OMAP4) += opp4xxx_data.o
230 endif
231
232+# CPUFREQ driver
233+obj-$(CONFIG_CPU_FREQ) += omap2plus-cpufreq.o
234+
235 # Power Management
236 ifeq ($(CONFIG_PM),y)
237 obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o
238diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
239new file mode 100644
240index 0000000..14f84cc
241--- /dev/null
242+++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
243@@ -0,0 +1,201 @@
244+/*
245+ * OMAP2PLUS cpufreq driver
246+ *
247+ * CPU frequency scaling for OMAP
248+ *
249+ * Copyright (C) 2005 Nokia Corporation
250+ * Written by Tony Lindgren <tony@atomide.com>
251+ *
252+ * Based on cpu-sa1110.c, Copyright (C) 2001 Russell King
253+ *
254+ * Copyright (C) 2007-2008 Texas Instruments, Inc.
255+ * Updated to support OMAP3
256+ * Rajendra Nayak <rnayak@ti.com>
257+ *
258+ * This program is free software; you can redistribute it and/or modify
259+ * it under the terms of the GNU General Public License version 2 as
260+ * published by the Free Software Foundation.
261+ */
262+#include <linux/types.h>
263+#include <linux/kernel.h>
264+#include <linux/sched.h>
265+#include <linux/cpufreq.h>
266+#include <linux/delay.h>
267+#include <linux/init.h>
268+#include <linux/err.h>
269+#include <linux/clk.h>
270+#include <linux/io.h>
271+#include <linux/opp.h>
272+
273+#include <asm/system.h>
274+#include <asm/smp_plat.h>
275+
276+#include <plat/clock.h>
277+#include <plat/omap-pm.h>
278+#include <plat/common.h>
279+
280+#include <mach/hardware.h>
281+
282+#define VERY_HI_RATE 900000000
283+
284+static struct cpufreq_frequency_table *freq_table;
285+static struct clk *mpu_clk;
286+
287+static int omap_verify_speed(struct cpufreq_policy *policy)
288+{
289+ if (freq_table)
290+ return cpufreq_frequency_table_verify(policy, freq_table);
291+
292+ if (policy->cpu)
293+ return -EINVAL;
294+
295+ cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
296+ policy->cpuinfo.max_freq);
297+
298+ policy->min = clk_round_rate(mpu_clk, policy->min * 1000) / 1000;
299+ policy->max = clk_round_rate(mpu_clk, policy->max * 1000) / 1000;
300+ cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
301+ policy->cpuinfo.max_freq);
302+ return 0;
303+}
304+
305+static unsigned int omap_getspeed(unsigned int cpu)
306+{
307+ unsigned long rate;
308+
309+ if (cpu)
310+ return 0;
311+
312+ rate = clk_get_rate(mpu_clk) / 1000;
313+ return rate;
314+}
315+
316+static int omap_target(struct cpufreq_policy *policy,
317+ unsigned int target_freq,
318+ unsigned int relation)
319+{
320+ int ret = 0;
321+ struct cpufreq_freqs freqs;
322+
323+ /* Ensure desired rate is within allowed range. Some govenors
324+ * (ondemand) will just pass target_freq=0 to get the minimum. */
325+ if (target_freq < policy->min)
326+ target_freq = policy->min;
327+ if (target_freq > policy->max)
328+ target_freq = policy->max;
329+
330+ freqs.old = omap_getspeed(0);
331+ freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
332+ freqs.cpu = 0;
333+
334+ if (freqs.old == freqs.new)
335+ return ret;
336+
337+ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
338+
339+#ifdef CONFIG_CPU_FREQ_DEBUG
340+ pr_info("cpufreq-omap: transition: %u --> %u\n", freqs.old, freqs.new);
341+#endif
342+
343+ ret = clk_set_rate(mpu_clk, freqs.new * 1000);
344+
345+ /*
346+ * Generic CPUFREQ driver jiffy update is under !SMP. So jiffies
347+ * won't get updated when UP machine cpufreq build with
348+ * CONFIG_SMP enabled. Below code is added only to manage that
349+ * scenario
350+ */
351+ if (!is_smp())
352+ loops_per_jiffy =
353+ cpufreq_scale(loops_per_jiffy, freqs.old, freqs.new);
354+
355+ cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
356+
357+ return ret;
358+}
359+
360+static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
361+{
362+ int result = 0;
363+ struct device *mpu_dev;
364+
365+ if (cpu_is_omap24xx())
366+ mpu_clk = clk_get(NULL, "virt_prcm_set");
367+ else if (cpu_is_omap34xx())
368+ mpu_clk = clk_get(NULL, "dpll1_ck");
369+ else if (cpu_is_omap34xx())
370+ mpu_clk = clk_get(NULL, "dpll_mpu_ck");
371+
372+ if (IS_ERR(mpu_clk))
373+ return PTR_ERR(mpu_clk);
374+
375+ if (policy->cpu != 0)
376+ return -EINVAL;
377+
378+ policy->cur = policy->min = policy->max = omap_getspeed(0);
379+
380+ mpu_dev = omap2_get_mpuss_device();
381+ if (!mpu_dev) {
382+ pr_warning("%s: unable to get the mpu device\n", __func__);
383+ return -EINVAL;
384+ }
385+ opp_init_cpufreq_table(mpu_dev, &freq_table);
386+
387+ if (freq_table) {
388+ result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
389+ if (!result)
390+ cpufreq_frequency_table_get_attr(freq_table,
391+ policy->cpu);
392+ } else {
393+ policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000;
394+ policy->cpuinfo.max_freq = clk_round_rate(mpu_clk,
395+ VERY_HI_RATE) / 1000;
396+ }
397+
398+ policy->min = policy->cpuinfo.min_freq;
399+ policy->max = policy->cpuinfo.max_freq;
400+ policy->cur = omap_getspeed(0);
401+
402+ /* FIXME: what's the actual transition time? */
403+ policy->cpuinfo.transition_latency = 300 * 1000;
404+
405+ return 0;
406+}
407+
408+static int omap_cpu_exit(struct cpufreq_policy *policy)
409+{
410+ clk_exit_cpufreq_table(&freq_table);
411+ clk_put(mpu_clk);
412+ return 0;
413+}
414+
415+static struct freq_attr *omap_cpufreq_attr[] = {
416+ &cpufreq_freq_attr_scaling_available_freqs,
417+ NULL,
418+};
419+
420+static struct cpufreq_driver omap_driver = {
421+ .flags = CPUFREQ_STICKY,
422+ .verify = omap_verify_speed,
423+ .target = omap_target,
424+ .get = omap_getspeed,
425+ .init = omap_cpu_init,
426+ .exit = omap_cpu_exit,
427+ .name = "omap2plus",
428+ .attr = omap_cpufreq_attr,
429+};
430+
431+static int __init omap_cpufreq_init(void)
432+{
433+ return cpufreq_register_driver(&omap_driver);
434+}
435+
436+static void __exit omap_cpufreq_exit(void)
437+{
438+ cpufreq_unregister_driver(&omap_driver);
439+}
440+
441+MODULE_DESCRIPTION("cpufreq driver for OMAP2PLUS SOCs");
442+MODULE_LICENSE("GPL");
443+module_init(omap_cpufreq_init);
444+module_exit(omap_cpufreq_exit);
445diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
446index a4a1285..ec7862e 100644
447--- a/arch/arm/plat-omap/Makefile
448+++ b/arch/arm/plat-omap/Makefile
449@@ -21,7 +21,6 @@ obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
450 obj-$(CONFIG_OMAP_IOMMU) += iommu.o iovmm.o
451 obj-$(CONFIG_OMAP_IOMMU_DEBUG) += iommu-debug.o
452
453-obj-$(CONFIG_CPU_FREQ) += cpu-omap.o
454 obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
455 obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
456 obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
457diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
458deleted file mode 100644
459index 9cd2709..0000000
460--- a/arch/arm/plat-omap/cpu-omap.c
461+++ /dev/null
462@@ -1,204 +0,0 @@
463-/*
464- * linux/arch/arm/plat-omap/cpu-omap.c
465- *
466- * CPU frequency scaling for OMAP
467- *
468- * Copyright (C) 2005 Nokia Corporation
469- * Written by Tony Lindgren <tony@atomide.com>
470- *
471- * Based on cpu-sa1110.c, Copyright (C) 2001 Russell King
472- *
473- * Copyright (C) 2007-2008 Texas Instruments, Inc.
474- * Updated to support OMAP3
475- * Rajendra Nayak <rnayak@ti.com>
476- *
477- * This program is free software; you can redistribute it and/or modify
478- * it under the terms of the GNU General Public License version 2 as
479- * published by the Free Software Foundation.
480- */
481-#include <linux/types.h>
482-#include <linux/kernel.h>
483-#include <linux/sched.h>
484-#include <linux/cpufreq.h>
485-#include <linux/delay.h>
486-#include <linux/init.h>
487-#include <linux/err.h>
488-#include <linux/clk.h>
489-#include <linux/io.h>
490-#include <linux/opp.h>
491-
492-#include <mach/hardware.h>
493-#include <plat/clock.h>
494-#include <asm/system.h>
495-
496-#if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE)
497-#include <plat/omap-pm.h>
498-#include <plat/common.h>
499-#endif
500-
501-#define VERY_HI_RATE 900000000
502-
503-static struct cpufreq_frequency_table *freq_table;
504-
505-#ifdef CONFIG_ARCH_OMAP1
506-#define MPU_CLK "mpu"
507-#elif defined(CONFIG_ARCH_OMAP3)
508-#define MPU_CLK "arm_fck"
509-#else
510-#define MPU_CLK "virt_prcm_set"
511-#endif
512-
513-static struct clk *mpu_clk;
514-
515-/* TODO: Add support for SDRAM timing changes */
516-
517-static int omap_verify_speed(struct cpufreq_policy *policy)
518-{
519- if (freq_table)
520- return cpufreq_frequency_table_verify(policy, freq_table);
521-
522- if (policy->cpu)
523- return -EINVAL;
524-
525- cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
526- policy->cpuinfo.max_freq);
527-
528- policy->min = clk_round_rate(mpu_clk, policy->min * 1000) / 1000;
529- policy->max = clk_round_rate(mpu_clk, policy->max * 1000) / 1000;
530- cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
531- policy->cpuinfo.max_freq);
532- return 0;
533-}
534-
535-static unsigned int omap_getspeed(unsigned int cpu)
536-{
537- unsigned long rate;
538-
539- if (cpu)
540- return 0;
541-
542- rate = clk_get_rate(mpu_clk) / 1000;
543- return rate;
544-}
545-
546-static int omap_target(struct cpufreq_policy *policy,
547- unsigned int target_freq,
548- unsigned int relation)
549-{
550-#ifdef CONFIG_ARCH_OMAP1
551- struct cpufreq_freqs freqs;
552-#endif
553-#if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE)
554- unsigned long freq;
555- struct device *mpu_dev = omap2_get_mpuss_device();
556-#endif
557- int ret = 0;
558-
559- /* Ensure desired rate is within allowed range. Some govenors
560- * (ondemand) will just pass target_freq=0 to get the minimum. */
561- if (target_freq < policy->min)
562- target_freq = policy->min;
563- if (target_freq > policy->max)
564- target_freq = policy->max;
565-
566-#ifdef CONFIG_ARCH_OMAP1
567- freqs.old = omap_getspeed(0);
568- freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
569- freqs.cpu = 0;
570-
571- if (freqs.old == freqs.new)
572- return ret;
573- cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
574-#ifdef CONFIG_CPU_FREQ_DEBUG
575- printk(KERN_DEBUG "cpufreq-omap: transition: %u --> %u\n",
576- freqs.old, freqs.new);
577-#endif
578- ret = clk_set_rate(mpu_clk, freqs.new * 1000);
579- cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
580-#elif defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE)
581- freq = target_freq * 1000;
582- if (opp_find_freq_ceil(mpu_dev, &freq))
583- omap_pm_cpu_set_freq(freq);
584-#endif
585- return ret;
586-}
587-
588-static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
589-{
590- int result = 0;
591-
592- mpu_clk = clk_get(NULL, MPU_CLK);
593- if (IS_ERR(mpu_clk))
594- return PTR_ERR(mpu_clk);
595-
596- if (policy->cpu != 0)
597- return -EINVAL;
598-
599- policy->cur = policy->min = policy->max = omap_getspeed(0);
600-
601- if (!cpu_is_omap34xx()) {
602- clk_init_cpufreq_table(&freq_table);
603- } else {
604- struct device *mpu_dev = omap2_get_mpuss_device();
605-
606- opp_init_cpufreq_table(mpu_dev, &freq_table);
607- }
608-
609- if (freq_table) {
610- result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
611- if (!result)
612- cpufreq_frequency_table_get_attr(freq_table,
613- policy->cpu);
614- } else {
615- policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000;
616- policy->cpuinfo.max_freq = clk_round_rate(mpu_clk,
617- VERY_HI_RATE) / 1000;
618- }
619-
620- policy->min = policy->cpuinfo.min_freq;
621- policy->max = policy->cpuinfo.max_freq;
622- policy->cur = omap_getspeed(0);
623-
624- /* FIXME: what's the actual transition time? */
625- policy->cpuinfo.transition_latency = 300 * 1000;
626-
627- return 0;
628-}
629-
630-static int omap_cpu_exit(struct cpufreq_policy *policy)
631-{
632- clk_exit_cpufreq_table(&freq_table);
633- clk_put(mpu_clk);
634- return 0;
635-}
636-
637-static struct freq_attr *omap_cpufreq_attr[] = {
638- &cpufreq_freq_attr_scaling_available_freqs,
639- NULL,
640-};
641-
642-static struct cpufreq_driver omap_driver = {
643- .flags = CPUFREQ_STICKY,
644- .verify = omap_verify_speed,
645- .target = omap_target,
646- .get = omap_getspeed,
647- .init = omap_cpu_init,
648- .exit = omap_cpu_exit,
649- .name = "omap",
650- .attr = omap_cpufreq_attr,
651-};
652-
653-static int __init omap_cpufreq_init(void)
654-{
655- return cpufreq_register_driver(&omap_driver);
656-}
657-
658-late_initcall(omap_cpufreq_init);
659-
660-/*
661- * if ever we want to remove this, upon cleanup call:
662- *
663- * cpufreq_unregister_driver()
664- * cpufreq_frequency_table_put_attr()
665- */
666-
667--
6681.6.6.1
669
diff --git a/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0050-OMAP2PLUS-cpufreq-Add-SMP-support-to-cater-OMAP4430.patch b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0050-OMAP2PLUS-cpufreq-Add-SMP-support-to-cater-OMAP4430.patch
new file mode 100644
index 00000000..c9e42893
--- /dev/null
+++ b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0050-OMAP2PLUS-cpufreq-Add-SMP-support-to-cater-OMAP4430.patch
@@ -0,0 +1,170 @@
1From d1774fef215a30d5a5db713170f74cc8da82933f Mon Sep 17 00:00:00 2001
2From: Santosh Shilimkar <santosh.shilimkar@ti.com>
3Date: Mon, 14 Mar 2011 17:08:49 +0530
4Subject: [PATCH 50/59] OMAP2PLUS: cpufreq: Add SMP support to cater OMAP4430
5
6On OMAP SMP configuartion, both processors share the voltage
7and clock. So both CPUs needs to be scaled together and hence
8needs software co-ordination.
9
10Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
11Cc: Kevin Hilman <khilman@ti.com>
12cc: Vishwanath BS <vishwanath.bs@ti.com>
13---
14 arch/arm/mach-omap2/omap2plus-cpufreq.c | 73 ++++++++++++++++++++++++++-----
15 1 files changed, 62 insertions(+), 11 deletions(-)
16
17diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
18index 14f84cc..8d472f6 100644
19--- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
20+++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
21@@ -26,9 +26,11 @@
22 #include <linux/clk.h>
23 #include <linux/io.h>
24 #include <linux/opp.h>
25+#include <linux/cpu.h>
26
27 #include <asm/system.h>
28 #include <asm/smp_plat.h>
29+#include <asm/cpu.h>
30
31 #include <plat/clock.h>
32 #include <plat/omap-pm.h>
33@@ -63,7 +65,7 @@ static unsigned int omap_getspeed(unsigned int cpu)
34 {
35 unsigned long rate;
36
37- if (cpu)
38+ if (cpu >= NR_CPUS)
39 return 0;
40
41 rate = clk_get_rate(mpu_clk) / 1000;
42@@ -74,9 +76,13 @@ static int omap_target(struct cpufreq_policy *policy,
43 unsigned int target_freq,
44 unsigned int relation)
45 {
46- int ret = 0;
47+ int i, ret = 0;
48 struct cpufreq_freqs freqs;
49
50+ /* Changes not allowed until all CPUs are online */
51+ if (is_smp() && (num_online_cpus() < NR_CPUS))
52+ return ret;
53+
54 /* Ensure desired rate is within allowed range. Some govenors
55 * (ondemand) will just pass target_freq=0 to get the minimum. */
56 if (target_freq < policy->min)
57@@ -84,15 +90,25 @@ static int omap_target(struct cpufreq_policy *policy,
58 if (target_freq > policy->max)
59 target_freq = policy->max;
60
61- freqs.old = omap_getspeed(0);
62+ freqs.old = omap_getspeed(policy->cpu);
63 freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
64- freqs.cpu = 0;
65+ freqs.cpu = policy->cpu;
66
67 if (freqs.old == freqs.new)
68 return ret;
69
70- cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
71+ if (!is_smp()) {
72+ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
73+ goto set_freq;
74+ }
75+
76+ /* notifiers */
77+ for_each_cpu(i, policy->cpus) {
78+ freqs.cpu = i;
79+ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
80+ }
81
82+set_freq:
83 #ifdef CONFIG_CPU_FREQ_DEBUG
84 pr_info("cpufreq-omap: transition: %u --> %u\n", freqs.old, freqs.new);
85 #endif
86@@ -105,12 +121,33 @@ static int omap_target(struct cpufreq_policy *policy,
87 * CONFIG_SMP enabled. Below code is added only to manage that
88 * scenario
89 */
90- if (!is_smp())
91+ freqs.new = omap_getspeed(policy->cpu);
92+ if (!is_smp()) {
93 loops_per_jiffy =
94 cpufreq_scale(loops_per_jiffy, freqs.old, freqs.new);
95+ cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
96+ goto skip_lpj;
97+ }
98
99- cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
100+#ifdef CONFIG_SMP
101+ /*
102+ * Note that loops_per_jiffy is not updated on SMP systems in
103+ * cpufreq driver. So, update the per-CPU loops_per_jiffy value
104+ * on frequency transition. We need to update all dependent CPUs.
105+ */
106+ for_each_cpu(i, policy->cpus)
107+ per_cpu(cpu_data, i).loops_per_jiffy =
108+ cpufreq_scale(per_cpu(cpu_data, i).loops_per_jiffy,
109+ freqs.old, freqs.new);
110+#endif
111
112+ /* notifiers */
113+ for_each_cpu(i, policy->cpus) {
114+ freqs.cpu = i;
115+ cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
116+ }
117+
118+skip_lpj:
119 return ret;
120 }
121
122@@ -118,6 +155,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
123 {
124 int result = 0;
125 struct device *mpu_dev;
126+ static cpumask_var_t cpumask;
127
128 if (cpu_is_omap24xx())
129 mpu_clk = clk_get(NULL, "virt_prcm_set");
130@@ -129,12 +167,12 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
131 if (IS_ERR(mpu_clk))
132 return PTR_ERR(mpu_clk);
133
134- if (policy->cpu != 0)
135+ if (policy->cpu >= NR_CPUS)
136 return -EINVAL;
137
138- policy->cur = policy->min = policy->max = omap_getspeed(0);
139-
140+ policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu);
141 mpu_dev = omap2_get_mpuss_device();
142+
143 if (!mpu_dev) {
144 pr_warning("%s: unable to get the mpu device\n", __func__);
145 return -EINVAL;
146@@ -154,7 +192,20 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
147
148 policy->min = policy->cpuinfo.min_freq;
149 policy->max = policy->cpuinfo.max_freq;
150- policy->cur = omap_getspeed(0);
151+ policy->cur = omap_getspeed(policy->cpu);
152+
153+ /*
154+ * On OMAP SMP configuartion, both processors share the voltage
155+ * and clock. So both CPUs needs to be scaled together and hence
156+ * needs software co-ordination. Use cpufreq affected_cpus
157+ * interface to handle this scenario. Additional is_smp() check
158+ * is to keep SMP_ON_UP build working.
159+ */
160+ if (is_smp()) {
161+ policy->shared_type = CPUFREQ_SHARED_TYPE_ANY;
162+ cpumask_or(cpumask, cpumask_of(policy->cpu), cpumask);
163+ cpumask_copy(policy->cpus, cpumask);
164+ }
165
166 /* FIXME: what's the actual transition time? */
167 policy->cpuinfo.transition_latency = 300 * 1000;
168--
1691.6.6.1
170
diff --git a/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0051-OMAP2PLUS-cpufreq-Fix-typo-when-attempting-to-set-mp.patch b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0051-OMAP2PLUS-cpufreq-Fix-typo-when-attempting-to-set-mp.patch
new file mode 100644
index 00000000..3685af92
--- /dev/null
+++ b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0051-OMAP2PLUS-cpufreq-Fix-typo-when-attempting-to-set-mp.patch
@@ -0,0 +1,29 @@
1From b25a843135dc8ba5053befd1d39ac2286a3d9fa4 Mon Sep 17 00:00:00 2001
2From: Jarkko Nikula <jhnikula@gmail.com>
3Date: Thu, 14 Apr 2011 16:21:58 +0300
4Subject: [PATCH 51/59] OMAP2PLUS: cpufreq: Fix typo when attempting to set mpu_clk for OMAP4
5
6Fix this typo as there is no dpll_mpu_ck for OMAP3 and code flow is clearly
7trying to set mpu_clk for OMAP4 for which this dpll_mpu_ck is available.
8
9Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
10---
11 arch/arm/mach-omap2/omap2plus-cpufreq.c | 2 +-
12 1 files changed, 1 insertions(+), 1 deletions(-)
13
14diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
15index 8d472f6..d53ce23 100644
16--- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
17+++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
18@@ -161,7 +161,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
19 mpu_clk = clk_get(NULL, "virt_prcm_set");
20 else if (cpu_is_omap34xx())
21 mpu_clk = clk_get(NULL, "dpll1_ck");
22- else if (cpu_is_omap34xx())
23+ else if (cpu_is_omap44xx())
24 mpu_clk = clk_get(NULL, "dpll_mpu_ck");
25
26 if (IS_ERR(mpu_clk))
27--
281.6.6.1
29