summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2013-08-09 17:55:11 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2013-08-12 10:16:58 +0200
commit1cf83224ac11e2ea1a0b3546b27ecd9a59fac247 (patch)
tree5dc5de2cbfc4570561fd78c4356bdfc823a97261 /board
parent658a5957747cd3f2d1d90f4983fec28a116851cd (diff)
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.
Diffstat (limited to 'board')
-rw-r--r--board/toradex/common/board.c28
1 files changed, 20 insertions, 8 deletions
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 */