Lines Matching refs:nkmp
33 struct _ccu_nkmp *nkmp) in ccu_nkmp_find_best() argument
39 for (_k = nkmp->min_k; _k <= nkmp->max_k; _k++) { in ccu_nkmp_find_best()
40 for (_n = nkmp->min_n; _n <= nkmp->max_n; _n++) { in ccu_nkmp_find_best()
41 for (_m = nkmp->min_m; _m <= nkmp->max_m; _m++) { in ccu_nkmp_find_best()
42 for (_p = nkmp->min_p; _p <= nkmp->max_p; _p <<= 1) { in ccu_nkmp_find_best()
64 nkmp->n = best_n; in ccu_nkmp_find_best()
65 nkmp->k = best_k; in ccu_nkmp_find_best()
66 nkmp->m = best_m; in ccu_nkmp_find_best()
67 nkmp->p = best_p; in ccu_nkmp_find_best()
74 struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); in ccu_nkmp_disable() local
76 return ccu_gate_helper_disable(&nkmp->common, nkmp->enable); in ccu_nkmp_disable()
81 struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); in ccu_nkmp_enable() local
83 return ccu_gate_helper_enable(&nkmp->common, nkmp->enable); in ccu_nkmp_enable()
88 struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); in ccu_nkmp_is_enabled() local
90 return ccu_gate_helper_is_enabled(&nkmp->common, nkmp->enable); in ccu_nkmp_is_enabled()
96 struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); in ccu_nkmp_recalc_rate() local
100 reg = readl(nkmp->common.base + nkmp->common.reg); in ccu_nkmp_recalc_rate()
102 n = reg >> nkmp->n.shift; in ccu_nkmp_recalc_rate()
103 n &= (1 << nkmp->n.width) - 1; in ccu_nkmp_recalc_rate()
104 n += nkmp->n.offset; in ccu_nkmp_recalc_rate()
108 k = reg >> nkmp->k.shift; in ccu_nkmp_recalc_rate()
109 k &= (1 << nkmp->k.width) - 1; in ccu_nkmp_recalc_rate()
110 k += nkmp->k.offset; in ccu_nkmp_recalc_rate()
114 m = reg >> nkmp->m.shift; in ccu_nkmp_recalc_rate()
115 m &= (1 << nkmp->m.width) - 1; in ccu_nkmp_recalc_rate()
116 m += nkmp->m.offset; in ccu_nkmp_recalc_rate()
120 p = reg >> nkmp->p.shift; in ccu_nkmp_recalc_rate()
121 p &= (1 << nkmp->p.width) - 1; in ccu_nkmp_recalc_rate()
124 if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nkmp_recalc_rate()
125 rate /= nkmp->fixed_post_div; in ccu_nkmp_recalc_rate()
133 struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); in ccu_nkmp_round_rate() local
136 if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nkmp_round_rate()
137 rate *= nkmp->fixed_post_div; in ccu_nkmp_round_rate()
139 if (nkmp->max_rate && rate > nkmp->max_rate) { in ccu_nkmp_round_rate()
140 rate = nkmp->max_rate; in ccu_nkmp_round_rate()
141 if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nkmp_round_rate()
142 rate /= nkmp->fixed_post_div; in ccu_nkmp_round_rate()
146 _nkmp.min_n = nkmp->n.min ?: 1; in ccu_nkmp_round_rate()
147 _nkmp.max_n = nkmp->n.max ?: 1 << nkmp->n.width; in ccu_nkmp_round_rate()
148 _nkmp.min_k = nkmp->k.min ?: 1; in ccu_nkmp_round_rate()
149 _nkmp.max_k = nkmp->k.max ?: 1 << nkmp->k.width; in ccu_nkmp_round_rate()
151 _nkmp.max_m = nkmp->m.max ?: 1 << nkmp->m.width; in ccu_nkmp_round_rate()
153 _nkmp.max_p = nkmp->p.max ?: 1 << ((1 << nkmp->p.width) - 1); in ccu_nkmp_round_rate()
157 if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nkmp_round_rate()
158 rate = rate / nkmp->fixed_post_div; in ccu_nkmp_round_rate()
166 struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); in ccu_nkmp_set_rate() local
172 if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV) in ccu_nkmp_set_rate()
173 rate = rate * nkmp->fixed_post_div; in ccu_nkmp_set_rate()
175 _nkmp.min_n = nkmp->n.min ?: 1; in ccu_nkmp_set_rate()
176 _nkmp.max_n = nkmp->n.max ?: 1 << nkmp->n.width; in ccu_nkmp_set_rate()
177 _nkmp.min_k = nkmp->k.min ?: 1; in ccu_nkmp_set_rate()
178 _nkmp.max_k = nkmp->k.max ?: 1 << nkmp->k.width; in ccu_nkmp_set_rate()
180 _nkmp.max_m = nkmp->m.max ?: 1 << nkmp->m.width; in ccu_nkmp_set_rate()
182 _nkmp.max_p = nkmp->p.max ?: 1 << ((1 << nkmp->p.width) - 1); in ccu_nkmp_set_rate()
192 if (nkmp->n.width) in ccu_nkmp_set_rate()
193 n_mask = GENMASK(nkmp->n.width + nkmp->n.shift - 1, in ccu_nkmp_set_rate()
194 nkmp->n.shift); in ccu_nkmp_set_rate()
195 if (nkmp->k.width) in ccu_nkmp_set_rate()
196 k_mask = GENMASK(nkmp->k.width + nkmp->k.shift - 1, in ccu_nkmp_set_rate()
197 nkmp->k.shift); in ccu_nkmp_set_rate()
198 if (nkmp->m.width) in ccu_nkmp_set_rate()
199 m_mask = GENMASK(nkmp->m.width + nkmp->m.shift - 1, in ccu_nkmp_set_rate()
200 nkmp->m.shift); in ccu_nkmp_set_rate()
201 if (nkmp->p.width) in ccu_nkmp_set_rate()
202 p_mask = GENMASK(nkmp->p.width + nkmp->p.shift - 1, in ccu_nkmp_set_rate()
203 nkmp->p.shift); in ccu_nkmp_set_rate()
205 spin_lock_irqsave(nkmp->common.lock, flags); in ccu_nkmp_set_rate()
207 reg = readl(nkmp->common.base + nkmp->common.reg); in ccu_nkmp_set_rate()
210 reg |= ((_nkmp.n - nkmp->n.offset) << nkmp->n.shift) & n_mask; in ccu_nkmp_set_rate()
211 reg |= ((_nkmp.k - nkmp->k.offset) << nkmp->k.shift) & k_mask; in ccu_nkmp_set_rate()
212 reg |= ((_nkmp.m - nkmp->m.offset) << nkmp->m.shift) & m_mask; in ccu_nkmp_set_rate()
213 reg |= (ilog2(_nkmp.p) << nkmp->p.shift) & p_mask; in ccu_nkmp_set_rate()
215 writel(reg, nkmp->common.base + nkmp->common.reg); in ccu_nkmp_set_rate()
217 spin_unlock_irqrestore(nkmp->common.lock, flags); in ccu_nkmp_set_rate()
219 ccu_helper_wait_for_lock(&nkmp->common, nkmp->lock); in ccu_nkmp_set_rate()