Lines Matching refs:nkmp
36 struct _ccu_nkmp *nkmp) in ccu_nkmp_find_best() argument
42 for (_k = nkmp->min_k; _k <= nkmp->max_k; _k++) { in ccu_nkmp_find_best()
43 for (_n = nkmp->min_n; _n <= nkmp->max_n; _n++) { in ccu_nkmp_find_best()
44 for (_m = nkmp->min_m; _m <= nkmp->max_m; _m++) { in ccu_nkmp_find_best()
45 for (_p = nkmp->min_p; _p <= nkmp->max_p; _p <<= 1) { in ccu_nkmp_find_best()
67 nkmp->n = best_n; in ccu_nkmp_find_best()
68 nkmp->k = best_k; in ccu_nkmp_find_best()
69 nkmp->m = best_m; in ccu_nkmp_find_best()
70 nkmp->p = best_p; in ccu_nkmp_find_best()
75 struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); in ccu_nkmp_disable() local
77 return ccu_gate_helper_disable(&nkmp->common, nkmp->enable); in ccu_nkmp_disable()
82 struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); in ccu_nkmp_enable() local
84 return ccu_gate_helper_enable(&nkmp->common, nkmp->enable); in ccu_nkmp_enable()
89 struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); in ccu_nkmp_is_enabled() local
91 return ccu_gate_helper_is_enabled(&nkmp->common, nkmp->enable); in ccu_nkmp_is_enabled()
97 struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); in ccu_nkmp_recalc_rate() local
101 reg = readl(nkmp->common.base + nkmp->common.reg); in ccu_nkmp_recalc_rate()
103 n = reg >> nkmp->n.shift; in ccu_nkmp_recalc_rate()
104 n &= (1 << nkmp->n.width) - 1; in ccu_nkmp_recalc_rate()
105 n += nkmp->n.offset; in ccu_nkmp_recalc_rate()
109 k = reg >> nkmp->k.shift; in ccu_nkmp_recalc_rate()
110 k &= (1 << nkmp->k.width) - 1; in ccu_nkmp_recalc_rate()
111 k += nkmp->k.offset; in ccu_nkmp_recalc_rate()
115 m = reg >> nkmp->m.shift; in ccu_nkmp_recalc_rate()
116 m &= (1 << nkmp->m.width) - 1; in ccu_nkmp_recalc_rate()
117 m += nkmp->m.offset; in ccu_nkmp_recalc_rate()
121 p = reg >> nkmp->p.shift; in ccu_nkmp_recalc_rate()
122 p &= (1 << nkmp->p.width) - 1; in ccu_nkmp_recalc_rate()
125 if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nkmp_recalc_rate()
126 rate /= nkmp->fixed_post_div; in ccu_nkmp_recalc_rate()
134 struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); in ccu_nkmp_round_rate() local
137 if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nkmp_round_rate()
138 rate *= nkmp->fixed_post_div; in ccu_nkmp_round_rate()
140 _nkmp.min_n = nkmp->n.min ?: 1; in ccu_nkmp_round_rate()
141 _nkmp.max_n = nkmp->n.max ?: 1 << nkmp->n.width; in ccu_nkmp_round_rate()
142 _nkmp.min_k = nkmp->k.min ?: 1; in ccu_nkmp_round_rate()
143 _nkmp.max_k = nkmp->k.max ?: 1 << nkmp->k.width; in ccu_nkmp_round_rate()
145 _nkmp.max_m = nkmp->m.max ?: 1 << nkmp->m.width; in ccu_nkmp_round_rate()
147 _nkmp.max_p = nkmp->p.max ?: 1 << ((1 << nkmp->p.width) - 1); in ccu_nkmp_round_rate()
153 if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nkmp_round_rate()
154 rate = rate / nkmp->fixed_post_div; in ccu_nkmp_round_rate()
162 struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); in ccu_nkmp_set_rate() local
168 if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nkmp_set_rate()
169 rate = rate * nkmp->fixed_post_div; in ccu_nkmp_set_rate()
171 _nkmp.min_n = nkmp->n.min ?: 1; in ccu_nkmp_set_rate()
172 _nkmp.max_n = nkmp->n.max ?: 1 << nkmp->n.width; in ccu_nkmp_set_rate()
173 _nkmp.min_k = nkmp->k.min ?: 1; in ccu_nkmp_set_rate()
174 _nkmp.max_k = nkmp->k.max ?: 1 << nkmp->k.width; in ccu_nkmp_set_rate()
176 _nkmp.max_m = nkmp->m.max ?: 1 << nkmp->m.width; in ccu_nkmp_set_rate()
178 _nkmp.max_p = nkmp->p.max ?: 1 << ((1 << nkmp->p.width) - 1); in ccu_nkmp_set_rate()
182 if (nkmp->n.width) in ccu_nkmp_set_rate()
183 n_mask = GENMASK(nkmp->n.width + nkmp->n.shift - 1, in ccu_nkmp_set_rate()
184 nkmp->n.shift); in ccu_nkmp_set_rate()
185 if (nkmp->k.width) in ccu_nkmp_set_rate()
186 k_mask = GENMASK(nkmp->k.width + nkmp->k.shift - 1, in ccu_nkmp_set_rate()
187 nkmp->k.shift); in ccu_nkmp_set_rate()
188 if (nkmp->m.width) in ccu_nkmp_set_rate()
189 m_mask = GENMASK(nkmp->m.width + nkmp->m.shift - 1, in ccu_nkmp_set_rate()
190 nkmp->m.shift); in ccu_nkmp_set_rate()
191 if (nkmp->p.width) in ccu_nkmp_set_rate()
192 p_mask = GENMASK(nkmp->p.width + nkmp->p.shift - 1, in ccu_nkmp_set_rate()
193 nkmp->p.shift); in ccu_nkmp_set_rate()
195 spin_lock_irqsave(nkmp->common.lock, flags); in ccu_nkmp_set_rate()
197 reg = readl(nkmp->common.base + nkmp->common.reg); in ccu_nkmp_set_rate()
200 reg |= ((_nkmp.n - nkmp->n.offset) << nkmp->n.shift) & n_mask; in ccu_nkmp_set_rate()
201 reg |= ((_nkmp.k - nkmp->k.offset) << nkmp->k.shift) & k_mask; in ccu_nkmp_set_rate()
202 reg |= ((_nkmp.m - nkmp->m.offset) << nkmp->m.shift) & m_mask; in ccu_nkmp_set_rate()
203 reg |= (ilog2(_nkmp.p) << nkmp->p.shift) & p_mask; in ccu_nkmp_set_rate()
205 writel(reg, nkmp->common.base + nkmp->common.reg); in ccu_nkmp_set_rate()
207 spin_unlock_irqrestore(nkmp->common.lock, flags); in ccu_nkmp_set_rate()
209 ccu_helper_wait_for_lock(&nkmp->common, nkmp->lock); in ccu_nkmp_set_rate()