From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subodh Nijsure Subject: Re: Configure standalone GPIO in device tree? Date: Mon, 11 Jun 2012 08:37:54 -0700 Message-ID: <4FD610D2.5020603@grid-net.com> References: <4FD5F8F7.1020901@grid-net.com> <4FD5FEEF.70606@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4FD5FEEF.70606-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: "devicetree-discuss" To: Rob Herring Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org List-Id: devicetree@vger.kernel.org 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