Message ID | 20190324164327.22590-2-martin.blumenstingl@googlemail.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Neil Armstrong |
Headers | show |
Series | clk: meson: fix PLL rate rounding | expand |
On Sun, 2019-03-24 at 17:43 +0100, Martin Blumenstingl wrote: > 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 8eed1db1adec6a ("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: 8eed1db1adec6a ("clk: meson: pll: update driver for the g12a") > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Good catch ! Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
On 25/03/2019 10:48, Jerome Brunet wrote: > On Sun, 2019-03-24 at 17:43 +0100, Martin Blumenstingl wrote: >> 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 8eed1db1adec6a ("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: 8eed1db1adec6a ("clk: meson: pll: update driver for the g12a") >> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> > > Good catch ! > > Reviewed-by: Jerome Brunet <jbrunet@baylibre.com> > > > Applied to fixes/drivers !
diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index 41e16dd7272a..7a14ac9b2fec 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -120,7 +120,7 @@ static bool meson_clk_pll_is_better(unsigned long rate, return true; } else { /* Round down */ - if (now < rate && best < now) + if (now <= rate && best < now) return true; }
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 8eed1db1adec6a ("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: 8eed1db1adec6a ("clk: meson: pll: update driver for the g12a") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/clk/meson/clk-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)