"Early" devices and the DT

Mitch Bradley wmb at firmworks.com
Mon Jun 27 05:22:39 EST 2011


Some solutions to the early device problem

a) Most complex:  Use new properties to create a dependency graph.  This 
is probably the most general solution, but also probably the hardest for 
people to think about and maintain.

b) Define a set of init phases 0,1,2,...  and mark each early device 
node with a phase number property.  Scan the tree for each phase and 
handle only the devices with that phase number.  Unmarked nodes are 
handled last.

c) Similar to b, but instead of properties in nodes, have properties 
like "linux-phase0", "linux-phase1", etc in /chosen, whose values are 
lists of phandles.

Admittedly, this is to some extent Linux-specific, but there is a fair 
chance that it would be useful to other OSs, as most OSs have similar 
ordering requirements for certain core devices.  I know that Windows 
works this way - the Windows kernel startup code scans the NT device 
tree multiple times, picking off different devices in different phases.

Some devices might appear in multiple phases.  For example, you might 
want to init a serial device in phase 0, in a simplified mode that 
doesn't depend on interrupts, then do the interrupt controller in phase 
1, then do the timer in phase 2 and also reinit the serial port to use 
interrupts in phase 2.


More information about the devicetree-discuss mailing list