From b84752f6de6c7dd74bd93c641b12f48e9846c8ab Mon Sep 17 00:00:00 2001 From: Ye Li Date: Wed, 31 Oct 2018 18:37:45 -0700 Subject: MLK-20051-2 imx8mq_arm2: Split DDR to two banks for iMX8MQ DDR4 ARM2 Because the iMX8MQ DDR4 ARM2 has 4GB DDR. To fit new MMU settings, we split it to two banks. The first bank has 3GB DDR, reach to 4GB memory map. The second bank has 1GB DDR, is beyond 4GB memory map. Notice: there is no OPTEE for ARM2 board. The trust zone setting in OPTEE for iMX8MQ EVK is not match with DDR size on ARM2 board. So ARM2 Only can work without OPTEE. Signed-off-by: Ye Li Reviewed-by: Peng Fan --- board/freescale/imx8mq_arm2/imx8mq_arm2.c | 23 +++++++++++++++++------ include/configs/imx8mq_arm2.h | 8 ++++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/board/freescale/imx8mq_arm2/imx8mq_arm2.c b/board/freescale/imx8mq_arm2/imx8mq_arm2.c index c50d6235cb6..4f1890b3ab1 100644 --- a/board/freescale/imx8mq_arm2/imx8mq_arm2.c +++ b/board/freescale/imx8mq_arm2/imx8mq_arm2.c @@ -137,18 +137,29 @@ int dram_init(void) else gd->ram_size = PHYS_SDRAM_SIZE; +#if CONFIG_NR_DRAM_BANKS > 1 + gd->ram_size += PHYS_SDRAM_2_SIZE; +#endif + return 0; } int dram_init_banksize(void) { gd->bd->bi_dram[0].start = PHYS_SDRAM; - gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE; + if (rom_pointer[1]) + gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE -rom_pointer[1]; + else + gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE; + +#if CONFIG_NR_DRAM_BANKS > 1 + gd->bd->bi_dram[1].start = PHYS_SDRAM_2; + gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; +#endif return 0; } - #ifdef CONFIG_OF_BOARD_SETUP int ft_board_setup(void *blob, bd_t *bd) { @@ -317,8 +328,8 @@ int board_late_init(void) phys_size_t get_effective_memsize(void) { - if (PHYS_SDRAM_SIZE > 0xc0000000) - return 0xc0000000; - - return PHYS_SDRAM_SIZE; + if (rom_pointer[1]) + return (PHYS_SDRAM_SIZE - rom_pointer[1]); + else + return PHYS_SDRAM_SIZE; } diff --git a/include/configs/imx8mq_arm2.h b/include/configs/imx8mq_arm2.h index fc86accbbe8..c9aec6a1660 100644 --- a/include/configs/imx8mq_arm2.h +++ b/include/configs/imx8mq_arm2.h @@ -241,10 +241,14 @@ #define PHYS_SDRAM 0x40000000 #ifdef CONFIG_TARGET_IMX8MQ_DDR3L_ARM2 #define PHYS_SDRAM_SIZE 0x80000000 /* 2GB DDR3L for two rank */ +#define CONFIG_NR_DRAM_BANKS 1 #else -#define PHYS_SDRAM_SIZE 0x100000000 /* 4GB DDR4 */ +#define PHYS_SDRAM_SIZE 0xc0000000 /* 3GB */ +#define PHYS_SDRAM_2 0x100000000 +#define PHYS_SDRAM_2_SIZE 0x40000000 /* 1GB */ +#define CONFIG_NR_DRAM_BANKS 2 #endif -#define CONFIG_NR_DRAM_BANKS 1 + #define CONFIG_SYS_MEMTEST_START PHYS_SDRAM #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + (PHYS_SDRAM_SIZE >> 1)) -- cgit v1.2.3