diff options
Diffstat (limited to 'arch/sparc64/kernel/us3_cpufreq.c')
-rw-r--r-- | arch/sparc64/kernel/us3_cpufreq.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/arch/sparc64/kernel/us3_cpufreq.c b/arch/sparc64/kernel/us3_cpufreq.c index 18fe54b8aa55..9080e7cd4bb0 100644 --- a/arch/sparc64/kernel/us3_cpufreq.c +++ b/arch/sparc64/kernel/us3_cpufreq.c | |||
@@ -56,7 +56,7 @@ static void write_safari_cfg(unsigned long val) | |||
56 | 56 | ||
57 | static unsigned long get_current_freq(unsigned int cpu, unsigned long safari_cfg) | 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 | unsigned long ret; | 60 | unsigned long ret; |
61 | 61 | ||
62 | switch (safari_cfg & SAFARI_CFG_DIV_MASK) { | 62 | switch (safari_cfg & SAFARI_CFG_DIV_MASK) { |
@@ -76,6 +76,26 @@ static unsigned long get_current_freq(unsigned int cpu, unsigned long safari_cfg | |||
76 | return ret; | 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 | static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index) | 99 | static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index) |
80 | { | 100 | { |
81 | unsigned long new_bits, new_freq, reg; | 101 | unsigned long new_bits, new_freq, reg; |
@@ -88,7 +108,7 @@ static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index) | |||
88 | cpus_allowed = current->cpus_allowed; | 108 | cpus_allowed = current->cpus_allowed; |
89 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | 109 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); |
90 | 110 | ||
91 | new_freq = sparc64_get_clock_tick(cpu); | 111 | new_freq = sparc64_get_clock_tick(cpu) / 1000; |
92 | switch (index) { | 112 | switch (index) { |
93 | case 0: | 113 | case 0: |
94 | new_bits = SAFARI_CFG_DIV_1; | 114 | new_bits = SAFARI_CFG_DIV_1; |
@@ -150,7 +170,7 @@ static int us3_freq_verify(struct cpufreq_policy *policy) | |||
150 | static int __init us3_freq_cpu_init(struct cpufreq_policy *policy) | 170 | static int __init us3_freq_cpu_init(struct cpufreq_policy *policy) |
151 | { | 171 | { |
152 | unsigned int cpu = policy->cpu; | 172 | unsigned int cpu = policy->cpu; |
153 | unsigned long clock_tick = sparc64_get_clock_tick(cpu); | 173 | unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000; |
154 | struct cpufreq_frequency_table *table = | 174 | struct cpufreq_frequency_table *table = |
155 | &us3_freq_table[cpu].table[0]; | 175 | &us3_freq_table[cpu].table[0]; |
156 | 176 | ||
@@ -206,9 +226,10 @@ static int __init us3_freq_init(void) | |||
206 | memset(us3_freq_table, 0, | 226 | memset(us3_freq_table, 0, |
207 | (NR_CPUS * sizeof(struct us3_freq_percpu_info))); | 227 | (NR_CPUS * sizeof(struct us3_freq_percpu_info))); |
208 | 228 | ||
229 | driver->init = us3_freq_cpu_init; | ||
209 | driver->verify = us3_freq_verify; | 230 | driver->verify = us3_freq_verify; |
210 | driver->target = us3_freq_target; | 231 | driver->target = us3_freq_target; |
211 | driver->init = us3_freq_cpu_init; | 232 | driver->get = us3_freq_get; |
212 | driver->exit = us3_freq_cpu_exit; | 233 | driver->exit = us3_freq_cpu_exit; |
213 | driver->owner = THIS_MODULE, | 234 | driver->owner = THIS_MODULE, |
214 | strcpy(driver->name, "UltraSPARC-III"); | 235 | strcpy(driver->name, "UltraSPARC-III"); |