summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2011-05-23 12:22:18 +0530
committersaid m bagheri <ebgheri@steludxu2848.(none)>2011-06-17 13:42:11 +0200
commit40c3e624d4f972124e067dc79f53265084249895 (patch)
tree7e6edd42735329687e37f860073ac9c26a8a2e07
parent6e70f76ec5cb698ced888471289d4e419724bcab (diff)
nmk-gpio: fix spurious interrupts with SKE
If the pin is switching to altfunc, and there was an interrupt installed on it which has been lazy disabled, actually mask the interrupt to prevent spurious interrupts that would occur while the pin is under control of the peripheral. Only SKE does this. ST-Ericsson Linux next: - ST-Ericsson ID: ER335433 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I9aac362d8bcc63d284ae0d483f0703be71328fd9 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/23929 Reviewed-by: QATEST Tested-by: Rabin VINCENT <rabin.vincent@stericsson.com> Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
-rw-r--r--arch/arm/plat-nomadik/gpio.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c
index 00c54000064..c96b4223538 100644
--- a/arch/arm/plat-nomadik/gpio.c
+++ b/arch/arm/plat-nomadik/gpio.c
@@ -169,6 +169,35 @@ static void __nmk_gpio_set_mode_safe(struct nmk_gpio_chip *nmk_chip,
}
}
+static void
+nmk_gpio_disable_lazy_irq(struct nmk_gpio_chip *nmk_chip, unsigned offset)
+{
+ u32 falling = nmk_chip->fimsc & BIT(offset);
+ u32 rising = nmk_chip->rimsc & BIT(offset);
+ int gpio = nmk_chip->chip.base + offset;
+ int irq = NOMADIK_GPIO_TO_IRQ(gpio);
+
+ if (!rising && !falling)
+ return;
+
+ if (!(irq_to_desc(irq)->status & IRQ_DISABLED))
+ return;
+
+ if (rising) {
+ nmk_chip->rimsc &= ~BIT(offset);
+ writel_relaxed(nmk_chip->rimsc,
+ nmk_chip->addr + NMK_GPIO_RIMSC);
+ }
+
+ if (falling) {
+ nmk_chip->fimsc &= ~BIT(offset);
+ writel_relaxed(nmk_chip->fimsc,
+ nmk_chip->addr + NMK_GPIO_FIMSC);
+ }
+
+ dev_dbg(nmk_chip->chip.dev, "%d: clearing interrupt mask\n", gpio);
+}
+
static void __nmk_config_pin(struct nmk_gpio_chip *nmk_chip, unsigned offset,
pin_cfg_t cfg, bool sleep, unsigned int *slpmregs)
{
@@ -235,6 +264,15 @@ static void __nmk_config_pin(struct nmk_gpio_chip *nmk_chip, unsigned offset,
}
/*
+ * If the pin is switching to altfunc, and there was an interrupt
+ * installed on it which has been lazy disabled, actually mask the
+ * interrupt to prevent spurious interrupts that would occur while the
+ * pin is under control of the peripheral. Only SKE does this.
+ */
+ if (af != NMK_GPIO_ALT_GPIO)
+ nmk_gpio_disable_lazy_irq(nmk_chip, offset);
+
+ /*
* If we've backed up the SLPM registers (glitch workaround), modify
* the backups since they will be restored.
*/