diff options
author | Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> | 2019-02-08 18:42:24 +0100 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2019-04-13 20:30:09 +0200 |
commit | bee73083a4f131ac585eb57ac9ae496f32c10de2 (patch) | |
tree | 154f6ddd2784512fc4b6763725324cfddb38009a | |
parent | 6218d4bdce1f928bbe58c32b4d560a962228a9d0 (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.c | 14 |
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 efb6b925af..35adff1d00 100644 --- a/board/toradex/colibri_imx6/colibri_imx6.c +++ b/board/toradex/colibri_imx6/colibri_imx6.c @@ -22,6 +22,7 @@ #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/sata.h> #include <asm/mach-imx/video.h> +#include <cpu.h> #include <dm/platform_data/serial_mxc.h> #include <environment.h> #include <fsl_esdhc.h> @@ -688,7 +689,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 |