Commit 4a3137c6 authored by Gilles Chanteperdrix's avatar Gilles Chanteperdrix Committed by Philippe Gerum

gpio: pl061: ipipe: enable interrupt pipelining

Fix up the pl061 GPIO driver in order to channel interrupts through
the interrupt pipeline.
parent 20914e3c
......@@ -26,6 +26,7 @@
#include <linux/slab.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pm.h>
#include <linux/ipipe.h>
#define GPIODIR 0x400
#define GPIOIS 0x404
......@@ -50,7 +51,11 @@ struct pl061_context_save_regs {
#endif
struct pl061 {
#ifdef CONFIG_IPIPE
ipipe_spinlock_t lock;
#else
raw_spinlock_t lock;
#endif
void __iomem *base;
struct gpio_chip gc;
......@@ -222,14 +227,30 @@ static void pl061_irq_handler(struct irq_desc *desc)
pending = readb(pl061->base + GPIOMIS);
if (pending) {
for_each_set_bit(offset, &pending, PL061_GPIO_NR)
generic_handle_irq(irq_find_mapping(gc->irq.domain,
offset));
ipipe_handle_demuxed_irq(irq_find_mapping(gc->irq.domain,
offset));
}
chained_irq_exit(irqchip, desc);
}
static void pl061_irq_mask(struct irq_data *d)
{
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct pl061 *pl061 = gpiochip_get_data(gc);
u8 mask = BIT(irqd_to_hwirq(d) % PL061_GPIO_NR);
unsigned long flags;
u8 gpioie;
raw_spin_lock_irqsave(&pl061->lock, flags);
gpioie = readb(pl061->base + GPIOIE) & ~mask;
writeb(gpioie, pl061->base + GPIOIE);
ipipe_lock_irq(d->irq);
raw_spin_unlock_irqrestore(&pl061->lock, flags);
}
#ifdef CONFIG_IPIPE
static void pl061_irq_mask_ack(struct irq_data *d)
{
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct pl061 *pl061 = gpiochip_get_data(gc);
......@@ -326,6 +347,10 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
pl061->irq_chip.irq_unmask = pl061_irq_unmask;
pl061->irq_chip.irq_set_type = pl061_irq_type;
pl061->irq_chip.irq_set_wake = pl061_irq_set_wake;
#ifdef CONFIG_IPIPE
pl061->irq_chip.irq_mask_ack = pl061_irq_mask_ack;
pl061->irq_chip.flags = IRQCHIP_PIPELINE_SAFE;
#endif
writeb(0, pl061->base + GPIOIE); /* disable irqs */
irq = adev->irq[0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment