Lines Matching refs:rate

92 		struct clk_pll14xx *pll, unsigned long rate)  in imx_get_pll_settings()  argument
98 if (rate == rate_table[i].rate) in imx_get_pll_settings()
119 unsigned long rate, unsigned long prate) in pll1443x_calc_kdiv() argument
124 kdiv = ((rate * ((pdiv * 65536) << sdiv) + prate / 2) / prate) - (mdiv * 65536); in pll1443x_calc_kdiv()
129 static void imx_pll14xx_calc_settings(struct clk_pll14xx *pll, unsigned long rate, in imx_pll14xx_calc_settings() argument
150 tt = imx_get_pll_settings(pll, rate); in imx_pll14xx_calc_settings()
153 clk_hw_get_name(&pll->hw), prate, rate); in imx_pll14xx_calc_settings()
154 t->rate = tt->rate; in imx_pll14xx_calc_settings()
172 if (rate >= rate_min && rate <= rate_max) { in imx_pll14xx_calc_settings()
173 kdiv = pll1443x_calc_kdiv(mdiv, pdiv, sdiv, rate, prate); in imx_pll14xx_calc_settings()
175 clk_hw_get_name(&pll->hw), prate, rate, in imx_pll14xx_calc_settings()
178 t->rate = (unsigned int)fvco; in imx_pll14xx_calc_settings()
190 mdiv = DIV_ROUND_CLOSEST(rate * (pdiv << sdiv), prate); in imx_pll14xx_calc_settings()
193 kdiv = pll1443x_calc_kdiv(mdiv, pdiv, sdiv, rate, prate); in imx_pll14xx_calc_settings()
197 dist = abs((long)rate - (long)fvco); in imx_pll14xx_calc_settings()
200 t->rate = (unsigned int)fvco; in imx_pll14xx_calc_settings()
213 clk_hw_get_name(&pll->hw), prate, rate, t->rate, t->pdiv, t->sdiv, in imx_pll14xx_calc_settings()
217 static long clk_pll1416x_round_rate(struct clk_hw *hw, unsigned long rate, in clk_pll1416x_round_rate() argument
226 if (rate >= rate_table[i].rate) in clk_pll1416x_round_rate()
227 return rate_table[i].rate; in clk_pll1416x_round_rate()
230 return rate_table[pll->rate_count - 1].rate; in clk_pll1416x_round_rate()
233 static long clk_pll1443x_round_rate(struct clk_hw *hw, unsigned long rate, in clk_pll1443x_round_rate() argument
239 imx_pll14xx_calc_settings(pll, rate, *prate, &t); in clk_pll1443x_round_rate()
241 return t.rate; in clk_pll1443x_round_rate()
265 static inline bool clk_pll14xx_mp_change(const struct imx_pll14xx_rate_table *rate, in clk_pll14xx_mp_change() argument
273 return rate->mdiv != old_mdiv || rate->pdiv != old_pdiv; in clk_pll14xx_mp_change()
288 const struct imx_pll14xx_rate_table *rate; in clk_pll1416x_set_rate() local
292 rate = imx_get_pll_settings(pll, drate); in clk_pll1416x_set_rate()
293 if (!rate) { in clk_pll1416x_set_rate()
301 if (!clk_pll14xx_mp_change(rate, tmp)) { in clk_pll1416x_set_rate()
303 tmp |= FIELD_PREP(SDIV_MASK, rate->sdiv); in clk_pll1416x_set_rate()
322 div_val = FIELD_PREP(MDIV_MASK, rate->mdiv) | FIELD_PREP(PDIV_MASK, rate->pdiv) | in clk_pll1416x_set_rate()
323 FIELD_PREP(SDIV_MASK, rate->sdiv); in clk_pll1416x_set_rate()
354 struct imx_pll14xx_rate_table rate; in clk_pll1443x_set_rate() local
358 imx_pll14xx_calc_settings(pll, drate, prate, &rate); in clk_pll1443x_set_rate()
362 if (!clk_pll14xx_mp_change(&rate, div_ctl0)) { in clk_pll1443x_set_rate()
365 div_ctl0 |= FIELD_PREP(SDIV_MASK, rate.sdiv); in clk_pll1443x_set_rate()
368 writel_relaxed(FIELD_PREP(KDIV_MASK, rate.kdiv), in clk_pll1443x_set_rate()
383 div_ctl0 = FIELD_PREP(MDIV_MASK, rate.mdiv) | in clk_pll1443x_set_rate()
384 FIELD_PREP(PDIV_MASK, rate.pdiv) | in clk_pll1443x_set_rate()
385 FIELD_PREP(SDIV_MASK, rate.sdiv); in clk_pll1443x_set_rate()
388 writel_relaxed(FIELD_PREP(KDIV_MASK, rate.kdiv), pll->base + DIV_CTL1); in clk_pll1443x_set_rate()