clk: pistachio: Add a pll_lock() helper for clarity
authorEzequiel Garcia <ezequiel.garcia@imgtec.com>
Tue, 26 May 2015 22:01:07 +0000 (19:01 -0300)
committerStephen Boyd <sboyd@codeaurora.org>
Thu, 4 Jun 2015 19:43:29 +0000 (12:43 -0700)
This commit adds a pll_lock() helper making the code more readable.
Cosmetic change only, no functionality changes.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/pistachio/clk-pll.c

index de537560bf709444601405f42650c22b91c4334d..9ce1be779c9cd80ab0714143494f3db526646a7a 100644 (file)
@@ -67,6 +67,12 @@ static inline void pll_writel(struct pistachio_clk_pll *pll, u32 val, u32 reg)
        writel(val, pll->base + reg);
 }
 
+static inline void pll_lock(struct pistachio_clk_pll *pll)
+{
+       while (!(pll_readl(pll, PLL_STATUS) & PLL_STATUS_LOCK))
+               cpu_relax();
+}
+
 static inline u32 do_div_round_closest(u64 dividend, u32 divisor)
 {
        dividend += divisor / 2;
@@ -178,8 +184,7 @@ static int pll_gf40lp_frac_set_rate(struct clk_hw *hw, unsigned long rate,
                (params->postdiv2 << PLL_FRAC_CTRL2_POSTDIV2_SHIFT);
        pll_writel(pll, val, PLL_CTRL2);
 
-       while (!(pll_readl(pll, PLL_STATUS) & PLL_STATUS_LOCK))
-               cpu_relax();
+       pll_lock(pll);
 
        if (!was_enabled)
                pll_gf40lp_frac_disable(hw);
@@ -288,8 +293,7 @@ static int pll_gf40lp_laint_set_rate(struct clk_hw *hw, unsigned long rate,
                (params->postdiv2 << PLL_INT_CTRL1_POSTDIV2_SHIFT);
        pll_writel(pll, val, PLL_CTRL1);
 
-       while (!(pll_readl(pll, PLL_STATUS) & PLL_STATUS_LOCK))
-               cpu_relax();
+       pll_lock(pll);
 
        if (!was_enabled)
                pll_gf40lp_laint_disable(hw);