Lines Matching refs:mn

114 static u32 md_to_m(struct mn *mn, u32 md)  in md_to_m()  argument
116 md >>= mn->m_val_shift; in md_to_m()
117 md &= BIT(mn->width) - 1; in md_to_m()
140 static u32 mn_to_md(struct mn *mn, u32 m, u32 n, u32 md) in mn_to_md() argument
144 mask_w = BIT(mn->width) - 1; in mn_to_md()
145 mask = (mask_w << mn->m_val_shift) | mask_w; in mn_to_md()
149 m <<= mn->m_val_shift; in mn_to_md()
157 static u32 ns_m_to_n(struct mn *mn, u32 ns, u32 m) in ns_m_to_n() argument
159 ns = ~ns >> mn->n_val_shift; in ns_m_to_n()
160 ns &= BIT(mn->width) - 1; in ns_m_to_n()
164 static u32 reg_to_mnctr_mode(struct mn *mn, u32 val) in reg_to_mnctr_mode() argument
166 val >>= mn->mnctr_mode_shift; in reg_to_mnctr_mode()
171 static u32 mn_to_ns(struct mn *mn, u32 m, u32 n, u32 ns) in mn_to_ns() argument
175 mask = BIT(mn->width) - 1; in mn_to_ns()
176 mask <<= mn->n_val_shift; in mn_to_ns()
182 n &= BIT(mn->width) - 1; in mn_to_ns()
183 n <<= mn->n_val_shift; in mn_to_ns()
190 static u32 mn_to_reg(struct mn *mn, u32 m, u32 n, u32 val) in mn_to_reg() argument
194 mask = MNCTR_MODE_MASK << mn->mnctr_mode_shift; in mn_to_reg()
195 mask |= BIT(mn->mnctr_en_bit); in mn_to_reg()
199 val |= BIT(mn->mnctr_en_bit); in mn_to_reg()
200 val |= MNCTR_MODE_DUAL << mn->mnctr_mode_shift; in mn_to_reg()
210 struct mn *mn; in configure_bank() local
215 bool banked_mn = !!rcg->mn[1].width; in configure_bank()
233 mn = &rcg->mn[new_bank]; in configure_bank()
236 ns |= BIT(mn->mnctr_reset_bit); in configure_bank()
244 md = mn_to_md(mn, f->m, f->n, md); in configure_bank()
248 ns = mn_to_ns(mn, f->m, f->n, ns); in configure_bank()
255 ns = mn_to_reg(mn, f->m, f->n, ns); in configure_bank()
260 reg = mn_to_reg(mn, f->m, f->n, reg); in configure_bank()
267 ns &= ~BIT(mn->mnctr_reset_bit); in configure_bank()
305 bool banked_mn = !!rcg->mn[1].width; in clk_dyn_rcg_set_parent()
315 f.m = md_to_m(&rcg->mn[bank], md); in clk_dyn_rcg_set_parent()
316 f.n = ns_m_to_n(&rcg->mn[bank], ns, f.m); in clk_dyn_rcg_set_parent()
354 struct mn *mn = &rcg->mn; in clk_rcg_recalc_rate() local
359 if (rcg->mn.width) { in clk_rcg_recalc_rate()
361 m = md_to_m(mn, md); in clk_rcg_recalc_rate()
362 n = ns_m_to_n(mn, ns, m); in clk_rcg_recalc_rate()
368 mode = reg_to_mnctr_mode(mn, mode); in clk_rcg_recalc_rate()
380 struct mn *mn; in clk_dyn_rcg_recalc_rate() local
382 bool banked_mn = !!rcg->mn[1].width; in clk_dyn_rcg_recalc_rate()
391 mn = &rcg->mn[bank]; in clk_dyn_rcg_recalc_rate()
393 m = md_to_m(mn, md); in clk_dyn_rcg_recalc_rate()
394 n = ns_m_to_n(mn, ns, m); in clk_dyn_rcg_recalc_rate()
398 mode = reg_to_mnctr_mode(mn, reg); in clk_dyn_rcg_recalc_rate()
485 struct mn *mn = &rcg->mn; in __clk_rcg_set_rate() local
489 if (rcg->mn.reset_in_cc) in __clk_rcg_set_rate()
494 if (rcg->mn.width) { in __clk_rcg_set_rate()
495 mask = BIT(mn->mnctr_reset_bit); in __clk_rcg_set_rate()
499 md = mn_to_md(mn, f->m, f->n, md); in __clk_rcg_set_rate()
506 ctl = mn_to_reg(mn, f->m, f->n, ctl); in __clk_rcg_set_rate()
509 ns = mn_to_reg(mn, f->m, f->n, ns); in __clk_rcg_set_rate()
511 ns = mn_to_ns(mn, f->m, f->n, ns); in __clk_rcg_set_rate()