From: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mxc: Make gpio_get_value() use PSR
Date: Mon, 20 Aug 2012 22:55:41 +0200 (CEST) [thread overview]
Message-ID: <1991832745.2612487.1345496141598.JavaMail.root@advansee.com> (raw)
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;
}
next reply other threads:[~2012-08-20 20:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-20 20:55 Benoît Thébaudeau [this message]
2012-08-21 6:20 ` [U-Boot] [PATCH] mxc: Make gpio_get_value() use PSR Stefano Babic
2012-08-23 14:03 ` Stefano Babic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1991832745.2612487.1345496141598.JavaMail.root@advansee.com \
--to=benoit.thebaudeau@advansee.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox