summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhuvanchandra DV <bhuvanchandra.dv@toradex.com>2017-06-06 16:16:27 +0530
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2017-06-18 22:47:31 +0200
commitdf048a64d344a36303cc56ab8da89887e4381491 (patch)
tree5ff3c0e6a797e02dd194245056c944b40a712404
parent4c43494fbf8d7abf3f44d62d25436d2354594a1d (diff)
toradex: colibri_imx6: overwrite CMA memory set in device tree
Make sure CMA memory is not greater than 50% of available physical memory. Allow user to change the CMA memory via 'cma-size' U-Boot environment variable. Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r--board/toradex/colibri_imx6/colibri_imx6.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c
index 20daa5c4477..eb2c552c4bf 100644
--- a/board/toradex/colibri_imx6/colibri_imx6.c
+++ b/board/toradex/colibri_imx6/colibri_imx6.c
@@ -35,6 +35,7 @@
#include <miiphy.h>
#include <mmc.h>
#include <netdev.h>
+#include <libfdt.h>
#include "../common/tdx-cfg-block.h"
#ifdef CONFIG_TDX_CMD_IMX_MFGR
@@ -718,7 +719,18 @@ int checkboard(void)
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, bd_t *bd)
{
- return ft_common_board_setup(blob, bd);
+ u32 cma_size;
+
+ ft_common_board_setup(blob, bd);
+
+ cma_size = getenv_ulong("cma-size", 10, 320 * 1024 * 1024);
+ cma_size = min((u32)(gd->ram_size >> 1), cma_size);
+
+ fdt_setprop_u32(blob,
+ fdt_path_offset (blob, "/reserved-memory/linux,cma"),
+ "size",
+ cma_size);
+ return 0;
}
#endif