All of lore.kernel.org
 help / color / mirror / Atom feed
* Configure standalone GPIO in device tree?
@ 2012-06-11 13:56 Subodh Nijsure
       [not found] ` <4FD5F8F7.1020901-4jo+YWezP1RWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Subodh Nijsure @ 2012-06-11 13:56 UTC (permalink / raw)
  To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

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.

-Subodh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Configure standalone GPIO in device tree?
       [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>
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Herring @ 2012-06-11 14:21 UTC (permalink / raw)
  To: Subodh Nijsure; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

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.

Rob

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Configure standalone GPIO in device tree?
       [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>
  0 siblings, 1 reply; 4+ messages in thread
From: Subodh Nijsure @ 2012-06-11 15:37 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

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?

-Subodh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Configure standalone GPIO in device tree?
       [not found]         ` <4FD610D2.5020603-4jo+YWezP1RWk0Htik3J/w@public.gmane.org>
@ 2012-06-11 15:46           ` Rob Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2012-06-11 15:46 UTC (permalink / raw)
  To: Subodh Nijsure; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-11 15:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.