Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 303288
b: refs/heads/master
c: 6c12fe8
h: refs/heads/master
v: v3
  • Loading branch information
Rabin Vincent authored and Linus Walleij committed Apr 23, 2012
1 parent a684988 commit 4dce015
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b982ff0e9a52553db246f7e171c03e7e0efedbe5
refs/heads/master: 6c12fe888a237c4a32d194fca8624c5c1d55e1b3
42 changes: 26 additions & 16 deletions trunk/drivers/gpio/gpio-nomadik.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ struct nmk_gpio_chip {
u32 real_wake;
u32 rwimsc;
u32 fwimsc;
u32 rimsc;
u32 fimsc;
u32 pull_up;
};

Expand Down Expand Up @@ -149,8 +151,8 @@ static void __nmk_gpio_set_mode_safe(struct nmk_gpio_chip *nmk_chip,
unsigned offset, int gpio_mode,
bool glitch)
{
u32 rwimsc = readl(nmk_chip->addr + NMK_GPIO_RWIMSC);
u32 fwimsc = readl(nmk_chip->addr + NMK_GPIO_FWIMSC);
u32 rwimsc = nmk_chip->rwimsc;
u32 fwimsc = nmk_chip->fwimsc;

if (glitch && nmk_chip->set_ioforce) {
u32 bit = BIT(offset);
Expand Down Expand Up @@ -555,27 +557,38 @@ static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip,
int gpio, enum nmk_gpio_irq_type which,
bool enable)
{
u32 rimsc = which == WAKE ? NMK_GPIO_RWIMSC : NMK_GPIO_RIMSC;
u32 fimsc = which == WAKE ? NMK_GPIO_FWIMSC : NMK_GPIO_FIMSC;
u32 bitmask = nmk_gpio_get_bitmask(gpio);
u32 reg;
u32 *rimscval;
u32 *fimscval;
u32 rimscreg;
u32 fimscreg;

if (which == NORMAL) {
rimscreg = NMK_GPIO_RIMSC;
fimscreg = NMK_GPIO_FIMSC;
rimscval = &nmk_chip->rimsc;
fimscval = &nmk_chip->fimsc;
} else {
rimscreg = NMK_GPIO_RWIMSC;
fimscreg = NMK_GPIO_FWIMSC;
rimscval = &nmk_chip->rwimsc;
fimscval = &nmk_chip->fwimsc;
}

/* we must individually set/clear the two edges */
if (nmk_chip->edge_rising & bitmask) {
reg = readl(nmk_chip->addr + rimsc);
if (enable)
reg |= bitmask;
*rimscval |= bitmask;
else
reg &= ~bitmask;
writel(reg, nmk_chip->addr + rimsc);
*rimscval &= ~bitmask;
writel(*rimscval, nmk_chip->addr + rimscreg);
}
if (nmk_chip->edge_falling & bitmask) {
reg = readl(nmk_chip->addr + fimsc);
if (enable)
reg |= bitmask;
*fimscval |= bitmask;
else
reg &= ~bitmask;
writel(reg, nmk_chip->addr + fimsc);
*fimscval &= ~bitmask;
writel(*fimscval, nmk_chip->addr + fimscreg);
}
}

Expand Down Expand Up @@ -1011,9 +1024,6 @@ void nmk_gpio_wakeups_suspend(void)

clk_enable(chip->clk);

chip->rwimsc = readl(chip->addr + NMK_GPIO_RWIMSC);
chip->fwimsc = readl(chip->addr + NMK_GPIO_FWIMSC);

writel(chip->rwimsc & chip->real_wake,
chip->addr + NMK_GPIO_RWIMSC);
writel(chip->fwimsc & chip->real_wake,
Expand Down

0 comments on commit 4dce015

Please sign in to comment.