Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191781
b: refs/heads/master
c: 040e5ec
h: refs/heads/master
i:
  191779: 0259060
v: v3
  • Loading branch information
Rabin Vincent authored and Russell King committed May 6, 2010
1 parent 188f514 commit 9178487
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 31 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: 6b07aaedc029d507501a931aabfd3d0a70f1828f
refs/heads/master: 040e5ecddaa72f1f982b83cb205509bc9ce7f91e
57 changes: 27 additions & 30 deletions trunk/arch/arm/plat-nomadik/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,62 +107,59 @@ static void nmk_gpio_irq_ack(unsigned int irq)
writel(nmk_gpio_get_bitmask(gpio), nmk_chip->addr + NMK_GPIO_IC);
}

static void nmk_gpio_irq_mask(unsigned int irq)
static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip,
int gpio, bool enable)
{
int gpio;
struct nmk_gpio_chip *nmk_chip;
unsigned long flags;
u32 bitmask, reg;

gpio = NOMADIK_IRQ_TO_GPIO(irq);
nmk_chip = get_irq_chip_data(irq);
bitmask = nmk_gpio_get_bitmask(gpio);
if (!nmk_chip)
return;
u32 bitmask = nmk_gpio_get_bitmask(gpio);
u32 reg;

/* we must individually clear the two edges */
spin_lock_irqsave(&nmk_chip->lock, flags);
/* we must individually set/clear the two edges */
if (nmk_chip->edge_rising & bitmask) {
reg = readl(nmk_chip->addr + NMK_GPIO_RIMSC);
reg &= ~bitmask;
if (enable)
reg |= bitmask;
else
reg &= ~bitmask;
writel(reg, nmk_chip->addr + NMK_GPIO_RIMSC);
}
if (nmk_chip->edge_falling & bitmask) {
reg = readl(nmk_chip->addr + NMK_GPIO_FIMSC);
reg &= ~bitmask;
if (enable)
reg |= bitmask;
else
reg &= ~bitmask;
writel(reg, nmk_chip->addr + NMK_GPIO_FIMSC);
}
spin_unlock_irqrestore(&nmk_chip->lock, flags);
};
}

static void nmk_gpio_irq_unmask(unsigned int irq)
static void nmk_gpio_irq_modify(unsigned int irq, bool enable)
{
int gpio;
struct nmk_gpio_chip *nmk_chip;
unsigned long flags;
u32 bitmask, reg;
u32 bitmask;

gpio = NOMADIK_IRQ_TO_GPIO(irq);
nmk_chip = get_irq_chip_data(irq);
bitmask = nmk_gpio_get_bitmask(gpio);
if (!nmk_chip)
return;

/* we must individually set the two edges */
spin_lock_irqsave(&nmk_chip->lock, flags);
if (nmk_chip->edge_rising & bitmask) {
reg = readl(nmk_chip->addr + NMK_GPIO_RIMSC);
reg |= bitmask;
writel(reg, nmk_chip->addr + NMK_GPIO_RIMSC);
}
if (nmk_chip->edge_falling & bitmask) {
reg = readl(nmk_chip->addr + NMK_GPIO_FIMSC);
reg |= bitmask;
writel(reg, nmk_chip->addr + NMK_GPIO_FIMSC);
}
__nmk_gpio_irq_modify(nmk_chip, gpio, enable);
spin_unlock_irqrestore(&nmk_chip->lock, flags);
}

static void nmk_gpio_irq_mask(unsigned int irq)
{
nmk_gpio_irq_modify(irq, false);
};

static void nmk_gpio_irq_unmask(unsigned int irq)
{
nmk_gpio_irq_modify(irq, true);
}

static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type)
{
int gpio;
Expand Down

0 comments on commit 9178487

Please sign in to comment.