linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Q: how to access the MPC5200B's timer gipo's?
@ 2009-12-09 16:28 Albrecht Dreß
  2009-12-11  6:02 ` Grant Likely
  0 siblings, 1 reply; 3+ messages in thread
From: Albrecht Dreß @ 2009-12-09 16:28 UTC (permalink / raw)
  To: linuxppc-dev

Hi all,

I have a (probably dumb) question regarding the access to the MPC5200B's timer gpio's.  I added e.g.

timer@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("/soc5200@f0000000/timer@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?

Thanks for any help,
Albrecht.

Es weihnachtet sehr! Vom leckerem Backrezept bis zum leckeren Schneehasen finden Sie alles im Weihnachtsspecial von Arcor.de:
http://www.arcor.de/rd/footer.weihnachten
Feliz Navidad, God Yul, Merry X-Mas und ein frohes Fest!

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

* Re: Q: how to access the MPC5200B's timer gipo's?
  2009-12-09 16:28 Q: how to access the MPC5200B's timer gipo's? Albrecht Dreß
@ 2009-12-11  6:02 ` Grant Likely
  2009-12-11 17:55   ` Albrecht Dreß
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Likely @ 2009-12-11  6:02 UTC (permalink / raw)
  To: Albrecht Dreß; +Cc: linuxppc-dev

On Wed, Dec 9, 2009 at 9:28 AM, Albrecht Dre=DF <albrecht.dress@arcor.de> w=
rote:
> Hi all,
>
> I have a (probably dumb) question regarding the access to the MPC5200B's =
timer gpio's. =A0I added e.g.
>
> timer@640 { =A0 =A0 // General Purpose Timer 4
> =A0 =A0 =A0 =A0compatible =3D "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
> =A0 =A0 =A0 =A0reg =3D <0x640 0x10>;
> =A0 =A0 =A0 =A0interrupts =3D <1 13 0>;
> =A0 =A0 =A0 =A0interrupt-parent =3D <&mpc5200_pic>;
> =A0 =A0 =A0 =A0gpio-controller;
> =A0 =A0 =A0 =A0#gpio-cells =3D <2>;
> };
>
> in the DTS file to several timers. =A0Several gpiochipxxx folders are now=
 present in /sys/class/gpio/.
>
> In my code, I grab the node by calling of_find_node_by_path("/soc5200@f00=
00000/timer@640"), which returns the proper node. =A0Then 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. =A0However, 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 g=
pio 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.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: Q: how to access the MPC5200B's timer gipo's?
  2009-12-11  6:02 ` Grant Likely
@ 2009-12-11 17:55   ` Albrecht Dreß
  0 siblings, 0 replies; 3+ messages in thread
From: Albrecht Dreß @ 2009-12-11 17:55 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 465 bytes --]

Hi Grant:

Am 11.12.09 07:02 schrieb(en) Grant Likely:
> 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).

Thanks a lot for that pointer - I actually missed that documentation (so it *was* a dumb question!.  Works as advertised when I add the gpio's to a (dummy) node.

Thanks, Albrecht.

[-- Attachment #2: Type: application/pgp-signature, Size: 190 bytes --]

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

end of thread, other threads:[~2009-12-11 18:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-09 16:28 Q: how to access the MPC5200B's timer gipo's? Albrecht Dreß
2009-12-11  6:02 ` Grant Likely
2009-12-11 17:55   ` Albrecht Dreß

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).