aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJames Liao <jamesjj.liao@mediatek.com>2019-03-05 00:05:46 -0500
committerStephen Boyd <sboyd@kernel.org>2019-04-11 16:29:19 -0400
commitdac5d67277d654695444fe6cab94c1a596dff33c (patch)
treec0bb23bdb3fe3e87bc8792bde1f199b2274651be /drivers
parentacddfc2c261b3653ab1c1b567a427299bac20d31 (diff)
clk: mediatek: Allow changing PLL rate when it is off
Some modules may need to change its clock rate before turn on it. So changing PLL's rate when it is off should be allowed. This patch removes PLL enabled check before set rate, so that PLLs can set new frequency even if they are off. On MT8173 for example, ARMPLL's enable bit can be controlled by other HW. That means ARMPLL may be turned on even if we (CPU / SW) set ARMPLL's enable bit as 0. In this case, SW may want and can still change ARMPLL's rate by changing its pcw and postdiv settings. But without this patch, new pcw setting will not be applied because its enable bit is 0. Signed-off-by: James Liao <jamesjj.liao@mediatek.com> Acked-by: Michael Turquette <mturuqette@baylibre.com> Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com> Reviewed-by: James Liao <jamesjj.liao@mediatek.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/mediatek/clk-pll.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c
index 65cee1d6c400..8d556fc99fed 100644
--- a/drivers/clk/mediatek/clk-pll.c
+++ b/drivers/clk/mediatek/clk-pll.c
@@ -124,9 +124,6 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw,
124 int postdiv) 124 int postdiv)
125{ 125{
126 u32 chg, val; 126 u32 chg, val;
127 int pll_en;
128
129 pll_en = readl(pll->base_addr + REG_CON0) & CON0_BASE_EN;
130 127
131 /* disable tuner */ 128 /* disable tuner */
132 __mtk_pll_tuner_disable(pll); 129 __mtk_pll_tuner_disable(pll);
@@ -147,12 +144,7 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw,
147 pll->data->pcw_shift); 144 pll->data->pcw_shift);
148 val |= pcw << pll->data->pcw_shift; 145 val |= pcw << pll->data->pcw_shift;
149 writel(val, pll->pcw_addr); 146 writel(val, pll->pcw_addr);
150 147 chg = readl(pll->pcw_chg_addr) | PCW_CHG_MASK;
151 chg = readl(pll->pcw_chg_addr);
152
153 if (pll_en)
154 chg |= PCW_CHG_MASK;
155
156 writel(chg, pll->pcw_chg_addr); 148 writel(chg, pll->pcw_chg_addr);
157 if (pll->tuner_addr) 149 if (pll->tuner_addr)
158 writel(val + 1, pll->tuner_addr); 150 writel(val + 1, pll->tuner_addr);
@@ -160,8 +152,7 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw,
160 /* restore tuner_en */ 152 /* restore tuner_en */
161 __mtk_pll_tuner_enable(pll); 153 __mtk_pll_tuner_enable(pll);
162 154
163 if (pll_en) 155 udelay(20);
164 udelay(20);
165} 156}
166 157
167/* 158/*