aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/blackfin-cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/blackfin-cpufreq.c')
-rw-r--r--drivers/cpufreq/blackfin-cpufreq.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/drivers/cpufreq/blackfin-cpufreq.c b/drivers/cpufreq/blackfin-cpufreq.c
index ef05978a7237..12528b28d45d 100644
--- a/drivers/cpufreq/blackfin-cpufreq.c
+++ b/drivers/cpufreq/blackfin-cpufreq.c
@@ -127,14 +127,11 @@ unsigned long cpu_set_cclk(int cpu, unsigned long new)
127} 127}
128#endif 128#endif
129 129
130static int bfin_target(struct cpufreq_policy *policy, 130static int bfin_target(struct cpufreq_policy *policy, unsigned int index)
131 unsigned int target_freq, unsigned int relation)
132{ 131{
133#ifndef CONFIG_BF60x 132#ifndef CONFIG_BF60x
134 unsigned int plldiv; 133 unsigned int plldiv;
135#endif 134#endif
136 unsigned int index;
137 unsigned long cclk_hz;
138 struct cpufreq_freqs freqs; 135 struct cpufreq_freqs freqs;
139 static unsigned long lpj_ref; 136 static unsigned long lpj_ref;
140 static unsigned int lpj_ref_freq; 137 static unsigned int lpj_ref_freq;
@@ -144,17 +141,11 @@ static int bfin_target(struct cpufreq_policy *policy,
144 cycles_t cycles; 141 cycles_t cycles;
145#endif 142#endif
146 143
147 if (cpufreq_frequency_table_target(policy, bfin_freq_table, target_freq,
148 relation, &index))
149 return -EINVAL;
150
151 cclk_hz = bfin_freq_table[index].frequency;
152
153 freqs.old = bfin_getfreq_khz(0); 144 freqs.old = bfin_getfreq_khz(0);
154 freqs.new = cclk_hz; 145 freqs.new = bfin_freq_table[index].frequency;
155 146
156 pr_debug("cpufreq: changing cclk to %lu; target = %u, oldfreq = %u\n", 147 pr_debug("cpufreq: changing cclk to %lu; target = %u, oldfreq = %u\n",
157 cclk_hz, target_freq, freqs.old); 148 freqs.new, freqs.new, freqs.old);
158 149
159 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); 150 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
160#ifndef CONFIG_BF60x 151#ifndef CONFIG_BF60x
@@ -191,11 +182,6 @@ static int bfin_target(struct cpufreq_policy *policy,
191 return ret; 182 return ret;
192} 183}
193 184
194static int bfin_verify_speed(struct cpufreq_policy *policy)
195{
196 return cpufreq_frequency_table_verify(policy, bfin_freq_table);
197}
198
199static int __bfin_cpu_init(struct cpufreq_policy *policy) 185static int __bfin_cpu_init(struct cpufreq_policy *policy)
200{ 186{
201 187
@@ -209,23 +195,17 @@ static int __bfin_cpu_init(struct cpufreq_policy *policy)
209 195
210 policy->cpuinfo.transition_latency = 50000; /* 50us assumed */ 196 policy->cpuinfo.transition_latency = 50000; /* 50us assumed */
211 197
212 policy->cur = cclk; 198 return cpufreq_table_validate_and_show(policy, bfin_freq_table);
213 cpufreq_frequency_table_get_attr(bfin_freq_table, policy->cpu);
214 return cpufreq_frequency_table_cpuinfo(policy, bfin_freq_table);
215} 199}
216 200
217static struct freq_attr *bfin_freq_attr[] = {
218 &cpufreq_freq_attr_scaling_available_freqs,
219 NULL,
220};
221
222static struct cpufreq_driver bfin_driver = { 201static struct cpufreq_driver bfin_driver = {
223 .verify = bfin_verify_speed, 202 .verify = cpufreq_generic_frequency_table_verify,
224 .target = bfin_target, 203 .target_index = bfin_target,
225 .get = bfin_getfreq_khz, 204 .get = bfin_getfreq_khz,
226 .init = __bfin_cpu_init, 205 .init = __bfin_cpu_init,
206 .exit = cpufreq_generic_exit,
227 .name = "bfin cpufreq", 207 .name = "bfin cpufreq",
228 .attr = bfin_freq_attr, 208 .attr = cpufreq_generic_attr,
229}; 209};
230 210
231static int __init bfin_cpu_init(void) 211static int __init bfin_cpu_init(void)