clk: at91: sam9x60: fix programmable clock prescaler
authorEugen Hristev <eugen.hristev@microchip.com>
Tue, 10 Dec 2019 11:25:19 +0000 (11:25 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:25 +0000 (08:36 +0100)
commit2f812301bacf1ba66fc1cbc286f25e79b5461ac9
treebea0bcc3fe2c3eb94ae83fb3a9de309fd471fea3
parente1e1cdbc646f99255f6fde34fea7743c934b38b1
clk: at91: sam9x60: fix programmable clock prescaler

[ Upstream commit 66d9f5214c9ba1c151478f99520b6817302d50dc ]

The prescaler works as parent rate divided by (PRES + 1) (is_pres_direct == 1)
It does not work in the way of parent rate shifted to the right by (PRES + 1),
which means division by 2^(PRES + 1) (is_pres_direct == 0)
Thus is_pres_direct must be enabled for this SoC, to make the right computation.
This field was added in
commit 45b06682113b ("clk: at91: fix programmable clock for sama5d2")
SAM9X60 has the same field as SAMA5D2 in the PCK

Fixes: 01e2113de9a5 ("clk: at91: add sam9x60 pmc driver")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Link: https://lkml.kernel.org/r/1575977088-16781-1-git-send-email-eugen.hristev@microchip.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/at91/sam9x60.c