[U-Boot] [PATCH] nds32: fix code/data will be corrupted on ram in rum time

From: rick rick@andestech.com
can not execute get_ram_size(), because the text/data will be corrupted by itself in specific case.
Signed-off-by: rick rick@andestech.com Cc: Andes uboot@andestech.com --- board/AndesTech/adp-ag101p/adp-ag101p.c | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/board/AndesTech/adp-ag101p/adp-ag101p.c b/board/AndesTech/adp-ag101p/adp-ag101p.c index dd8a6653..9866431 100644 --- a/board/AndesTech/adp-ag101p/adp-ag101p.c +++ b/board/AndesTech/adp-ag101p/adp-ag101p.c @@ -34,18 +34,14 @@ int board_init(void)
int dram_init(void) { - unsigned long sdram_base = PHYS_SDRAM_0; - unsigned long expected_size = PHYS_SDRAM_0_SIZE + PHYS_SDRAM_1_SIZE; - unsigned long actual_size; - - actual_size = get_ram_size((void *)sdram_base, expected_size); - - gd->ram_size = actual_size; + /* + * can not execute get_ram_size(), because the + * text will be corrupted by itself + * in specific case + */
- if (expected_size != actual_size) { - printf("Warning: Only %lu of %lu MiB SDRAM is working\n", - actual_size >> 20, expected_size >> 20); - } + unsigned long expected_size = PHYS_SDRAM_0_SIZE + PHYS_SDRAM_1_SIZE; + gd->ram_size = expected_size;
return 0; }

Dear Andes,
In message 1391675928-28370-1-git-send-email-uboot@andestech.com you wrote:
From: rick rick@andestech.com
can not execute get_ram_size(), because the text/data will be corrupted by itself in specific case.
You must be doing something wrong then. Of course you have to run get_ram_size() _before_ relocation to RAM. You cannot test the memory you are executing from.
Best regards,
Wolfgang Denk
participants (2)
-
Andes
-
Wolfgang Denk