[PATCH 2/7] imx/gpio: make gpio_get_value actually work

Wolfram Sang w.sang at pengutronix.de
Mon Apr 19 04:28:13 EDT 2010


From: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>

Newer i.MX-variants can route the content of the Sample Status Register to the
Data Register, but older ones can't. So, use the Sample Register to be generic.
As a drawback, the ability to read back the values of output GPIOs is lost.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
Signed-off-by: Wolfram Sang <w.sang at pengutronix.de>
---
 arch/arm/mach-imx/gpio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-imx/gpio.c b/arch/arm/mach-imx/gpio.c
index 6157bd1..c6a59a6 100644
--- a/arch/arm/mach-imx/gpio.c
+++ b/arch/arm/mach-imx/gpio.c
@@ -121,7 +121,7 @@ int gpio_get_value(unsigned gpio)
 	if (!base)
 		return -EINVAL;
 
-	val = readl(base + GPIO_DR);
+	val = readl(base + GPIO_PSR);
 
 	return val & (1 << shift) ? 1 : 0;
 }
-- 
1.7.0




More information about the barebox mailing list