]> git.baikalelectronics.ru Git - kernel.git/commit
clk: meson: mpll: use 64-bit maths in params_from_rate
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Sat, 23 Dec 2017 21:38:32 +0000 (22:38 +0100)
committerJerome Brunet <jbrunet@baylibre.com>
Sat, 23 Dec 2017 22:14:20 +0000 (23:14 +0100)
commit5f13ad069f26deebd5b2dc80c8ecf4b6385be0ff
tree420a849184c3398dca81a53bb0d344837eea1aa7
parentde6d8b0529f99a613a610064877f35e843f5fa1f
clk: meson: mpll: use 64-bit maths in params_from_rate

"rem * SDM_DEN" can easily overflow on the 32-bit Meson8 and Meson8b
SoCs if the "remainder" (after the division operation) is greater than
262143Hz. This is likely to happen since the input clock for the MPLLs
on Meson8 and Meson8b is "fixed_pll", which is running at a rate of
2550MHz.

One example where this was observed to be problematic was the Ethernet
clock calculation (which takes MPLL2 as input). When requesting a rate
of 125MHz there is a remainder of 2500000Hz.
The resulting MPLL2 rate before this patch was 127488329Hz.
The resulting MPLL2 rate after this patch is 124999103Hz.

Commit 706d62ee4153 ("clk: meson: mpll: use 64bit math in
rate_from_params") already fixed a similar issue in rate_from_params.

Fixes: a1be91571e280d ("clk: meson: mpll: add rw operation")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
drivers/clk/meson/clk-mpll.c