diff options
author | Nicolas Pitre <nico@cam.org> | 2009-02-17 14:45:50 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-02-17 17:37:09 -0500 |
commit | fd4b9b3650076ffadbdd6e360eb198f5d61747c0 (patch) | |
tree | ef6246442bf2c434269355f7ec52eefd897c1cb0 /arch/arm/plat-orion/include/plat/gpio.h | |
parent | 744f6592727a7ab9e3ca4266bedaa786825a31bb (diff) |
[ARM] 5401/1: Orion: fix edge triggered GPIO interrupt support
The GPIO interrupts can be configured as either level triggered or edge
triggered, with a default of level triggered. When an edge triggered
interrupt is requested, the gpio_irq_set_type method is called which
currently switches the given IRQ descriptor between two struct irq_chip
instances: orion_gpio_irq_level_chip and orion_gpio_irq_edge_chip. This
happens via __setup_irq() which also calls irq_chip_set_defaults() to
assign default methods to uninitialized ones. The problem is that
irq_chip_set_defaults() is called before the irq_chip reference is
switched, leaving the new irq_chip (orion_gpio_irq_edge_chip in this
case) with uninitialized methods such as chip->startup() causing a kernel
oops.
Many solutions are possible, such as making irq_chip_set_defaults() global
and calling it from gpio_irq_set_type(), or calling __irq_set_trigger()
before irq_chip_set_defaults() in __setup_irq(). But those require
modifications to the generic IRQ code which might have adverse effect on
other architectures, and that would still be a fragile arrangement.
Manually copying the missing methods from within gpio_irq_set_type()
would be really ugly and it would break again the day new methods with
automatic defaults are added.
A better solution is to have a single irq_chip instance which can deal
with both edge and level triggered interrupts. It is also a good idea
to switch the IRQ handler instead, as the edge IRQ handler allows for
one edge IRQ event to be queued as the IRQ is actually masked only when
that second IRQ is received, at which point the hardware can queue an
additional IRQ event, making edge triggered interrupts a bit more
reliable.
Tested-by: Martin Michlmayr <tbm@cyrius.com>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-orion/include/plat/gpio.h')
-rw-r--r-- | arch/arm/plat-orion/include/plat/gpio.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h index 54deaf274b52..ec743e82c876 100644 --- a/arch/arm/plat-orion/include/plat/gpio.h +++ b/arch/arm/plat-orion/include/plat/gpio.h | |||
@@ -31,8 +31,7 @@ void orion_gpio_set_blink(unsigned pin, int blink); | |||
31 | /* | 31 | /* |
32 | * GPIO interrupt handling. | 32 | * GPIO interrupt handling. |
33 | */ | 33 | */ |
34 | extern struct irq_chip orion_gpio_irq_edge_chip; | 34 | extern struct irq_chip orion_gpio_irq_chip; |
35 | extern struct irq_chip orion_gpio_irq_level_chip; | ||
36 | void orion_gpio_irq_handler(int irqoff); | 35 | void orion_gpio_irq_handler(int irqoff); |
37 | 36 | ||
38 | 37 | ||