提交 30a2c5d2 编写于 作者: S Sekhar Nori 提交者: Kevin Hilman

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: NSekhar Nori <nsekhar@ti.com>
Signed-off-by: NKevin Hilman <khilman@deeprootsystems.com>
上级 b39639b8
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
struct davinci_cpufreq { struct davinci_cpufreq {
struct device *dev; struct device *dev;
struct clk *armclk; struct clk *armclk;
struct clk *asyncclk;
unsigned long asyncrate;
}; };
static struct davinci_cpufreq cpufreq; static struct davinci_cpufreq cpufreq;
...@@ -114,6 +116,12 @@ static int davinci_target(struct cpufreq_policy *policy, ...@@ -114,6 +116,12 @@ static int davinci_target(struct cpufreq_policy *policy,
if (ret) if (ret)
goto out; goto out;
if (cpufreq.asyncclk) {
ret = clk_set_rate(cpufreq.asyncclk, cpufreq.asyncrate);
if (ret)
goto out;
}
/* if moving to lower freq, lower the voltage after lowering freq */ /* if moving to lower freq, lower the voltage after lowering freq */
if (pdata->set_voltage && freqs.new < freqs.old) if (pdata->set_voltage && freqs.new < freqs.old)
pdata->set_voltage(idx); pdata->set_voltage(idx);
...@@ -191,6 +199,7 @@ static struct cpufreq_driver davinci_driver = { ...@@ -191,6 +199,7 @@ static struct cpufreq_driver davinci_driver = {
static int __init davinci_cpufreq_probe(struct platform_device *pdev) static int __init davinci_cpufreq_probe(struct platform_device *pdev)
{ {
struct davinci_cpufreq_config *pdata = pdev->dev.platform_data; struct davinci_cpufreq_config *pdata = pdev->dev.platform_data;
struct clk *asyncclk;
if (!pdata) if (!pdata)
return -EINVAL; return -EINVAL;
...@@ -205,6 +214,12 @@ static int __init davinci_cpufreq_probe(struct platform_device *pdev) ...@@ -205,6 +214,12 @@ static int __init davinci_cpufreq_probe(struct platform_device *pdev)
return PTR_ERR(cpufreq.armclk); return PTR_ERR(cpufreq.armclk);
} }
asyncclk = clk_get(cpufreq.dev, "async");
if (!IS_ERR(asyncclk)) {
cpufreq.asyncclk = asyncclk;
cpufreq.asyncrate = clk_get_rate(asyncclk);
}
return cpufreq_register_driver(&davinci_driver); return cpufreq_register_driver(&davinci_driver);
} }
...@@ -212,6 +227,9 @@ static int __exit davinci_cpufreq_remove(struct platform_device *pdev) ...@@ -212,6 +227,9 @@ static int __exit davinci_cpufreq_remove(struct platform_device *pdev)
{ {
clk_put(cpufreq.armclk); clk_put(cpufreq.armclk);
if (cpufreq.asyncclk)
clk_put(cpufreq.asyncclk);
return cpufreq_unregister_driver(&davinci_driver); return cpufreq_unregister_driver(&davinci_driver);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册