[U-Boot] [PATCH] post, arm, memorytest: add support for arm based boards
Wolfgang Denk
wd at denx.de
Wed Jun 1 08:37:28 CEST 2011
Dear Heiko Schocher,
In message <1306909447-19603-2-git-send-email-hs at denx.de> you wrote:
> Signed-off-by: Heiko Schocher <hs at denx.de>
> ---
> 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)
This is a weak function, so there should be no need to have #ifdef's
in there.
Just define your own code as you need it.
> + 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;
This is a constant part and should be moved out of the loop. Then
you can also get rid of th if...else clause.
> + } 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;
So how do you handle non-contiguous memory banks? It appears these
are quite frequent on ARM these days.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Beware of bugs in the above code; I have only proved it correct, not
tried it." - Donald Knuth
More information about the U-Boot
mailing list