* [U-Boot] [PATCH] mxc: Make gpio_get_value() use PSR
@ 2012-08-20 20:55 Benoît Thébaudeau
2012-08-21 6:20 ` Stefano Babic
2012-08-23 14:03 ` Stefano Babic
0 siblings, 2 replies; 3+ messages in thread
From: Benoît Thébaudeau @ 2012-08-20 20:55 UTC (permalink / raw)
To: u-boot
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 <benoit.thebaudeau@advansee.com>
Cc: Stefano Babic <sbabic@denx.de>
---
This patch depends on http://patchwork.ozlabs.org/patch/178694/ .
.../drivers/gpio/mxc_gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git u-boot-imx-84ab1cb.orig/drivers/gpio/mxc_gpio.c u-boot-imx-84ab1cb/drivers/gpio/mxc_gpio.c
index 6615535..e9bf278 100644
--- u-boot-imx-84ab1cb.orig/drivers/gpio/mxc_gpio.c
+++ u-boot-imx-84ab1cb/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;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] mxc: Make gpio_get_value() use PSR
2012-08-20 20:55 [U-Boot] [PATCH] mxc: Make gpio_get_value() use PSR Benoît Thébaudeau
@ 2012-08-21 6:20 ` Stefano Babic
2012-08-23 14:03 ` Stefano Babic
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Babic @ 2012-08-21 6:20 UTC (permalink / raw)
To: u-boot
On 20/08/2012 22:55, Beno?t Th?baudeau wrote:
> 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 <benoit.thebaudeau@advansee.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
> This patch depends on http://patchwork.ozlabs.org/patch/178694/ .
>
> .../drivers/gpio/mxc_gpio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git u-boot-imx-84ab1cb.orig/drivers/gpio/mxc_gpio.c u-boot-imx-84ab1cb/drivers/gpio/mxc_gpio.c
> index 6615535..e9bf278 100644
> --- u-boot-imx-84ab1cb.orig/drivers/gpio/mxc_gpio.c
> +++ u-boot-imx-84ab1cb/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;
> }
>
Kernel does the same.
Acked-by: Stefano Babic <sbabic@denx.de>
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] mxc: Make gpio_get_value() use PSR
2012-08-20 20:55 [U-Boot] [PATCH] mxc: Make gpio_get_value() use PSR Benoît Thébaudeau
2012-08-21 6:20 ` Stefano Babic
@ 2012-08-23 14:03 ` Stefano Babic
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Babic @ 2012-08-23 14:03 UTC (permalink / raw)
To: u-boot
On 20/08/2012 22:55, Beno?t Th?baudeau wrote:
> 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 <benoit.thebaudeau@advansee.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
> This patch depends on http://patchwork.ozlabs.org/patch/178694/ .
>
> .../drivers/gpio/mxc_gpio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git u-boot-imx-84ab1cb.orig/drivers/gpio/mxc_gpio.c u-boot-imx-84ab1cb/drivers/gpio/mxc_gpio.c
> index 6615535..e9bf278 100644
> --- u-boot-imx-84ab1cb.orig/drivers/gpio/mxc_gpio.c
> +++ u-boot-imx-84ab1cb/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;
> }
>
Applied to u-boot-imx, thanks.
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-23 14:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20 20:55 [U-Boot] [PATCH] mxc: Make gpio_get_value() use PSR Benoît Thébaudeau
2012-08-21 6:20 ` Stefano Babic
2012-08-23 14:03 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox