From: Arnd Bergmann <arnd@arndb.de>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Chris Ball <cjb@laptop.org>,
linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org,
Magnus Damm <magnus.damm@gmail.com>
Subject: Re: [PATCH v2 02/11] mmc: deprecate redundant cd-inverted and wp-inverted DT properties
Date: Thu, 31 Jan 2013 09:00:56 +0000 [thread overview]
Message-ID: <201301310900.56868.arnd@arndb.de> (raw)
In-Reply-To: <Pine.LNX.4.64.1301310727590.14639@axis700.grange>
On Thursday 31 January 2013, Guennadi Liakhovetski wrote:
> On Thu, 31 Jan 2013, Arnd Bergmann wrote:
> > On Wednesday 30 January 2013, Guennadi Liakhovetski wrote:
> > > On Wed, 30 Jan 2013, Arnd Bergmann wrote:
> >
> > I'm not saying that it should, I just thought that it did that already,
> > but I may be wrong with that. Where does the polarity of a gpio
> > line normally get set?
>
> Well, don't think we had a generic way to handle this until now. Each
> driver handles GPIOs in its own way. The GPIO API only provides functions
> to reserve GPIOs, specify their direction (out / in) and set or get level
> respectively. Besides you could set some flags like GPIOF_OPEN_DRAIN etc.
> After a driver, say, reads low level of a GPIO it has to decide itself
> whether it's the "on" or the "off" level, for which many drivers often use
> their own means to specify GPIO's "polarity."
Right, Chris also mentioned the of_get_named_gpio_flags() method that
drivers would need to use to get the flags, although currently
most of them don't.
>
> > > > and
> > > > the SDHCI_QUIRK_INVERTED_WRITE_PROTECT flag can be used to invert it
> > > > independent of it.
> > >
> > > Right, not sure about that flag. Isn't it used for SDHCI-native WP?
> >
> > It's used in the sdhci_check_ro() function, independent of whether
> > the bit comes from the GPIO or from the SDHCI_PRESENT_STATE
> > register.
>
> Right, but the MMC core already has a generic MMC_CAP2_RO_ACTIVE_HIGH
> flag, so, this flag is redundant. Perhaps, the SDHCI OF glue will have to
> set that flag if the MMC core reports MMC_CAP2_RO_ACTIVE_HIGH.
Makes sense. It seems that the MMC_CAP2_RO_ACTIVE_HIGH flag is only
evaluated by the generic mmc_gpio_get_ro() helper function you wrote
and that is currently used in only one host driver, while the
SDHCI_QUIRK_INVERTED_WRITE_PROTECT obviously is only used in SDHCI.
It certainly makes sense to unify those flags.
> > It gets set based on the presence of the wp-inverted or the
> > older sdhci,wp-inverted property, which both get interpreted
> > in the same way.
>
> Right, which is already a mess...
Yes. It was worse before I introduced the common mmc binding, when
each driver had its own method. I left the sdhci specific one there
because there are (old) preexising users of that on powerpc that
would suffer from an incompatible change to the binding, but I
changed some of those that I knew had few existing users.
> > > > So you could actually express the same thing by either
> > > > putting the inversion into the gpio specifier or into the *-inverted
> > > > properties.
> > > >
> > > > If you actually provide both, that would have the same meaning as not
> > > > inverting.
> > >
> > > Hm, that'd be a weird way to configure the pin, perhaps.
> >
> > Yes, it's silly and I don't see a reason why you'd do that, but I think
> > it should still be considered valid.
>
> We can do that, sure, but I'm not sure we really have to apply both to end
> up with a non-inverted pin, or just interpret it as resundant information
> and invert once.
Fine with me, too. It's not a case I'm worried about for the practical
applications. My thought was that it would be just as easy and more logical
to combine the two using XOR as it is using OR logic wherever they get
interpreted, but if it's easier to use OR, then I don't object.
Arnd
next prev parent reply other threads:[~2013-01-31 9:01 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-23 15:32 [PATCH v2 00/11] mmc: core and driver DT and related development Guennadi Liakhovetski
2013-01-23 15:32 ` [PATCH v2 01/11] mmc: sdhi, tmio: only check flags in tmio-mmc driver proper Guennadi Liakhovetski
2013-01-23 15:32 ` [PATCH v2 02/11] mmc: deprecate redundant cd-inverted and wp-inverted DT properties Guennadi Liakhovetski
2013-01-28 22:23 ` Chris Ball
2013-01-30 15:47 ` Arnd Bergmann
2013-01-30 16:02 ` Guennadi Liakhovetski
2013-01-30 16:13 ` Guennadi Liakhovetski
2013-01-30 16:29 ` Arnd Bergmann
2013-01-30 17:03 ` Guennadi Liakhovetski
2013-01-31 0:09 ` Arnd Bergmann
2013-01-31 0:20 ` Chris Ball
2013-01-31 6:47 ` Guennadi Liakhovetski
2013-01-31 9:00 ` Arnd Bergmann [this message]
2013-01-23 15:32 ` [PATCH v2 03/11] mmc: provide a standard MMC device-tree binding parser centrally Guennadi Liakhovetski
2013-01-23 15:32 ` [PATCH v2 04/11] mmc: (cosmetic) remove "extern" from function declarations Guennadi Liakhovetski
2013-01-23 15:32 ` [PATCH v2 05/11] mmc: sh-mmcif: use mmc_of_parse() to parse standard MMC DT bindings Guennadi Liakhovetski
2013-01-28 22:25 ` Chris Ball
2013-01-23 15:32 ` [PATCH/RFC v2 06/11] mmc: tmio-mmc: define device-tree bindings Guennadi Liakhovetski
2013-01-24 15:34 ` Guennadi Liakhovetski
2013-01-24 15:39 ` Chris Ball
2013-01-24 15:58 ` Guennadi Liakhovetski
2013-01-24 16:03 ` Chris Ball
2013-01-30 14:07 ` Guennadi Liakhovetski
2013-01-30 14:09 ` Chris Ball
2013-02-01 4:23 ` Simon Horman
2013-01-23 15:32 ` [PATCH v2 07/11] mmc: tmio-mmc: parse " Guennadi Liakhovetski
2013-01-23 15:32 ` [PATCH v2 08/11] mmc: sh_mobile_sdhi: remove unused .pdata field Guennadi Liakhovetski
2013-01-23 15:32 ` [PATCH v2 09/11] mmc: sh_mobile_sdhi: use managed resource allocations Guennadi Liakhovetski
2013-01-23 15:32 ` [PATCH v2 10/11] mmc: tmio: remove unused and deprecated symbols Guennadi Liakhovetski
2013-01-23 15:32 ` [PATCH v2 11/11] mmc: tmio: add support for the VccQ regulator Guennadi Liakhovetski
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=201301310900.56868.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=cjb@laptop.org \
--cc=g.liakhovetski@gmx.de \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).