Commit d6f987c8 authored by Martin Blumenstingl's avatar Martin Blumenstingl Committed by Neil Armstrong

clk: meson: pll: fix rounding and setting a rate that matches precisely

Make meson_clk_pll_is_better() consider a rate that precisely matches
the requested rate to be better than any previous rate (which was
smaller than the current).

Prior to commit 8eed1db1 ("clk: meson: pll: update driver for the
g12a") meson_clk_get_pll_settings() returned early (before calling
meson_clk_pll_is_better()) if the rate from the current iteration
matches the requested rate precisely. After this commit
meson_clk_pll_is_better() is called unconditionally. This requires
meson_clk_pll_is_better() to work with the case where "now == rate".

This fixes a hang during boot on Meson8b / Odroid-C1 for me.

Fixes: 8eed1db1 ("clk: meson: pll: update driver for the g12a")
Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Link: https://lkml.kernel.org/r/20190324164327.22590-2-martin.blumenstingl@googlemail.com
parent 9e05e49c
...@@ -120,7 +120,7 @@ static bool meson_clk_pll_is_better(unsigned long rate, ...@@ -120,7 +120,7 @@ static bool meson_clk_pll_is_better(unsigned long rate,
return true; return true;
} else { } else {
/* Round down */ /* Round down */
if (now < rate && best < now) if (now <= rate && best < now)
return true; return true;
} }
......
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