FDT Support for GPIO (gpiobus and friends)

Luiz Otavio O Souza loos.br at gmail.com
Fri Jun 21 21:05:37 UTC 2013


On Dec 4, 2012, at 7:00 PM, Hiroki Sato wrote:
> Luiz Otavio O Souza <loos.br at gmail.com> wrote
>  in <BEB9A0F8-560B-4937-8707-653988A26D85 at gmail.com>:
> 
> lo> Hi,
> lo>
> lo> I've been playing with GPIO on RPi and found the missing support of
> lo> FDT on gpiobus very annoying.
> lo>
> lo> The following patch (gpio-fdt.diff) adds FDT support to GPIO (gpiobus,
> lo> gpioc, gpioled).
> lo>
> lo> The bcm2835_gpio.c.fdt.diff will add (a better) support of FDT on RPi
> lo> GPIO controller and the bcm2835.dts.diff has my changes on the RPi dts
> lo> for adding support of gpioled on 'ok' led (pin 16).
> lo>
> lo> Comments ?
> 
> I like this idea, but it should be consistent with standard device
> tree bindings.  For example,
> 
> +			gpiobus {
> +				compatible = "gpiobus";
> +
> +				/* Ok led */
> +				led {
> +					compatible = "gpioled";
> +					label = "ok";
> +					pins = <16>;
> +				};
> +			};
> 
> should be something like the following:
> 
> led {
> 	compatible = "gpio-leds";
> 	ok {
> 		gpios = <&foo 16 1>;
> 		label = "ok";
> 	};
> };
> 
> A node using GPIOs must have gpios property for the gpio-controller
> node and pin number.
> 
> -- Hiroki

Sorry for the long delay.

And yes, i should have read the bindings-gpio.txt document first :)

Is the attached patch better ? It implements the gpios property decoding for gpioled (and could be used as a template for others gpio consumers) and now it works (almost) out of box with the standard rpi dts file.

The only change on the rpi dts file was to add the flags field and mark the pin led as an output (even if this is unused by the current code - a gpioled pin is always an output). This was necessary to match the format documented on bindings-gpio.txt.

Luiz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bcm2835-rpi-b.diff
Type: application/octet-stream
Size: 394 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20130621/3438b70d/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpioled-fdt.diff
Type: application/octet-stream
Size: 9173 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20130621/3438b70d/attachment-0001.obj>


More information about the freebsd-arch mailing list