dm: core: Introduce support for multiple trees
At present ofnode only works with a single device tree, for the most part. This is the control FDT used by U-Boot. When booting an OS we may obtain a different device tree and want to modify it. Add some initial support for this into the ofnode API. Note that we don't permit aliases in this other device tree, since the of_access implementation maintains a list of aliases collected at start-up. Also, we don't need aliases to do fixups in the other FDT. So make sure that flat tree and live tree processing are consistent in this area. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -176,6 +176,23 @@ static inline ofnode ofnode_root(void)
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* oftree_default() - Returns the default device tree (U-Boot's control FDT)
|
||||
*
|
||||
* Returns: reference to the control FDT
|
||||
*/
|
||||
static inline oftree oftree_default(void)
|
||||
{
|
||||
oftree tree;
|
||||
|
||||
if (of_live_active())
|
||||
tree.np = gd_of_root();
|
||||
else
|
||||
tree.fdt = (void *)gd->fdt_blob;
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* ofnode_name_eq() - Check if the node name is equivalent to a given name
|
||||
* ignoring the unit address
|
||||
@@ -640,11 +657,22 @@ int ofnode_count_phandle_with_args(ofnode node, const char *list_name,
|
||||
/**
|
||||
* ofnode_path() - find a node by full path
|
||||
*
|
||||
* This uses the control FDT.
|
||||
*
|
||||
* @path: Full path to node, e.g. "/bus/spi@1"
|
||||
* Return: reference to the node found. Use ofnode_valid() to check if it exists
|
||||
*/
|
||||
ofnode ofnode_path(const char *path);
|
||||
|
||||
/**
|
||||
* ofnode_path_root() - find a node by full path from a root node
|
||||
*
|
||||
* @tree: Device tree to use
|
||||
* @path: Full path to node, e.g. "/bus/spi@1"
|
||||
* Return: reference to the node found. Use ofnode_valid() to check if it exists
|
||||
*/
|
||||
ofnode ofnode_path_root(oftree tree, const char *path);
|
||||
|
||||
/**
|
||||
* ofnode_read_chosen_prop() - get the value of a chosen property
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user