Configure standalone GPIO in device tree?
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
Quoted 6 lines · Subodh Nijsure
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.
Quoted 7 lines
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
Quoted 7 lines · Rob Herring
Quoted 6 lines · Subodh Nijsure
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.
Quoted 8 lines
Quoted 7 lines
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
Quoted 36 lines · Subodh Nijsure
Quoted 11 lines · Rob Herring
Quoted 10 lines · Subodh Nijsure
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?
Quoted 5 lines
Quoted 3 lines
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,
Quoted 6 lines
"status-led");
So in DT world I would like to lookup LED named status-led, only version I know of
of_get_named_gpio()requiresdevice_nodepointer,so I guess I am looking for way to lookup gpio in .init_machine function, without having a pointer to adevice_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