ARM: 6060/1: PL061 GPIO: Setting gpio val after changing direction to OUT.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, April 29, 2010 - 5:59 pm

Gitweb:     http://git.kernel.org/linus/64b997c5142a13373857de09599afd2f079c2f7a
Commit:     64b997c5142a13373857de09599afd2f079c2f7a
Parent:     9a99d55514d3c6bfc03e41536659d781af6998f5
Author:     viresh kumar <viresh.kumar@st.com>
AuthorDate: Wed Apr 21 09:42:05 2010 +0100
Committer:  Russell King <rmk+kernel@arm.linux.org.uk>
CommitDate: Thu Apr 22 12:30:14 2010 +0100

    ARM: 6060/1: PL061 GPIO: Setting gpio val after changing direction to 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>
---
 drivers/gpio/pl061.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/pl061.c b/drivers/gpio/pl061.c
index cc3b5e0..2196f31 100644
--- a/drivers/gpio/pl061.c
+++ b/drivers/gpio/pl061.c
@@ -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;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ARM: 6060/1: PL061 GPIO: Setting gpio val after changing d ..., Linux Kernel Mailing ..., (Thu Apr 29, 5:59 pm)