aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-s3c64xx/cpufreq.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-08 11:12:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-08 11:12:43 -0500
commit79c9601c2e0dbbe69895d302de4d19f3a31fbd30 (patch)
tree78d4be2df851b2b4106adcfd736622a90cecf9e9 /arch/arm/plat-s3c64xx/cpufreq.c
parent41440ffe21f29bdb985cab76b2d0b06d83e63b19 (diff)
parent3d14b5beba35250c548d3851a2b84fce742d8311 (diff)
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (272 commits) Fix soc_common PCMCIA configuration ARM: 5827/1: SA1100: h3100/h3600: emit messages on failed gpio_request ARM: 5826/1: SA1100: h3100/h3600: always build htc-egpio driver ARM: 5825/1: SA1100: h3600: update defconfig ARM: 5824/1: SA1100: reuse h3600 PCMCIA driver on h3100 ARM: 5823/1: SA1100: h3100/h3600: add support for gpio-keys ARM: 5822/1: SA1100: h3100/h3600: clean up #includes ARM: 5821/1: SA1100: h3100/h3600: revise copyright boilerplates ARM: 5820/1: SA1100: h3100/h3600: split h3600.c ARM: 5819/1: SA1100: h3100/h3600: merge h3600.h and h3600_gpio.h into h3xxx.h ARM: 5818/1: SA1100: h3100/h3600: drop old GPIO definitions ARM: 5817/1: SA1100: h3100/h3600: configure all unused gpios as inputs ARM: 5816/1: SA1100: h3600: remove IRQ_GPIO_* definitions ARM: 5815/1: SA1100: h3100/h3600: remove now unused assign_h3600_egpio handlers ARM: 5814/1: SA1100: h3100/h3600: convert all users of assign_h3600_egpio to gpiolib ARM: 5813/1: SA1100: h3100/h3600: add htc-egpio driver ARM: 5812/1: SA1100: h3100/h3600: separate machine-specific LCD helpers ARM: 5811/2: pcmcia: convert sa1100_h3600 driver to gpiolib ARM: 5799/1: SA1100: h3600: stop setting direction for LCD pins ARM: 5798/1: SA1100: h3600: remove unused cruft from h3600.h ...
Diffstat (limited to 'arch/arm/plat-s3c64xx/cpufreq.c')
-rw-r--r--arch/arm/plat-s3c64xx/cpufreq.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/arch/arm/plat-s3c64xx/cpufreq.c b/arch/arm/plat-s3c64xx/cpufreq.c
index e6e0843215df..74c0e8347de5 100644
--- a/arch/arm/plat-s3c64xx/cpufreq.c
+++ b/arch/arm/plat-s3c64xx/cpufreq.c
@@ -19,6 +19,7 @@
19 19
20static struct clk *armclk; 20static struct clk *armclk;
21static struct regulator *vddarm; 21static struct regulator *vddarm;
22static unsigned long regulator_latency;
22 23
23#ifdef CONFIG_CPU_S3C6410 24#ifdef CONFIG_CPU_S3C6410
24struct s3c64xx_dvfs { 25struct s3c64xx_dvfs {
@@ -27,11 +28,10 @@ struct s3c64xx_dvfs {
27}; 28};
28 29
29static struct s3c64xx_dvfs s3c64xx_dvfs_table[] = { 30static struct s3c64xx_dvfs s3c64xx_dvfs_table[] = {
30 [0] = { 1000000, 1000000 }, 31 [0] = { 1000000, 1150000 },
31 [1] = { 1000000, 1050000 }, 32 [1] = { 1050000, 1150000 },
32 [2] = { 1050000, 1100000 }, 33 [2] = { 1100000, 1150000 },
33 [3] = { 1050000, 1150000 }, 34 [3] = { 1200000, 1350000 },
34 [4] = { 1250000, 1350000 },
35}; 35};
36 36
37static struct cpufreq_frequency_table s3c64xx_freq_table[] = { 37static struct cpufreq_frequency_table s3c64xx_freq_table[] = {
@@ -41,9 +41,9 @@ static struct cpufreq_frequency_table s3c64xx_freq_table[] = {
41 { 1, 266000 }, 41 { 1, 266000 },
42 { 2, 333000 }, 42 { 2, 333000 },
43 { 2, 400000 }, 43 { 2, 400000 },
44 { 3, 532000 }, 44 { 2, 532000 },
45 { 3, 533000 }, 45 { 2, 533000 },
46 { 4, 667000 }, 46 { 3, 667000 },
47 { 0, CPUFREQ_TABLE_END }, 47 { 0, CPUFREQ_TABLE_END },
48}; 48};
49#endif 49#endif
@@ -141,7 +141,7 @@ err:
141} 141}
142 142
143#ifdef CONFIG_REGULATOR 143#ifdef CONFIG_REGULATOR
144static void __init s3c64xx_cpufreq_constrain_voltages(void) 144static void __init s3c64xx_cpufreq_config_regulator(void)
145{ 145{
146 int count, v, i, found; 146 int count, v, i, found;
147 struct cpufreq_frequency_table *freq; 147 struct cpufreq_frequency_table *freq;
@@ -150,11 +150,10 @@ static void __init s3c64xx_cpufreq_constrain_voltages(void)
150 count = regulator_count_voltages(vddarm); 150 count = regulator_count_voltages(vddarm);
151 if (count < 0) { 151 if (count < 0) {
152 pr_err("cpufreq: Unable to check supported voltages\n"); 152 pr_err("cpufreq: Unable to check supported voltages\n");
153 return;
154 } 153 }
155 154
156 freq = s3c64xx_freq_table; 155 freq = s3c64xx_freq_table;
157 while (freq->frequency != CPUFREQ_TABLE_END) { 156 while (count > 0 && freq->frequency != CPUFREQ_TABLE_END) {
158 if (freq->frequency == CPUFREQ_ENTRY_INVALID) 157 if (freq->frequency == CPUFREQ_ENTRY_INVALID)
159 continue; 158 continue;
160 159
@@ -175,6 +174,10 @@ static void __init s3c64xx_cpufreq_constrain_voltages(void)
175 174
176 freq++; 175 freq++;
177 } 176 }
177
178 /* Guess based on having to do an I2C/SPI write; in future we
179 * will be able to query the regulator performance here. */
180 regulator_latency = 1 * 1000 * 1000;
178} 181}
179#endif 182#endif
180 183
@@ -206,7 +209,7 @@ static int __init s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
206 pr_err("cpufreq: Only frequency scaling available\n"); 209 pr_err("cpufreq: Only frequency scaling available\n");
207 vddarm = NULL; 210 vddarm = NULL;
208 } else { 211 } else {
209 s3c64xx_cpufreq_constrain_voltages(); 212 s3c64xx_cpufreq_config_regulator();
210 } 213 }
211#endif 214#endif
212 215
@@ -217,8 +220,11 @@ static int __init s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
217 /* Check for frequencies we can generate */ 220 /* Check for frequencies we can generate */
218 r = clk_round_rate(armclk, freq->frequency * 1000); 221 r = clk_round_rate(armclk, freq->frequency * 1000);
219 r /= 1000; 222 r /= 1000;
220 if (r != freq->frequency) 223 if (r != freq->frequency) {
224 pr_debug("cpufreq: %dkHz unsupported by clock\n",
225 freq->frequency);
221 freq->frequency = CPUFREQ_ENTRY_INVALID; 226 freq->frequency = CPUFREQ_ENTRY_INVALID;
227 }
222 228
223 /* If we have no regulator then assume startup 229 /* If we have no regulator then assume startup
224 * frequency is the maximum we can support. */ 230 * frequency is the maximum we can support. */
@@ -230,9 +236,11 @@ static int __init s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
230 236
231 policy->cur = clk_get_rate(armclk) / 1000; 237 policy->cur = clk_get_rate(armclk) / 1000;
232 238
233 /* Pick a conservative guess in ns: we'll need ~1 I2C/SPI 239 /* Datasheet says PLL stabalisation time (if we were to use
234 * write plus clock reprogramming. */ 240 * the PLLs, which we don't currently) is ~300us worst case,
235 policy->cpuinfo.transition_latency = 2 * 1000 * 1000; 241 * but add some fudge.
242 */
243 policy->cpuinfo.transition_latency = (500 * 1000) + regulator_latency;
236 244
237 ret = cpufreq_frequency_table_cpuinfo(policy, s3c64xx_freq_table); 245 ret = cpufreq_frequency_table_cpuinfo(policy, s3c64xx_freq_table);
238 if (ret != 0) { 246 if (ret != 0) {