Lines Matching full:rate
51 struct rockchip_clk_pll *pll, unsigned long rate) in rockchip_get_pll_settings() argument
57 if (rate == rate_table[i].rate) in rockchip_get_pll_settings()
73 if (drate >= rate_table[i].rate) in rockchip_pll_round_rate()
74 return rate_table[i].rate; in rockchip_pll_round_rate()
78 return rate_table[i - 1].rate; in rockchip_pll_round_rate()
140 struct rockchip_pll_rate_table *rate) in rockchip_rk3036_pll_get_params() argument
145 rate->fbdiv = ((pllcon >> RK3036_PLLCON0_FBDIV_SHIFT) in rockchip_rk3036_pll_get_params()
147 rate->postdiv1 = ((pllcon >> RK3036_PLLCON0_POSTDIV1_SHIFT) in rockchip_rk3036_pll_get_params()
151 rate->refdiv = ((pllcon >> RK3036_PLLCON1_REFDIV_SHIFT) in rockchip_rk3036_pll_get_params()
153 rate->postdiv2 = ((pllcon >> RK3036_PLLCON1_POSTDIV2_SHIFT) in rockchip_rk3036_pll_get_params()
155 rate->dsmpd = ((pllcon >> RK3036_PLLCON1_DSMPD_SHIFT) in rockchip_rk3036_pll_get_params()
159 rate->frac = ((pllcon >> RK3036_PLLCON2_FRAC_SHIFT) in rockchip_rk3036_pll_get_params()
190 const struct rockchip_pll_rate_table *rate) in rockchip_rk3036_pll_set_params() argument
200 …pr_debug("%s: rate settings for %lu fbdiv: %d, postdiv1: %d, refdiv: %d, postdiv2: %d, dsmpd: %d, … in rockchip_rk3036_pll_set_params()
201 __func__, rate->rate, rate->fbdiv, rate->postdiv1, rate->refdiv, in rockchip_rk3036_pll_set_params()
202 rate->postdiv2, rate->dsmpd, rate->frac); in rockchip_rk3036_pll_set_params()
205 cur.rate = 0; in rockchip_rk3036_pll_set_params()
214 writel_relaxed(HIWORD_UPDATE(rate->fbdiv, RK3036_PLLCON0_FBDIV_MASK, in rockchip_rk3036_pll_set_params()
216 HIWORD_UPDATE(rate->postdiv1, RK3036_PLLCON0_POSTDIV1_MASK, in rockchip_rk3036_pll_set_params()
220 writel_relaxed(HIWORD_UPDATE(rate->refdiv, RK3036_PLLCON1_REFDIV_MASK, in rockchip_rk3036_pll_set_params()
222 HIWORD_UPDATE(rate->postdiv2, RK3036_PLLCON1_POSTDIV2_MASK, in rockchip_rk3036_pll_set_params()
224 HIWORD_UPDATE(rate->dsmpd, RK3036_PLLCON1_DSMPD_MASK, in rockchip_rk3036_pll_set_params()
231 pllcon |= rate->frac << RK3036_PLLCON2_FRAC_SHIFT; in rockchip_rk3036_pll_set_params()
252 const struct rockchip_pll_rate_table *rate; in rockchip_rk3036_pll_set_rate() local
254 pr_debug("%s: changing %s to %lu with a parent rate of %lu\n", in rockchip_rk3036_pll_set_rate()
257 /* Get required rate settings from table */ in rockchip_rk3036_pll_set_rate()
258 rate = rockchip_get_pll_settings(pll, drate); in rockchip_rk3036_pll_set_rate()
259 if (!rate) { in rockchip_rk3036_pll_set_rate()
260 pr_err("%s: Invalid rate : %lu for pll clk %s\n", __func__, in rockchip_rk3036_pll_set_rate()
265 return rockchip_rk3036_pll_set_params(pll, rate); in rockchip_rk3036_pll_set_rate()
299 const struct rockchip_pll_rate_table *rate; in rockchip_rk3036_pll_init() local
307 rate = rockchip_get_pll_settings(pll, drate); in rockchip_rk3036_pll_init()
309 /* when no rate setting for the current rate, rely on clk_set_rate */ in rockchip_rk3036_pll_init()
310 if (!rate) in rockchip_rk3036_pll_init()
321 rate->fbdiv, rate->postdiv1, rate->refdiv, rate->postdiv2, in rockchip_rk3036_pll_init()
322 rate->dsmpd, rate->frac); in rockchip_rk3036_pll_init()
324 if (rate->fbdiv != cur.fbdiv || rate->postdiv1 != cur.postdiv1 || in rockchip_rk3036_pll_init()
325 rate->refdiv != cur.refdiv || rate->postdiv2 != cur.postdiv2 || in rockchip_rk3036_pll_init()
326 rate->dsmpd != cur.dsmpd || in rockchip_rk3036_pll_init()
327 (!cur.dsmpd && (rate->frac != cur.frac))) { in rockchip_rk3036_pll_init()
336 pr_debug("%s: pll %s: rate params do not match rate table, adjusting\n", in rockchip_rk3036_pll_init()
338 rockchip_rk3036_pll_set_params(pll, rate); in rockchip_rk3036_pll_init()
381 struct rockchip_pll_rate_table *rate) in rockchip_rk3066_pll_get_params() argument
386 rate->nr = ((pllcon >> RK3066_PLLCON0_NR_SHIFT) in rockchip_rk3066_pll_get_params()
388 rate->no = ((pllcon >> RK3066_PLLCON0_OD_SHIFT) in rockchip_rk3066_pll_get_params()
392 rate->nf = ((pllcon >> RK3066_PLLCON1_NF_SHIFT) in rockchip_rk3066_pll_get_params()
396 rate->nb = ((pllcon >> RK3066_PLLCON2_NB_SHIFT) in rockchip_rk3066_pll_get_params()
425 const struct rockchip_pll_rate_table *rate) in rockchip_rk3066_pll_set_params() argument
434 pr_debug("%s: rate settings for %lu (nr, no, nf): (%d, %d, %d)\n", in rockchip_rk3066_pll_set_params()
435 __func__, rate->rate, rate->nr, rate->no, rate->nf); in rockchip_rk3066_pll_set_params()
438 cur.rate = 0; in rockchip_rk3066_pll_set_params()
451 writel(HIWORD_UPDATE(rate->nr - 1, RK3066_PLLCON0_NR_MASK, in rockchip_rk3066_pll_set_params()
453 HIWORD_UPDATE(rate->no - 1, RK3066_PLLCON0_OD_MASK, in rockchip_rk3066_pll_set_params()
457 writel_relaxed(HIWORD_UPDATE(rate->nf - 1, RK3066_PLLCON1_NF_MASK, in rockchip_rk3066_pll_set_params()
460 writel_relaxed(HIWORD_UPDATE(rate->nb - 1, RK3066_PLLCON2_NB_MASK, in rockchip_rk3066_pll_set_params()
467 udelay(RK3066_PLL_RESET_DELAY(rate->nr)); in rockchip_rk3066_pll_set_params()
487 const struct rockchip_pll_rate_table *rate; in rockchip_rk3066_pll_set_rate() local
489 pr_debug("%s: changing %s to %lu with a parent rate of %lu\n", in rockchip_rk3066_pll_set_rate()
492 /* Get required rate settings from table */ in rockchip_rk3066_pll_set_rate()
493 rate = rockchip_get_pll_settings(pll, drate); in rockchip_rk3066_pll_set_rate()
494 if (!rate) { in rockchip_rk3066_pll_set_rate()
495 pr_err("%s: Invalid rate : %lu for pll clk %s\n", __func__, in rockchip_rk3066_pll_set_rate()
500 return rockchip_rk3066_pll_set_params(pll, rate); in rockchip_rk3066_pll_set_rate()
534 const struct rockchip_pll_rate_table *rate; in rockchip_rk3066_pll_init() local
542 rate = rockchip_get_pll_settings(pll, drate); in rockchip_rk3066_pll_init()
544 /* when no rate setting for the current rate, rely on clk_set_rate */ in rockchip_rk3066_pll_init()
545 if (!rate) in rockchip_rk3066_pll_init()
551 __func__, clk_hw_get_name(hw), drate, rate->nr, cur.nr, in rockchip_rk3066_pll_init()
552 rate->no, cur.no, rate->nf, cur.nf, rate->nb, cur.nb); in rockchip_rk3066_pll_init()
553 if (rate->nr != cur.nr || rate->no != cur.no || rate->nf != cur.nf in rockchip_rk3066_pll_init()
554 || rate->nb != cur.nb) { in rockchip_rk3066_pll_init()
555 pr_debug("%s: pll %s: rate params do not match rate table, adjusting\n", in rockchip_rk3066_pll_init()
557 rockchip_rk3066_pll_set_params(pll, rate); in rockchip_rk3066_pll_init()
620 struct rockchip_pll_rate_table *rate) in rockchip_rk3399_pll_get_params() argument
625 rate->fbdiv = ((pllcon >> RK3399_PLLCON0_FBDIV_SHIFT) in rockchip_rk3399_pll_get_params()
629 rate->refdiv = ((pllcon >> RK3399_PLLCON1_REFDIV_SHIFT) in rockchip_rk3399_pll_get_params()
631 rate->postdiv1 = ((pllcon >> RK3399_PLLCON1_POSTDIV1_SHIFT) in rockchip_rk3399_pll_get_params()
633 rate->postdiv2 = ((pllcon >> RK3399_PLLCON1_POSTDIV2_SHIFT) in rockchip_rk3399_pll_get_params()
637 rate->frac = ((pllcon >> RK3399_PLLCON2_FRAC_SHIFT) in rockchip_rk3399_pll_get_params()
641 rate->dsmpd = ((pllcon >> RK3399_PLLCON3_DSMPD_SHIFT) in rockchip_rk3399_pll_get_params()
672 const struct rockchip_pll_rate_table *rate) in rockchip_rk3399_pll_set_params() argument
682 …pr_debug("%s: rate settings for %lu fbdiv: %d, postdiv1: %d, refdiv: %d, postdiv2: %d, dsmpd: %d, … in rockchip_rk3399_pll_set_params()
683 __func__, rate->rate, rate->fbdiv, rate->postdiv1, rate->refdiv, in rockchip_rk3399_pll_set_params()
684 rate->postdiv2, rate->dsmpd, rate->frac); in rockchip_rk3399_pll_set_params()
687 cur.rate = 0; in rockchip_rk3399_pll_set_params()
696 writel_relaxed(HIWORD_UPDATE(rate->fbdiv, RK3399_PLLCON0_FBDIV_MASK, in rockchip_rk3399_pll_set_params()
700 writel_relaxed(HIWORD_UPDATE(rate->refdiv, RK3399_PLLCON1_REFDIV_MASK, in rockchip_rk3399_pll_set_params()
702 HIWORD_UPDATE(rate->postdiv1, RK3399_PLLCON1_POSTDIV1_MASK, in rockchip_rk3399_pll_set_params()
704 HIWORD_UPDATE(rate->postdiv2, RK3399_PLLCON1_POSTDIV2_MASK, in rockchip_rk3399_pll_set_params()
711 pllcon |= rate->frac << RK3399_PLLCON2_FRAC_SHIFT; in rockchip_rk3399_pll_set_params()
714 writel_relaxed(HIWORD_UPDATE(rate->dsmpd, RK3399_PLLCON3_DSMPD_MASK, in rockchip_rk3399_pll_set_params()
736 const struct rockchip_pll_rate_table *rate; in rockchip_rk3399_pll_set_rate() local
738 pr_debug("%s: changing %s to %lu with a parent rate of %lu\n", in rockchip_rk3399_pll_set_rate()
741 /* Get required rate settings from table */ in rockchip_rk3399_pll_set_rate()
742 rate = rockchip_get_pll_settings(pll, drate); in rockchip_rk3399_pll_set_rate()
743 if (!rate) { in rockchip_rk3399_pll_set_rate()
744 pr_err("%s: Invalid rate : %lu for pll clk %s\n", __func__, in rockchip_rk3399_pll_set_rate()
749 return rockchip_rk3399_pll_set_params(pll, rate); in rockchip_rk3399_pll_set_rate()
783 const struct rockchip_pll_rate_table *rate; in rockchip_rk3399_pll_init() local
791 rate = rockchip_get_pll_settings(pll, drate); in rockchip_rk3399_pll_init()
793 /* when no rate setting for the current rate, rely on clk_set_rate */ in rockchip_rk3399_pll_init()
794 if (!rate) in rockchip_rk3399_pll_init()
805 rate->fbdiv, rate->postdiv1, rate->refdiv, rate->postdiv2, in rockchip_rk3399_pll_init()
806 rate->dsmpd, rate->frac); in rockchip_rk3399_pll_init()
808 if (rate->fbdiv != cur.fbdiv || rate->postdiv1 != cur.postdiv1 || in rockchip_rk3399_pll_init()
809 rate->refdiv != cur.refdiv || rate->postdiv2 != cur.postdiv2 || in rockchip_rk3399_pll_init()
810 rate->dsmpd != cur.dsmpd || in rockchip_rk3399_pll_init()
811 (!cur.dsmpd && (rate->frac != cur.frac))) { in rockchip_rk3399_pll_init()
820 pr_debug("%s: pll %s: rate params do not match rate table, adjusting\n", in rockchip_rk3399_pll_init()
822 rockchip_rk3399_pll_set_params(pll, rate); in rockchip_rk3399_pll_init()
881 struct rockchip_pll_rate_table *rate) in rockchip_rk3588_pll_get_params() argument
886 rate->m = ((pllcon >> RK3588_PLLCON0_M_SHIFT) & RK3588_PLLCON0_M_MASK); in rockchip_rk3588_pll_get_params()
889 rate->p = ((pllcon >> RK3588_PLLCON1_P_SHIFT) & RK3588_PLLCON1_P_MASK); in rockchip_rk3588_pll_get_params()
890 rate->s = ((pllcon >> RK3588_PLLCON1_S_SHIFT) & RK3588_PLLCON1_S_MASK); in rockchip_rk3588_pll_get_params()
893 rate->k = ((pllcon >> RK3588_PLLCON2_K_SHIFT) & RK3588_PLLCON2_K_MASK); in rockchip_rk3588_pll_get_params()
924 const struct rockchip_pll_rate_table *rate) in rockchip_rk3588_pll_set_params() argument
933 pr_debug("%s: rate settings for %lu p: %d, m: %d, s: %d, k: %d\n", in rockchip_rk3588_pll_set_params()
934 __func__, rate->rate, rate->p, rate->m, rate->s, rate->k); in rockchip_rk3588_pll_set_params()
937 cur.rate = 0; in rockchip_rk3588_pll_set_params()
953 writel_relaxed(HIWORD_UPDATE(rate->m, RK3588_PLLCON0_M_MASK, RK3588_PLLCON0_M_SHIFT), in rockchip_rk3588_pll_set_params()
956 writel_relaxed(HIWORD_UPDATE(rate->p, RK3588_PLLCON1_P_MASK, RK3588_PLLCON1_P_SHIFT) | in rockchip_rk3588_pll_set_params()
957 HIWORD_UPDATE(rate->s, RK3588_PLLCON1_S_MASK, RK3588_PLLCON1_S_SHIFT), in rockchip_rk3588_pll_set_params()
960 writel_relaxed(HIWORD_UPDATE(rate->k, RK3588_PLLCON2_K_MASK, RK3588_PLLCON2_K_SHIFT), in rockchip_rk3588_pll_set_params()
985 const struct rockchip_pll_rate_table *rate; in rockchip_rk3588_pll_set_rate() local
987 pr_debug("%s: changing %s to %lu with a parent rate of %lu\n", in rockchip_rk3588_pll_set_rate()
990 /* Get required rate settings from table */ in rockchip_rk3588_pll_set_rate()
991 rate = rockchip_get_pll_settings(pll, drate); in rockchip_rk3588_pll_set_rate()
992 if (!rate) { in rockchip_rk3588_pll_set_rate()
993 pr_err("%s: Invalid rate : %lu for pll clk %s\n", __func__, in rockchip_rk3588_pll_set_rate()
998 return rockchip_rk3588_pll_set_params(pll, rate); in rockchip_rk3588_pll_set_rate()
1138 for (len = 0; rate_table[len].rate != 0; ) in rockchip_clk_register_pll()
1147 "%s: could not allocate rate table for %s\n", in rockchip_clk_register_pll()