David Brownell <[email protected]> writes:
> From: David Brownell <[email protected]>
>
> Fix two IRQ triggering bugs affecting GPIO IRQs:
>
> - Make sure enabling with IRQ_TYPE_NONE ("default, unspecified")
> isn't a NOP ... default to both edges, at least one must work.
>
> - As noted by Kevin Hilman, setting the irq trigger type for a
> banked gpio interrupt shouldn't enable irqs that are disabled.
>
> Since GPIO IRQs haven't been used much yet, it's not clear these
> bugs could have affected anything. The few current users don't
> seem to have been obviously suffering from these issues.
>
> Signed-off-by: David Brownell <[email protected]>
> ---
> Applies also to mainline, with minor offsets. So if I get some
> acks, I can submit to the ARM patch queue...
Thanks, pushing to DaVinci git, and I'll add this to my queue of
davinci fixes for RMK/mainline, so you don't need to bother with ARM
patch queue.
Kevin
> arch/arm/mach-davinci/gpio.c | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> --- a/arch/arm/mach-davinci/gpio.c
> +++ b/arch/arm/mach-davinci/gpio.c
> @@ -179,10 +179,15 @@ static void gpio_irq_enable(unsigned irq
> {
> struct gpio_controller *__iomem g = get_irq_chip_data(irq);
> u32 mask = __gpio_mask(irq_to_gpio(irq));
> + unsigned status = irq_desc[irq].status;
>
> - if (irq_desc[irq].status & IRQ_TYPE_EDGE_FALLING)
> + status &= IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;
> + if (!status)
> + status = IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;
> +
> + if (status & IRQ_TYPE_EDGE_FALLING)
> __raw_writel(mask, &g->set_falling);
> - if (irq_desc[irq].status & IRQ_TYPE_EDGE_RISING)
> + if (status & IRQ_TYPE_EDGE_RISING)
> __raw_writel(mask, &g->set_rising);
> }
>
> @@ -197,10 +202,13 @@ static int gpio_irq_type(unsigned irq, u
> irq_desc[irq].status &= ~IRQ_TYPE_SENSE_MASK;
> irq_desc[irq].status |= trigger;
>
> - __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING)
> - ? &g->set_falling : &g->clr_falling);
> - __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING)
> - ? &g->set_rising : &g->clr_rising);
> + /* don't enable the IRQ if it's currently disabled */
> + if (irq_desc[irq].depth == 0) {
> + __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING)
> + ? &g->set_falling : &g->clr_falling);
> + __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING)
> + ? &g->set_rising : &g->clr_rising);
> + }
> return 0;
> }
>
>
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> [email protected]
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source