devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Stephen Warren <swarren@wwwdotorg.org>
Cc: Devicetree Discuss <devicetree-discuss@lists.ozlabs.org>,
	U-Boot Mailing List <u-boot@lists.denx.de>,
	Jerry Van Baren <vanbaren@cideas.com>,
	Sean Paul <seanpaul@chromium.org>, Tom Rini <trini@ti.com>
Subject: Re: [PATCH 09/14] fdt: Add polarity-aware gpio functions to fdtdec
Date: Thu, 15 Nov 2012 15:31:49 -0800	[thread overview]
Message-ID: <CAPnjgZ0qt200WSzmYXXCiEZ6d_d8mxVs1MU-byA7-JDM_JR4rQ@mail.gmail.com> (raw)
In-Reply-To: <5091FF8B.7040109@wwwdotorg.org>

Hi Stephen,

On Wed, Oct 31, 2012 at 9:50 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 10/31/2012 05:59 PM, Simon Glass wrote:
>> Hi,
>>
>> On Fri, Oct 26, 2012 at 12:17 AM, Lucas Stach <dev@lynxeye.de> wrote:
>>> Am Donnerstag, den 25.10.2012, 19:31 -0700 schrieb Simon Glass:
>>>> From: Sean Paul <seanpaul@chromium.org>
>>>>
>>>> Add get and set gpio functions to fdtdec that take into account the
>>>> polarity field in fdtdec_gpio_state.flags.
>>>>
>>> In another thread Stephen Warren and I came to the conclusion that we
>>> most likely should remove this polarity flag from the GPIO bindings.
>>>
>>> Currently it is only for the USB VBUS GPIO which should move over to
>>> regulators once they land in U-Boot. Do you have any other applications
>>> for this flag, so we might reconsider removing it?
>>>
>>
>> Well, any time you have a flag which is inverted in meaning, it can be
>> useful. We have several switches on the board which can be active high
>> or low, and polarity is used for that.
>>
>> In fact, it would be nice IMO to be able to specify input/output as
>> well. I know the exynos bindings do this. There is a noddy function
>> called fdtdec_setup_gpio() in U-Boot which really needs to be sorted
>> out. I discussed with Stephen some time ago how GPIOs should be
>> SOC-specific and it should be possible to set up a GPIO with a single
>> call, as Linux does. The more information there is in the binding, the
>> more it can do automatically.
>>
>> Does the Tegra Linux GPIO binding still have a polarity?
>
> Yes it does, although in practice it can't be used (and hence should
> really be removed), since not all GPIO bindings have such a flag, so
> there is always a need for a separate property to indicate the polarity
> (c.f. fixed-regulator with GPIO control bindings for example).
>

I've had a bit of time to look into this. I see that the regulator
framework in the kernel seems to be used for various control purposes,
and provides useful polarity stuff. I was rather hoping that GPIOs
could be a bit more high level in U-Boot, with information about:

- input/output
- drive strength
- polarity
- pull up/down

In fact most of these are actually supported in most kernel bindings,
but of course it is binding-specific. Would it be useful to ask for a
polarity setting in the GPIO. When it is not available, the polarity
would then always be normal.

This might avoid moving polarity and input/output selecting down into
each client of the gpio, which seems undesirable in general.

Should we consider a second level of indirection for GPIOs to support
these non-binding features? It seems a bit complicated though.

However, if it is too late to do this, or not desirable for some
reason, then we should just drop this patch.

Regards,
Simon

  reply	other threads:[~2012-11-15 23:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-26  2:30 [PATCH 0/14] fdt: Add various device tree utilities and features Simon Glass
     [not found] ` <1351218671-15228-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-10-26  2:30   ` [PATCH 01/14] fdt: Add function to get config int from device tree Simon Glass
2012-10-26  2:30   ` [PATCH 02/14] fdt: Add function to get a config string " Simon Glass
2012-10-26  2:31   ` [PATCH 03/14] fdt: Add fdtdec_decode_region() to decode memory region Simon Glass
2012-10-26  2:31   ` [PATCH 04/14] fdt: Add function for decoding multiple gpios globally available Simon Glass
2012-10-26  2:31   ` [PATCH 05/14] fdt: Export fdtdec_find_alias_node() function Simon Glass
     [not found]     ` <1351218671-15228-6-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-10-26  4:24       ` David Gibson
2012-10-31 23:50         ` Simon Glass
2012-10-26  2:31   ` [PATCH 06/14] fdt: Export fdtdec_lookup() and fix the name Simon Glass
2012-10-26  2:31   ` [PATCH 07/14] fdt: Add function to read boolean property Simon Glass
2012-10-26  2:31   ` [PATCH 08/14] fdt: Add fdtdec_get_uint64 to decode a 64-bit value from a property Simon Glass
2012-10-26  2:31   ` [PATCH 09/14] fdt: Add polarity-aware gpio functions to fdtdec Simon Glass
2012-10-26  7:17     ` Lucas Stach
2012-10-31 23:59       ` Simon Glass
2012-11-01  4:50         ` Stephen Warren
2012-11-15 23:31           ` Simon Glass [this message]
2012-11-15 23:46             ` Stephen Warren
2012-11-16  0:01               ` Simon Glass
2012-10-26  2:31   ` [PATCH 11/14] fdt: Tell the FDT library where the device tree is Simon Glass
2012-10-26  2:31   ` [PATCH 12/14] fdt: Allow device tree to specify secure booting Simon Glass
2012-10-26  2:31 ` [PATCH 10/14] fdt: Load boot command from device tree Simon Glass
2012-10-26  2:31 ` [PATCH 13/14] fdt: Add option to default to most compatible conf in a fit image Simon Glass
2012-10-26  2:31 ` [PATCH 14/14] fdt: Set kernaddr if fdt indicates a kernel is present Simon Glass
     [not found]   ` <1351218671-15228-15-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-11-28 14:30     ` [U-Boot] " Dennis Lan (dlan)
2012-11-18  1:35 ` [PATCH 0/14] fdt: Add various device tree utilities and features Jerry Van Baren
2012-11-19 17:08   ` Simon Glass

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=CAPnjgZ0qt200WSzmYXXCiEZ6d_d8mxVs1MU-byA7-JDM_JR4rQ@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=seanpaul@chromium.org \
    --cc=swarren@wwwdotorg.org \
    --cc=trini@ti.com \
    --cc=u-boot@lists.denx.de \
    --cc=vanbaren@cideas.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).