Lines Matching +full:flags +full:- +full:mask

1 // SPDX-License-Identifier: GPL-2.0
29 unsigned int irq = irq_of_parse_and_map(func->node, 0); in macio_do_gpio_irq_enable()
31 return -EINVAL; in macio_do_gpio_irq_enable()
32 return request_irq(irq, macio_gpio_irq, 0, func->node->name, func); in macio_do_gpio_irq_enable()
37 unsigned int irq = irq_of_parse_and_map(func->node, 0); in macio_do_gpio_irq_disable()
39 return -EINVAL; in macio_do_gpio_irq_disable()
44 static int macio_do_gpio_write(PMF_STD_ARGS, u8 value, u8 mask) in macio_do_gpio_write() argument
46 u8 __iomem *addr = (u8 __iomem *)func->driver_data; in macio_do_gpio_write()
47 unsigned long flags; in macio_do_gpio_write() local
51 if (args && args->count && !args->u[0].v) in macio_do_gpio_write()
55 raw_spin_lock_irqsave(&feature_lock, flags); in macio_do_gpio_write()
57 tmp = (tmp & ~mask) | (value & mask); in macio_do_gpio_write()
59 tmp, func->node, addr); in macio_do_gpio_write()
61 raw_spin_unlock_irqrestore(&feature_lock, flags); in macio_do_gpio_write()
66 static int macio_do_gpio_read(PMF_STD_ARGS, u8 mask, int rshift, u8 xor) in macio_do_gpio_read() argument
68 u8 __iomem *addr = (u8 __iomem *)func->driver_data; in macio_do_gpio_read()
72 if (args == NULL || args->count == 0 || args->u[0].p == NULL) in macio_do_gpio_read()
73 return -EINVAL; in macio_do_gpio_read()
76 *args->u[0].p = ((value & mask) >> rshift) ^ xor; in macio_do_gpio_read()
104 for_each_child_of_node(macio->of_node, gparent) in macio_gpio_init_one()
111 macio->of_node); in macio_gpio_init_one()
123 /* Deal with old style device-tree. We can safely hard code the in macio_gpio_init_one()
128 offset += (unsigned long)macio->base; in macio_gpio_init_one()
133 macio->of_node); in macio_gpio_init_one()
146 static int macio_do_write_reg32(PMF_STD_ARGS, u32 offset, u32 value, u32 mask) in macio_do_write_reg32() argument
148 struct macio_chip *macio = func->driver_data; in macio_do_write_reg32()
149 unsigned long flags; in macio_do_write_reg32() local
151 raw_spin_lock_irqsave(&feature_lock, flags); in macio_do_write_reg32()
152 MACIO_OUT32(offset, (MACIO_IN32(offset) & ~mask) | (value & mask)); in macio_do_write_reg32()
153 raw_spin_unlock_irqrestore(&feature_lock, flags); in macio_do_write_reg32()
159 struct macio_chip *macio = func->driver_data; in macio_do_read_reg32()
162 if (args == NULL || args->count == 0 || args->u[0].p == NULL) in macio_do_read_reg32()
163 return -EINVAL; in macio_do_read_reg32()
165 *args->u[0].p = MACIO_IN32(offset); in macio_do_read_reg32()
169 static int macio_do_write_reg8(PMF_STD_ARGS, u32 offset, u8 value, u8 mask) in macio_do_write_reg8() argument
171 struct macio_chip *macio = func->driver_data; in macio_do_write_reg8()
172 unsigned long flags; in macio_do_write_reg8() local
174 raw_spin_lock_irqsave(&feature_lock, flags); in macio_do_write_reg8()
175 MACIO_OUT8(offset, (MACIO_IN8(offset) & ~mask) | (value & mask)); in macio_do_write_reg8()
176 raw_spin_unlock_irqrestore(&feature_lock, flags); in macio_do_write_reg8()
182 struct macio_chip *macio = func->driver_data; in macio_do_read_reg8()
185 if (args == NULL || args->count == 0 || args->u[0].p == NULL) in macio_do_read_reg8()
186 return -EINVAL; in macio_do_read_reg8()
188 *((u8 *)(args->u[0].p)) = MACIO_IN8(offset); in macio_do_read_reg8()
192 static int macio_do_read_reg32_msrx(PMF_STD_ARGS, u32 offset, u32 mask, in macio_do_read_reg32_msrx() argument
195 struct macio_chip *macio = func->driver_data; in macio_do_read_reg32_msrx()
198 if (args == NULL || args->count == 0 || args->u[0].p == NULL) in macio_do_read_reg32_msrx()
199 return -EINVAL; in macio_do_read_reg32_msrx()
201 *args->u[0].p = ((MACIO_IN32(offset) & mask) >> shift) ^ xor; in macio_do_read_reg32_msrx()
205 static int macio_do_read_reg8_msrx(PMF_STD_ARGS, u32 offset, u32 mask, in macio_do_read_reg8_msrx() argument
208 struct macio_chip *macio = func->driver_data; in macio_do_read_reg8_msrx()
211 if (args == NULL || args->count == 0 || args->u[0].p == NULL) in macio_do_read_reg8_msrx()
212 return -EINVAL; in macio_do_read_reg8_msrx()
214 *((u8 *)(args->u[0].p)) = ((MACIO_IN8(offset) & mask) >> shift) ^ xor; in macio_do_read_reg8_msrx()
219 u32 mask) in macio_do_write_reg32_slm() argument
221 struct macio_chip *macio = func->driver_data; in macio_do_write_reg32_slm()
222 unsigned long flags; in macio_do_write_reg32_slm() local
226 if (args == NULL || args->count == 0) in macio_do_write_reg32_slm()
227 return -EINVAL; in macio_do_write_reg32_slm()
229 raw_spin_lock_irqsave(&feature_lock, flags); in macio_do_write_reg32_slm()
231 val = args->u[0].v << shift; in macio_do_write_reg32_slm()
232 tmp = (tmp & ~mask) | (val & mask); in macio_do_write_reg32_slm()
234 raw_spin_unlock_irqrestore(&feature_lock, flags); in macio_do_write_reg32_slm()
239 u32 mask) in macio_do_write_reg8_slm() argument
241 struct macio_chip *macio = func->driver_data; in macio_do_write_reg8_slm()
242 unsigned long flags; in macio_do_write_reg8_slm() local
246 if (args == NULL || args->count == 0) in macio_do_write_reg8_slm()
247 return -EINVAL; in macio_do_write_reg8_slm()
249 raw_spin_lock_irqsave(&feature_lock, flags); in macio_do_write_reg8_slm()
251 val = args->u[0].v << shift; in macio_do_write_reg8_slm()
252 tmp = (tmp & ~mask) | (val & mask); in macio_do_write_reg8_slm()
254 raw_spin_unlock_irqrestore(&feature_lock, flags); in macio_do_write_reg8_slm()
273 macio->of_node); in macio_mmio_init_one()
275 pmf_register_driver(macio->of_node, &macio_mmio_handlers, macio); in macio_mmio_init_one()
280 static int unin_do_write_reg32(PMF_STD_ARGS, u32 offset, u32 value, u32 mask) in unin_do_write_reg32() argument
282 unsigned long flags; in unin_do_write_reg32() local
284 raw_spin_lock_irqsave(&feature_lock, flags); in unin_do_write_reg32()
288 UN_OUT(offset, (UN_IN(offset) & ~mask) | (value & mask)); in unin_do_write_reg32()
289 raw_spin_unlock_irqrestore(&feature_lock, flags); in unin_do_write_reg32()
317 if (of_node_name_eq(np, "hw-clock")) { in uninorth_install_pfunc()
346 * Locate mac-io chips and install handlers in pmac_pfunc_base_install()
376 * to see a case where a GPIO function has the on-suspend or on-resume bit