aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini2015-04-28 12:15:13 -0400
committerTom Rini2015-04-28 12:15:13 -0400
commite536ab8849b2b4f6d68bbc8e1d1f9bc033db06bd (patch)
treee5e3a3d5a0bee8a1d9a74deb3990455c40ded6b1 /common
parentcc555bd4f40a652471df4a3621d45ee57df0ca11 (diff)
parent205d58699b157df75f1aa0b363ea9c21add21a0c (diff)
Merge branch 'master' of git://www.denx.de/git/u-boot-imx
Diffstat (limited to 'common')
-rw-r--r--common/fdt_support.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 8266bca7d64..c5ed5ad89ee 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1560,3 +1560,32 @@ int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width,
return 0;
}
+
+/*
+ * Update native-mode in display-timings from display environment variable.
+ * The node to update are specified by path.
+ */
+int fdt_fixup_display(void *blob, const char *path, const char *display)
+{
+ int off, toff;
+
+ if (!display || !path)
+ return -FDT_ERR_NOTFOUND;
+
+ toff = fdt_path_offset(blob, path);
+ if (toff >= 0)
+ toff = fdt_subnode_offset(blob, toff, "display-timings");
+ if (toff < 0)
+ return toff;
+
+ for (off = fdt_first_subnode(blob, toff);
+ off >= 0;
+ off = fdt_next_subnode(blob, off)) {
+ uint32_t h = fdt_get_phandle(blob, off);
+ debug("%s:0x%x\n", fdt_get_name(blob, off, NULL),
+ fdt32_to_cpu(h));
+ if (strcasecmp(fdt_get_name(blob, off, NULL), display) == 0)
+ return fdt_setprop_u32(blob, toff, "native-mode", h);
+ }
+ return toff;
+}