FDT Support for GPIO (gpiobus and friends)
Warner Losh
imp at bsdimp.com
Mon Jun 24 14:52:23 UTC 2013
I'm loving this patch, mostly.
But I don't see where the ivar gets freed... Perhaps this is because we dont' support detaching GPIOs?
Warner
On Jun 24, 2013, at 6:20 AM, Luiz Otavio O Souza wrote:
> On Jun 21, 2013, at 6:05 PM, Luiz Otavio O Souza wrote:
>
> +int
> +gpiobus_fdt_add_child(device_t bus, phandle_t childnode)
> +{
> [...]
> + /* Add newbus device for the child. */
> + child = device_add_child(bus, NULL, -1);
>
>
> This is obviously wrong.. it should only probe the specified type of drivers...
>
> The attached patch fix this problem. Now i can have things like:
>
> Index: bcm2835-rpi-b.dts
> ===================================================================
> --- bcm2835-rpi-b.dts (revision 251700)
> +++ bcm2835-rpi-b.dts (working copy)
> @@ -518,7 +518,7 @@
>
> ok {
> label = "ok";
> - gpios = <&gpio 16 1>;
> + gpios = <&gpio 16 2 0>;
>
> /* Don't change this - it configures
> * how the led driver determines if
> @@ -529,8 +529,24 @@
> /* This is the real default state. */
> linux,default-trigger = "default-on";
> };
> +
> + blue {
> + label = "blue";
> + gpios = <&sr1 3 2 0>;
> + };
> };
>
> + shift-registers {
> + compatible = "gpio-shiftregister";
> +
> + sr1: sr1 {
> + gpios = <&gpio 17 2 0
> + &gpio 21 2 0
> + &gpio 22 2 0>;
> + gpio-controller;
> + };
> + };
> +
> power: regulator {
> compatible = "broadcom,bcm2835-power-mgr", "broadcom,bcm2708-power-mgr", "simple-bus";
> #address-cells = <1>;
>
>
> And everything attaches correctly:
>
> gpio0: <BCM2708/2835 GPIO controller> mem 0x20200000-0x202000af irq 57,59,58,60 on simplebus0
> gpio0: read-only pins: 46,47,48,49,50,51,52,53.
> gpio0: reserved pins: 48,49,50,51,52,53.
> gpioc0: <GPIO controller> on gpio0
> gpiobus0: <GPIO bus> on gpio0
> gpioled0: <GPIO led> at pin(s) 16 on gpiobus0
> gpioshiftreg0: <GPIO Shift-Register expander> at pin(s) 17,21-22 on gpiobus0
> gpioc1: <GPIO controller> on gpioshiftreg0
> gpiobus1: <GPIO bus> on gpioshiftreg0
> gpioled1: <GPIO led> at pin(s) 3 on gpiobus1
>
>
> Regards,
> Luiz
>
>
> <gpioled-fdt.diff>_______________________________________________
> freebsd-arch at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe at freebsd.org"
More information about the freebsd-arch
mailing list