ARM: tegra: clock: Add a pass-through set_rate to super clocks
authorColin Cross <ccross@android.com>
Wed, 3 Nov 2010 23:32:15 +0000 (16:32 -0700)
committerColin Cross <ccross@android.com>
Thu, 4 Nov 2010 00:55:55 +0000 (17:55 -0700)
Change-Id: I55027c93415a59cbf701b1f30e436203316c0d61
Signed-off-by: Colin Cross <ccross@android.com>
arch/arm/mach-tegra/tegra2_clocks.c

index 8bc46e7e098862d5d8441c3df4460f9465c4afd8..2c667fab39ab60a269e78a559accadefe8b4fc23 100644 (file)
@@ -351,11 +351,24 @@ static int tegra2_super_clk_set_parent(struct clk *c, struct clk *p)
        return -EINVAL;
 }
 
+/*
+ * Super clocks have "clock skippers" instead of dividers.  Dividing using
+ * a clock skipper does not allow the voltage to be scaled down, so instead
+ * adjust the rate of the parent clock.  This requires that the parent of a
+ * super clock have no other children, otherwise the rate will change
+ * underneath the other children.
+ */
+static int tegra2_super_clk_set_rate(struct clk *c, unsigned long rate)
+{
+       return clk_set_rate(c->parent, rate);
+}
+
 static struct clk_ops tegra_super_ops = {
        .init                   = tegra2_super_clk_init,
        .enable                 = tegra2_super_clk_enable,
        .disable                = tegra2_super_clk_disable,
        .set_parent             = tegra2_super_clk_set_parent,
+       .set_rate               = tegra2_super_clk_set_rate,
 };
 
 /* virtual cpu clock functions */