public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: shawn.guo@freescale.com (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: gpio-mxc gpio get always returns 0 for outputs for IMX6
Date: Mon, 14 Jul 2014 22:05:27 +0800	[thread overview]
Message-ID: <20140714140526.GK2197@dragon> (raw)
In-Reply-To: <CA+sos7_quvZo6j9rFPvgCdYsEx6RoUNPUyvxE74K4vaNWDkGyg@mail.gmail.com>

On Mon, Jul 14, 2014 at 02:56:06PM +0200, Beno?t Th?baudeau wrote:
> > So the question comes down to, for an output GPIO, whether the value in
> > GPIO_DR register is always identical to what we see on the pad.  If yes,
> > your patch makes sense to me.  Otherwise, we have to set SION bit to
> > read the value of an output GPIO from GPIO_PSR.
> 
> Both are not always the same. They should be the same only for sane
> hardware. GPIO_DR indicates the level that the output pad tries to
> drive, while GPIO_PSR indicates the level sensed on the pad. Thus,
> they may differ if there is an external level conflict on the pin.
> This difference may be useful in order to test if the board is
> behaving as expected or if there is anything going wrong, which is
> typically useful for board prototyping.
> 
> The software "knows" what it has set on the output pad, so having a
> get accessor for GPIO_PSR is more useful than for GPIO_DR, and it
> better fits the actual meaning of this function. GPIO_DR would
> correspond to the non-existing gpio_get_set_value() function.

Thanks for the input, Beno?t.  That's helpful.

Shawn

  reply	other threads:[~2014-07-14 14:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 15:34 gpio-mxc gpio get always returns 0 for outputs for IMX6 Tim Harvey
2014-07-11 16:02 ` Russell King - ARM Linux
2014-07-11 16:16   ` Alexander Shiyan
2014-07-11 16:22     ` Russell King - ARM Linux
2014-07-14  3:01   ` Fabio Estevam
2014-07-14  7:04 ` Shawn Guo
2014-07-14 12:56   ` Benoît Thébaudeau
2014-07-14 14:05     ` Shawn Guo [this message]
2014-07-15 17:28       ` Tim Harvey
2014-07-16  6:01         ` Shawn Guo
2014-07-16 19:14           ` Benoît Thébaudeau
2014-07-17  2:41             ` Shawn Guo

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=20140714140526.GK2197@dragon \
    --to=shawn.guo@freescale.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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