summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/pmac64-cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/pmac64-cpufreq.c')
-rw-r--r--drivers/cpufreq/pmac64-cpufreq.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/drivers/cpufreq/pmac64-cpufreq.c b/drivers/cpufreq/pmac64-cpufreq.c
index 3a51ad7e47c8..5261b92d768b 100644
--- a/drivers/cpufreq/pmac64-cpufreq.c
+++ b/drivers/cpufreq/pmac64-cpufreq.c
@@ -70,11 +70,6 @@ static struct cpufreq_frequency_table g5_cpu_freqs[] = {
70 {0, CPUFREQ_TABLE_END}, 70 {0, CPUFREQ_TABLE_END},
71}; 71};
72 72
73static struct freq_attr* g5_cpu_freqs_attr[] = {
74 &cpufreq_freq_attr_scaling_available_freqs,
75 NULL,
76};
77
78/* Power mode data is an array of the 32 bits PCR values to use for 73/* Power mode data is an array of the 32 bits PCR values to use for
79 * the various frequencies, retrieved from the device-tree 74 * the various frequencies, retrieved from the device-tree
80 */ 75 */
@@ -142,7 +137,7 @@ static void g5_vdnap_switch_volt(int speed_mode)
142 pmf_call_one(pfunc_vdnap0_complete, &args); 137 pmf_call_one(pfunc_vdnap0_complete, &args);
143 if (done) 138 if (done)
144 break; 139 break;
145 msleep(1); 140 usleep_range(1000, 1000);
146 } 141 }
147 if (done == 0) 142 if (done == 0)
148 printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n"); 143 printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n");
@@ -241,7 +236,7 @@ static void g5_pfunc_switch_volt(int speed_mode)
241 if (pfunc_cpu1_volt_low) 236 if (pfunc_cpu1_volt_low)
242 pmf_call_one(pfunc_cpu1_volt_low, NULL); 237 pmf_call_one(pfunc_cpu1_volt_low, NULL);
243 } 238 }
244 msleep(10); /* should be faster , to fix */ 239 usleep_range(10000, 10000); /* should be faster , to fix */
245} 240}
246 241
247/* 242/*
@@ -286,7 +281,7 @@ static int g5_pfunc_switch_freq(int speed_mode)
286 pmf_call_one(pfunc_slewing_done, &args); 281 pmf_call_one(pfunc_slewing_done, &args);
287 if (done) 282 if (done)
288 break; 283 break;
289 msleep(1); 284 usleep_range(500, 500);
290 } 285 }
291 if (done == 0) 286 if (done == 0)
292 printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n"); 287 printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n");
@@ -317,11 +312,6 @@ static int g5_pfunc_query_freq(void)
317 * Common interface to the cpufreq core 312 * Common interface to the cpufreq core
318 */ 313 */
319 314
320static int g5_cpufreq_verify(struct cpufreq_policy *policy)
321{
322 return cpufreq_frequency_table_verify(policy, g5_cpu_freqs);
323}
324
325static int g5_cpufreq_target(struct cpufreq_policy *policy, 315static int g5_cpufreq_target(struct cpufreq_policy *policy,
326 unsigned int target_freq, unsigned int relation) 316 unsigned int target_freq, unsigned int relation)
327{ 317{
@@ -357,27 +347,17 @@ static unsigned int g5_cpufreq_get_speed(unsigned int cpu)
357 347
358static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy) 348static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy)
359{ 349{
360 policy->cpuinfo.transition_latency = transition_latency; 350 return cpufreq_generic_init(policy, g5_cpu_freqs, transition_latency);
361 policy->cur = g5_cpu_freqs[g5_query_freq()].frequency;
362 /* secondary CPUs are tied to the primary one by the
363 * cpufreq core if in the secondary policy we tell it that
364 * it actually must be one policy together with all others. */
365 cpumask_copy(policy->cpus, cpu_online_mask);
366 cpufreq_frequency_table_get_attr(g5_cpu_freqs, policy->cpu);
367
368 return cpufreq_frequency_table_cpuinfo(policy,
369 g5_cpu_freqs);
370} 351}
371 352
372
373static struct cpufreq_driver g5_cpufreq_driver = { 353static struct cpufreq_driver g5_cpufreq_driver = {
374 .name = "powermac", 354 .name = "powermac",
375 .flags = CPUFREQ_CONST_LOOPS, 355 .flags = CPUFREQ_CONST_LOOPS,
376 .init = g5_cpufreq_cpu_init, 356 .init = g5_cpufreq_cpu_init,
377 .verify = g5_cpufreq_verify, 357 .verify = cpufreq_generic_frequency_table_verify,
378 .target = g5_cpufreq_target, 358 .target = g5_cpufreq_target,
379 .get = g5_cpufreq_get_speed, 359 .get = g5_cpufreq_get_speed,
380 .attr = g5_cpu_freqs_attr, 360 .attr = cpufreq_generic_attr,
381}; 361};
382 362
383 363
@@ -397,7 +377,8 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpunode)
397 /* Check supported platforms */ 377 /* Check supported platforms */
398 if (of_machine_is_compatible("PowerMac8,1") || 378 if (of_machine_is_compatible("PowerMac8,1") ||
399 of_machine_is_compatible("PowerMac8,2") || 379 of_machine_is_compatible("PowerMac8,2") ||
400 of_machine_is_compatible("PowerMac9,1")) 380 of_machine_is_compatible("PowerMac9,1") ||
381 of_machine_is_compatible("PowerMac12,1"))
401 use_volts_smu = 1; 382 use_volts_smu = 1;
402 else if (of_machine_is_compatible("PowerMac11,2")) 383 else if (of_machine_is_compatible("PowerMac11,2"))
403 use_volts_vdnap = 1; 384 use_volts_vdnap = 1;
@@ -647,8 +628,10 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpunode)
647 g5_cpu_freqs[0].frequency = max_freq; 628 g5_cpu_freqs[0].frequency = max_freq;
648 g5_cpu_freqs[1].frequency = min_freq; 629 g5_cpu_freqs[1].frequency = min_freq;
649 630
631 /* Based on a measurement on Xserve G5, rounded up. */
632 transition_latency = 10 * NSEC_PER_MSEC;
633
650 /* Set callbacks */ 634 /* Set callbacks */
651 transition_latency = CPUFREQ_ETERNAL;
652 g5_switch_volt = g5_pfunc_switch_volt; 635 g5_switch_volt = g5_pfunc_switch_volt;
653 g5_switch_freq = g5_pfunc_switch_freq; 636 g5_switch_freq = g5_pfunc_switch_freq;
654 g5_query_freq = g5_pfunc_query_freq; 637 g5_query_freq = g5_pfunc_query_freq;