clk: meson: use the frac parameter width instead of a constant
authorJerome Brunet <jbrunet@baylibre.com>
Fri, 19 Jan 2018 15:55:24 +0000 (16:55 +0100)
committerJerome Brunet <jbrunet@baylibre.com>
Mon, 12 Feb 2018 08:49:23 +0000 (09:49 +0100)
Use the fractional part width in the calculation instead of 12, which
happens to be the witdh right now. This is safer in case the field width
ever change in the future

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
drivers/clk/meson/clk-pll.c

index 087dfc5..50923d0 100644 (file)
@@ -81,7 +81,7 @@ static unsigned long meson_clk_pll_recalc_rate(struct clk_hw *hw,
                reg = readl(pll->base + p->reg_off);
                frac = PARM_GET(p->width, p->shift, reg);
 
-               rate += mul_u64_u32_shr(parent_rate, frac, 12);
+               rate += mul_u64_u32_shr(parent_rate, frac, p->width);
                rate *= 2;
        }