summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv7/omap4
diff options
context:
space:
mode:
authorAneesh V <aneesh@ti.com>2010-09-12 10:32:55 +0530
committerSandeep Paulraj <s-paulraj@ti.com>2010-09-28 13:54:43 -0400
commit7ca3f9c5688b9f42d8dcc765c0f982be6542f4b3 (patch)
tree6bac5e2d18e2ced2f98f6d9148a05fa3e4294534 /arch/arm/cpu/armv7/omap4
parentc1244e852f06346a65ffa433b172fef8dfe33032 (diff)
downloadu-boot-imx-7ca3f9c5688b9f42d8dcc765c0f982be6542f4b3.zip
u-boot-imx-7ca3f9c5688b9f42d8dcc765c0f982be6542f4b3.tar.gz
u-boot-imx-7ca3f9c5688b9f42d8dcc765c0f982be6542f4b3.tar.bz2
ARMV7: OMAP4: Calculate SDRAM size
Calculate the SDRAM size from DMM configuration registers instead of using hard-coded values. This gives correct values for all different boards. It's assumed that DMM sections do not overlap memory areas. Signed-off-by: Aneesh V <aneesh@ti.com> Tested-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
Diffstat (limited to 'arch/arm/cpu/armv7/omap4')
-rw-r--r--arch/arm/cpu/armv7/omap4/board.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c
index 195be6e..8c1f395 100644
--- a/arch/arm/cpu/armv7/omap4/board.c
+++ b/arch/arm/cpu/armv7/omap4/board.c
@@ -30,6 +30,7 @@
#include <common.h>
#include <asm/arch/cpu.h>
#include <asm/arch/sys_proto.h>
+#include <asm/sizes.h>
/*
* Routine: s_init
@@ -66,6 +67,33 @@ void watchdog_init(void)
writel(WD_UNLOCK2, &wd2_base->wspr);
}
+
+/*
+ * This function finds the SDRAM size available in the system
+ * based on DMM section configurations
+ * This is needed because the size of memory installed may be
+ * different on different versions of the board
+ */
+u32 sdram_size(void)
+{
+ u32 section, i, total_size = 0, size, addr;
+ for (i = 0; i < 4; i++) {
+ section = __raw_readl(DMM_LISA_MAP_BASE + i*4);
+ addr = section & DMM_LISA_MAP_SYS_ADDR_MASK;
+ /* See if the address is valid */
+ if ((addr >= OMAP44XX_DRAM_ADDR_SPACE_START) &&
+ (addr < OMAP44XX_DRAM_ADDR_SPACE_END)) {
+ size = ((section & DMM_LISA_MAP_SYS_SIZE_MASK) >>
+ DMM_LISA_MAP_SYS_SIZE_SHIFT);
+ size = 1 << size;
+ size *= SZ_16M;
+ total_size += size;
+ }
+ }
+ return total_size;
+}
+
+
/*
* Routine: dram_init
* Description: sets uboots idea of sdram size
@@ -75,7 +103,7 @@ int dram_init(void)
DECLARE_GLOBAL_DATA_PTR;
gd->bd->bi_dram[0].start = 0x80000000;
- gd->bd->bi_dram[0].size = 512 << 20;
+ gd->bd->bi_dram[0].size = sdram_size();
return 0;
}