Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6

+52 -13
+27 -9
arch/sparc64/kernel/us2e_cpufreq.c
··· 88 88 { 89 89 unsigned long old_refr_count, refr_count, mctrl; 90 90 91 - 92 91 refr_count = (clock_tick * MCTRL0_REFR_INTERVAL); 93 92 refr_count /= (MCTRL0_REFR_CLKS_P_CNT * divisor * 1000000000UL); 94 93 ··· 229 230 return ret; 230 231 } 231 232 233 + static unsigned int us2e_freq_get(unsigned int cpu) 234 + { 235 + cpumask_t cpus_allowed; 236 + unsigned long clock_tick, estar; 237 + 238 + if (!cpu_online(cpu)) 239 + return 0; 240 + 241 + cpus_allowed = current->cpus_allowed; 242 + set_cpus_allowed(current, cpumask_of_cpu(cpu)); 243 + 244 + clock_tick = sparc64_get_clock_tick(cpu) / 1000; 245 + estar = read_hbreg(HBIRD_ESTAR_MODE_ADDR); 246 + 247 + set_cpus_allowed(current, cpus_allowed); 248 + 249 + return clock_tick / estar_to_divisor(estar); 250 + } 251 + 232 252 static void us2e_set_cpu_divider_index(unsigned int cpu, unsigned int index) 233 253 { 234 254 unsigned long new_bits, new_freq; ··· 261 243 cpus_allowed = current->cpus_allowed; 262 244 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 263 245 264 - new_freq = clock_tick = sparc64_get_clock_tick(cpu); 246 + new_freq = clock_tick = sparc64_get_clock_tick(cpu) / 1000; 265 247 new_bits = index_to_estar_mode(index); 266 248 divisor = index_to_divisor(index); 267 249 new_freq /= divisor; ··· 276 258 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 277 259 278 260 if (old_divisor != divisor) 279 - us2e_transition(estar, new_bits, clock_tick, old_divisor, divisor); 261 + us2e_transition(estar, new_bits, clock_tick * 1000, 262 + old_divisor, divisor); 280 263 281 264 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 282 265 ··· 291 272 unsigned int new_index = 0; 292 273 293 274 if (cpufreq_frequency_table_target(policy, 294 - &us2e_freq_table[policy->cpu].table[0], 295 - target_freq, 296 - relation, 297 - &new_index)) 275 + &us2e_freq_table[policy->cpu].table[0], 276 + target_freq, relation, &new_index)) 298 277 return -EINVAL; 299 278 300 279 us2e_set_cpu_divider_index(policy->cpu, new_index); ··· 309 292 static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy) 310 293 { 311 294 unsigned int cpu = policy->cpu; 312 - unsigned long clock_tick = sparc64_get_clock_tick(cpu); 295 + unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000; 313 296 struct cpufreq_frequency_table *table = 314 297 &us2e_freq_table[cpu].table[0]; 315 298 ··· 368 351 memset(us2e_freq_table, 0, 369 352 (NR_CPUS * sizeof(struct us2e_freq_percpu_info))); 370 353 354 + driver->init = us2e_freq_cpu_init; 371 355 driver->verify = us2e_freq_verify; 372 356 driver->target = us2e_freq_target; 373 - driver->init = us2e_freq_cpu_init; 357 + driver->get = us2e_freq_get; 374 358 driver->exit = us2e_freq_cpu_exit; 375 359 driver->owner = THIS_MODULE, 376 360 strcpy(driver->name, "UltraSPARC-IIe");
+25 -4
arch/sparc64/kernel/us3_cpufreq.c
··· 56 56 57 57 static unsigned long get_current_freq(unsigned int cpu, unsigned long safari_cfg) 58 58 { 59 - unsigned long clock_tick = sparc64_get_clock_tick(cpu); 59 + unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000; 60 60 unsigned long ret; 61 61 62 62 switch (safari_cfg & SAFARI_CFG_DIV_MASK) { ··· 76 76 return ret; 77 77 } 78 78 79 + static unsigned int us3_freq_get(unsigned int cpu) 80 + { 81 + cpumask_t cpus_allowed; 82 + unsigned long reg; 83 + unsigned int ret; 84 + 85 + if (!cpu_online(cpu)) 86 + return 0; 87 + 88 + cpus_allowed = current->cpus_allowed; 89 + set_cpus_allowed(current, cpumask_of_cpu(cpu)); 90 + 91 + reg = read_safari_cfg(); 92 + ret = get_current_freq(cpu, reg); 93 + 94 + set_cpus_allowed(current, cpus_allowed); 95 + 96 + return ret; 97 + } 98 + 79 99 static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index) 80 100 { 81 101 unsigned long new_bits, new_freq, reg; ··· 108 88 cpus_allowed = current->cpus_allowed; 109 89 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 110 90 111 - new_freq = sparc64_get_clock_tick(cpu); 91 + new_freq = sparc64_get_clock_tick(cpu) / 1000; 112 92 switch (index) { 113 93 case 0: 114 94 new_bits = SAFARI_CFG_DIV_1; ··· 170 150 static int __init us3_freq_cpu_init(struct cpufreq_policy *policy) 171 151 { 172 152 unsigned int cpu = policy->cpu; 173 - unsigned long clock_tick = sparc64_get_clock_tick(cpu); 153 + unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000; 174 154 struct cpufreq_frequency_table *table = 175 155 &us3_freq_table[cpu].table[0]; 176 156 ··· 226 206 memset(us3_freq_table, 0, 227 207 (NR_CPUS * sizeof(struct us3_freq_percpu_info))); 228 208 209 + driver->init = us3_freq_cpu_init; 229 210 driver->verify = us3_freq_verify; 230 211 driver->target = us3_freq_target; 231 - driver->init = us3_freq_cpu_init; 212 + driver->get = us3_freq_get; 232 213 driver->exit = us3_freq_cpu_exit; 233 214 driver->owner = THIS_MODULE, 234 215 strcpy(driver->name, "UltraSPARC-III");