[U-Boot] [PATCH 1/2] dm: gpio: mxc: fix mxc_gpio_bank_get_value
Peng Fan
van.freenix at gmail.com
Tue Mar 15 06:48:56 CET 2016
When configured a gpio to output direction, directly reading PSR register
can not return the output value, since we did not set SION bit for gpio
iomux. So, we can use data register to reflect what value is outputed.
If not, "regulator status" always return disabled, even if already "regulator
enable":
"
=> regulator enable
=> regulator status
Regulator VSD_3V3 status:
* enable: 0 (false)
* value uV: 3300000
* current uA: No data available (err: -61)
* mode id: Function not implemented (err: -38)
"
Signed-off-by: Peng Fan <van.freenix at gmail.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Stefano Babic <sbabic at denx.de>
Cc: Fabio Estevam <fabio.estevam at nxp.com>
---
drivers/gpio/mxc_gpio.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index 70fe5b6..b6ae3fc 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -201,6 +201,9 @@ static void mxc_gpio_bank_set_value(struct gpio_regs *regs, int offset,
static int mxc_gpio_bank_get_value(struct gpio_regs *regs, int offset)
{
+ if (mxc_gpio_is_output(regs, offset))
+ return (readl(®s->gpio_dr) >> offset) & 0x01;
+
return (readl(®s->gpio_psr) >> offset) & 0x01;
}
--
2.6.2
More information about the U-Boot
mailing list