summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/clock.c
diff options
context:
space:
mode:
authorAlex Frid <afrid@nvidia.com>2011-01-24 20:33:16 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:42:15 -0800
commit6ea8f8522a40a988c4926fde70ed1fd159981d8f (patch)
tree34c68f0d9a5ec08e6ae5138127e6a82f2d522075 /arch/arm/mach-tegra/clock.c
parent2b452562c87e3f03859b116d950f53efd58cbe2d (diff)
ARM: tegra: clock: Add check for parent over-clocking
Fail clk_set_parent() interface if switching the clock parent will set the rate above maximum limit. Original-Change-Id: I47c0798dafe5f8f497dcacfcd23f6957244cdb0a Reviewed-on: http://git-master/r/16876 Tested-by: Aleksandr Frid <afrid@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> Original-Change-Id: Ie5fef027411096a465ae5aa84fe84a08a769a613 Rebase-Id: Rce314c75bbd31c8fc579e7bd22a00777dc6e94dc
Diffstat (limited to 'arch/arm/mach-tegra/clock.c')
-rw-r--r--arch/arm/mach-tegra/clock.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index c19370b74fcc..326010e65325 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -78,6 +78,10 @@
* The clock operations must lock internally to protect against
* read-modify-write on registers that are shared by multiple clocks
*/
+
+/* FIXME: remove and never ignore overclock */
+#define IGNORE_PARENT_OVERCLOCK 0
+
static DEFINE_MUTEX(clock_list_lock);
static LIST_HEAD(clocks);
@@ -292,6 +296,16 @@ int clk_set_parent(struct clk *c, struct clk *parent)
new_rate = clk_predict_rate_from_parent(c, parent);
old_rate = clk_get_rate_locked(c);
+ if (new_rate > clk_get_max_rate(c)) {
+
+ pr_err("Failed to set parent %s for %s (violates clock limit"
+ " %lu)\n", parent->name, c->name, clk_get_max_rate(c));
+#if !IGNORE_PARENT_OVERCLOCK
+ ret = -EINVAL;
+ goto out;
+#endif
+ }
+
if (clk_is_auto_dvfs(c) && c->refcnt > 0 &&
(!c->parent || new_rate > old_rate)) {
ret = tegra_dvfs_set_rate(c, new_rate);