clk: atlas7: fix pll missed divide NR in fraction mode
authorGuo Zeng <guo.zeng@csr.com>
Tue, 4 Aug 2015 14:45:32 +0000 (14:45 +0000)
committerMichael Turquette <mturquette@baylibre.com>
Mon, 24 Aug 2015 23:49:08 +0000 (16:49 -0700)
PLL VCO frequency is given by Fvco = Fref * 2 * NF / NR
in integer-N mode, or by Fvco = Fref * SSN / NR in Spread
Spectrum (fractional-N) mode. Thus fix the missing part
of NR

Signed-off-by: Guo Zeng <guo.zeng@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/sirf/clk-atlas7.c

index 2ce2653e5630d63fa9cae0199e334aae090003f4..a98e21fe773a364739f299aac651ccc4d2e18656 100644 (file)
@@ -358,6 +358,7 @@ static unsigned long pll_clk_recalc_rate(struct clk_hw *hw,
        if (regctrl0 & SIRFSOC_ABPLL_CTRL0_SSEN) {
                rate = fin;
                rate *= 1 << 24;
+               do_div(rate, nr);
                do_div(rate, (256 * ((ssdiv >> ssdepth) << ssdepth)
                        + (ssmod << ssdepth)));
        } else {