Lines Matching refs:nkmp
43 struct sunxi_ccu_nkmp *nkmp = &clk->u.nkmp;
49 if (!nkmp->enable)
52 val = CCU_READ(sc, nkmp->reg);
54 val |= nkmp->enable;
56 val &= ~nkmp->enable;
57 CCU_WRITE(sc, nkmp->reg, val);
59 if (enable && nkmp->lock) {
61 val = CCU_READ(sc, nkmp->reg);
62 if (val & nkmp->lock)
77 struct sunxi_ccu_nkmp *nkmp = &clk->u.nkmp;
93 val = CCU_READ(sc, nkmp->reg);
94 if (nkmp->n)
95 n = __SHIFTOUT(val, nkmp->n);
98 if (nkmp->k)
99 k = __SHIFTOUT(val, nkmp->k);
102 if (nkmp->m)
103 m = __SHIFTOUT(val, nkmp->m);
106 if (nkmp->p)
107 p = __SHIFTOUT(val, nkmp->p);
111 if (nkmp->enable && !(val & nkmp->enable))
114 if ((nkmp->flags & SUNXI_CCU_NKMP_FACTOR_N_EXACT) == 0)
117 if ((nkmp->flags & SUNXI_CCU_NKMP_FACTOR_N_ZERO_IS_ONE) != 0 && n == 0)
122 if ((nkmp->flags & SUNXI_CCU_NKMP_FACTOR_P_POW2) != 0)
124 else if ((nkmp->flags & SUNXI_CCU_NKMP_FACTOR_P_X4) != 0)
130 if (nkmp->flags & SUNXI_CCU_NKMP_DIVIDE_BY_TWO)
140 struct sunxi_ccu_nkmp *nkmp = &clk->u.nkmp;
146 if (nkmp->table == NULL || rate == 0)
149 for (tab = nkmp->table; tab->rate > 0; tab++)
155 val = CCU_READ(sc, nkmp->reg);
157 if (nkmp->flags & SUNXI_CCU_NKMP_SCALE_CLOCK) {
158 if (nkmp->p && __SHIFTOUT(val, nkmp->p) < tab->p) {
159 val &= ~nkmp->p;
160 val |= __SHIFTIN(tab->p, nkmp->p);
161 CCU_WRITE(sc, nkmp->reg, val);
164 if (nkmp->m && __SHIFTOUT(val, nkmp->m) < tab->m) {
165 val &= ~nkmp->m;
166 val |= __SHIFTIN(tab->m, nkmp->m);
167 CCU_WRITE(sc, nkmp->reg, val);
170 if (nkmp->n) {
171 val &= ~nkmp->n;
172 val |= __SHIFTIN(tab->n, nkmp->n);
174 if (nkmp->k) {
175 val &= ~nkmp->k;
176 val |= __SHIFTIN(tab->k, nkmp->k);
178 CCU_WRITE(sc, nkmp->reg, val);
180 if (nkmp->m && __SHIFTOUT(val, nkmp->m) > tab->m) {
181 val &= ~nkmp->m;
182 val |= __SHIFTIN(tab->m, nkmp->m);
183 CCU_WRITE(sc, nkmp->reg, val);
186 if (nkmp->p && __SHIFTOUT(val, nkmp->p) > tab->p) {
187 val &= ~nkmp->p;
188 val |= __SHIFTIN(tab->p, nkmp->p);
189 CCU_WRITE(sc, nkmp->reg, val);
193 if (nkmp->n) {
194 val &= ~nkmp->n;
195 val |= __SHIFTIN(tab->n, nkmp->n);
197 if (nkmp->k) {
198 val &= ~nkmp->k;
199 val |= __SHIFTIN(tab->k, nkmp->k);
201 if (nkmp->m) {
202 val &= ~nkmp->m;
203 val |= __SHIFTIN(tab->m, nkmp->m);
205 if (nkmp->p) {
206 val &= ~nkmp->p;
207 val |= __SHIFTIN(tab->p, nkmp->p);
209 CCU_WRITE(sc, nkmp->reg, val);
219 struct sunxi_ccu_nkmp *nkmp = &clk->u.nkmp;
223 return nkmp->parent;