[PATCH] of/flattree: Early "find node by alias" function

Dave Martin dave.martin at linaro.org
Wed Oct 26 20:29:37 EST 2011


On Fri, Oct 21, 2011 at 09:45:29AM -0700, David Daney wrote:
> On 10/21/2011 08:16 AM, Pawel Moll wrote:
> >This patch adds a function for finding a node in flat tree
> >based on an alias name. It can be used in early boot code.
> >
> >Typical use case is a situation when early code needs data
> >from a arbitrary tree node, eg. base address of "serial0" to
> >initialise debug output or some sort of ID register to
> >probe hardware.
> >
> >The tree source could look like that:
> >
> >/ {
> >	aliases {
> >		serial0 =&uart0;
> >	};
> >
> >	uart0: uart at f0001000 {
> >		reg =<0xf0001000 0x1000>;
> >	};
> >}
> >
> >Signed-off-by: Pawel Moll<pawel.moll at arm.com>
> 
> How is this patch different/better than:
> 
> 
> http://lists.ozlabs.org/pipermail/devicetree-discuss/2011-June/005819.html

Note that unless we have reasonably standard alias names, finding nodes
by alias may recreate the same problem that it attempts to solve.

For example, how do I know which alias among serial0, serial1 etc.
should be used as the debug UART?

It feels like we either need well-defined conventions, or proper
symbolic names for aliases.  Or alternatively, the meanings of aliases
need to be documented somewhere just like the real bindings.

Of course, some alises can have board-specific meanings, but if all
alises are board-specific they become less useful.  If some alises are
board-specific and some are not, then we really need some namespacing
convention, just as for the real bindings.

Of course, this may all have been discussed before and dismissed as
overkill...

Cheers
---Dave


More information about the devicetree-discuss mailing list