Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 192105
b: refs/heads/master
c: b27b6d0
h: refs/heads/master
i:
  192103: 5ee786f
v: v3
  • Loading branch information
Cyril Chemparathy authored and Kevin Hilman committed May 6, 2010
1 parent c22dc87 commit 28af399
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 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: 686b634a07451fc4fe3b712fe211bfa861a53241
refs/heads/master: b27b6d03f245e5eaf6473da58a2612077fb7cfe7
9 changes: 5 additions & 4 deletions trunk/arch/arm/mach-davinci/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ struct davinci_gpio_regs {
u32 intstat;
};

static DEFINE_SPINLOCK(gpio_lock);

#define chip2controller(chip) \
container_of(chip, struct davinci_gpio_controller, chip)

Expand Down Expand Up @@ -83,10 +81,11 @@ static inline int __davinci_direction(struct gpio_chip *chip,
{
struct davinci_gpio_controller *d = chip2controller(chip);
struct davinci_gpio_regs __iomem *g = d->regs;
unsigned long flags;
u32 temp;
u32 mask = 1 << offset;

spin_lock(&gpio_lock);
spin_lock_irqsave(&d->lock, flags);
temp = __raw_readl(&g->dir);
if (out) {
temp &= ~mask;
Expand All @@ -95,7 +94,7 @@ static inline int __davinci_direction(struct gpio_chip *chip,
temp |= mask;
}
__raw_writel(temp, &g->dir);
spin_unlock(&gpio_lock);
spin_unlock_irqrestore(&d->lock, flags);

return 0;
}
Expand Down Expand Up @@ -175,6 +174,8 @@ static int __init davinci_gpio_setup(void)
if (chips[i].chip.ngpio > 32)
chips[i].chip.ngpio = 32;

spin_lock_init(&chips[i].lock);

regs = gpio2regs(base);
chips[i].regs = regs;
chips[i].set_data = &regs->set_data;
Expand Down
3 changes: 3 additions & 0 deletions trunk/arch/arm/mach-davinci/include/mach/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#define __DAVINCI_GPIO_H

#include <linux/io.h>
#include <linux/spinlock.h>

#include <asm-generic/gpio.h>

#include <mach/irqs.h>
Expand Down Expand Up @@ -52,6 +54,7 @@ enum davinci_gpio_type {
struct davinci_gpio_controller {
struct gpio_chip chip;
int irq_base;
spinlock_t lock;
void __iomem *regs;
void __iomem *set_data;
void __iomem *clr_data;
Expand Down

0 comments on commit 28af399

Please sign in to comment.