summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-12-09 10:32:08 -0500
committerTom Rini <trini@konsulko.com>2019-12-09 10:32:08 -0500
commit2f02845817bec0dd0f89eb0d829b17b40d005afc (patch)
tree516685ba58b11ddabeed03f3be7b43286ebdce24 /common
parentb38c3a641fc01fcd4eda5fa107ae3c247baa0196 (diff)
parent6a4b07e08605ad171823021aa158b6b9bebfc6e6 (diff)
Merge tag 'u-boot-imx-20191209' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Fixes for 2020.01 ----------------- - imx8qxp_mek: increase buffer sizes and args number - Fixes for imx7ulp - imx8mm: Fix the first root clock in imx8mm_ahb_sels[] - colibri_imx7: reserve DDR memory for Cortex-M4 - vining2000: fixes and convert to ethernet DM - imx8m: fix rom version check to unbreak some B0 chips - tbs2910: Disable VxWorks image booting support
Diffstat (limited to 'common')
-rw-r--r--common/fdt_support.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 6834399039..02cf5c6241 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -467,6 +467,41 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
}
return 0;
}
+
+int fdt_set_usable_memory(void *blob, u64 start[], u64 size[], int areas)
+{
+ int err, nodeoffset;
+ int len;
+ u8 tmp[8 * 16]; /* Up to 64-bit address + 64-bit size */
+
+ if (areas > 8) {
+ printf("%s: num areas %d exceeds hardcoded limit %d\n",
+ __func__, areas, 8);
+ return -1;
+ }
+
+ err = fdt_check_header(blob);
+ if (err < 0) {
+ printf("%s: %s\n", __func__, fdt_strerror(err));
+ return err;
+ }
+
+ /* find or create "/memory" node. */
+ nodeoffset = fdt_find_or_add_subnode(blob, 0, "memory");
+ if (nodeoffset < 0)
+ return nodeoffset;
+
+ len = fdt_pack_reg(blob, tmp, start, size, areas);
+
+ err = fdt_setprop(blob, nodeoffset, "linux,usable-memory", tmp, len);
+ if (err < 0) {
+ printf("WARNING: could not set %s %s.\n",
+ "reg", fdt_strerror(err));
+ return err;
+ }
+
+ return 0;
+}
#endif
int fdt_fixup_memory(void *blob, u64 start, u64 size)