Lines Matching refs:bank

93 static inline void tz1090_gpio_write(struct tz1090_gpio_bank *bank,  in tz1090_gpio_write()  argument
96 iowrite32(data, bank->reg + reg_offs); in tz1090_gpio_write()
99 static inline u32 tz1090_gpio_read(struct tz1090_gpio_bank *bank, in tz1090_gpio_read() argument
102 return ioread32(bank->reg + reg_offs); in tz1090_gpio_read()
106 static inline void _tz1090_gpio_clear_bit(struct tz1090_gpio_bank *bank, in _tz1090_gpio_clear_bit() argument
112 value = tz1090_gpio_read(bank, reg_offs); in _tz1090_gpio_clear_bit()
114 tz1090_gpio_write(bank, reg_offs, value); in _tz1090_gpio_clear_bit()
117 static void tz1090_gpio_clear_bit(struct tz1090_gpio_bank *bank, in tz1090_gpio_clear_bit() argument
124 _tz1090_gpio_clear_bit(bank, reg_offs, offset); in tz1090_gpio_clear_bit()
129 static inline void _tz1090_gpio_set_bit(struct tz1090_gpio_bank *bank, in _tz1090_gpio_set_bit() argument
135 value = tz1090_gpio_read(bank, reg_offs); in _tz1090_gpio_set_bit()
137 tz1090_gpio_write(bank, reg_offs, value); in _tz1090_gpio_set_bit()
140 static void tz1090_gpio_set_bit(struct tz1090_gpio_bank *bank, in tz1090_gpio_set_bit() argument
147 _tz1090_gpio_set_bit(bank, reg_offs, offset); in tz1090_gpio_set_bit()
152 static inline void _tz1090_gpio_mod_bit(struct tz1090_gpio_bank *bank, in _tz1090_gpio_mod_bit() argument
159 value = tz1090_gpio_read(bank, reg_offs); in _tz1090_gpio_mod_bit()
163 tz1090_gpio_write(bank, reg_offs, value); in _tz1090_gpio_mod_bit()
166 static void tz1090_gpio_mod_bit(struct tz1090_gpio_bank *bank, in tz1090_gpio_mod_bit() argument
174 _tz1090_gpio_mod_bit(bank, reg_offs, offset, val); in tz1090_gpio_mod_bit()
178 static inline int tz1090_gpio_read_bit(struct tz1090_gpio_bank *bank, in tz1090_gpio_read_bit() argument
182 return tz1090_gpio_read(bank, reg_offs) & BIT(offset); in tz1090_gpio_read_bit()
190 struct tz1090_gpio_bank *bank = to_bank(chip); in tz1090_gpio_direction_input() local
191 tz1090_gpio_set_bit(bank, REG_GPIO_DIR, offset); in tz1090_gpio_direction_input()
199 struct tz1090_gpio_bank *bank = to_bank(chip); in tz1090_gpio_direction_output() local
203 _tz1090_gpio_mod_bit(bank, REG_GPIO_DOUT, offset, output_value); in tz1090_gpio_direction_output()
204 _tz1090_gpio_clear_bit(bank, REG_GPIO_DIR, offset); in tz1090_gpio_direction_output()
215 struct tz1090_gpio_bank *bank = to_bank(chip); in tz1090_gpio_get() local
217 return tz1090_gpio_read_bit(bank, REG_GPIO_DIN, offset); in tz1090_gpio_get()
226 struct tz1090_gpio_bank *bank = to_bank(chip); in tz1090_gpio_set() local
228 tz1090_gpio_mod_bit(bank, REG_GPIO_DOUT, offset, output_value); in tz1090_gpio_set()
233 struct tz1090_gpio_bank *bank = to_bank(chip); in tz1090_gpio_request() local
240 tz1090_gpio_set_bit(bank, REG_GPIO_DIR, offset); in tz1090_gpio_request()
241 tz1090_gpio_set_bit(bank, REG_GPIO_BIT_EN, offset); in tz1090_gpio_request()
248 struct tz1090_gpio_bank *bank = to_bank(chip); in tz1090_gpio_free() local
252 tz1090_gpio_clear_bit(bank, REG_GPIO_BIT_EN, offset); in tz1090_gpio_free()
257 struct tz1090_gpio_bank *bank = to_bank(chip); in tz1090_gpio_to_irq() local
259 if (!bank->domain) in tz1090_gpio_to_irq()
262 return irq_create_mapping(bank->domain, offset); in tz1090_gpio_to_irq()
273 static void tz1090_gpio_irq_polarity(struct tz1090_gpio_bank *bank, in tz1090_gpio_irq_polarity() argument
276 tz1090_gpio_mod_bit(bank, REG_GPIO_IRQ_PLRT, offset, polarity); in tz1090_gpio_irq_polarity()
279 static void tz1090_gpio_irq_type(struct tz1090_gpio_bank *bank, in tz1090_gpio_irq_type() argument
282 tz1090_gpio_mod_bit(bank, REG_GPIO_IRQ_TYPE, offset, type); in tz1090_gpio_irq_type()
286 static void tz1090_gpio_irq_next_edge(struct tz1090_gpio_bank *bank, in tz1090_gpio_irq_next_edge() argument
297 value_i = ~tz1090_gpio_read(bank, REG_GPIO_DIN); in tz1090_gpio_irq_next_edge()
298 value_p = tz1090_gpio_read(bank, REG_GPIO_IRQ_PLRT); in tz1090_gpio_irq_next_edge()
301 tz1090_gpio_write(bank, REG_GPIO_IRQ_PLRT, value_p); in tz1090_gpio_irq_next_edge()
322 struct tz1090_gpio_bank *bank = irqd_to_gpio_bank(data); in gpio_set_irq_type() local
351 tz1090_gpio_irq_type(bank, data->hwirq, type); in gpio_set_irq_type()
355 tz1090_gpio_irq_next_edge(bank, data->hwirq); in gpio_set_irq_type()
357 tz1090_gpio_irq_polarity(bank, data->hwirq, polarity); in gpio_set_irq_type()
365 struct tz1090_gpio_bank *bank = irqd_to_gpio_bank(data); in gpio_set_irq_wake() local
372 return irq_set_irq_wake(bank->irq, on); in gpio_set_irq_wake()
382 struct tz1090_gpio_bank *bank; in tz1090_gpio_irq_handler() local
385 bank = (struct tz1090_gpio_bank *)irq_desc_get_handler_data(desc); in tz1090_gpio_irq_handler()
386 irq_stat = tz1090_gpio_read(bank, REG_GPIO_DIR) & in tz1090_gpio_irq_handler()
387 tz1090_gpio_read(bank, REG_GPIO_IRQ_STS) & in tz1090_gpio_irq_handler()
388 tz1090_gpio_read(bank, REG_GPIO_IRQ_EN) & in tz1090_gpio_irq_handler()
395 irq_no = irq_linear_revmap(bank->domain, hw); in tz1090_gpio_irq_handler()
401 tz1090_gpio_irq_next_edge(bank, hw); in tz1090_gpio_irq_handler()
411 struct tz1090_gpio_bank *bank; in tz1090_gpio_bank_probe() local
415 bank = devm_kzalloc(dev, sizeof(*bank), GFP_KERNEL); in tz1090_gpio_bank_probe()
416 if (!bank) { in tz1090_gpio_bank_probe()
422 bank->reg = info->priv->reg + info->index * 4; in tz1090_gpio_bank_probe()
425 snprintf(bank->label, sizeof(bank->label), "tz1090-gpio-%u", in tz1090_gpio_bank_probe()
427 bank->chip.label = bank->label; in tz1090_gpio_bank_probe()
428 bank->chip.dev = dev; in tz1090_gpio_bank_probe()
429 bank->chip.direction_input = tz1090_gpio_direction_input; in tz1090_gpio_bank_probe()
430 bank->chip.direction_output = tz1090_gpio_direction_output; in tz1090_gpio_bank_probe()
431 bank->chip.get = tz1090_gpio_get; in tz1090_gpio_bank_probe()
432 bank->chip.set = tz1090_gpio_set; in tz1090_gpio_bank_probe()
433 bank->chip.free = tz1090_gpio_free; in tz1090_gpio_bank_probe()
434 bank->chip.request = tz1090_gpio_request; in tz1090_gpio_bank_probe()
435 bank->chip.to_irq = tz1090_gpio_to_irq; in tz1090_gpio_bank_probe()
436 bank->chip.of_node = np; in tz1090_gpio_bank_probe()
439 bank->chip.base = info->index * 30; in tz1090_gpio_bank_probe()
440 bank->chip.ngpio = 30; in tz1090_gpio_bank_probe()
443 gpiochip_add(&bank->chip); in tz1090_gpio_bank_probe()
446 bank->irq = irq_of_parse_and_map(np, 0); in tz1090_gpio_bank_probe()
449 if (!bank->irq) { in tz1090_gpio_bank_probe()
463 tz1090_gpio_write(bank, REG_GPIO_IRQ_EN, 0); in tz1090_gpio_bank_probe()
466 bank->domain = irq_domain_add_linear(np, in tz1090_gpio_bank_probe()
467 bank->chip.ngpio, in tz1090_gpio_bank_probe()
469 bank); in tz1090_gpio_bank_probe()
472 err = irq_alloc_domain_generic_chips(bank->domain, bank->chip.ngpio, 2, in tz1090_gpio_bank_probe()
473 bank->label, handle_bad_irq, 0, 0, in tz1090_gpio_bank_probe()
479 irq_domain_remove(bank->domain); in tz1090_gpio_bank_probe()
483 gc = irq_get_domain_generic_chip(bank->domain, 0); in tz1090_gpio_bank_probe()
484 gc->reg_base = bank->reg; in tz1090_gpio_bank_probe()
513 irq_set_chained_handler_and_data(bank->irq, tz1090_gpio_irq_handler, in tz1090_gpio_bank_probe()
514 bank); in tz1090_gpio_bank_probe()