Lines Matching refs:tgpio
45 struct timbgpio *tgpio = gpiochip_get_data(gpio); in timbgpio_update_bit() local
49 spin_lock_irqsave(&tgpio->lock, flags); in timbgpio_update_bit()
50 reg = ioread32(tgpio->membase + offset); in timbgpio_update_bit()
57 iowrite32(reg, tgpio->membase + offset); in timbgpio_update_bit()
58 spin_unlock_irqrestore(&tgpio->lock, flags); in timbgpio_update_bit()
70 struct timbgpio *tgpio = gpiochip_get_data(gpio); in timbgpio_gpio_get() local
73 value = ioread32(tgpio->membase + TGPIOVAL); in timbgpio_gpio_get()
91 struct timbgpio *tgpio = gpiochip_get_data(gpio); in timbgpio_to_irq() local
93 if (tgpio->irq_base <= 0) in timbgpio_to_irq()
96 return tgpio->irq_base + offset; in timbgpio_to_irq()
104 struct timbgpio *tgpio = irq_data_get_irq_chip_data(d); in timbgpio_irq_disable() local
105 int offset = d->irq - tgpio->irq_base; in timbgpio_irq_disable()
108 spin_lock_irqsave(&tgpio->lock, flags); in timbgpio_irq_disable()
109 tgpio->last_ier &= ~(1UL << offset); in timbgpio_irq_disable()
110 iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); in timbgpio_irq_disable()
111 spin_unlock_irqrestore(&tgpio->lock, flags); in timbgpio_irq_disable()
116 struct timbgpio *tgpio = irq_data_get_irq_chip_data(d); in timbgpio_irq_enable() local
117 int offset = d->irq - tgpio->irq_base; in timbgpio_irq_enable()
120 spin_lock_irqsave(&tgpio->lock, flags); in timbgpio_irq_enable()
121 tgpio->last_ier |= 1UL << offset; in timbgpio_irq_enable()
122 iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); in timbgpio_irq_enable()
123 spin_unlock_irqrestore(&tgpio->lock, flags); in timbgpio_irq_enable()
128 struct timbgpio *tgpio = irq_data_get_irq_chip_data(d); in timbgpio_irq_type() local
129 int offset = d->irq - tgpio->irq_base; in timbgpio_irq_type()
135 if (offset < 0 || offset > tgpio->gpio.ngpio) in timbgpio_irq_type()
138 ver = ioread32(tgpio->membase + TGPIO_VER); in timbgpio_irq_type()
140 spin_lock_irqsave(&tgpio->lock, flags); in timbgpio_irq_type()
142 lvr = ioread32(tgpio->membase + TGPIO_LVR); in timbgpio_irq_type()
143 flr = ioread32(tgpio->membase + TGPIO_FLR); in timbgpio_irq_type()
145 bflr = ioread32(tgpio->membase + TGPIO_BFLR); in timbgpio_irq_type()
173 iowrite32(lvr, tgpio->membase + TGPIO_LVR); in timbgpio_irq_type()
174 iowrite32(flr, tgpio->membase + TGPIO_FLR); in timbgpio_irq_type()
176 iowrite32(bflr, tgpio->membase + TGPIO_BFLR); in timbgpio_irq_type()
178 iowrite32(1 << offset, tgpio->membase + TGPIO_ICR); in timbgpio_irq_type()
181 spin_unlock_irqrestore(&tgpio->lock, flags); in timbgpio_irq_type()
187 struct timbgpio *tgpio = irq_desc_get_handler_data(desc); in timbgpio_irq() local
193 ipr = ioread32(tgpio->membase + TGPIO_IPR); in timbgpio_irq()
194 iowrite32(ipr, tgpio->membase + TGPIO_ICR); in timbgpio_irq()
200 iowrite32(0, tgpio->membase + TGPIO_IER); in timbgpio_irq()
202 for_each_set_bit(offset, &ipr, tgpio->gpio.ngpio) in timbgpio_irq()
203 generic_handle_irq(timbgpio_to_irq(&tgpio->gpio, offset)); in timbgpio_irq()
205 iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); in timbgpio_irq()
220 struct timbgpio *tgpio; in timbgpio_probe() local
229 tgpio = devm_kzalloc(dev, sizeof(*tgpio), GFP_KERNEL); in timbgpio_probe()
230 if (!tgpio) in timbgpio_probe()
233 tgpio->irq_base = pdata->irq_base; in timbgpio_probe()
235 spin_lock_init(&tgpio->lock); in timbgpio_probe()
237 tgpio->membase = devm_platform_ioremap_resource(pdev, 0); in timbgpio_probe()
238 if (IS_ERR(tgpio->membase)) in timbgpio_probe()
239 return PTR_ERR(tgpio->membase); in timbgpio_probe()
241 gc = &tgpio->gpio; in timbgpio_probe()
250 gc->to_irq = (irq >= 0 && tgpio->irq_base > 0) ? timbgpio_to_irq : NULL; in timbgpio_probe()
256 err = devm_gpiochip_add_data(&pdev->dev, gc, tgpio); in timbgpio_probe()
261 iowrite32(0x0, tgpio->membase + TGPIO_IER); in timbgpio_probe()
263 if (irq < 0 || tgpio->irq_base <= 0) in timbgpio_probe()
267 irq_set_chip_and_handler(tgpio->irq_base + i, in timbgpio_probe()
269 irq_set_chip_data(tgpio->irq_base + i, tgpio); in timbgpio_probe()
270 irq_clear_status_flags(tgpio->irq_base + i, IRQ_NOREQUEST | IRQ_NOPROBE); in timbgpio_probe()
273 irq_set_chained_handler_and_data(irq, timbgpio_irq, tgpio); in timbgpio_probe()