[PATCH v2] clk: meson: pll: adjust timeout in meson_clk_pll_wait_lock()
Heiner Kallweit
hkallweit1 at gmail.com
Mon Aug 29 11:52:59 PDT 2022
Currently we loop over meson_parm_read() up to 24mln times.
This results in a unpredictable timeout period. In my case
it's over 5s on a S905X4-based system. Make the timeout
period predictable and set it to 100ms.
Signed-off-by: Heiner Kallweit <hkallweit1 at gmail.com>
---
v2:
- remove an unrelated change
---
drivers/clk/meson/clk-pll.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c
index daa025b6d..53b8e17e4 100644
--- a/drivers/clk/meson/clk-pll.c
+++ b/drivers/clk/meson/clk-pll.c
@@ -277,15 +277,15 @@ static int meson_clk_pll_wait_lock(struct clk_hw *hw)
{
struct clk_regmap *clk = to_clk_regmap(hw);
struct meson_clk_pll_data *pll = meson_clk_pll_data(clk);
- int delay = 24000000;
+ int delay = 5000;
do {
- /* Is the clock locked now ? */
+ /* Is the clock locked now ? Time out after 100ms. */
if (meson_parm_read(clk->map, &pll->l))
return 0;
- delay--;
- } while (delay > 0);
+ udelay(20);
+ } while (--delay);
return -ETIMEDOUT;
}
--
2.37.2
More information about the linux-amlogic
mailing list