From: Heiko Schocher Date: Wed, 1 Jun 2011 08:24:06 +0200 Subject: [U-Boot] [PATCH] post, arm, memorytest: add support for arm based boards In-Reply-To: <1306909447-19603-1-git-send-email-hs@denx.de> References: <1306909447-19603-1-git-send-email-hs@denx.de> Message-ID: <1306909447-19603-2-git-send-email-hs@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Signed-off-by: Heiko Schocher --- post/drivers/memory.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/post/drivers/memory.c b/post/drivers/memory.c index b7943ef..47b312d 100644 --- a/post/drivers/memory.c +++ b/post/drivers/memory.c @@ -455,10 +455,30 @@ static int memory_post_tests (unsigned long start, unsigned long size) __attribute__((weak)) int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t *phys_offset) { +#if defined(CONFIG_ARM) + bd_t *bd = gd->bd; + int i; + + *size = 0; + for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { + if (i == 0) { + *vstart = bd->bi_dram[0].start; + *size += bd->bi_dram[i].size; + } else { + if (bd->bi_dram[i].start == + (bd->bi_dram[i - 1].start + bd->bi_dram[i - 1].size)) { + *size += bd->bi_dram[i].size; + } else { + break; + } + } + } +#else bd_t *bd = gd->bd; *vstart = CONFIG_SYS_SDRAM_BASE; *size = (bd->bi_memsize >= 256 << 20 ? 256 << 20 : bd->bi_memsize) - (1 << 20); +#endif /* Limit area to be tested with the board info struct */ if ((*vstart) + (*size) > (ulong)bd) -- 1.7.4.4