On Wed, Dec 9, 2009 at 9:28 AM, Albrecht Dreß <[email protected]> wrote: > Hi all, > > I have a (probably dumb) question regarding the access to the MPC5200B's > timer gpio's. I added e.g. > > ti...@640 { // General Purpose Timer 4 > compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; > reg = <0x640 0x10>; > interrupts = <1 13 0>; > interrupt-parent = <&mpc5200_pic>; > gpio-controller; > #gpio-cells = <2>; > }; > > in the DTS file to several timers. Several gpiochipxxx folders are now > present in /sys/class/gpio/. > > In my code, I grab the node by calling > of_find_node_by_path("/soc5...@f0000000/ti...@640"), which returns the proper > node. Then I try to get the gpio number (for a call to gpio_set_value()) by > calling of_get_gpio(node, 0) with the node found above. However, this call > always dumps > > of_get_gpio_flags: can't parse gpios property > of_get_gpio_flags exited with status -2 > > What would be the proper way to determine the gpio number for a timer's gpio > pin from the node name or path?
The existing API (of_get_gpio()) doesn't operate on gpio-controller nodes. It operates on a node that uses the gpio (has a 'gpios' property as documented in Documentation/powerpc/dts-bindings/gpio/gpio.txt). Therefore, you need a node to describe the *user* of the GPIO pin, and call of_get_gpio() on that. If you want to resolve the GPIO number from the timer node itself, then you'll need to refactor the API a bit to expose what you want. Nobody has asked to do it that way until now. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. _______________________________________________ Linuxppc-dev mailing list [email protected] https://lists.ozlabs.org/listinfo/linuxppc-dev
