]> git.baikalelectronics.ru Git - kernel.git/commit
clk: ingenic: Fix divider calculation with div tables
authorPaul Cercueil <paul@crapouillou.net>
Sat, 12 Dec 2020 13:57:33 +0000 (13:57 +0000)
committerStephen Boyd <sboyd@kernel.org>
Sun, 20 Dec 2020 00:04:58 +0000 (16:04 -0800)
commitfc3a6702ed6a9f8c51098f26cee6fb7512fbfb95
tree422228c83974b0020d1fd9c68a89dceb75790909
parenta1fe7c755400af92f0070a66f48f00b659aeacac
clk: ingenic: Fix divider calculation with div tables

The previous code assumed that a higher hardware value always resulted
in a bigger divider, which is correct for the regular clocks, but is
an invalid assumption when a divider table is provided for the clock.

Perfect example of this is the PLL0_HALF clock, which applies a /2
divider with the hardware value 0, and a /1 divider otherwise.

Fixes: 0be32546fe07 ("clk: ingenic: Add support for divider tables")
Cc: <stable@vger.kernel.org> # 5.2
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20201212135733.38050-1-paul@crapouillou.net
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/ingenic/cgu.c