aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorMike Turquette <mturquette@linaro.org>2014-08-18 11:30:29 -0400
committerMike Turquette <mturquette@linaro.org>2014-09-02 18:02:54 -0400
commit105299381d8720a3afd4252689ae8551f49944be (patch)
tree4978320975b50e6960af612cbeaab04bb48e549b /drivers/cpufreq
parente8e8a9b0d86c093b208789fd71501c91a919ffdb (diff)
cpufreq: kirkwood: use the powersave multiplexer
The powersave clock acts like a multiplexer for the cpu, selecting either the clock signal derived from the cpu pll or from the ddr clock. This patch changes powersave from a gate clock to a mux clock to better reflect this behavior. This is a cleaner approach whereby the frequency of the cpu always matches the rate of powersave_clk. The cpufreq driver for the kirkwood platform no longer must parse this behavior out of various calls to clk_enable and clk_disable, but can instead simply select the parent cpu it wants when changing rate. Likewise when requesting the cpu rate we need only query powersave_clk's rate through the usual call to clk_get_rate. The new clock data and corresponding changes to the cpufreq driver are combined into this single commit to avoid a git bisect issue where this cpufreq driver fails to work properly between the commit that updates the kirkwood clock driver and the commit that changes how the cpufreq driver uses that clock. Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Tested-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/kirkwood-cpufreq.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c
index 37a480680cd0..7906d4acfe40 100644
--- a/drivers/cpufreq/kirkwood-cpufreq.c
+++ b/drivers/cpufreq/kirkwood-cpufreq.c
@@ -12,7 +12,6 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/clk-provider.h>
16#include <linux/cpufreq.h> 15#include <linux/cpufreq.h>
17#include <linux/of_device.h> 16#include <linux/of_device.h>
18#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -39,8 +38,7 @@ static struct priv
39 * - cpu clk 38 * - cpu clk
40 * - ddr clk 39 * - ddr clk
41 * 40 *
42 * The frequencies are set at runtime before registering this * 41 * The frequencies are set at runtime before registering this table.
43 * table.
44 */ 42 */
45static struct cpufreq_frequency_table kirkwood_freq_table[] = { 43static struct cpufreq_frequency_table kirkwood_freq_table[] = {
46 {0, STATE_CPU_FREQ, 0}, /* CPU uses cpuclk */ 44 {0, STATE_CPU_FREQ, 0}, /* CPU uses cpuclk */
@@ -50,9 +48,7 @@ static struct cpufreq_frequency_table kirkwood_freq_table[] = {
50 48
51static unsigned int kirkwood_cpufreq_get_cpu_frequency(unsigned int cpu) 49static unsigned int kirkwood_cpufreq_get_cpu_frequency(unsigned int cpu)
52{ 50{
53 if (__clk_is_enabled(priv.powersave_clk)) 51 return clk_get_rate(priv.powersave_clk) / 1000;
54 return kirkwood_freq_table[1].frequency;
55 return kirkwood_freq_table[0].frequency;
56} 52}
57 53
58static int kirkwood_cpufreq_target(struct cpufreq_policy *policy, 54static int kirkwood_cpufreq_target(struct cpufreq_policy *policy,
@@ -70,10 +66,10 @@ static int kirkwood_cpufreq_target(struct cpufreq_policy *policy,
70 66
71 switch (state) { 67 switch (state) {
72 case STATE_CPU_FREQ: 68 case STATE_CPU_FREQ:
73 clk_disable(priv.powersave_clk); 69 clk_set_parent(priv.powersave_clk, priv.cpu_clk);
74 break; 70 break;
75 case STATE_DDR_FREQ: 71 case STATE_DDR_FREQ:
76 clk_enable(priv.powersave_clk); 72 clk_set_parent(priv.powersave_clk, priv.ddr_clk);
77 break; 73 break;
78 } 74 }
79 75
@@ -150,7 +146,7 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
150 err = PTR_ERR(priv.powersave_clk); 146 err = PTR_ERR(priv.powersave_clk);
151 goto out_ddr; 147 goto out_ddr;
152 } 148 }
153 clk_prepare(priv.powersave_clk); 149 clk_prepare_enable(priv.powersave_clk);
154 150
155 of_node_put(np); 151 of_node_put(np);
156 np = NULL; 152 np = NULL;