dm: core: Add an ofnode function to obtain the flat tree
The flat device tree is assumed to be the control FDT but this is not always the case. Update the ofnode implementation to obtain the node via an function call so we can eventually add support for selecting different trees. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -35,6 +35,25 @@ struct ofnode_phandle_args {
|
||||
*/
|
||||
static inline void oftree_reset(void) {}
|
||||
|
||||
/**
|
||||
* ofnode_to_fdt() - convert an ofnode to a flat DT pointer
|
||||
*
|
||||
* This cannot be called if the reference contains a node pointer.
|
||||
*
|
||||
* @node: Reference containing offset (possibly invalid)
|
||||
* Return: DT offset (can be NULL)
|
||||
*/
|
||||
static inline void *ofnode_to_fdt(ofnode node)
|
||||
{
|
||||
#ifdef OF_CHECKS
|
||||
if (of_live_active())
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
/* Use the control FDT by default */
|
||||
return (void *)gd->fdt_blob;
|
||||
}
|
||||
|
||||
/**
|
||||
* ofnode_to_np() - convert an ofnode to a live DT node pointer
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user