Lines Matching refs:nkm
22 struct _ccu_nkm *nkm)
28 for (_k = nkm->min_k; _k <= nkm->max_k; _k++) {
29 for (_n = nkm->min_n; _n <= nkm->max_n; _n++) {
30 for (_m = nkm->min_m; _m <= nkm->max_m; _m++) {
49 nkm->n = best_n;
50 nkm->k = best_k;
51 nkm->m = best_m;
59 struct _ccu_nkm *nkm, struct ccu_common *common)
65 for (_k = nkm->min_k; _k <= nkm->max_k; _k++) {
66 for (_n = nkm->min_n; _n <= nkm->max_n; _n++) {
67 for (_m = nkm->min_m; _m <= nkm->max_m; _m++) {
82 nkm->n = best_n;
83 nkm->k = best_k;
84 nkm->m = best_m;
91 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
93 return ccu_gate_helper_disable(&nkm->common, nkm->enable);
98 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
100 return ccu_gate_helper_enable(&nkm->common, nkm->enable);
105 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
107 return ccu_gate_helper_is_enabled(&nkm->common, nkm->enable);
113 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
117 reg = readl(nkm->common.base + nkm->common.reg);
119 n = reg >> nkm->n.shift;
120 n &= (1 << nkm->n.width) - 1;
121 n += nkm->n.offset;
125 k = reg >> nkm->k.shift;
126 k &= (1 << nkm->k.width) - 1;
127 k += nkm->k.offset;
131 m = reg >> nkm->m.shift;
132 m &= (1 << nkm->m.width) - 1;
133 m += nkm->m.offset;
139 if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
140 rate /= nkm->fixed_post_div;
151 struct ccu_nkm *nkm = data;
154 _nkm.min_n = nkm->n.min ?: 1;
155 _nkm.max_n = nkm->n.max ?: 1 << nkm->n.width;
156 _nkm.min_k = nkm->k.min ?: 1;
157 _nkm.max_k = nkm->k.max ?: 1 << nkm->k.width;
159 _nkm.max_m = nkm->m.max ?: 1 << nkm->m.width;
161 if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
162 rate *= nkm->fixed_post_div;
164 if (!clk_hw_can_set_rate_parent(&nkm->common.hw))
165 rate = ccu_nkm_find_best(*parent_rate, rate, &_nkm, &nkm->common);
167 rate = ccu_nkm_find_best_with_parent_adj(&nkm->common, parent_hw, parent_rate, rate,
170 if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
171 rate /= nkm->fixed_post_div;
179 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
181 return ccu_mux_helper_determine_rate(&nkm->common, &nkm->mux,
182 req, ccu_nkm_round_rate, nkm);
188 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
193 if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
194 rate *= nkm->fixed_post_div;
196 _nkm.min_n = nkm->n.min ?: 1;
197 _nkm.max_n = nkm->n.max ?: 1 << nkm->n.width;
198 _nkm.min_k = nkm->k.min ?: 1;
199 _nkm.max_k = nkm->k.max ?: 1 << nkm->k.width;
201 _nkm.max_m = nkm->m.max ?: 1 << nkm->m.width;
203 ccu_nkm_find_best(parent_rate, rate, &_nkm, &nkm->common);
205 spin_lock_irqsave(nkm->common.lock, flags);
207 reg = readl(nkm->common.base + nkm->common.reg);
208 reg &= ~GENMASK(nkm->n.width + nkm->n.shift - 1, nkm->n.shift);
209 reg &= ~GENMASK(nkm->k.width + nkm->k.shift - 1, nkm->k.shift);
210 reg &= ~GENMASK(nkm->m.width + nkm->m.shift - 1, nkm->m.shift);
212 reg |= (_nkm.n - nkm->n.offset) << nkm->n.shift;
213 reg |= (_nkm.k - nkm->k.offset) << nkm->k.shift;
214 reg |= (_nkm.m - nkm->m.offset) << nkm->m.shift;
215 writel(reg, nkm->common.base + nkm->common.reg);
217 spin_unlock_irqrestore(nkm->common.lock, flags);
219 ccu_helper_wait_for_lock(&nkm->common, nkm->lock);
226 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
228 return ccu_mux_helper_get_parent(&nkm->common, &nkm->mux);
233 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
235 return ccu_mux_helper_set_parent(&nkm->common, &nkm->mux, index);