]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clk: imx: clk-fracn-gppll: correct rdiv
authorPeng Fan <peng.fan@nxp.com>
Thu, 9 Jun 2022 13:29:01 +0000 (21:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:41:37 +0000 (14:41 +0200)
[ Upstream commit f300cb7fccf69ba1835b983c76d70deb818ad194 ]

According to Reference Manual:
 000b - Divide by 1
 001b - Divide by 1
 010b - Divide by 2
 011b - Divide by 3
 100b - Divide by 4
 101b - Divide by 5
 110b - Divide by 6
 111b - Divide by 7

So only need increase rdiv by 1 when the register value is 0.

Fixes: 1b26cb8a77a4 ("clk: imx: support fracn gppll")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
Link: https://lore.kernel.org/r/20220609132902.3504651-7-peng.fan@oss.nxp.com
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/imx/clk-fracn-gppll.c

index cb06b0045e9e2688f7609ff9792cdb1dd6ac3b25..025b73229cdddc1384b154a05d53b8c87d51c660 100644 (file)
@@ -149,7 +149,8 @@ static unsigned long clk_fracn_gppll_recalc_rate(struct clk_hw *hw, unsigned lon
        if (rate)
                return (unsigned long)rate;
 
-       rdiv = rdiv + 1;
+       if (!rdiv)
+               rdiv = rdiv + 1;
 
        switch (odiv) {
        case 0: