summaryrefslogtreecommitdiffstats
path: root/drivers/clk/pistachio
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel.garcia@imgtec.com>2015-05-27 00:01:07 +0200
committerStephen Boyd <sboyd@codeaurora.org>2015-06-04 21:43:29 +0200
commit4f4adfbf8e655914bb80daa0252c90b62fd27d78 (patch)
tree865edfd9d7a8abca3ff3d24feb243fa4d8e8bdf0 /drivers/clk/pistachio
parentclk: mmp: add timer clock for pxa168/mmp2/pxa910 (diff)
downloadlinux-4f4adfbf8e655914bb80daa0252c90b62fd27d78.tar.xz
linux-4f4adfbf8e655914bb80daa0252c90b62fd27d78.zip
clk: pistachio: Add a pll_lock() helper for clarity
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>
Diffstat (limited to 'drivers/clk/pistachio')
-rw-r--r--drivers/clk/pistachio/clk-pll.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/clk/pistachio/clk-pll.c b/drivers/clk/pistachio/clk-pll.c
index de537560bf70..9ce1be779c9c 100644
--- a/drivers/clk/pistachio/clk-pll.c
+++ b/drivers/clk/pistachio/clk-pll.c
@@ -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);