From: Fabio Estevam <festevam@gmail.com>
To: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Cc: barebox@lists.infradead.org,
Andrey Gusakov <andrey.gusakov@cogentembedded.com>,
Chris Healy <cphealy@gmail.com>,
Sascha Hauer <sha@pengutronix.de>
Subject: Re: [PATCH] IMX gpio: use DR register to get gpio value
Date: Thu, 10 May 2018 15:00:41 -0300 [thread overview]
Message-ID: <CAOMZO5BZuq1RCY=834M7ENhJ9f+eEFYS6niW9trnYamX0YURuQ@mail.gmail.com> (raw)
In-Reply-To: <20180510174959.14933-1-nikita.yoush@cogentembedded.com>
Hi Nikita,
On Thu, May 10, 2018 at 2:49 PM, Nikita Yushchenko
<nikita.yoush@cogentembedded.com> wrote:
> From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
>
> 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@cogentembedded.com>
> ---
> 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2018-05-10 18:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 17:49 Nikita Yushchenko
2018-05-10 18:00 ` Fabio Estevam [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOMZO5BZuq1RCY=834M7ENhJ9f+eEFYS6niW9trnYamX0YURuQ@mail.gmail.com' \
--to=festevam@gmail.com \
--cc=andrey.gusakov@cogentembedded.com \
--cc=barebox@lists.infradead.org \
--cc=cphealy@gmail.com \
--cc=nikita.yoush@cogentembedded.com \
--cc=sha@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox