diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0003-OMAP3-PM-CPUFreq-driver-for-OMAP3.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0003-OMAP3-PM-CPUFreq-driver-for-OMAP3.patch | 263 |
1 files changed, 263 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0003-OMAP3-PM-CPUFreq-driver-for-OMAP3.patch b/extras/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0003-OMAP3-PM-CPUFreq-driver-for-OMAP3.patch new file mode 100644 index 00000000..fbe16213 --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq/0003-OMAP3-PM-CPUFreq-driver-for-OMAP3.patch | |||
@@ -0,0 +1,263 @@ | |||
1 | From 948b868e4a83b054e8a58362238bc6cd61c0aeab Mon Sep 17 00:00:00 2001 | ||
2 | From: Rajendra Nayak <rnayak@ti.com> | ||
3 | Date: Mon, 10 Nov 2008 17:00:25 +0530 | ||
4 | Subject: [PATCH 3/8] OMAP3 PM: CPUFreq driver for OMAP3 | ||
5 | |||
6 | CPUFreq driver for OMAP3 | ||
7 | |||
8 | With 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 | |||
12 | Signed-off-by: Tero Kristo <tero.kristo@nokia.com> | ||
13 | Signed-off-by: Rajendra Nayak <rnayak@ti.com> | ||
14 | |||
15 | OMAP3: PM: CPUFreq: Fix omap_getspeed. | ||
16 | |||
17 | Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com> | ||
18 | |||
19 | Make sure omap cpufreq driver initializes after cpufreq framework and governors | ||
20 | |||
21 | Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com> | ||
22 | |||
23 | merge: CPUFreq: remove obsolete funcs | ||
24 | |||
25 | OMAP3 clock: Update cpufreq driver | ||
26 | |||
27 | This patch removes all refrences to virtual clock | ||
28 | nodes in CPUFreq driver. | ||
29 | |||
30 | Signed-off-by: Rajendra Nayak <rnayak@ti.com> | ||
31 | Signed-off-by: Tero Kristo <tero.kristo@nokia.com> | ||
32 | Signed-off-by: Jean Pihet <jpihet@mvista.com> | ||
33 | |||
34 | PM: Prevent direct cpufreq scaling during initialization | ||
35 | |||
36 | It is seen that the OMAP specific cpufreq initialization code tries to | ||
37 | scale the MPU frequency to the highest possible without taking care of | ||
38 | the voltage level. On power on reset the power IC does not provide the | ||
39 | necessary voltage for the highest available MPU frequency (that would | ||
40 | satisfy all Si families). This potentially is an window of opportunity | ||
41 | for things to go wrong. | ||
42 | |||
43 | Signed-off-by: Romit Dasgupta <romit@ti.com> | ||
44 | Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> | ||
45 | |||
46 | OMAP3: PM: enable 600MHz (overdrive) OPP | ||
47 | |||
48 | Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> | ||
49 | |||
50 | omap3: introduce cpufreq | ||
51 | |||
52 | OMAP OPP layer functions now have dependencies of CONFIG_CPU_FREQ only. | ||
53 | |||
54 | With this patch, omap opp layer now has its compilation flags | ||
55 | bound to CONFIG_CPU_FREQ. Also its code has been removed from pm34xx.c. | ||
56 | |||
57 | A new file has been created to contain cpu freq code related to | ||
58 | OMAP3: cpufreq34xx.c | ||
59 | |||
60 | OMAP34xx and OMAP36xx family OPPs are made available | ||
61 | |||
62 | Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com> | ||
63 | Signed-off-by: Paul Walmsley <paul@pwsan.com> | ||
64 | Signed-off-by: Nishanth Menon <nm@ti.com> | ||
65 | Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com> | ||
66 | Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> | ||
67 | Signed-off-by: Romit Dasgupta <romit@ti.com> | ||
68 | Signed-off-by: Rajendra Nayak <rnayak@ti.com> | ||
69 | |||
70 | omap3: cpufreq: allow default opp table init | ||
71 | |||
72 | For board files which choose to override the defaults, the existing | ||
73 | mechanism will work, for boards that would like to work with defaults, | ||
74 | allow init_common_hw to call init_opp_table to initialize if not | ||
75 | already initialized. this will allow all omap boards which have opp | ||
76 | tables predefined for a silicon to use the same. | ||
77 | |||
78 | Originally reported for overo: | ||
79 | http://marc.info/?t=127265269400004&r=1&w=2 | ||
80 | |||
81 | Signed-off-by: Nishanth Menon <nm@ti.com> | ||
82 | Reported-by: Peter Tseng <tsenpet09@gmail.com> | ||
83 | Cc: Cliff Brake <cliff.brake@gmail.com> | ||
84 | Cc: Kevin Hilman <khilman@deeprootsystems.com> | ||
85 | |||
86 | OMAP2: update OPP data to be device based | ||
87 | |||
88 | Cc: Nishanth Menon <nm@ti.com> | ||
89 | Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> | ||
90 | |||
91 | OMAP3: CPUfreq: update to device-based OPP API | ||
92 | |||
93 | Update usage of OPP API to use new device-based API. This requires | ||
94 | getting the 'struct device' for the MPU and using that with the OPP | ||
95 | API. | ||
96 | |||
97 | Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> | ||
98 | |||
99 | omap3: opp: make independent of cpufreq | ||
100 | |||
101 | Make opp3xx data which is registered with the opp layer | ||
102 | dependent purely on CONFIG_PM as opp layer and pm.c users | ||
103 | are CONFIG_PM dependent not cpufreq dependent. | ||
104 | so we rename the data definition to opp3xxx_data.c (inline with what | ||
105 | we have for omap2), also move the build definition to be under | ||
106 | the existing CONFIG_PM build instead of CPUFREQ. | ||
107 | |||
108 | Cc: Eduardo Valentin <eduardo.valentin@nokia.com> | ||
109 | Cc: Kevin Hilman <khilman@deeprootsystems.com> | ||
110 | Cc: Paul Walmsley <paul@pwsan.com> | ||
111 | Cc: Rajendra Nayak <rnayak@ti.com> | ||
112 | Cc: Sanjeev Premi <premi@ti.com> | ||
113 | Cc: Thara Gopinath <thara@ti.com> | ||
114 | Cc: Tony Lindgren <tony@atomide.com> | ||
115 | |||
116 | Signed-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 | |||
123 | diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h | ||
124 | index 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; | ||
155 | diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c | ||
156 | index 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 | |||
168 | diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c | ||
169 | index 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 | -- | ||
262 | 1.6.6.1 | ||
263 | |||