Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

genirq: replace irq_gc_ack() with {set,clr}_bit variants (fwd)

This fixes a regression introduced by e59347a "arm: orion:
Use generic irq chip".

Depending on the device, interrupts acknowledgement is done by setting
or by clearing a dedicated register. Replace irq_gc_ack() with some
{set,clr}_bit variants allows to handle both cases.

Note that this patch affects the following SoCs: Davinci, Samsung and
Orion. Except for this last, the change is minor: irq_gc_ack() is just
renamed into irq_gc_ack_set_bit().

For the Orion SoCs, the edge GPIO interrupts support is currently
broken. irq_gc_ack() try to acknowledge a such interrupt by setting
the corresponding cause register bit. The Orion GPIO device expect the
opposite. To fix this issue, the irq_gc_ack_clr_bit() variant is used.

Tested on Network Space v2.

Reported-by: Joey Oravec <joravec@drewtech.com>
Signed-off-by: Simon Guinot <sguinot@lacie.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

authored by

Simon Guinot and committed by
Arnd Bergmann
659fb32d d30e1521

+22 -7
+1 -1
arch/arm/mach-davinci/irq.c
··· 53 53 54 54 gc = irq_alloc_generic_chip("AINTC", 1, irq_start, base, handle_edge_irq); 55 55 ct = gc->chip_types; 56 - ct->chip.irq_ack = irq_gc_ack; 56 + ct->chip.irq_ack = irq_gc_ack_set_bit; 57 57 ct->chip.irq_mask = irq_gc_mask_clr_bit; 58 58 ct->chip.irq_unmask = irq_gc_mask_set_bit; 59 59
+1 -1
arch/arm/plat-orion/gpio.c
··· 432 432 ct->regs.mask = ochip->mask_offset + GPIO_EDGE_MASK_OFF; 433 433 ct->regs.ack = GPIO_EDGE_CAUSE_OFF; 434 434 ct->type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; 435 - ct->chip.irq_ack = irq_gc_ack; 435 + ct->chip.irq_ack = irq_gc_ack_clr_bit; 436 436 ct->chip.irq_mask = irq_gc_mask_clr_bit; 437 437 ct->chip.irq_unmask = irq_gc_mask_set_bit; 438 438 ct->chip.irq_set_type = gpio_irq_set_type;
+1 -1
arch/arm/plat-s5p/irq-gpioint.c
··· 152 152 if (!gc) 153 153 return -ENOMEM; 154 154 ct = gc->chip_types; 155 - ct->chip.irq_ack = irq_gc_ack; 155 + ct->chip.irq_ack = irq_gc_ack_set_bit; 156 156 ct->chip.irq_mask = irq_gc_mask_set_bit; 157 157 ct->chip.irq_unmask = irq_gc_mask_clr_bit; 158 158 ct->chip.irq_set_type = s5p_gpioint_set_type,
+1 -1
arch/arm/plat-samsung/irq-uart.c
··· 55 55 gc = irq_alloc_generic_chip("s3c-uart", 1, uirq->base_irq, reg_base, 56 56 handle_level_irq); 57 57 ct = gc->chip_types; 58 - ct->chip.irq_ack = irq_gc_ack; 58 + ct->chip.irq_ack = irq_gc_ack_set_bit; 59 59 ct->chip.irq_mask = irq_gc_mask_set_bit; 60 60 ct->chip.irq_unmask = irq_gc_mask_clr_bit; 61 61 ct->regs.ack = S3C64XX_UINTP;
+2 -1
include/linux/irq.h
··· 676 676 void irq_gc_mask_set_bit(struct irq_data *d); 677 677 void irq_gc_mask_clr_bit(struct irq_data *d); 678 678 void irq_gc_unmask_enable_reg(struct irq_data *d); 679 - void irq_gc_ack(struct irq_data *d); 679 + void irq_gc_ack_set_bit(struct irq_data *d); 680 + void irq_gc_ack_clr_bit(struct irq_data *d); 680 681 void irq_gc_mask_disable_reg_and_ack(struct irq_data *d); 681 682 void irq_gc_eoi(struct irq_data *d); 682 683 int irq_gc_set_wake(struct irq_data *d, unsigned int on);
+16 -2
kernel/irq/generic-chip.c
··· 101 101 } 102 102 103 103 /** 104 - * irq_gc_ack - Ack pending interrupt 104 + * irq_gc_ack_set_bit - Ack pending interrupt via setting bit 105 105 * @d: irq_data 106 106 */ 107 - void irq_gc_ack(struct irq_data *d) 107 + void irq_gc_ack_set_bit(struct irq_data *d) 108 108 { 109 109 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 110 110 u32 mask = 1 << (d->irq - gc->irq_base); 111 + 112 + irq_gc_lock(gc); 113 + irq_reg_writel(mask, gc->reg_base + cur_regs(d)->ack); 114 + irq_gc_unlock(gc); 115 + } 116 + 117 + /** 118 + * irq_gc_ack_clr_bit - Ack pending interrupt via clearing bit 119 + * @d: irq_data 120 + */ 121 + void irq_gc_ack_clr_bit(struct irq_data *d) 122 + { 123 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 124 + u32 mask = ~(1 << (d->irq - gc->irq_base)); 111 125 112 126 irq_gc_lock(gc); 113 127 irq_reg_writel(mask, gc->reg_base + cur_regs(d)->ack);