aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2010-07-20 07:16:50 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-09-24 10:40:25 -0400
commit30a2c5d2f0134df6175af26ce554aacaee304280 (patch)
tree29fe671fef47283a0838cb38f207f4762a604c89 /arch/arm/mach-davinci
parentb39639b820ca64e55c39b5217773919ca7973cec (diff)
davinci: cpufreq: add support for keeping an additional clock constant
On OMAP-L138 SoC, some of the sysclks need not be at a fixed ratio to CPU clock and can be kept at a relatively constant rate by adjusting the PLLDIVn ratio even as cpufreq goes ahead and changes the CPU clock. This feature can be used to keep the EMIFA (PLL0 SYSCLK3) clock at a constant rate so that the EMIF timings need not be re-programmed whenever the CPU frequency changes. This patch adds the required suppport to cpufreq driver. Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r--arch/arm/mach-davinci/cpufreq.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c
index bc8014279114..343de73161fa 100644
--- a/arch/arm/mach-davinci/cpufreq.c
+++ b/arch/arm/mach-davinci/cpufreq.c
@@ -34,6 +34,8 @@
34struct davinci_cpufreq { 34struct davinci_cpufreq {
35 struct device *dev; 35 struct device *dev;
36 struct clk *armclk; 36 struct clk *armclk;
37 struct clk *asyncclk;
38 unsigned long asyncrate;
37}; 39};
38static struct davinci_cpufreq cpufreq; 40static struct davinci_cpufreq cpufreq;
39 41
@@ -114,6 +116,12 @@ static int davinci_target(struct cpufreq_policy *policy,
114 if (ret) 116 if (ret)
115 goto out; 117 goto out;
116 118
119 if (cpufreq.asyncclk) {
120 ret = clk_set_rate(cpufreq.asyncclk, cpufreq.asyncrate);
121 if (ret)
122 goto out;
123 }
124
117 /* if moving to lower freq, lower the voltage after lowering freq */ 125 /* if moving to lower freq, lower the voltage after lowering freq */
118 if (pdata->set_voltage && freqs.new < freqs.old) 126 if (pdata->set_voltage && freqs.new < freqs.old)
119 pdata->set_voltage(idx); 127 pdata->set_voltage(idx);
@@ -191,6 +199,7 @@ static struct cpufreq_driver davinci_driver = {
191static int __init davinci_cpufreq_probe(struct platform_device *pdev) 199static int __init davinci_cpufreq_probe(struct platform_device *pdev)
192{ 200{
193 struct davinci_cpufreq_config *pdata = pdev->dev.platform_data; 201 struct davinci_cpufreq_config *pdata = pdev->dev.platform_data;
202 struct clk *asyncclk;
194 203
195 if (!pdata) 204 if (!pdata)
196 return -EINVAL; 205 return -EINVAL;
@@ -205,6 +214,12 @@ static int __init davinci_cpufreq_probe(struct platform_device *pdev)
205 return PTR_ERR(cpufreq.armclk); 214 return PTR_ERR(cpufreq.armclk);
206 } 215 }
207 216
217 asyncclk = clk_get(cpufreq.dev, "async");
218 if (!IS_ERR(asyncclk)) {
219 cpufreq.asyncclk = asyncclk;
220 cpufreq.asyncrate = clk_get_rate(asyncclk);
221 }
222
208 return cpufreq_register_driver(&davinci_driver); 223 return cpufreq_register_driver(&davinci_driver);
209} 224}
210 225
@@ -212,6 +227,9 @@ static int __exit davinci_cpufreq_remove(struct platform_device *pdev)
212{ 227{
213 clk_put(cpufreq.armclk); 228 clk_put(cpufreq.armclk);
214 229
230 if (cpufreq.asyncclk)
231 clk_put(cpufreq.asyncclk);
232
215 return cpufreq_unregister_driver(&davinci_driver); 233 return cpufreq_unregister_driver(&davinci_driver);
216} 234}
217 235