summaryrefslogtreecommitdiffstats
path: root/common/oftree.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-03-04 09:21:37 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-03-04 09:21:37 +0100
commit831d83e922a3b45d52f502f12b75c2e97a1c7c48 (patch)
tree5a8a779e99c1a214d503abace154c0e4edd8fe01 /common/oftree.c
parentc6813a5fb1c776f3e161d7ae881316d01e9cc39e (diff)
parent07ca814239129f91bede0ba2a6de9c36e53fb33c (diff)
downloadbarebox-831d83e922a3b45d52f502f12b75c2e97a1c7c48.tar.gz
barebox-831d83e922a3b45d52f502f12b75c2e97a1c7c48.tar.xz
Merge branch 'for-next/highbank'
Diffstat (limited to 'common/oftree.c')
-rw-r--r--common/oftree.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/common/oftree.c b/common/oftree.c
index 6b20cdbd8a..82e5ddd60b 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -229,6 +229,33 @@ void do_fixup_by_path_u32(struct fdt_header *fdt, const char *path,
do_fixup_by_path(fdt, path, prop, &val, sizeof(val), create);
}
+void do_fixup_by_compatible(struct fdt_header *fdt, const char *compatible,
+ const char *prop, const void *val, int len, int create)
+{
+ int off = -1;
+
+ off = fdt_node_offset_by_compatible(fdt, -1, compatible);
+ while (off != -FDT_ERR_NOTFOUND) {
+ if (create || (fdt_get_property(fdt, off, prop, 0) != NULL))
+ fdt_setprop(fdt, off, prop, val, len);
+ off = fdt_node_offset_by_compatible(fdt, off, compatible);
+ }
+}
+
+void do_fixup_by_compatible_u32(struct fdt_header *fdt, const char *compatible,
+ const char *prop, u32 val, int create)
+{
+ val = cpu_to_fdt32(val);
+ do_fixup_by_compatible(fdt, compatible, prop, &val, 4, create);
+}
+
+void do_fixup_by_compatible_string(struct fdt_header *fdt, const char *compatible,
+ const char *prop, const char *val, int create)
+{
+ do_fixup_by_compatible(fdt, compatible, prop, val, strlen(val) + 1,
+ create);
+}
+
int fdt_get_path_or_create(struct fdt_header *fdt, const char *path)
{
int nodeoffset;