summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorLokesh Vutla <lokeshvutla@ti.com>2014-05-12 13:49:33 +0530
committerTom Rini <trini@ti.com>2014-05-23 19:40:38 -0400
commitd7630da6f401a68644f8c5fa1ee3b39bcf60972f (patch)
treee18556370ce727193d91238d7391164783541420 /arch
parentd14c6335bcae5fd1909f6280dcfa064bb62c30f0 (diff)
downloadu-boot-imx-d7630da6f401a68644f8c5fa1ee3b39bcf60972f.zip
u-boot-imx-d7630da6f401a68644f8c5fa1ee3b39bcf60972f.tar.gz
u-boot-imx-d7630da6f401a68644f8c5fa1ee3b39bcf60972f.tar.bz2
ARM: OMAP: Fix omap_sdram_size calculation
Last section of DMM is used for trapping tiler unmapped sections. Corresponding trap_size should be deducted from total SDRAM size only if trap section is overlapping with available SDRAM based on DMM sections. Fixing the same. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/armv7/omap-common/hwinit-common.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/arm/cpu/armv7/omap-common/hwinit-common.c b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
index 132454c..ba97d9e 100644
--- a/arch/arm/cpu/armv7/omap-common/hwinit-common.c
+++ b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
@@ -185,7 +185,7 @@ u32 omap_sdram_size(void)
{
u32 section, i, valid;
u64 sdram_start = 0, sdram_end = 0, addr,
- size, total_size = 0, trap_size = 0;
+ size, total_size = 0, trap_size = 0, trap_start = 0;
for (i = 0; i < 4; i++) {
section = __raw_readl(DMM_BASE + i*4);
@@ -208,12 +208,15 @@ u32 omap_sdram_size(void)
sdram_end = addr + size;
} else {
trap_size = size;
+ trap_start = addr;
}
-
}
-
}
- total_size = (sdram_end - sdram_start) - (trap_size);
+
+ if ((trap_start >= sdram_start) && (trap_start < sdram_end))
+ total_size = (sdram_end - sdram_start) - (trap_size);
+ else
+ total_size = sdram_end - sdram_start;
return total_size;
}