From 1cf83224ac11e2ea1a0b3546b27ecd9a59fac247 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Fri, 9 Aug 2013 17:55:11 +0200 Subject: apalis/colibri_t30: implement memory size auto detection In preparation for the new Apalis T30 SKUs implement memory size auto detection based on reading the aperture register set by boot ROM from BCT and a simple mirroring detection. Tested on initial samples of Apalis T30 1GB V1.0A, Apalis T30 2GB V1.0B, Apalis T30 2GB V1.0C and Colibri T30 V1.1C. --- board/toradex/common/board.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'board') diff --git a/board/toradex/common/board.c b/board/toradex/common/board.c index 934266ef6a..dab6e838e8 100644 --- a/board/toradex/common/board.c +++ b/board/toradex/common/board.c @@ -492,15 +492,27 @@ int board_late_init(void) /* Default memory arguments */ if (!getenv("memargs")) { -#if !defined(CONFIG_COLIBRI_T30) && !defined(CONFIG_APALIS_T30) - if (gd->ram_size == 0x10000000) { - /* 256 MB */ - setenv("memargs", "mem=148M@0M fbmem=12M@148M nvmem=96M@160M"); - } else { - /* 512 MB */ - setenv("memargs", "mem=372M@0M fbmem=12M@372M nvmem=128M@384M"); + switch (gd->ram_size) { + case 0x10000000: + /* 256 MB */ + setenv("memargs", "mem=148M@0M fbmem=12M@148M nvmem=96M@160M"); + break; + case 0x20000000: + /* 512 MB */ + setenv("memargs", "mem=372M@0M fbmem=12M@372M nvmem=128M@384M"); + break; + case 0x40000000: + /* 1 GB */ + setenv("memargs", "vmalloc=128M mem=1012M@2048M fbmem=12M@3060M"); + break; + case 0x7ff00000: + case 0x80000000: + /* 2 GB */ + setenv("memargs", "vmalloc=256M mem=2035M@2048M fbmem=12M@4083M"); + break; + default: + printf("Failed detecting RAM size.\n"); } -#endif /* !CONFIG_COLIBRI_T30 && !CONFIG_APALIS_T30 */ } /* Set eMMC or NAND kernel offset */ -- cgit v1.2.3