]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-3.0/pm-wip/cpufreq/0004-OMAP3-PM-CPUFreq-driver-for-OMAP3.patch
linux 3.0: update to 3.0.17
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / pm-wip / cpufreq / 0004-OMAP3-PM-CPUFreq-driver-for-OMAP3.patch
1 From fcd436dfb1c2d8e4866001700a5bba2a1d4079aa 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 04/19] OMAP3 PM: CPUFreq driver for OMAP3
6 CPUFreq driver for OMAP3
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
12 Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
13 Signed-off-by: Rajendra Nayak <rnayak@ti.com>
15 OMAP3: PM: CPUFreq: Fix omap_getspeed.
17 Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
19 Make sure omap cpufreq driver initializes after cpufreq framework and governors
21 Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
23 merge: CPUFreq: remove obsolete funcs
25 OMAP3 clock: Update cpufreq driver
27 This patch removes all refrences to virtual clock
28 nodes in CPUFreq driver.
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>
34 PM: Prevent direct cpufreq scaling during initialization
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.
43 Signed-off-by: Romit Dasgupta <romit@ti.com>
44 Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
46 OMAP3: PM: enable 600MHz (overdrive) OPP
48 Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
50 omap3: introduce cpufreq
52 OMAP OPP layer functions now have dependencies of CONFIG_CPU_FREQ only.
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.
57 A new file has been created to contain cpu freq code related to
58 OMAP3: cpufreq34xx.c
60 OMAP34xx and OMAP36xx family OPPs are made available
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>
70 omap3: cpufreq: allow default opp table init
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.
78 Originally reported for overo:
79 http://marc.info/?t=127265269400004&r=1&w=2
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>
86 OMAP2: update OPP data to be device based
88 Cc: Nishanth Menon <nm@ti.com>
89 Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
91 OMAP3: CPUfreq: update to device-based OPP API
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.
97 Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
99 omap3: opp: make independent of cpufreq
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.
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>
116 Signed-off-by: Nishanth Menon <nm@ti.com>
117 Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
118 ---
119  arch/arm/mach-omap2/clock.h     |   14 +++++++++++++-
120  arch/arm/mach-omap2/clock34xx.c |    2 ++
121  arch/arm/plat-omap/cpu-omap.c   |   34 +++++++++++++++++++++++++++++++---
122  3 files changed, 46 insertions(+), 4 deletions(-)
124 diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
125 index 48ac568..8bad1c6 100644
126 --- a/arch/arm/mach-omap2/clock.h
127 +++ b/arch/arm/mach-omap2/clock.h
128 @@ -144,7 +144,9 @@ extern const struct clksel_rate gpt_sys_rates[];
129  extern const struct clksel_rate gfx_l3_rates[];
130  extern const struct clksel_rate dsp_ick_rates[];
131  
132 -#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_CPU_FREQ)
133 +#ifdef CONFIG_CPU_FREQ
135 +#ifdef CONFIG_ARCH_OMAP2
136  extern void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
137  extern void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
138  #else
139 @@ -152,6 +154,16 @@ extern void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
140  #define omap2_clk_exit_cpufreq_table   0
141  #endif
142  
143 +#ifdef CONFIG_ARCH_OMAP3
144 +extern void omap3_clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
145 +extern void omap3_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
146 +#else
147 +#define omap3_clk_init_cpufreq_table   0
148 +#define omap3_clk_exit_cpufreq_table   0
149 +#endif
151 +#endif /* CONFIG_CPU_FREQ */
153  extern const struct clkops clkops_omap2_iclk_dflt_wait;
154  extern const struct clkops clkops_omap2_iclk_dflt;
155  extern const struct clkops clkops_omap2_iclk_idle_only;
156 diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
157 index 1fc96b9..119e135 100644
158 --- a/arch/arm/mach-omap2/clock34xx.c
159 +++ b/arch/arm/mach-omap2/clock34xx.c
160 @@ -20,6 +20,8 @@
161  #include <linux/kernel.h>
162  #include <linux/clk.h>
163  #include <linux/io.h>
164 +#include <linux/err.h>
165 +#include <linux/cpufreq.h>
166  
167  #include <plat/clock.h>
168  
169 diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
170 index 1b36664..f0f9430 100644
171 --- a/arch/arm/plat-omap/cpu-omap.c
172 +++ b/arch/arm/plat-omap/cpu-omap.c
173 @@ -8,6 +8,10 @@
174   *
175   *  Based on cpu-sa1110.c, Copyright (C) 2001 Russell King
176   *
177 + * Copyright (C) 2007-2008 Texas Instruments, Inc.
178 + * Updated to support OMAP3
179 + * Rajendra Nayak <rnayak@ti.com>
180 + *
181   * This program is free software; you can redistribute it and/or modify
182   * it under the terms of the GNU General Public License version 2 as
183   * published by the Free Software Foundation.
184 @@ -26,12 +30,19 @@
185  #include <plat/clock.h>
186  #include <asm/system.h>
187  
188 +#if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE)
189 +#include <plat/omap-pm.h>
190 +#include <plat/opp.h>
191 +#endif
193  #define VERY_HI_RATE   900000000
194  
195  static struct cpufreq_frequency_table *freq_table;
196  
197  #ifdef CONFIG_ARCH_OMAP1
198  #define MPU_CLK                "mpu"
199 +#elif CONFIG_ARCH_OMAP3
200 +#define MPU_CLK                "arm_fck"
201  #else
202  #define MPU_CLK                "virt_prcm_set"
203  #endif
204 @@ -73,7 +84,13 @@ static int omap_target(struct cpufreq_policy *policy,
205                        unsigned int target_freq,
206                        unsigned int relation)
207  {
208 +#ifdef CONFIG_ARCH_OMAP1
209         struct cpufreq_freqs freqs;
210 +#endif
211 +#if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE)
212 +       unsigned long freq;
213 +       struct device *mpu_dev = omap2_get_mpuss_device();
214 +#endif
215         int ret = 0;
216  
217         /* Ensure desired rate is within allowed range.  Some govenors
218 @@ -83,13 +100,13 @@ static int omap_target(struct cpufreq_policy *policy,
219         if (target_freq > policy->max)
220                 target_freq = policy->max;
221  
222 +#ifdef CONFIG_ARCH_OMAP1
223         freqs.old = omap_getspeed(0);
224         freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
225         freqs.cpu = 0;
226  
227         if (freqs.old == freqs.new)
228                 return ret;
230         cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
231  #ifdef CONFIG_CPU_FREQ_DEBUG
232         printk(KERN_DEBUG "cpufreq-omap: transition: %u --> %u\n",
233 @@ -97,7 +114,11 @@ static int omap_target(struct cpufreq_policy *policy,
234  #endif
235         ret = clk_set_rate(mpu_clk, freqs.new * 1000);
236         cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
238 +#elif defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE)
239 +       freq = target_freq * 1000;
240 +       if (opp_find_freq_ceil(mpu_dev, &freq))
241 +               omap_pm_cpu_set_freq(freq);
242 +#endif
243         return ret;
244  }
245  
246 @@ -114,7 +135,14 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
247  
248         policy->cur = policy->min = policy->max = omap_getspeed(0);
249  
250 -       clk_init_cpufreq_table(&freq_table);
251 +       if (!cpu_is_omap34xx()) {
252 +               clk_init_cpufreq_table(&freq_table);
253 +       } else {
254 +               struct device *mpu_dev = omap2_get_mpuss_device();
256 +               opp_init_cpufreq_table(mpu_dev, &freq_table);
257 +       }
259         if (freq_table) {
260                 result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
261                 if (!result)
262 -- 
263 1.7.2.5