FDT Support for GPIO (gpiobus and friends)
Luiz Otavio O Souza
luiz.souza at ad.com.br
Mon Jun 24 12:36:16 UTC 2013
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpioled-fdt.diff
Type: application/octet-stream
Size: 9219 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20130624/2200ac70/attachment.obj>
More information about the freebsd-arch
mailing list