From ab839f4c2e4ad1bf9f58534a63645e6961469e33 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 25 Nov 2016 18:56:47 -0800 Subject: board: colibri_imx7: avoid using DDR reserved for Cortex-M4 Using linux,usable-memory the board code carves out 1MiB of memory for the Cortex-M4 core at the end of the 256MiB block. However, in case a board has 256MiB of memory (Colibri iMX7S), that is the area where U-Boot gets relocated to... Use board_get_usable_ram_top to avoid using that area as relocation target. Signed-off-by: Stefan Agner Acked-by: Marcel Ziswiler --- board/toradex/colibri_imx7/colibri_imx7.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/board/toradex/colibri_imx7/colibri_imx7.c b/board/toradex/colibri_imx7/colibri_imx7.c index e4a6ed5d5d..d0a0092b64 100644 --- a/board/toradex/colibri_imx7/colibri_imx7.c +++ b/board/toradex/colibri_imx7/colibri_imx7.c @@ -784,7 +784,17 @@ void udc_pins_setting(void) #endif /*CONFIG_IMX_UDC*/ -#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_CMD_BOOTAUX) +#if defined(CONFIG_CMD_BOOTAUX) +ulong board_get_usable_ram_top(ulong total_size) +{ + /* Reserve last 1MiB for M4 on modules with 256MiB RAM */ + if (gd->ram_size == SZ_256M) + return gd->ram_top - SZ_1M; + else + return gd->ram_top; +} + +#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) int ft_board_setup(void *blob, bd_t *bd) { int up; @@ -825,3 +835,4 @@ int ft_board_setup(void *blob, bd_t *bd) return 0; } #endif +#endif -- cgit v1.2.3