Lines Matching defs:nkm
20 struct _ccu_nkm *nkm)
26 for (_k = nkm->min_k; _k <= nkm->max_k; _k++) {
27 for (_n = nkm->min_n; _n <= nkm->max_n; _n++) {
28 for (_m = nkm->min_m; _m <= nkm->max_m; _m++) {
45 nkm->n = best_n;
46 nkm->k = best_k;
47 nkm->m = best_m;
52 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
54 return ccu_gate_helper_disable(&nkm->common, nkm->enable);
59 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
61 return ccu_gate_helper_enable(&nkm->common, nkm->enable);
66 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
68 return ccu_gate_helper_is_enabled(&nkm->common, nkm->enable);
74 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
78 reg = readl(nkm->common.base + nkm->common.reg);
80 n = reg >> nkm->n.shift;
81 n &= (1 << nkm->n.width) - 1;
82 n += nkm->n.offset;
86 k = reg >> nkm->k.shift;
87 k &= (1 << nkm->k.width) - 1;
88 k += nkm->k.offset;
92 m = reg >> nkm->m.shift;
93 m &= (1 << nkm->m.width) - 1;
94 m += nkm->m.offset;
100 if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
101 rate /= nkm->fixed_post_div;
112 struct ccu_nkm *nkm = data;
115 _nkm.min_n = nkm->n.min ?: 1;
116 _nkm.max_n = nkm->n.max ?: 1 << nkm->n.width;
117 _nkm.min_k = nkm->k.min ?: 1;
118 _nkm.max_k = nkm->k.max ?: 1 << nkm->k.width;
120 _nkm.max_m = nkm->m.max ?: 1 << nkm->m.width;
122 if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
123 rate *= nkm->fixed_post_div;
129 if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
130 rate /= nkm->fixed_post_div;
138 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
140 return ccu_mux_helper_determine_rate(&nkm->common, &nkm->mux,
141 req, ccu_nkm_round_rate, nkm);
147 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
152 if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
153 rate *= nkm->fixed_post_div;
155 _nkm.min_n = nkm->n.min ?: 1;
156 _nkm.max_n = nkm->n.max ?: 1 << nkm->n.width;
157 _nkm.min_k = nkm->k.min ?: 1;
158 _nkm.max_k = nkm->k.max ?: 1 << nkm->k.width;
160 _nkm.max_m = nkm->m.max ?: 1 << nkm->m.width;
164 spin_lock_irqsave(nkm->common.lock, flags);
166 reg = readl(nkm->common.base + nkm->common.reg);
167 reg &= ~GENMASK(nkm->n.width + nkm->n.shift - 1, nkm->n.shift);
168 reg &= ~GENMASK(nkm->k.width + nkm->k.shift - 1, nkm->k.shift);
169 reg &= ~GENMASK(nkm->m.width + nkm->m.shift - 1, nkm->m.shift);
171 reg |= (_nkm.n - nkm->n.offset) << nkm->n.shift;
172 reg |= (_nkm.k - nkm->k.offset) << nkm->k.shift;
173 reg |= (_nkm.m - nkm->m.offset) << nkm->m.shift;
174 writel(reg, nkm->common.base + nkm->common.reg);
176 spin_unlock_irqrestore(nkm->common.lock, flags);
178 ccu_helper_wait_for_lock(&nkm->common, nkm->lock);
185 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
187 return ccu_mux_helper_get_parent(&nkm->common, &nkm->mux);
192 struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
194 return ccu_mux_helper_set_parent(&nkm->common, &nkm->mux, index);