diff options
author | James Liao <jamesjj.liao@mediatek.com> | 2015-07-10 10:39:34 +0200 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2015-07-28 20:58:57 +0200 |
commit | 75ce0cdb6243d42daca6130e5feb71f536bb136e (patch) | |
tree | baa25bb3aceeb8638dc98938c02ddd9ae2470ebc /drivers/clk/mediatek/clk-pll.c | |
parent | clk: mediatek: Fix calculation of PLL rate settings (diff) | |
download | linux-75ce0cdb6243d42daca6130e5feb71f536bb136e.tar.xz linux-75ce0cdb6243d42daca6130e5feb71f536bb136e.zip |
clk: mediatek: Add MT8173 MMPLL change rate support
MT8173 MMPLL frequency settings are different from common PLLs.
It needs different post divider settings for some ranges of frequency.
This patch add support for MT8173 MMPLL frequency setting by adding
div-rate table to lookup suitable post divider setting under a
specified frequency.
Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/mediatek/clk-pll.c')
-rw-r--r-- | drivers/clk/mediatek/clk-pll.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c index 0e3f4ef0e871..622e7b6c62b4 100644 --- a/drivers/clk/mediatek/clk-pll.c +++ b/drivers/clk/mediatek/clk-pll.c @@ -138,16 +138,28 @@ static void mtk_pll_calc_values(struct mtk_clk_pll *pll, u32 *pcw, u32 *postdiv, u32 freq, u32 fin) { unsigned long fmin = 1000 * MHZ; + const struct mtk_pll_div_table *div_table = pll->data->div_table; u64 _pcw; u32 val; if (freq > pll->data->fmax) freq = pll->data->fmax; - for (val = 0; val < 5; val++) { + if (div_table) { + if (freq > div_table[0].freq) + freq = div_table[0].freq; + + for (val = 0; div_table[val + 1].freq != 0; val++) { + if (freq > div_table[val + 1].freq) + break; + } *postdiv = 1 << val; - if ((u64)freq * *postdiv >= fmin) - break; + } else { + for (val = 0; val < 5; val++) { + *postdiv = 1 << val; + if ((u64)freq * *postdiv >= fmin) + break; + } } /* _pcw = freq * postdiv / fin * 2^pcwfbits */ |