devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Stezenbach <js@sig21.net>
To: devicetree-discuss@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org,
	Grant Likely <grant.likely@secretlab.ca>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: DT GPIO numbering?
Date: Wed, 1 Aug 2012 17:22:40 +0200	[thread overview]
Message-ID: <20120801152240.GA16388@sig21.net> (raw)

Hi,

I'm currently learning how Linux devicetree support works,
here is one question I couldn't find an answer for.

I understand that within the devicetree GPIOs are referenced by phandle,
thus the numbers are irrelevant.  However, in sysfs the number is
what is used to access the GPIO, e.g. for debugging or
blinkenlight apps.  How does this fit together?

In the old days platform data was used, e.g.

	struct pl061_platform_data {
		/* number of the first GPIO */
		unsigned	gpio_base;
		...
	};

Now, when DT is used gpio-pl061.c sets gc.base = -1 (dynamic numbering).

Should there be a DT property to assign the number base?

Or is there some better way, e.g. in gpio-mxs.c the code derives
the gc.base from of_alias_get_id(np, "gpio").
Should gpio-pl061.c do the same?

And how about assigning gpio names?  When a name is assigned to
the GPIO, is shows up in sysfs instead of gpio%d, however the
number is still needed for /sys/class/gpio/export, right?


Thanks,
Johannes

             reply	other threads:[~2012-08-01 15:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01 15:22 Johannes Stezenbach [this message]
     [not found] ` <20120801152240.GA16388-FF7aIK3TAVNeoWH0uzbU5w@public.gmane.org>
2012-08-05 10:06   ` DT GPIO numbering? Linus Walleij
2012-08-06  2:18     ` Stephen Warren
2012-08-06  6:35       ` Linus Walleij
2012-08-06  9:58         ` Johannes Stezenbach
     [not found]           ` <20120806095805.GA16607-FF7aIK3TAVNeoWH0uzbU5w@public.gmane.org>
2012-08-06 11:10             ` Mitch Bradley
2012-08-10  9:34               ` Johannes Stezenbach
2012-08-14 10:00                 ` Linus Walleij
2012-08-14 13:05                   ` Johannes Stezenbach

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=20120801152240.GA16388@sig21.net \
    --to=js@sig21.net \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).