summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/cpu/armv7/tegra-common/board.c34
-rw-r--r--arch/arm/include/asm/arch-tegra/tegra.h2
-rw-r--r--board/toradex/common/board.c28
-rw-r--r--include/configs/apalis_t30.h4
-rw-r--r--include/configs/colibri_t30.h4
5 files changed, 58 insertions, 14 deletions
diff --git a/arch/arm/cpu/armv7/tegra-common/board.c b/arch/arm/cpu/armv7/tegra-common/board.c
index 4dbd139838..c2c8be3b9f 100644
--- a/arch/arm/cpu/armv7/tegra-common/board.c
+++ b/arch/arm/cpu/armv7/tegra-common/board.c
@@ -39,7 +39,7 @@ DECLARE_GLOBAL_DATA_PTR;
unsigned int board_query_sdram_size(void)
{
-#ifndef CONFIG_COLIBRI_T20
+#if !defined(CONFIG_APALIS_T30) && !defined(CONFIG_COLIBRI_T20) && !defined(CONFIG_COLIBRI_T30)
struct pmc_ctlr *const pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
u32 reg;
@@ -63,7 +63,8 @@ unsigned int board_query_sdram_size(void)
default:
return 0x40000000; /* 1GB */
}
-#else /* CONFIG_COLIBRI_T20 */
+#else /* !CONFIG_APALIS_T30 & !CONFIG_COLIBRI_T20 & !CONFIG_COLIBRI_T30 */
+#ifdef CONFIG_COLIBRI_T20
/* Colibri T20 does not use OdmData but rather relies on memory controller
configuration done by boot ROM based on BCT information */
@@ -88,7 +89,36 @@ unsigned int board_query_sdram_size(void)
}
return memsize;
+#else /* CONFIG_COLIBRI_T20 */
+ u32 *mc_emem_cfg = (void *)NV_PA_MC_EMEM_CFG_0;
+
+ u32 reg = readl(mc_emem_cfg);
+
+ /* Aperture in MB */
+ u32 memsize = reg * 1024 * 1024;
+
+ /* Unfortunately it is possible to at least boot a 1 GB module with
+ a 2 GB BCT therefore double check whether we really do have that
+ amount of physical memory */
+ if (memsize > 1024*1024*1024) {
+ volatile u32 *pMem = (void *)((u32)2048*1024*1024);
+ u32 temp = pMem[0];
+ pMem[0] = 0xabadcafe;
+ asm volatile("" ::: "memory");
+ if (pMem[0] == pMem[1024*1024*1024/4])
+ memsize = 0x40000000; /* 1GB */
+ else
+ /*
+ * On tegra3, out of 2GB, 1MB(0xFFF00000 - FFFFFFFF) is used for
+ * Bootcode(IROM) and arm specific exception vector code.
+ */
+ memsize = 0x7ff00000; /* 2GB - 1MB */
+ pMem[0] = temp;
+ }
+
+ return memsize;
#endif /* CONFIG_COLIBRI_T20 */
+#endif /* !CONFIG_APALIS_T30 & !CONFIG_COLIBRI_T20 & !CONFIG_COLIBRI_T30 */
}
#if defined(CONFIG_DISPLAY_BOARDINFO) || defined(CONFIG_DISPLAY_BOARDINFO_LATE)
diff --git a/arch/arm/include/asm/arch-tegra/tegra.h b/arch/arm/include/asm/arch-tegra/tegra.h
index 73cd230e11..dc588ce6b2 100644
--- a/arch/arm/include/asm/arch-tegra/tegra.h
+++ b/arch/arm/include/asm/arch-tegra/tegra.h
@@ -55,6 +55,8 @@
#define TEGRA_DVC_BASE 0x7000D000
#define TEGRA_KBC_BASE 0x7000E200
#define NV_PA_PMC_BASE 0x7000E400
+#define NV_PA_MC_BASE 0x7000F000
+#define NV_PA_MC_EMEM_CFG_0 (NV_PA_MC_BASE + 0x50)
#define NV_PA_EMC_BASE 0x7000F400
#define NV_PA_EMC_ADR_CFG_BASE (NV_PA_EMC_BASE + 0x10)
#define EMEM_DEVSIZE_MASK (0xf << EMEM_DEVSIZE_SHIFT)
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 */
diff --git a/include/configs/apalis_t30.h b/include/configs/apalis_t30.h
index e2c8d45f4a..73fc4f2c23 100644
--- a/include/configs/apalis_t30.h
+++ b/include/configs/apalis_t30.h
@@ -109,12 +109,12 @@
#define CONFIG_LOADADDR 0x80408000
#define CONFIG_EXTRA_ENV_SETTINGS \
CONFIG_STD_DEVICES_SETTINGS \
- "defargs=video=tegrafb vmalloc=256M mem=2036M@2048M core_edp_mv=1300 fbmem=12M@4084M usb_high_speed=1\0" \
+ "defargs=video=tegrafb core_edp_mv=1300 usb_high_speed=1\0" \
"emmcboot=" EMMC_BOOTCMD "\0" \
"mmcargs=ip=off root=/dev/mmcblk0p1 rw,noatime rootfstype=ext3 rootwait\0" \
"mmc_kernel_size=0x4000\0" \
"nfsargs=ip=:::::eth0:on root=/dev/nfs rw netdevwait\0" \
- "setup=setenv setupargs gpt gpt_sector=${gptoffset} igb_mac=${ethaddr} no_console_suspend=1 console=tty1 console=ttyS0,${baudrate}n8 debug_uartport=lsport,0 fbcon=map:1\0" \
+ "setup=setenv setupargs gpt gpt_sector=${gptoffset} igb_mac=${ethaddr} no_console_suspend=1 console=tty1 console=ttyS0,${baudrate}n8 debug_uartport=lsport,0 ${memargs} fbcon=map:1\0" \
"usbboot=" USB_BOOTCMD "\0" \
""
diff --git a/include/configs/colibri_t30.h b/include/configs/colibri_t30.h
index cbbdd1f71d..f8246448a1 100644
--- a/include/configs/colibri_t30.h
+++ b/include/configs/colibri_t30.h
@@ -109,12 +109,12 @@
#define CONFIG_LOADADDR 0x80408000
#define CONFIG_EXTRA_ENV_SETTINGS \
CONFIG_STD_DEVICES_SETTINGS \
- "defargs=video=tegrafb vmalloc=128M mem=1023M@2048M core_edp_mv=1300 tegra_fbmem=3072K@0xBFE00000 usb_high_speed=1\0" \
+ "defargs=video=tegrafb core_edp_mv=1300 usb_high_speed=1\0" \
"emmcboot=" EMMC_BOOTCMD "\0" \
"mmcargs=ip=off root=/dev/mmcblk0p1 rw,noatime rootfstype=ext3 rootwait\0" \
"mmc_kernel_size=0x4000\0" \
"nfsargs=ip=:::::eth0:on root=/dev/nfs rw netdevwait\0" \
- "setup=setenv setupargs gpt gpt_sector=${gptoffset} asix_mac=${ethaddr} no_console_suspend=1 console=tty1 console=ttyS0,${baudrate}n8 debug_uartport=lsport,0\0" \
+ "setup=setenv setupargs gpt gpt_sector=${gptoffset} asix_mac=${ethaddr} no_console_suspend=1 console=tty1 console=ttyS0,${baudrate}n8 debug_uartport=lsport,0 ${memargs}\0" \
"usbboot=" USB_BOOTCMD "\0" \
""