[PATCHv3 02/10] gpio: mxc_gpio: add support to read status of output gpios

Fabio Estevam festevam at gmail.com
Sun Aug 23 16:44:35 CEST 2020

Hi Sebastian,

On Fri, Aug 21, 2020 at 1:16 PM Sebastian Reichel
<sebastian.reichel at collabora.com> wrote:
> This is supported by the hardware when the pinmux is configured

I assume you are referring to the SION bit.

> correctly. Usually it is not, so this adds explicit code for this.
> This fixes all GPIO regulators being shown as disabled.

This has come up in the past and the consensus was to set the SION bit
when reading the output of a GPIO is needed.

Please see commit:

commit 5dafa4543c399d329c7b01df1afa98437861cac0
Author: Benoît Thébaudeau <benoit.thebaudeau at advansee.com>
Date:   Mon Aug 20 10:55:41 2012 +0000

    mxc: Make gpio_get_value() use PSR

    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 at advansee.com>
    Cc: Stefano Babic <sbabic at denx.de>
    Acked-by: Stefano Babic <sbabic at denx.de>

More information about the U-Boot mailing list