aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/s3c2416-cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/s3c2416-cpufreq.c')
-rw-r--r--drivers/cpufreq/s3c2416-cpufreq.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/drivers/cpufreq/s3c2416-cpufreq.c b/drivers/cpufreq/s3c2416-cpufreq.c
index 4626f90559b5..2fd53eaaec20 100644
--- a/drivers/cpufreq/s3c2416-cpufreq.c
+++ b/drivers/cpufreq/s3c2416-cpufreq.c
@@ -266,7 +266,7 @@ out:
266static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq) 266static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
267{ 267{
268 int count, v, i, found; 268 int count, v, i, found;
269 struct cpufreq_frequency_table *freq; 269 struct cpufreq_frequency_table *pos;
270 struct s3c2416_dvfs *dvfs; 270 struct s3c2416_dvfs *dvfs;
271 271
272 count = regulator_count_voltages(s3c_freq->vddarm); 272 count = regulator_count_voltages(s3c_freq->vddarm);
@@ -275,12 +275,11 @@ static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
275 return; 275 return;
276 } 276 }
277 277
278 freq = s3c_freq->freq_table; 278 if (!count)
279 while (count > 0 && freq->frequency != CPUFREQ_TABLE_END) { 279 goto out;
280 if (freq->frequency == CPUFREQ_ENTRY_INVALID)
281 continue;
282 280
283 dvfs = &s3c2416_dvfs_table[freq->driver_data]; 281 cpufreq_for_each_valid_entry(pos, s3c_freq->freq_table) {
282 dvfs = &s3c2416_dvfs_table[pos->driver_data];
284 found = 0; 283 found = 0;
285 284
286 /* Check only the min-voltage, more is always ok on S3C2416 */ 285 /* Check only the min-voltage, more is always ok on S3C2416 */
@@ -292,13 +291,12 @@ static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
292 291
293 if (!found) { 292 if (!found) {
294 pr_debug("cpufreq: %dkHz unsupported by regulator\n", 293 pr_debug("cpufreq: %dkHz unsupported by regulator\n",
295 freq->frequency); 294 pos->frequency);
296 freq->frequency = CPUFREQ_ENTRY_INVALID; 295 pos->frequency = CPUFREQ_ENTRY_INVALID;
297 } 296 }
298
299 freq++;
300 } 297 }
301 298
299out:
302 /* Guessed */ 300 /* Guessed */
303 s3c_freq->regulator_latency = 1 * 1000 * 1000; 301 s3c_freq->regulator_latency = 1 * 1000 * 1000;
304} 302}
@@ -338,7 +336,7 @@ static struct notifier_block s3c2416_cpufreq_reboot_notifier = {
338static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy) 336static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
339{ 337{
340 struct s3c2416_data *s3c_freq = &s3c2416_cpufreq; 338 struct s3c2416_data *s3c_freq = &s3c2416_cpufreq;
341 struct cpufreq_frequency_table *freq; 339 struct cpufreq_frequency_table *pos;
342 struct clk *msysclk; 340 struct clk *msysclk;
343 unsigned long rate; 341 unsigned long rate;
344 int ret; 342 int ret;
@@ -427,31 +425,27 @@ static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
427 s3c_freq->regulator_latency = 0; 425 s3c_freq->regulator_latency = 0;
428#endif 426#endif
429 427
430 freq = s3c_freq->freq_table; 428 cpufreq_for_each_entry(pos, s3c_freq->freq_table) {
431 while (freq->frequency != CPUFREQ_TABLE_END) {
432 /* special handling for dvs mode */ 429 /* special handling for dvs mode */
433 if (freq->driver_data == 0) { 430 if (pos->driver_data == 0) {
434 if (!s3c_freq->hclk) { 431 if (!s3c_freq->hclk) {
435 pr_debug("cpufreq: %dkHz unsupported as it would need unavailable dvs mode\n", 432 pr_debug("cpufreq: %dkHz unsupported as it would need unavailable dvs mode\n",
436 freq->frequency); 433 pos->frequency);
437 freq->frequency = CPUFREQ_ENTRY_INVALID; 434 pos->frequency = CPUFREQ_ENTRY_INVALID;
438 } else { 435 } else {
439 freq++;
440 continue; 436 continue;
441 } 437 }
442 } 438 }
443 439
444 /* Check for frequencies we can generate */ 440 /* Check for frequencies we can generate */
445 rate = clk_round_rate(s3c_freq->armdiv, 441 rate = clk_round_rate(s3c_freq->armdiv,
446 freq->frequency * 1000); 442 pos->frequency * 1000);
447 rate /= 1000; 443 rate /= 1000;
448 if (rate != freq->frequency) { 444 if (rate != pos->frequency) {
449 pr_debug("cpufreq: %dkHz unsupported by clock (clk_round_rate return %lu)\n", 445 pr_debug("cpufreq: %dkHz unsupported by clock (clk_round_rate return %lu)\n",
450 freq->frequency, rate); 446 pos->frequency, rate);
451 freq->frequency = CPUFREQ_ENTRY_INVALID; 447 pos->frequency = CPUFREQ_ENTRY_INVALID;
452 } 448 }
453
454 freq++;
455 } 449 }
456 450
457 /* Datasheet says PLL stabalisation time must be at least 300us, 451 /* Datasheet says PLL stabalisation time must be at least 300us,