Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 201683
b: refs/heads/master
c: 14cb0de
h: refs/heads/master
i:
  201681: 50930c0
  201679: 9379210
v: v3
  • Loading branch information
Baruch Siach authored and Sascha Hauer committed Jul 28, 2010
1 parent 6116c0b commit 5098b4a
Show file tree
Hide file tree
Showing 3 changed files with 10 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: ef93f1443c014e0d6dd7a5b1e592a02aa266f001
refs/heads/master: 14cb0deb66fcfca8fdbef75da8c84b5405a8c767
8 changes: 8 additions & 0 deletions trunk/arch/arm/plat-mxc/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,16 @@ static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset,
struct mxc_gpio_port *port =
container_of(chip, struct mxc_gpio_port, chip);
u32 l;
unsigned long flags;

spin_lock_irqsave(&port->lock, flags);
l = __raw_readl(port->base + GPIO_GDIR);
if (dir)
l |= 1 << offset;
else
l &= ~(1 << offset);
__raw_writel(l, port->base + GPIO_GDIR);
spin_unlock_irqrestore(&port->lock, flags);
}

static void mxc_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
Expand All @@ -229,9 +232,12 @@ static void mxc_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
container_of(chip, struct mxc_gpio_port, chip);
void __iomem *reg = port->base + GPIO_DR;
u32 l;
unsigned long flags;

spin_lock_irqsave(&port->lock, flags);
l = (__raw_readl(reg) & (~(1 << offset))) | (value << offset);
__raw_writel(l, reg);
spin_unlock_irqrestore(&port->lock, flags);
}

static int mxc_gpio_get(struct gpio_chip *chip, unsigned offset)
Expand Down Expand Up @@ -285,6 +291,8 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
port[i].chip.base = i * 32;
port[i].chip.ngpio = 32;

spin_lock_init(&port[i].lock);

/* its a serious configuration bug when it fails */
BUG_ON( gpiochip_add(&port[i].chip) < 0 );

Expand Down
1 change: 1 addition & 0 deletions trunk/arch/arm/plat-mxc/include/mach/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct mxc_gpio_port {
int virtual_irq_start;
struct gpio_chip chip;
u32 both_edges;
spinlock_t lock;
};

int mxc_gpio_init(struct mxc_gpio_port*, int);
Expand Down

0 comments on commit 5098b4a

Please sign in to comment.