public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] dm: gpio: mxc: fix mxc_gpio_bank_get_value
@ 2016-03-15  5:48 Peng Fan
  2016-03-15  5:48 ` [U-Boot] [PATCH 2/2] dm: gpio: mxc: implement xlate function Peng Fan
  2016-03-15 12:53 ` [U-Boot] [PATCH 1/2] dm: gpio: mxc: fix mxc_gpio_bank_get_value Fabio Estevam
  0 siblings, 2 replies; 12+ messages in thread
From: Peng Fan @ 2016-03-15  5:48 UTC (permalink / raw)
  To: u-boot

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@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@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(&regs->gpio_dr) >> offset) & 0x01;
+
 	return (readl(&regs->gpio_psr) >> offset) & 0x01;
 }
 
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-04-11 14:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-15  5:48 [U-Boot] [PATCH 1/2] dm: gpio: mxc: fix mxc_gpio_bank_get_value Peng Fan
2016-03-15  5:48 ` [U-Boot] [PATCH 2/2] dm: gpio: mxc: implement xlate function Peng Fan
2016-03-16  3:32   ` Simon Glass
2016-04-11  5:28     ` Peng Fan
2016-04-11 14:56       ` Eric Nelson
2016-03-15 12:53 ` [U-Boot] [PATCH 1/2] dm: gpio: mxc: fix mxc_gpio_bank_get_value Fabio Estevam
2016-03-16  1:27   ` Peng Fan
2016-03-16 12:48     ` Fabio Estevam
2016-03-17  1:44       ` Peng Fan
2016-04-03 18:09         ` Stefano Babic
2016-04-05  5:04           ` Peng Fan
2016-04-09 18:35             ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox