Skip to content

Commit 3507df1

Browse files
committed
clk: rockchip: convert basic pll lock_wait to use regmap_read_poll_timeout
Instead of open coding the polling of the lock status, use the handy regmap_read_poll_timeout for this. As the pll locking is normally blazingly fast and we don't want to incur additional delays, we're not doing any sleeps similar to for example the imx clk-pllv4 and define a very safe but still short timeout of 1ms. Suggested-by: Stephen Boyd <[email protected]> Signed-off-by: Heiko Stuebner <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bf4237a commit 3507df1

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

drivers/clk/rockchip/clk-pll.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,14 @@ static int rockchip_pll_wait_lock(struct rockchip_clk_pll *pll)
8686
{
8787
struct regmap *grf = pll->ctx->grf;
8888
unsigned int val;
89-
int delay = 24000000, ret;
90-
91-
while (delay > 0) {
92-
ret = regmap_read(grf, pll->lock_offset, &val);
93-
if (ret) {
94-
pr_err("%s: failed to read pll lock status: %d\n",
95-
__func__, ret);
96-
return ret;
97-
}
89+
int ret;
9890

99-
if (val & BIT(pll->lock_shift))
100-
return 0;
101-
delay--;
102-
}
91+
ret = regmap_read_poll_timeout(grf, pll->lock_offset, val,
92+
val & BIT(pll->lock_shift), 0, 1000);
93+
if (ret)
94+
pr_err("%s: timeout waiting for pll to lock\n", __func__);
10395

104-
pr_err("%s: timeout waiting for pll to lock\n", __func__);
105-
return -ETIMEDOUT;
96+
return ret;
10697
}
10798

10899
/**

0 commit comments

Comments
 (0)