Date: Mon, 24 Jun 2013 08:52:16 -0600 From: Warner Losh <imp@bsdimp.com> To: Luiz Otavio O Souza <luiz.souza@ad.com.br> Cc: freebsd-arch@FreeBSD.org, Luiz Otavio O Souza <loos.br@gmail.com> Subject: Re: FDT Support for GPIO (gpiobus and friends) Message-ID: <1142ABEB-7FDA-4CFE-9D12-F8FD2D4C85D6@bsdimp.com> In-Reply-To: <04AEF097-025D-4B3F-A345-98878AE4A822@ad.com.br> References: <BEB9A0F8-560B-4937-8707-653988A26D85@gmail.com> <20121205.060056.592894859995638978.hrs@allbsd.org> <B97B1170-69AD-4AA2-A111-1B9539C71BC3@gmail.com> <04AEF097-025D-4B3F-A345-98878AE4A822@ad.com.br>
next in thread | previous in thread | raw e-mail | index | archive | help
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: >=20 > +int > +gpiobus_fdt_add_child(device_t bus, phandle_t childnode) > +{ > [...] > + /* Add newbus device for the child. */ > + child =3D device_add_child(bus, NULL, -1); >=20 >=20 > This is obviously wrong.. it should only probe the specified type of = drivers... >=20 > The attached patch fix this problem. Now i can have things like: >=20 > Index: bcm2835-rpi-b.dts > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- bcm2835-rpi-b.dts (revision 251700) > +++ bcm2835-rpi-b.dts (working copy) > @@ -518,7 +518,7 @@ >=20 > ok { > label =3D "ok"; > - gpios =3D <&gpio 16 1>; > + gpios =3D <&gpio 16 2 0>; >=20 > /* 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 =3D "default-on"; > }; > + > + blue { > + label =3D "blue"; > + gpios =3D <&sr1 3 2 0>; > + }; > }; >=20 > + shift-registers { > + compatible =3D "gpio-shiftregister"; > + > + sr1: sr1 { > + gpios =3D <&gpio 17 2 0 > + &gpio 21 2 0 > + &gpio 22 2 0>; > + gpio-controller; > + }; > + }; > + > power: regulator { > compatible =3D "broadcom,bcm2835-power-mgr", = "broadcom,bcm2708-power-mgr", "simple-bus"; > #address-cells =3D <1>; >=20 >=20 > And everything attaches correctly: >=20 > 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 >=20 >=20 > Regards, > Luiz >=20 >=20 > <gpioled-fdt.diff>_______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to = "freebsd-arch-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1142ABEB-7FDA-4CFE-9D12-F8FD2D4C85D6>