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

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