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 <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Fabio Estevam <[email protected]>
---
 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

_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to