Lines Matching +full:64 +full:bit
31 #define XGPIO_GIER_IE BIT(31)
64 DECLARE_BITMAP(hw_map, 64);
65 DECLARE_BITMAP(sw_map, 64);
66 DECLARE_BITMAP(state, 64);
67 DECLARE_BITMAP(last_irq_read, 64);
68 DECLARE_BITMAP(dir, 64);
71 DECLARE_BITMAP(enable, 64);
72 DECLARE_BITMAP(rising_edge, 64);
73 DECLARE_BITMAP(falling_edge, 64);
77 static inline int xgpio_from_bit(struct xgpio_instance *chip, int bit) in xgpio_from_bit() argument
79 return bitmap_bitremap(bit, chip->hw_map, chip->sw_map, 64); in xgpio_from_bit()
84 return bitmap_bitremap(gpio, chip->sw_map, chip->hw_map, 64); in xgpio_to_bit()
87 static inline u32 xgpio_get_value32(const unsigned long *map, int bit) in xgpio_get_value32() argument
89 const size_t index = BIT_WORD(bit); in xgpio_get_value32()
90 const unsigned long offset = (bit % BITS_PER_LONG) & BIT(5); in xgpio_get_value32()
95 static inline void xgpio_set_value32(unsigned long *map, int bit, u32 v) in xgpio_set_value32() argument
97 const size_t index = BIT_WORD(bit); in xgpio_set_value32()
98 const unsigned long offset = (bit % BITS_PER_LONG) & BIT(5); in xgpio_set_value32()
116 static void xgpio_read_ch(struct xgpio_instance *chip, int reg, int bit, unsigned long *a) in xgpio_read_ch() argument
118 void __iomem *addr = chip->regs + reg + xgpio_regoffset(chip, bit / 32); in xgpio_read_ch()
120 xgpio_set_value32(a, bit, xgpio_readreg(addr)); in xgpio_read_ch()
123 static void xgpio_write_ch(struct xgpio_instance *chip, int reg, int bit, unsigned long *a) in xgpio_write_ch() argument
125 void __iomem *addr = chip->regs + reg + xgpio_regoffset(chip, bit / 32); in xgpio_write_ch()
127 xgpio_writereg(addr, xgpio_get_value32(a, bit)); in xgpio_write_ch()
132 int bit, lastbit = xgpio_to_bit(chip, chip->gc.ngpio - 1); in xgpio_read_ch_all() local
134 for (bit = 0; bit <= lastbit ; bit += 32) in xgpio_read_ch_all()
135 xgpio_read_ch(chip, reg, bit, a); in xgpio_read_ch_all()
140 int bit, lastbit = xgpio_to_bit(chip, chip->gc.ngpio - 1); in xgpio_write_ch_all() local
142 for (bit = 0; bit <= lastbit ; bit += 32) in xgpio_write_ch_all()
143 xgpio_write_ch(chip, reg, bit, a); in xgpio_write_ch_all()
160 int bit = xgpio_to_bit(chip, gpio); in xgpio_get() local
161 DECLARE_BITMAP(state, 64); in xgpio_get()
163 xgpio_read_ch(chip, XGPIO_DATA_OFFSET, bit, state); in xgpio_get()
165 return test_bit(bit, state); in xgpio_get()
181 int bit = xgpio_to_bit(chip, gpio); in xgpio_set() local
186 __assign_bit(bit, chip->state, val); in xgpio_set()
188 xgpio_write_ch(chip, XGPIO_DATA_OFFSET, bit, chip->state); in xgpio_set()
205 DECLARE_BITMAP(hw_mask, 64); in xgpio_set_multiple()
206 DECLARE_BITMAP(hw_bits, 64); in xgpio_set_multiple()
207 DECLARE_BITMAP(state, 64); in xgpio_set_multiple()
211 bitmap_remap(hw_mask, mask, chip->sw_map, chip->hw_map, 64); in xgpio_set_multiple()
212 bitmap_remap(hw_bits, bits, chip->sw_map, chip->hw_map, 64); in xgpio_set_multiple()
216 bitmap_replace(state, chip->state, hw_bits, hw_mask, 64); in xgpio_set_multiple()
220 bitmap_copy(chip->state, state, 64); in xgpio_set_multiple()
238 int bit = xgpio_to_bit(chip, gpio); in xgpio_dir_in() local
242 /* Set the GPIO bit in shadow register and set direction as input */ in xgpio_dir_in()
243 __set_bit(bit, chip->dir); in xgpio_dir_in()
244 xgpio_write_ch(chip, XGPIO_TRI_OFFSET, bit, chip->dir); in xgpio_dir_in()
267 int bit = xgpio_to_bit(chip, gpio); in xgpio_dir_out() local
272 __assign_bit(bit, chip->state, val); in xgpio_dir_out()
273 xgpio_write_ch(chip, XGPIO_DATA_OFFSET, bit, chip->state); in xgpio_dir_out()
275 /* Clear the GPIO bit in shadow register and set direction as output */ in xgpio_dir_out()
276 __clear_bit(bit, chip->dir); in xgpio_dir_out()
277 xgpio_write_ch(chip, XGPIO_TRI_OFFSET, bit, chip->dir); in xgpio_dir_out()
404 int bit = xgpio_to_bit(chip, irq_offset); in xgpio_irq_mask() local
405 u32 mask = BIT(bit / 32), temp; in xgpio_irq_mask()
409 __clear_bit(bit, chip->enable); in xgpio_irq_mask()
411 if (xgpio_get_value32(chip->enable, bit) == 0) { in xgpio_irq_mask()
431 int bit = xgpio_to_bit(chip, irq_offset); in xgpio_irq_unmask() local
432 u32 old_enable = xgpio_get_value32(chip->enable, bit); in xgpio_irq_unmask()
433 u32 mask = BIT(bit / 32), val; in xgpio_irq_unmask()
439 __set_bit(bit, chip->enable); in xgpio_irq_unmask()
448 xgpio_read_ch(chip, XGPIO_DATA_OFFSET, bit, chip->last_irq_read); in xgpio_irq_unmask()
471 int bit = xgpio_to_bit(chip, irq_offset); in xgpio_set_irq_type() local
481 __set_bit(bit, chip->rising_edge); in xgpio_set_irq_type()
482 __set_bit(bit, chip->falling_edge); in xgpio_set_irq_type()
485 __set_bit(bit, chip->rising_edge); in xgpio_set_irq_type()
486 __clear_bit(bit, chip->falling_edge); in xgpio_set_irq_type()
489 __clear_bit(bit, chip->rising_edge); in xgpio_set_irq_type()
490 __set_bit(bit, chip->falling_edge); in xgpio_set_irq_type()
509 DECLARE_BITMAP(rising, 64); in xgpio_irqhandler()
510 DECLARE_BITMAP(falling, 64); in xgpio_irqhandler()
511 DECLARE_BITMAP(all, 64); in xgpio_irqhandler()
514 u32 bit; in xgpio_irqhandler() local
525 bitmap_complement(rising, chip->last_irq_read, 64); in xgpio_irqhandler()
526 bitmap_and(rising, rising, all, 64); in xgpio_irqhandler()
527 bitmap_and(rising, rising, chip->enable, 64); in xgpio_irqhandler()
528 bitmap_and(rising, rising, chip->rising_edge, 64); in xgpio_irqhandler()
530 bitmap_complement(falling, all, 64); in xgpio_irqhandler()
531 bitmap_and(falling, falling, chip->last_irq_read, 64); in xgpio_irqhandler()
532 bitmap_and(falling, falling, chip->enable, 64); in xgpio_irqhandler()
533 bitmap_and(falling, falling, chip->falling_edge, 64); in xgpio_irqhandler()
535 bitmap_copy(chip->last_irq_read, all, 64); in xgpio_irqhandler()
536 bitmap_or(all, rising, falling, 64); in xgpio_irqhandler()
540 dev_dbg(gc->parent, "IRQ rising %*pb falling %*pb\n", 64, rising, 64, falling); in xgpio_irqhandler()
542 for_each_set_bit(bit, all, 64) { in xgpio_irqhandler()
543 irq_offset = xgpio_from_bit(chip, bit); in xgpio_irqhandler()
598 bitmap_from_arr32(chip->state, state, 64); in xgpio_probe()
604 bitmap_from_arr32(chip->dir, dir, 64); in xgpio_probe()
632 chip->gc.ngpio = bitmap_weight(chip->hw_map, 64); in xgpio_probe()