diff options
Diffstat (limited to 'drivers/cpufreq/at32ap-cpufreq.c')
-rw-r--r-- | drivers/cpufreq/at32ap-cpufreq.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/cpufreq/at32ap-cpufreq.c b/drivers/cpufreq/at32ap-cpufreq.c index 788f7e77565d..7439deddd5cf 100644 --- a/drivers/cpufreq/at32ap-cpufreq.c +++ b/drivers/cpufreq/at32ap-cpufreq.c | |||
@@ -77,7 +77,7 @@ static int at32_set_target(struct cpufreq_policy *policy, | |||
77 | 77 | ||
78 | static int __init at32_cpufreq_driver_init(struct cpufreq_policy *policy) | 78 | static int __init at32_cpufreq_driver_init(struct cpufreq_policy *policy) |
79 | { | 79 | { |
80 | unsigned int frequency, rate; | 80 | unsigned int frequency, rate, min_freq; |
81 | int retval, steps, i; | 81 | int retval, steps, i; |
82 | 82 | ||
83 | if (policy->cpu != 0) | 83 | if (policy->cpu != 0) |
@@ -90,12 +90,9 @@ static int __init at32_cpufreq_driver_init(struct cpufreq_policy *policy) | |||
90 | goto out_err; | 90 | goto out_err; |
91 | } | 91 | } |
92 | 92 | ||
93 | policy->cpuinfo.min_freq = (clk_round_rate(cpuclk, 1) + 500) / 1000; | 93 | min_freq = (clk_round_rate(cpuclk, 1) + 500) / 1000; |
94 | policy->cpuinfo.max_freq = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000; | 94 | frequency = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000; |
95 | policy->cpuinfo.transition_latency = 0; | 95 | policy->cpuinfo.transition_latency = 0; |
96 | policy->cur = at32_get_speed(0); | ||
97 | policy->min = policy->cpuinfo.min_freq; | ||
98 | policy->max = policy->cpuinfo.max_freq; | ||
99 | 96 | ||
100 | /* | 97 | /* |
101 | * AVR32 CPU frequency rate scales in power of two between maximum and | 98 | * AVR32 CPU frequency rate scales in power of two between maximum and |
@@ -104,7 +101,7 @@ static int __init at32_cpufreq_driver_init(struct cpufreq_policy *policy) | |||
104 | * Further validate that the frequency is usable, and append it to the | 101 | * Further validate that the frequency is usable, and append it to the |
105 | * frequency table. | 102 | * frequency table. |
106 | */ | 103 | */ |
107 | steps = fls(policy->cpuinfo.max_freq / policy->cpuinfo.min_freq) + 1; | 104 | steps = fls(frequency / min_freq) + 1; |
108 | freq_table = kzalloc(steps * sizeof(struct cpufreq_frequency_table), | 105 | freq_table = kzalloc(steps * sizeof(struct cpufreq_frequency_table), |
109 | GFP_KERNEL); | 106 | GFP_KERNEL); |
110 | if (!freq_table) { | 107 | if (!freq_table) { |
@@ -112,7 +109,6 @@ static int __init at32_cpufreq_driver_init(struct cpufreq_policy *policy) | |||
112 | goto out_err_put_clk; | 109 | goto out_err_put_clk; |
113 | } | 110 | } |
114 | 111 | ||
115 | frequency = policy->cpuinfo.max_freq; | ||
116 | for (i = 0; i < (steps - 1); i++) { | 112 | for (i = 0; i < (steps - 1); i++) { |
117 | rate = clk_round_rate(cpuclk, frequency * 1000) / 1000; | 113 | rate = clk_round_rate(cpuclk, frequency * 1000) / 1000; |
118 | 114 | ||