Re: [PATCH] IMX gpio: use DR register to get gpio value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Nikita,

On Thu, May 10, 2018 at 2:49 PM, Nikita Yushchenko
<nikita.yoush@xxxxxxxxxxxxxxxxxx> wrote:
> From: Andrey Gusakov <andrey.gusakov@xxxxxxxxxxxxxxxxxx>
>
> Reading PSR register report wrong value for pins
> configured as output.
> According DS: While the GPIO direction is set to input
> (GPIO_GDIR = 0), a read access to GPIO_DR does not return
> GPIO_DR data. Instead, it returns the GPIO_PSR data, which
> is the corresponding input signal value.
>
> Signed-off-by: Andrey Gusakov <andrey.gusakov@xxxxxxxxxxxxxxxxxx>
> ---
>  drivers/gpio/gpio-imx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-imx.c b/drivers/gpio/gpio-imx.c
> index d8bcea223..a9d44d4e6 100644
> --- a/drivers/gpio/gpio-imx.c
> +++ b/drivers/gpio/gpio-imx.c
> @@ -108,9 +108,9 @@ static int imx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
>         void __iomem *base = imxgpio->base;
>         u32 val;
>
> -       val = readl(base + imxgpio->regs->psr);
> +       val = readl(base + imxgpio->regs->dr);

Current code is correct.

What you need to do when you want to be able to read a pin configured
as output is to set the SION bit on that pin.

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux