Lines Matching refs:nkm

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