Lines Matching refs:mn

106 static u32 md_to_m(struct mn *mn, u32 md)  in md_to_m()  argument
108 md >>= mn->m_val_shift; in md_to_m()
109 md &= BIT(mn->width) - 1; in md_to_m()
132 static u32 mn_to_md(struct mn *mn, u32 m, u32 n, u32 md) in mn_to_md() argument
136 mask_w = BIT(mn->width) - 1; in mn_to_md()
137 mask = (mask_w << mn->m_val_shift) | mask_w; in mn_to_md()
141 m <<= mn->m_val_shift; in mn_to_md()
149 static u32 ns_m_to_n(struct mn *mn, u32 ns, u32 m) in ns_m_to_n() argument
151 ns = ~ns >> mn->n_val_shift; in ns_m_to_n()
152 ns &= BIT(mn->width) - 1; in ns_m_to_n()
156 static u32 reg_to_mnctr_mode(struct mn *mn, u32 val) in reg_to_mnctr_mode() argument
158 val >>= mn->mnctr_mode_shift; in reg_to_mnctr_mode()
163 static u32 mn_to_ns(struct mn *mn, u32 m, u32 n, u32 ns) in mn_to_ns() argument
167 mask = BIT(mn->width) - 1; in mn_to_ns()
168 mask <<= mn->n_val_shift; in mn_to_ns()
174 n &= BIT(mn->width) - 1; in mn_to_ns()
175 n <<= mn->n_val_shift; in mn_to_ns()
182 static u32 mn_to_reg(struct mn *mn, u32 m, u32 n, u32 val) in mn_to_reg() argument
186 mask = MNCTR_MODE_MASK << mn->mnctr_mode_shift; in mn_to_reg()
187 mask |= BIT(mn->mnctr_en_bit); in mn_to_reg()
191 val |= BIT(mn->mnctr_en_bit); in mn_to_reg()
192 val |= MNCTR_MODE_DUAL << mn->mnctr_mode_shift; in mn_to_reg()
202 struct mn *mn; in configure_bank() local
207 bool banked_mn = !!rcg->mn[1].width; in configure_bank()
225 mn = &rcg->mn[new_bank]; in configure_bank()
228 ns |= BIT(mn->mnctr_reset_bit); in configure_bank()
236 md = mn_to_md(mn, f->m, f->n, md); in configure_bank()
240 ns = mn_to_ns(mn, f->m, f->n, ns); in configure_bank()
247 ns = mn_to_reg(mn, f->m, f->n, ns); in configure_bank()
252 reg = mn_to_reg(mn, f->m, f->n, reg); in configure_bank()
259 ns &= ~BIT(mn->mnctr_reset_bit); in configure_bank()
297 bool banked_mn = !!rcg->mn[1].width; in clk_dyn_rcg_set_parent()
307 f.m = md_to_m(&rcg->mn[bank], md); in clk_dyn_rcg_set_parent()
308 f.n = ns_m_to_n(&rcg->mn[bank], ns, f.m); in clk_dyn_rcg_set_parent()
346 struct mn *mn = &rcg->mn; in clk_rcg_recalc_rate() local
351 if (rcg->mn.width) { in clk_rcg_recalc_rate()
353 m = md_to_m(mn, md); in clk_rcg_recalc_rate()
354 n = ns_m_to_n(mn, ns, m); in clk_rcg_recalc_rate()
360 mode = reg_to_mnctr_mode(mn, mode); in clk_rcg_recalc_rate()
372 struct mn *mn; in clk_dyn_rcg_recalc_rate() local
374 bool banked_mn = !!rcg->mn[1].width; in clk_dyn_rcg_recalc_rate()
383 mn = &rcg->mn[bank]; in clk_dyn_rcg_recalc_rate()
385 m = md_to_m(mn, md); in clk_dyn_rcg_recalc_rate()
386 n = ns_m_to_n(mn, ns, m); in clk_dyn_rcg_recalc_rate()
390 mode = reg_to_mnctr_mode(mn, reg); in clk_dyn_rcg_recalc_rate()
477 struct mn *mn = &rcg->mn; in __clk_rcg_set_rate() local
481 if (rcg->mn.reset_in_cc) in __clk_rcg_set_rate()
486 if (rcg->mn.width) { in __clk_rcg_set_rate()
487 mask = BIT(mn->mnctr_reset_bit); in __clk_rcg_set_rate()
491 md = mn_to_md(mn, f->m, f->n, md); in __clk_rcg_set_rate()
498 ctl = mn_to_reg(mn, f->m, f->n, ctl); in __clk_rcg_set_rate()
501 ns = mn_to_reg(mn, f->m, f->n, ns); in __clk_rcg_set_rate()
503 ns = mn_to_ns(mn, f->m, f->n, ns); in __clk_rcg_set_rate()