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-04-26 15:50:03 -0700
commit8156c6698070651abe04de23cf03d91a269dd70c (patch)
tree0b9271889caf43bdf2ebe233dc497565a844edd5 /arch/arm/mach-tegra/clock.c
parent248e5e7b80230b76de98c311003b4f5159960646 (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> Change-Id: Ie5fef027411096a465ae5aa84fe84a08a769a613
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 a4ff1dd73a4d..8afc3f8a2689 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);
@@ -331,6 +335,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);