Thread (1 message) 1 message, 1 author, 2012-06-11

Re: Configure standalone GPIO in device tree?

From: Subodh Nijsure <hidden>
Date: 2012-06-11 15:37:54

On 06/11/2012 07:21 AM, Rob Herring wrote:
On 06/11/2012 08:56 AM, Subodh Nijsure wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help