Lines Matching refs:pll
123 imx_get_pll_settings(struct clk_fracn_gppll *pll, unsigned long rate) in imx_get_pll_settings() argument
125 const struct imx_fracn_gppll_rate_table *rate_table = pll->rate_table; in imx_get_pll_settings()
128 for (i = 0; i < pll->rate_count; i++) in imx_get_pll_settings()
138 struct clk_fracn_gppll *pll = to_clk_fracn_gppll(hw); in clk_fracn_gppll_round_rate() local
139 const struct imx_fracn_gppll_rate_table *rate_table = pll->rate_table; in clk_fracn_gppll_round_rate()
143 for (i = 0; i < pll->rate_count; i++) in clk_fracn_gppll_round_rate()
148 return rate_table[pll->rate_count - 1].rate; in clk_fracn_gppll_round_rate()
153 struct clk_fracn_gppll *pll = to_clk_fracn_gppll(hw); in clk_fracn_gppll_recalc_rate() local
154 const struct imx_fracn_gppll_rate_table *rate_table = pll->rate_table; in clk_fracn_gppll_recalc_rate()
161 pll_numerator = readl_relaxed(pll->base + PLL_NUMERATOR); in clk_fracn_gppll_recalc_rate()
164 pll_denominator = readl_relaxed(pll->base + PLL_DENOMINATOR); in clk_fracn_gppll_recalc_rate()
167 pll_div = readl_relaxed(pll->base + PLL_DIV); in clk_fracn_gppll_recalc_rate()
179 for (i = 0; i < pll->rate_count; i++) { in clk_fracn_gppll_recalc_rate()
203 if (pll->flags & CLK_FRACN_GPPLL_INTEGER) { in clk_fracn_gppll_recalc_rate()
216 static int clk_fracn_gppll_wait_lock(struct clk_fracn_gppll *pll) in clk_fracn_gppll_wait_lock() argument
220 return readl_poll_timeout(pll->base + PLL_STATUS, val, in clk_fracn_gppll_wait_lock()
227 struct clk_fracn_gppll *pll = to_clk_fracn_gppll(hw); in clk_fracn_gppll_set_rate() local
232 rate = imx_get_pll_settings(pll, drate); in clk_fracn_gppll_set_rate()
235 tmp = readl_relaxed(pll->base + PLL_CTRL); in clk_fracn_gppll_set_rate()
237 writel_relaxed(tmp, pll->base + PLL_CTRL); in clk_fracn_gppll_set_rate()
240 tmp = readl_relaxed(pll->base + PLL_CTRL); in clk_fracn_gppll_set_rate()
242 writel_relaxed(tmp, pll->base + PLL_CTRL); in clk_fracn_gppll_set_rate()
246 writel_relaxed(tmp, pll->base + PLL_CTRL); in clk_fracn_gppll_set_rate()
250 writel_relaxed(tmp, pll->base + PLL_CTRL); in clk_fracn_gppll_set_rate()
254 writel_relaxed(pll_div, pll->base + PLL_DIV); in clk_fracn_gppll_set_rate()
255 if (pll->flags & CLK_FRACN_GPPLL_FRACN) { in clk_fracn_gppll_set_rate()
256 writel_relaxed(rate->mfd, pll->base + PLL_DENOMINATOR); in clk_fracn_gppll_set_rate()
257 writel_relaxed(FIELD_PREP(PLL_MFN_MASK, rate->mfn), pll->base + PLL_NUMERATOR); in clk_fracn_gppll_set_rate()
265 writel_relaxed(tmp, pll->base + PLL_CTRL); in clk_fracn_gppll_set_rate()
268 ret = clk_fracn_gppll_wait_lock(pll); in clk_fracn_gppll_set_rate()
274 writel_relaxed(tmp, pll->base + PLL_CTRL); in clk_fracn_gppll_set_rate()
276 ana_mfn = readl_relaxed(pll->base + PLL_STATUS); in clk_fracn_gppll_set_rate()
286 struct clk_fracn_gppll *pll = to_clk_fracn_gppll(hw); in clk_fracn_gppll_prepare() local
290 val = readl_relaxed(pll->base + PLL_CTRL); in clk_fracn_gppll_prepare()
295 writel_relaxed(val, pll->base + PLL_CTRL); in clk_fracn_gppll_prepare()
298 writel_relaxed(val, pll->base + PLL_CTRL); in clk_fracn_gppll_prepare()
301 writel_relaxed(val, pll->base + PLL_CTRL); in clk_fracn_gppll_prepare()
303 ret = clk_fracn_gppll_wait_lock(pll); in clk_fracn_gppll_prepare()
308 writel_relaxed(val, pll->base + PLL_CTRL); in clk_fracn_gppll_prepare()
315 struct clk_fracn_gppll *pll = to_clk_fracn_gppll(hw); in clk_fracn_gppll_is_prepared() local
318 val = readl_relaxed(pll->base + PLL_CTRL); in clk_fracn_gppll_is_prepared()
325 struct clk_fracn_gppll *pll = to_clk_fracn_gppll(hw); in clk_fracn_gppll_unprepare() local
328 val = readl_relaxed(pll->base + PLL_CTRL); in clk_fracn_gppll_unprepare()
330 writel_relaxed(val, pll->base + PLL_CTRL); in clk_fracn_gppll_unprepare()
347 struct clk_fracn_gppll *pll; in _imx_clk_fracn_gppll() local
352 pll = kzalloc(sizeof(*pll), GFP_KERNEL); in _imx_clk_fracn_gppll()
353 if (!pll) in _imx_clk_fracn_gppll()
362 pll->base = base; in _imx_clk_fracn_gppll()
363 pll->hw.init = &init; in _imx_clk_fracn_gppll()
364 pll->rate_table = pll_clk->rate_table; in _imx_clk_fracn_gppll()
365 pll->rate_count = pll_clk->rate_count; in _imx_clk_fracn_gppll()
366 pll->flags = pll_flags; in _imx_clk_fracn_gppll()
368 hw = &pll->hw; in _imx_clk_fracn_gppll()
373 kfree(pll); in _imx_clk_fracn_gppll()