aboutsummaryrefslogtreecommitdiff
path: root/include/libfdt.h
diff options
context:
space:
mode:
authorMaxime Ripard2016-07-05 10:26:44 +0200
committerTom Rini2016-08-20 11:35:04 -0400
commitddf67f71352be56d98f0e5bcf851146e54d764ad (patch)
treef649ddc66bbcbffaa8ecdfc74205300f55ee8cea /include/libfdt.h
parentea7b1a213e8b01befd05d94620add7cf84883876 (diff)
libfdt: Add overlay application function
The device tree overlays are a good way to deal with user-modifyable boards or boards with some kind of an expansion mechanism where we can easily plug new board in (like the BBB, the Raspberry Pi or the CHIP). Add a new function to merge overlays with a base device tree. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'include/libfdt.h')
-rw-r--r--include/libfdt.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/libfdt.h b/include/libfdt.h
index 4c56711c713..b6a400a7a82 100644
--- a/include/libfdt.h
+++ b/include/libfdt.h
@@ -1740,6 +1740,36 @@ int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
*/
int fdt_del_node(void *fdt, int nodeoffset);
+/**
+ * fdt_overlay_apply - Applies a DT overlay on a base DT
+ * @fdt: pointer to the base device tree blob
+ * @fdto: pointer to the device tree overlay blob
+ *
+ * fdt_overlay_apply() will apply the given device tree overlay on the
+ * given base device tree.
+ *
+ * Expect the base device tree to be modified, even if the function
+ * returns an error.
+ *
+ * returns:
+ * 0, on success
+ * -FDT_ERR_NOSPACE, there's not enough space in the base device tree
+ * -FDT_ERR_NOTFOUND, the overlay points to some inexistant nodes or
+ * properties in the base DT
+ * -FDT_ERR_BADPHANDLE, the phandles in the overlay do not have the right
+ * magic
+ * -FDT_ERR_INTERNAL,
+ * -FDT_ERR_BADLAYOUT,
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADOFFSET,
+ * -FDT_ERR_BADPATH,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTRUCTURE,
+ * -FDT_ERR_BADSTATE,
+ * -FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_overlay_apply(void *fdt, void *fdto);
+
/**********************************************************************/
/* Debugging / informational functions */
/**********************************************************************/