* [PATCH v2] cpufreq: loongson2: fix broken cpufreq
@ 2013-08-05 18:27 Aaro Koskinen
2013-08-06 14:40 ` Ralf Baechle
0 siblings, 1 reply; 3+ messages in thread
From: Aaro Koskinen @ 2013-08-05 18:27 UTC (permalink / raw)
To: Rafael J. Wysocki, Viresh Kumar, cpufreq, linux-pm, Ralf Baechle
Cc: linux-kernel, linux-mips, Julia Lawall, Aaro Koskinen, stable
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: stable@vger.kernel.org
---
Changes since the first version
(http://marc.info/?l=linux-kernel&m=137357177225034&w=2):
- Changed the subject prefix. I guess this should be merged through
the cpufreq/PM instead of MIPS tree?
- Added ACK from Viresh Kumar.
drivers/cpufreq/loongson2_cpufreq.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
index bb838b9..9536852 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)
clk_put(cpuclk);
return -EINVAL;
}
- ret = clk_set_rate(cpuclk, rate);
- if (ret) {
- clk_put(cpuclk);
- return ret;
- }
/* clock table init */
for (i = 2;
@@ -130,6 +125,12 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
i++)
loongson2_clockmod_table[i].frequency = (rate * i) / 8;
+ ret = clk_set_rate(cpuclk, rate);
+ if (ret) {
+ clk_put(cpuclk);
+ return ret;
+ }
+
policy->cur = loongson2_cpufreq_get(policy->cpu);
cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0],
--
1.8.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] cpufreq: loongson2: fix broken cpufreq
2013-08-05 18:27 [PATCH v2] cpufreq: loongson2: fix broken cpufreq Aaro Koskinen
@ 2013-08-06 14:40 ` Ralf Baechle
2013-08-06 22:43 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2013-08-06 14:40 UTC (permalink / raw)
To: Aaro Koskinen
Cc: Rafael J. Wysocki, Viresh Kumar, cpufreq, linux-pm, linux-kernel,
linux-mips, Julia Lawall, stable
On Mon, Aug 05, 2013 at 09:27:12PM +0300, Aaro Koskinen wrote:
> 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.
Seems to make sense.
Rafael or Virish, this should go to Linus for 3.11. Do you want to funnel
this through the cpufreq tree or shall I send this to Linus with the
next batch of MIPS stuff?
Ralf
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] cpufreq: loongson2: fix broken cpufreq
2013-08-06 14:40 ` Ralf Baechle
@ 2013-08-06 22:43 ` Rafael J. Wysocki
0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2013-08-06 22:43 UTC (permalink / raw)
To: Ralf Baechle
Cc: Aaro Koskinen, Viresh Kumar, cpufreq, linux-pm, linux-kernel,
linux-mips, Julia Lawall, stable
On Tuesday, August 06, 2013 04:40:12 PM Ralf Baechle wrote:
> On Mon, Aug 05, 2013 at 09:27:12PM +0300, Aaro Koskinen wrote:
>
> > 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.
>
> Seems to make sense.
>
> Rafael or Virish, this should go to Linus for 3.11. Do you want to funnel
> this through the cpufreq tree or shall I send this to Linus with the
> next batch of MIPS stuff?
I've taken it already.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-06 22:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-05 18:27 [PATCH v2] cpufreq: loongson2: fix broken cpufreq Aaro Koskinen
2013-08-06 14:40 ` Ralf Baechle
2013-08-06 22:43 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).