devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Subodh Nijsure <snijsure-4jo+YWezP1RWk0Htik3J/w@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: Configure standalone GPIO in device tree?
Date: Mon, 11 Jun 2012 10:46:41 -0500	[thread overview]
Message-ID: <4FD612E1.6070107@gmail.com> (raw)
In-Reply-To: <4FD610D2.5020603-4jo+YWezP1RWk0Htik3J/w@public.gmane.org>

On 06/11/2012 10:37 AM, Subodh Nijsure wrote:
> On 06/11/2012 07:21 AM, Rob Herring wrote:
>> On 06/11/2012 08:56 AM, Subodh Nijsure wrote:
>>> Hello,
>>>
>>> I am working with a hardware that has couple of GPIOs that are not tied
>>> to any specific device one to indicate board status, other to indicate
>>> presence of this hardware to some other 'independent' hardware.
>>>
>>> I have been going through some of the device tree files and I haven't
>>> come across way to represent a GPIO independent of a specific device, is
>>> it possible to do so using DT? How would I specify such a GPIO?
>>>
>>> I am working on MX28 (MXS for linux) based platform but if there are
>>> some other platforms already doing that would appreciate pointer to that
>>> dt file.
>> How do you program that gpio line? It has to be controlled from
>> somewhere.
> In non-dt version, .init_machine code used to configure GPIO using
> gpio_request_one() interface and set the values.
> 
> Currently as a hack on my board, I am doing the following, but that
> status led has nothing do with the ethernet driver.
> 
>                 mac0: ethernet@800f0000 {
>                         phy-mode = "rmii";
>                         pinctrl-names = "default";
>                         pinctrl-0 = <&mac0_pins_a>;
>                         status-led = <&gpio3 5 0>;
>                         mac-address = [ 00 11 22 33 44 56 ];
>                 };
> 
>                 int status_led;
>                 struct device_node *np = pdev->dev.of_node;
> 
>                 status_led = of_get_named_gpio(np, "status-led", 0);
>                 gpio_request_one(status_led, GPIOF_OUT_INIT_LOW,
> "status-led");
> 
> So in DT world I would like to  lookup  LED named status-led, only
> version I know of of_get_named_gpio() requires device_node pointer,so I
> guess I am looking for way to lookup gpio in .init_machine function,
> without having a pointer to a device_node, is that possible?

Look at gpio-led. There are some examples in PowerPC dts files and
documentation in Documentation/devicetree/bindings/gpio/led.txt.

Rob

      parent reply	other threads:[~2012-06-11 15:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-11 13:56 Configure standalone GPIO in device tree? Subodh Nijsure
     [not found] ` <4FD5F8F7.1020901-4jo+YWezP1RWk0Htik3J/w@public.gmane.org>
2012-06-11 14:21   ` Rob Herring
     [not found]     ` <4FD5FEEF.70606-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-06-11 15:37       ` Subodh Nijsure
     [not found]         ` <4FD610D2.5020603-4jo+YWezP1RWk0Htik3J/w@public.gmane.org>
2012-06-11 15:46           ` Rob Herring [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=4FD612E1.6070107@gmail.com \
    --to=robherring2-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=snijsure-4jo+YWezP1RWk0Htik3J/w@public.gmane.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).