diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2013-08-05 14:27:12 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-08-07 16:25:06 -0400 |
commit | f54fe64d14dff3df6d45a48115d248a82557811f (patch) | |
tree | a0115b281230dbb0a1c3d50e95b81c64264e63c9 | |
parent | c095ba7224d8edc71dcef0d655911399a8bd4a3f (diff) |
cpufreq: loongson2: fix regression related to clock management
Commit 42913c799 (MIPS: Loongson2: Use clk API instead of direct
dereferences) broke the cpufreq functionality on Loongson2 boards:
clk_set_rate() is called before the CPU frequency table is
initialized, and therefore will always fail.
Fix by moving the clk_set_rate() after the table initialization.
Tested on Lemote FuLoong mini-PC.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 3.9+ <stable@vger.kernel.org> # 3.9+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpufreq/loongson2_cpufreq.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c index bb838b985077..9536852c504a 100644 --- a/drivers/cpufreq/loongson2_cpufreq.c +++ b/drivers/cpufreq/loongson2_cpufreq.c | |||
@@ -118,11 +118,6 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
118 | clk_put(cpuclk); | 118 | clk_put(cpuclk); |
119 | return -EINVAL; | 119 | return -EINVAL; |
120 | } | 120 | } |
121 | ret = clk_set_rate(cpuclk, rate); | ||
122 | if (ret) { | ||
123 | clk_put(cpuclk); | ||
124 | return ret; | ||
125 | } | ||
126 | 121 | ||
127 | /* clock table init */ | 122 | /* clock table init */ |
128 | for (i = 2; | 123 | for (i = 2; |
@@ -130,6 +125,12 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
130 | i++) | 125 | i++) |
131 | loongson2_clockmod_table[i].frequency = (rate * i) / 8; | 126 | loongson2_clockmod_table[i].frequency = (rate * i) / 8; |
132 | 127 | ||
128 | ret = clk_set_rate(cpuclk, rate); | ||
129 | if (ret) { | ||
130 | clk_put(cpuclk); | ||
131 | return ret; | ||
132 | } | ||
133 | |||
133 | policy->cur = loongson2_cpufreq_get(policy->cpu); | 134 | policy->cur = loongson2_cpufreq_get(policy->cpu); |
134 | 135 | ||
135 | cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0], | 136 | cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0], |