add simplebus node patch
[bbb-usb.git] / misc / patches / simplebus-nodeattach.patch
1 Currently, we do not have a way to iterate over child FDT nodes, which
2 is a problem when you have a devices like the USB system on the am335x
3 (Beaglebone Black):
4
5 https://uglyman.kremlin.cc/gitweb/gitweb.cgi?p=bbb-usb.git;a=blob;f=misc/fdt/am335x-boneblack.dts;h=8799dc1d171961d3cd9a941131a82a15bbe445d7;hb=HEAD#l1489
6
7 This patch externalizes simplebus_attach_node which probes for drivers
8 to attach to individual nodes, allowing drivers matching parent nodes to
9 iterate over their children and call this function on each child. It
10 works.
11
12 For a driver matching parent node property compatible="ti,am33xx-usb"
13 and another driver matching child node property
14 compatible="ti,musb-am33xx", we do the following in the parent node
15 driver's _attach:
16
17 155: for (node = OF_child(faa->fa_node); node > 0; node = OF_peer(node))
18 156: simplebus_attach_node(parent, node);
19
20 and 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
27 This is needed for a USB OTG driver for the am335x in the works.
28
29 Ian
30
31 Index: simplebusvar.h
32 ===================================================================
33 RCS file: /cvs/src/sys/arch/arm/simplebus/simplebusvar.h,v
34 retrieving revision 1.1
35 diff -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