Skip to content

Commit

Permalink
ARM: 6060/1: PL061 GPIO: Setting gpio val after changing direction to…
Browse files Browse the repository at this point in the history
… OUT.

pl061_direction_output doesn't set value of gpio to value passed to it.
This patch sets value of GPIO pin to requested value after changing direction
to OUT.

Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
viresh kumar authored and Russell King committed Apr 22, 2010
1 parent 9a99d55 commit 64b997c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/gpio/pl061.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ static int pl061_direction_output(struct gpio_chip *gc, unsigned offset,
gpiodir = readb(chip->base + GPIODIR);
gpiodir |= 1 << offset;
writeb(gpiodir, chip->base + GPIODIR);

/*
* gpio value is set again, because pl061 doesn't allow to set value of
* a gpio pin before configuring it in OUT mode.
*/
writeb(!!value << offset, chip->base + (1 << (offset + 2)));
spin_unlock_irqrestore(&chip->lock, flags);

return 0;
Expand Down

0 comments on commit 64b997c

Please sign in to comment.