Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 303289
b: refs/heads/master
c: 6c42ad1
h: refs/heads/master
i:
  303287: a684988
v: v3
  • Loading branch information
Rabin Vincent authored and Linus Walleij committed Apr 23, 2012
1 parent 4dce015 commit 35328d4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6c12fe888a237c4a32d194fca8624c5c1d55e1b3
refs/heads/master: 6c42ad1cf4d7f22469eaecb2eee3b6442169d732
39 changes: 39 additions & 0 deletions trunk/drivers/gpio/gpio-nomadik.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,36 @@ 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);
struct irq_data *d = irq_get_irq_data(irq);

if (!rising && !falling)
return;

if (!d || !irqd_irq_disabled(d))
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)
{
Expand Down Expand Up @@ -239,6 +269,15 @@ static void __nmk_config_pin(struct nmk_gpio_chip *nmk_chip, unsigned offset,
__nmk_gpio_set_pull(nmk_chip, offset, pull);
}

/*
* 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.
Expand Down

0 comments on commit 35328d4

Please sign in to comment.