[PATCH 1/2] of: Add for_each_compatible_node_from iterator

Trent Piepho tpiepho at kymetacorp.com
Mon Jan 4 11:07:27 PST 2016

On Mon, 2016-01-04 at 09:32 +0100, Sascha Hauer wrote:
> On Sat, Dec 19, 2015 at 12:13:59AM +0000, Trent Piepho wrote:
> > The existing iterator for_each_compatible_node() searches for each
> > compatible node starting from the root of the loaded device tree.
> > This means it only works on the barebox device tree and not the tree
> > to be passed to the Linux kernel, which is what an of_fixup would
> > probably want to use.
> > 
> > This adds for_each_compatible_node_from(), which takes an additional
> > parameter of a root to search from.  This could be the device tree to
> > be used for the kernel.  It could also be used to search just a
> > subtree.
> > 
> > Signed-off-by: Trent Piepho <tpiepho at kymetacorp.com>
> Applied, thanks
> > ---
> > 
> > It's possible the fixups in cm_cogent_fixup() and hb_fixup() should
> > be using this.  It's not clear to me if they want to modify the barebox
> > device tree or the Linux device tree or both.
> It's always the Linux device tree that is fixed up in the OF fixups.

Sent patch to fix them.

Couldn't one also use the of fixup system to modify the barebox DT?  In
order to support multiple board variants, I added DT nodes that specify
what nodes should be enabled and/or disabled for different board
versions.  An OF fixup applies this to the Linux DT.  I haven't had to
modify the barebox DT for different boards but anticipate that happening
for the next board and I was planning to use the same system.

More information about the barebox mailing list