diff options
author | Anson Huang <b20788@freescale.com> | 2013-08-28 10:53:53 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:01:28 -0400 |
commit | 3012ea8b96545be52d55fdbb2b4abf0aeb1cda05 (patch) | |
tree | c317a291932562e4e540c1720e951ecca44d753f /arch | |
parent | 5be85de5270b8c85593a95dbc78261a1909b99bf (diff) |
ENGR00276845-1 ARM: imx: No need to wait for PLL lock when PLL is power down
Add the check for PLL power status before wait for PLL to be locked.
It will not do further operation when PLL is powered down.
Signed-off-by: Anson Huang <b20788@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-imx/clk-pllv3.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/arch/arm/mach-imx/clk-pllv3.c b/arch/arm/mach-imx/clk-pllv3.c index f98674c63270..21f64e0a7d5a 100644 --- a/arch/arm/mach-imx/clk-pllv3.c +++ b/arch/arm/mach-imx/clk-pllv3.c | |||
@@ -45,19 +45,24 @@ struct clk_pllv3 { | |||
45 | 45 | ||
46 | #define to_clk_pllv3(_hw) container_of(_hw, struct clk_pllv3, hw) | 46 | #define to_clk_pllv3(_hw) container_of(_hw, struct clk_pllv3, hw) |
47 | 47 | ||
48 | static int clk_pllv3_wait_for_lock(void __iomem *base, u32 timeout_ms) | 48 | static int clk_pllv3_wait_for_lock(struct clk_pllv3 *pll, u32 timeout_ms) |
49 | { | 49 | { |
50 | unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); | 50 | unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); |
51 | u32 val = readl_relaxed(pll->base) & BM_PLL_POWER; | ||
52 | |||
53 | /* No need to wait for lock when pll is power down */ | ||
54 | if ((pll->powerup_set && !val) || (!pll->powerup_set && val)) | ||
55 | return 0; | ||
51 | 56 | ||
52 | /* Wait for PLL to lock */ | 57 | /* Wait for PLL to lock */ |
53 | do { | 58 | do { |
54 | if (readl_relaxed(base) & BM_PLL_LOCK) | 59 | if (readl_relaxed(pll->base) & BM_PLL_LOCK) |
55 | break; | 60 | break; |
56 | if (time_after(jiffies, timeout)) | 61 | if (time_after(jiffies, timeout)) |
57 | break; | 62 | break; |
58 | } while (1); | 63 | } while (1); |
59 | 64 | ||
60 | if (readl_relaxed(base) & BM_PLL_LOCK) | 65 | if (readl_relaxed(pll->base) & BM_PLL_LOCK) |
61 | return 0; | 66 | return 0; |
62 | else | 67 | else |
63 | return -ETIMEDOUT; | 68 | return -ETIMEDOUT; |
@@ -76,7 +81,7 @@ static int clk_pllv3_prepare(struct clk_hw *hw) | |||
76 | val &= ~BM_PLL_POWER; | 81 | val &= ~BM_PLL_POWER; |
77 | writel_relaxed(val, pll->base); | 82 | writel_relaxed(val, pll->base); |
78 | 83 | ||
79 | return clk_pllv3_wait_for_lock(pll->base, 10); | 84 | return clk_pllv3_wait_for_lock(pll, 10); |
80 | } | 85 | } |
81 | 86 | ||
82 | static void clk_pllv3_unprepare(struct clk_hw *hw) | 87 | static void clk_pllv3_unprepare(struct clk_hw *hw) |
@@ -151,7 +156,7 @@ static int clk_pllv3_set_rate(struct clk_hw *hw, unsigned long rate, | |||
151 | val |= div; | 156 | val |= div; |
152 | writel_relaxed(val, pll->base); | 157 | writel_relaxed(val, pll->base); |
153 | 158 | ||
154 | return clk_pllv3_wait_for_lock(pll->base, 10); | 159 | return clk_pllv3_wait_for_lock(pll, 10); |
155 | } | 160 | } |
156 | 161 | ||
157 | static const struct clk_ops clk_pllv3_ops = { | 162 | static const struct clk_ops clk_pllv3_ops = { |
@@ -207,7 +212,7 @@ static int clk_pllv3_sys_set_rate(struct clk_hw *hw, unsigned long rate, | |||
207 | val |= div; | 212 | val |= div; |
208 | writel_relaxed(val, pll->base); | 213 | writel_relaxed(val, pll->base); |
209 | 214 | ||
210 | return clk_pllv3_wait_for_lock(pll->base, 10); | 215 | return clk_pllv3_wait_for_lock(pll, 10); |
211 | } | 216 | } |
212 | 217 | ||
213 | static const struct clk_ops clk_pllv3_sys_ops = { | 218 | static const struct clk_ops clk_pllv3_sys_ops = { |
@@ -281,7 +286,7 @@ static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate, | |||
281 | writel_relaxed(mfn, pll->base + PLL_NUM_OFFSET); | 286 | writel_relaxed(mfn, pll->base + PLL_NUM_OFFSET); |
282 | writel_relaxed(mfd, pll->base + PLL_DENOM_OFFSET); | 287 | writel_relaxed(mfd, pll->base + PLL_DENOM_OFFSET); |
283 | 288 | ||
284 | return clk_pllv3_wait_for_lock(pll->base, 10); | 289 | return clk_pllv3_wait_for_lock(pll, 10); |
285 | } | 290 | } |
286 | 291 | ||
287 | static const struct clk_ops clk_pllv3_av_ops = { | 292 | static const struct clk_ops clk_pllv3_av_ops = { |