add simplebus node patch
[bbb-usb.git] / misc / patches / simplebus-nodeattach.patch
CommitLineData
4257b72f 1Currently, we do not have a way to iterate over child FDT nodes, which
2is a problem when you have a devices like the USB system on the am335x
3(Beaglebone Black):
4
5https://uglyman.kremlin.cc/gitweb/gitweb.cgi?p=bbb-usb.git;a=blob;f=misc/fdt/am335x-boneblack.dts;h=8799dc1d171961d3cd9a941131a82a15bbe445d7;hb=HEAD#l1489
6
7This patch externalizes simplebus_attach_node which probes for drivers
8to attach to individual nodes, allowing drivers matching parent nodes to
9iterate over their children and call this function on each child. It
10works.
11
12For a driver matching parent node property compatible="ti,am33xx-usb"
13and another driver matching child node property
14compatible="ti,musb-am33xx", we do the following in the parent node
15driver's _attach:
16
17155: for (node = OF_child(faa->fa_node); node > 0; node = OF_peer(node))
18156: simplebus_attach_node(parent, node);
19
20and get:
21
22 amusbss0 at simplebus0: rev 0.13
23 ammusb0 at simplebus0: rev 0.0
24 ammusb1 at simplebus0: rev 0.0
25 panic: welcome to openbsd
26
27This is needed for a USB OTG driver for the am335x in the works.
28
29Ian
30
31Index: simplebusvar.h
32===================================================================
33RCS file: /cvs/src/sys/arch/arm/simplebus/simplebusvar.h,v
34retrieving revision 1.1
35diff -u -p -r1.1 simplebusvar.h
36--- simplebusvar.h 21 Oct 2016 20:09:49 -0000 1.1
37+++ simplebusvar.h 12 Feb 2017 01:27:21 -0000
38@@ -31,3 +31,4 @@ struct simplebus_softc {
39 };
40
41 extern void simplebus_attach(struct device *, struct device *, void *);
42+extern void simplebus_attach_node(struct device *, int);
43
44