Commit 4824b61c authored by Bai Ping's avatar Bai Ping Committed by Shawn Guo

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: default avatarBai Ping <b51503@freescale.com>
Reviewed-by: default avatarLucas Stach <l.stach@pengutronix.de>
Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
parent 78ae71ac
...@@ -97,6 +97,16 @@ static void clk_pllv3_unprepare(struct clk_hw *hw) ...@@ -97,6 +97,16 @@ static void clk_pllv3_unprepare(struct clk_hw *hw)
writel_relaxed(val, pll->base); writel_relaxed(val, pll->base);
} }
static int clk_pllv3_is_prepared(struct clk_hw *hw)
{
struct clk_pllv3 *pll = to_clk_pllv3(hw);
if (readl_relaxed(pll->base) & BM_PLL_LOCK)
return 1;
return 0;
}
static unsigned long clk_pllv3_recalc_rate(struct clk_hw *hw, static unsigned long clk_pllv3_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) unsigned long parent_rate)
{ {
...@@ -139,6 +149,7 @@ static int clk_pllv3_set_rate(struct clk_hw *hw, unsigned long rate, ...@@ -139,6 +149,7 @@ static int clk_pllv3_set_rate(struct clk_hw *hw, unsigned long rate,
static const struct clk_ops clk_pllv3_ops = { static const struct clk_ops clk_pllv3_ops = {
.prepare = clk_pllv3_prepare, .prepare = clk_pllv3_prepare,
.unprepare = clk_pllv3_unprepare, .unprepare = clk_pllv3_unprepare,
.is_prepared = clk_pllv3_is_prepared,
.recalc_rate = clk_pllv3_recalc_rate, .recalc_rate = clk_pllv3_recalc_rate,
.round_rate = clk_pllv3_round_rate, .round_rate = clk_pllv3_round_rate,
.set_rate = clk_pllv3_set_rate, .set_rate = clk_pllv3_set_rate,
...@@ -193,6 +204,7 @@ static int clk_pllv3_sys_set_rate(struct clk_hw *hw, unsigned long rate, ...@@ -193,6 +204,7 @@ static int clk_pllv3_sys_set_rate(struct clk_hw *hw, unsigned long rate,
static const struct clk_ops clk_pllv3_sys_ops = { static const struct clk_ops clk_pllv3_sys_ops = {
.prepare = clk_pllv3_prepare, .prepare = clk_pllv3_prepare,
.unprepare = clk_pllv3_unprepare, .unprepare = clk_pllv3_unprepare,
.is_prepared = clk_pllv3_is_prepared,
.recalc_rate = clk_pllv3_sys_recalc_rate, .recalc_rate = clk_pllv3_sys_recalc_rate,
.round_rate = clk_pllv3_sys_round_rate, .round_rate = clk_pllv3_sys_round_rate,
.set_rate = clk_pllv3_sys_set_rate, .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, ...@@ -265,6 +277,7 @@ static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate,
static const struct clk_ops clk_pllv3_av_ops = { static const struct clk_ops clk_pllv3_av_ops = {
.prepare = clk_pllv3_prepare, .prepare = clk_pllv3_prepare,
.unprepare = clk_pllv3_unprepare, .unprepare = clk_pllv3_unprepare,
.is_prepared = clk_pllv3_is_prepared,
.recalc_rate = clk_pllv3_av_recalc_rate, .recalc_rate = clk_pllv3_av_recalc_rate,
.round_rate = clk_pllv3_av_round_rate, .round_rate = clk_pllv3_av_round_rate,
.set_rate = clk_pllv3_av_set_rate, .set_rate = clk_pllv3_av_set_rate,
...@@ -279,6 +292,7 @@ static unsigned long clk_pllv3_enet_recalc_rate(struct clk_hw *hw, ...@@ -279,6 +292,7 @@ static unsigned long clk_pllv3_enet_recalc_rate(struct clk_hw *hw,
static const struct clk_ops clk_pllv3_enet_ops = { static const struct clk_ops clk_pllv3_enet_ops = {
.prepare = clk_pllv3_prepare, .prepare = clk_pllv3_prepare,
.unprepare = clk_pllv3_unprepare, .unprepare = clk_pllv3_unprepare,
.is_prepared = clk_pllv3_is_prepared,
.recalc_rate = clk_pllv3_enet_recalc_rate, .recalc_rate = clk_pllv3_enet_recalc_rate,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment