summaryrefslogtreecommitdiff
path: root/arch/arm/cpu
diff options
context:
space:
mode:
authorJoel A Fernandes <agnel.joel@gmail.com>2011-09-04 11:10:03 -0500
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2011-09-12 17:40:48 +0200
commit569919d8e284c36d4ee981df5fcaa2e188f006a0 (patch)
treef982e86be213ca14605c4afe27c9da86716c7be3 /arch/arm/cpu
parent043cfcfb7ed1815264df823e5a91683a50189892 (diff)
downloadu-boot-imx-569919d8e284c36d4ee981df5fcaa2e188f006a0.zip
u-boot-imx-569919d8e284c36d4ee981df5fcaa2e188f006a0.tar.gz
u-boot-imx-569919d8e284c36d4ee981df5fcaa2e188f006a0.tar.bz2
OMAP: Add function to get state of a GPIO output
Read directly from OMAP_GPIO_DATAOUT to get the output state of the GPIO pin Signed-off-by: Joel A Fernandes <agnel.joel@gmail.com> Signed-off-by: Jason Kridner <jkridner@beagleboard.org> Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
Diffstat (limited to 'arch/arm/cpu')
-rw-r--r--arch/arm/cpu/armv7/omap-common/gpio.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7/omap-common/gpio.c b/arch/arm/cpu/armv7/omap-common/gpio.c
index 2fcaf5a..4749524 100644
--- a/arch/arm/cpu/armv7/omap-common/gpio.c
+++ b/arch/arm/cpu/armv7/omap-common/gpio.c
@@ -151,6 +151,26 @@ int omap_get_gpio_datain(int gpio)
& (1 << get_gpio_index(gpio))) != 0;
}
+int omap_get_gpio_dataout(int gpio)
+{
+ struct gpio_bank *bank;
+ void *reg;
+
+ if (check_gpio(gpio) < 0)
+ return -EINVAL;
+ bank = get_gpio_bank(gpio);
+ reg = bank->base;
+ switch (bank->method) {
+ case METHOD_GPIO_24XX:
+ reg += OMAP_GPIO_DATAOUT;
+ break;
+ default:
+ return -EINVAL;
+ }
+ return (__raw_readl(reg)
+ & (1 << get_gpio_index(gpio))) != 0;
+}
+
static void _reset_gpio(const struct gpio_bank *bank, int gpio)
{
_set_gpio_direction(bank, get_gpio_index(gpio), 1);