[RESEND][PATCH][POWERPC] PIKA Warp: Update platform code to supportRev B boards

Sean MacLennan smaclennan at pikatech.com
Tue Apr 29 03:10:01 EST 2008


On Sun, 27 Apr 2008 22:47:43 -0600
"Grant Likely" <grant.likely at secretlab.ca> wrote:

> If your LEDs are attached to gpio pins, then you should use the
> current draft led->gpio bindings as shown in the above patch.  Then,
> let your platform code extract whatever data it needs from the device
> tree to set up the LEDs.

I added the following to the dts:

	led at 31 {
		compatible = "linux,gpio-led";
		linux,name = "green";
		gpios = <&GPIO1 31>;
	};

	led at 30 {
		compatible = "linux,gpio-led";
		linux,name = "red";
		gpios = <&GPIO1 30>;
	};

I then map the gpio base as follows (I removed the if checks just to
make things short and sweet):

	np = of_find_compatible_node(NULL, NULL, "linux,gpio-led");

	gpios = of_get_property(np, "gpios", &lenp);
	of_node_put(np);

	np = of_find_node_by_phandle(gpios[0]);

	gpio_base = of_iomap(np, 0);
	of_node_put(np);

Comments?

Cheers,
  Sean



More information about the Linuxppc-dev mailing list