aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBai Ping <b51503@freescale.com>2015-11-24 11:06:53 -0500
committerShawn Guo <shawnguo@kernel.org>2015-11-24 22:50:46 -0500
commit4824b61c666831e1051530c7f0ff68b0ae6c2511 (patch)
treea47f6f40e8dabb1e23be14fbe791875e58c8c7dd
parent78ae71ac882fbca3b092656b6fed46f0c2e71dd6 (diff)
clk: imx: add 'is_prepared' clk_ops callback for pllv3 clk
Add 'is_prepared' callback function for pllv3 type clk to make sure when the system is bootup, the unused clk is in a known state to match the prepare count info. Signed-off-by: Bai Ping <b51503@freescale.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
-rw-r--r--drivers/clk/imx/clk-pllv3.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c
index 6addf8f58b97..c05c43d56a94 100644
--- a/drivers/clk/imx/clk-pllv3.c
+++ b/drivers/clk/imx/clk-pllv3.c
@@ -97,6 +97,16 @@ static void clk_pllv3_unprepare(struct clk_hw *hw)
97 writel_relaxed(val, pll->base); 97 writel_relaxed(val, pll->base);
98} 98}
99 99
100static int clk_pllv3_is_prepared(struct clk_hw *hw)
101{
102 struct clk_pllv3 *pll = to_clk_pllv3(hw);
103
104 if (readl_relaxed(pll->base) & BM_PLL_LOCK)
105 return 1;
106
107 return 0;
108}
109
100static unsigned long clk_pllv3_recalc_rate(struct clk_hw *hw, 110static unsigned long clk_pllv3_recalc_rate(struct clk_hw *hw,
101 unsigned long parent_rate) 111 unsigned long parent_rate)
102{ 112{
@@ -139,6 +149,7 @@ static int clk_pllv3_set_rate(struct clk_hw *hw, unsigned long rate,
139static const struct clk_ops clk_pllv3_ops = { 149static const struct clk_ops clk_pllv3_ops = {
140 .prepare = clk_pllv3_prepare, 150 .prepare = clk_pllv3_prepare,
141 .unprepare = clk_pllv3_unprepare, 151 .unprepare = clk_pllv3_unprepare,
152 .is_prepared = clk_pllv3_is_prepared,
142 .recalc_rate = clk_pllv3_recalc_rate, 153 .recalc_rate = clk_pllv3_recalc_rate,
143 .round_rate = clk_pllv3_round_rate, 154 .round_rate = clk_pllv3_round_rate,
144 .set_rate = clk_pllv3_set_rate, 155 .set_rate = clk_pllv3_set_rate,
@@ -193,6 +204,7 @@ static int clk_pllv3_sys_set_rate(struct clk_hw *hw, unsigned long rate,
193static const struct clk_ops clk_pllv3_sys_ops = { 204static const struct clk_ops clk_pllv3_sys_ops = {
194 .prepare = clk_pllv3_prepare, 205 .prepare = clk_pllv3_prepare,
195 .unprepare = clk_pllv3_unprepare, 206 .unprepare = clk_pllv3_unprepare,
207 .is_prepared = clk_pllv3_is_prepared,
196 .recalc_rate = clk_pllv3_sys_recalc_rate, 208 .recalc_rate = clk_pllv3_sys_recalc_rate,
197 .round_rate = clk_pllv3_sys_round_rate, 209 .round_rate = clk_pllv3_sys_round_rate,
198 .set_rate = clk_pllv3_sys_set_rate, 210 .set_rate = clk_pllv3_sys_set_rate,
@@ -265,6 +277,7 @@ static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate,
265static const struct clk_ops clk_pllv3_av_ops = { 277static const struct clk_ops clk_pllv3_av_ops = {
266 .prepare = clk_pllv3_prepare, 278 .prepare = clk_pllv3_prepare,
267 .unprepare = clk_pllv3_unprepare, 279 .unprepare = clk_pllv3_unprepare,
280 .is_prepared = clk_pllv3_is_prepared,
268 .recalc_rate = clk_pllv3_av_recalc_rate, 281 .recalc_rate = clk_pllv3_av_recalc_rate,
269 .round_rate = clk_pllv3_av_round_rate, 282 .round_rate = clk_pllv3_av_round_rate,
270 .set_rate = clk_pllv3_av_set_rate, 283 .set_rate = clk_pllv3_av_set_rate,
@@ -279,6 +292,7 @@ static unsigned long clk_pllv3_enet_recalc_rate(struct clk_hw *hw,
279static const struct clk_ops clk_pllv3_enet_ops = { 292static const struct clk_ops clk_pllv3_enet_ops = {
280 .prepare = clk_pllv3_prepare, 293 .prepare = clk_pllv3_prepare,
281 .unprepare = clk_pllv3_unprepare, 294 .unprepare = clk_pllv3_unprepare,
295 .is_prepared = clk_pllv3_is_prepared,
282 .recalc_rate = clk_pllv3_enet_recalc_rate, 296 .recalc_rate = clk_pllv3_enet_recalc_rate,
283}; 297};
284 298