From: Benoît Thébaudeau Date: Mon, 20 Aug 2012 10:55:41 +0000 (+0000) Subject: mxc: Make gpio_get_value() use PSR X-Git-Tag: v2012.10-rc1~148 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5dafa4543c399d329c7b01df1afa98437861cac0;p=u-boot mxc: Make gpio_get_value() use PSR gpio_get_value() should use PSR like Linux, not DR, because DR does not always reflect the pin state, while PSR does. This is especially useful to detect a short circuit on a GPIO pin configured as output, or to read the level of a pin controlled by a non-GPIO IOMUX function. Signed-off-by: Benoît Thébaudeau Cc: Stefano Babic Acked-by: Stefano Babic --- diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c index 661553552e..e9bf27841c 100644 --- a/drivers/gpio/mxc_gpio.c +++ b/drivers/gpio/mxc_gpio.c @@ -116,7 +116,7 @@ int gpio_get_value(unsigned gpio) regs = (struct gpio_regs *)gpio_ports[port]; - val = (readl(®s->gpio_dr) >> gpio) & 0x01; + val = (readl(®s->gpio_psr) >> gpio) & 0x01; return val; }