Currently, we do not have a way to iterate over child FDT nodes, which
is a problem when you have a devices like the USB system on the am335x
(Beaglebone Black):

https://uglyman.kremlin.cc/gitweb/gitweb.cgi?p=bbb-usb.git;a=blob;f=misc/fdt/am335x-boneblack.dts;h=8799dc1d171961d3cd9a941131a82a15bbe445d7;hb=HEAD#l1489

This patch externalizes simplebus_attach_node which probes for drivers
to attach to individual nodes, allowing drivers matching parent nodes to
iterate over their children and call this function on each child. It
works.

For a driver matching parent node property compatible="ti,am33xx-usb"
and another driver matching child node property
compatible="ti,musb-am33xx", we do the following in the parent node
driver's _attach:

155: for (node = OF_child(faa->fa_node); node > 0; node = OF_peer(node))
156:     simplebus_attach_node(parent, node);

and get:

        amusbss0 at simplebus0: rev 0.13
        ammusb0 at simplebus0: rev 0.0  
        ammusb1 at simplebus0: rev 0.0
        panic: welcome to openbsd     

This is needed for a USB OTG driver for the am335x in the works. 

Ian

Index: simplebusvar.h
===================================================================
RCS file: /cvs/src/sys/arch/arm/simplebus/simplebusvar.h,v
retrieving revision 1.1
diff -u -p -r1.1 simplebusvar.h
--- simplebusvar.h      21 Oct 2016 20:09:49 -0000      1.1
+++ simplebusvar.h      12 Feb 2017 01:27:21 -0000
@@ -31,3 +31,4 @@ struct simplebus_softc {
 };
 
 extern void simplebus_attach(struct device *, struct device *, void *);
+extern void simplebus_attach_node(struct device *, int);


Reply via email to