Merge branch 'cleanup/io-pci' into next/cleanups
[cascardo/linux.git] / arch / arm / mach-omap2 / dpll3xxx.c
index f0f10be..b9c8d2f 100644 (file)
@@ -135,11 +135,20 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
  */
 static int _omap3_noncore_dpll_lock(struct clk *clk)
 {
+       const struct dpll_data *dd;
        u8 ai;
-       int r;
+       u8 state = 1;
+       int r = 0;
 
        pr_debug("clock: locking DPLL %s\n", clk->name);
 
+       dd = clk->dpll_data;
+       state <<= __ffs(dd->idlest_mask);
+
+       /* Check if already locked */
+       if ((__raw_readl(dd->idlest_reg) & dd->idlest_mask) == state)
+               goto done;
+
        ai = omap3_dpll_autoidle_read(clk);
 
        if (ai)
@@ -152,6 +161,7 @@ static int _omap3_noncore_dpll_lock(struct clk *clk)
        if (ai)
                omap3_dpll_allow_idle(clk);
 
+done:
        return r;
 }
 
@@ -628,3 +638,17 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
                rate = clk->parent->rate * 2;
        return rate;
 }
+
+/* OMAP3/4 non-CORE DPLL clkops */
+
+const struct clkops clkops_omap3_noncore_dpll_ops = {
+       .enable         = omap3_noncore_dpll_enable,
+       .disable        = omap3_noncore_dpll_disable,
+       .allow_idle     = omap3_dpll_allow_idle,
+       .deny_idle      = omap3_dpll_deny_idle,
+};
+
+const struct clkops clkops_omap3_core_dpll_ops = {
+       .allow_idle     = omap3_dpll_allow_idle,
+       .deny_idle      = omap3_dpll_deny_idle,
+};