aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cris-etraxfs-cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cris-etraxfs-cpufreq.c')
-rw-r--r--drivers/cpufreq/cris-etraxfs-cpufreq.c53
1 files changed, 6 insertions, 47 deletions
diff --git a/drivers/cpufreq/cris-etraxfs-cpufreq.c b/drivers/cpufreq/cris-etraxfs-cpufreq.c
index 72328f77dc53..c58811abd961 100644
--- a/drivers/cpufreq/cris-etraxfs-cpufreq.c
+++ b/drivers/cpufreq/cris-etraxfs-cpufreq.c
@@ -27,8 +27,7 @@ static unsigned int cris_freq_get_cpu_frequency(unsigned int cpu)
27 return clk_ctrl.pll ? 200000 : 6000; 27 return clk_ctrl.pll ? 200000 : 6000;
28} 28}
29 29
30static void cris_freq_set_cpu_state(struct cpufreq_policy *policy, 30static int cris_freq_target(struct cpufreq_policy *policy, unsigned int state)
31 unsigned int state)
32{ 31{
33 struct cpufreq_freqs freqs; 32 struct cpufreq_freqs freqs;
34 reg_config_rw_clk_ctrl clk_ctrl; 33 reg_config_rw_clk_ctrl clk_ctrl;
@@ -52,63 +51,23 @@ static void cris_freq_set_cpu_state(struct cpufreq_policy *policy,
52 local_irq_enable(); 51 local_irq_enable();
53 52
54 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 53 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
55};
56
57static int cris_freq_verify(struct cpufreq_policy *policy)
58{
59 return cpufreq_frequency_table_verify(policy, &cris_freq_table[0]);
60}
61
62static int cris_freq_target(struct cpufreq_policy *policy,
63 unsigned int target_freq, unsigned int relation)
64{
65 unsigned int newstate = 0;
66
67 if (cpufreq_frequency_table_target
68 (policy, cris_freq_table, target_freq, relation, &newstate))
69 return -EINVAL;
70
71 cris_freq_set_cpu_state(policy, newstate);
72 54
73 return 0; 55 return 0;
74} 56}
75 57
76static int cris_freq_cpu_init(struct cpufreq_policy *policy) 58static int cris_freq_cpu_init(struct cpufreq_policy *policy)
77{ 59{
78 int result; 60 return cpufreq_generic_init(policy, cris_freq_table, 1000000);
79
80 /* cpuinfo and default policy values */
81 policy->cpuinfo.transition_latency = 1000000; /* 1ms */
82 policy->cur = cris_freq_get_cpu_frequency(0);
83
84 result = cpufreq_frequency_table_cpuinfo(policy, cris_freq_table);
85 if (result)
86 return (result);
87
88 cpufreq_frequency_table_get_attr(cris_freq_table, policy->cpu);
89
90 return 0;
91} 61}
92 62
93static int cris_freq_cpu_exit(struct cpufreq_policy *policy)
94{
95 cpufreq_frequency_table_put_attr(policy->cpu);
96 return 0;
97}
98
99static struct freq_attr *cris_freq_attr[] = {
100 &cpufreq_freq_attr_scaling_available_freqs,
101 NULL,
102};
103
104static struct cpufreq_driver cris_freq_driver = { 63static struct cpufreq_driver cris_freq_driver = {
105 .get = cris_freq_get_cpu_frequency, 64 .get = cris_freq_get_cpu_frequency,
106 .verify = cris_freq_verify, 65 .verify = cpufreq_generic_frequency_table_verify,
107 .target = cris_freq_target, 66 .target_index = cris_freq_target,
108 .init = cris_freq_cpu_init, 67 .init = cris_freq_cpu_init,
109 .exit = cris_freq_cpu_exit, 68 .exit = cpufreq_generic_exit,
110 .name = "cris_freq", 69 .name = "cris_freq",
111 .attr = cris_freq_attr, 70 .attr = cpufreq_generic_attr,
112}; 71};
113 72
114static int __init cris_freq_init(void) 73static int __init cris_freq_init(void)