
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(®s->gpio_dr) >> offset) & 0x01; + return (readl(®s->gpio_psr) >> offset) & 0x01; }