riscv: ax25-ae350: Pass dtb address to u-boot with a1 register
authorRick Chen <rick@andestech.com>
Mon, 3 Dec 2018 09:48:20 +0000 (17:48 +0800)
committerAndes <uboot@andestech.com>
Wed, 5 Dec 2018 06:14:16 +0000 (14:14 +0800)
ax25-ae350 use CONFIG_OF_BOARD via a2 and CONFIG_SYS_SDRAM_BASE
to boot from ram which allow the board to override the fdt
address originally.

But after this patch
riscv: save hart ID and device tree passed by prior boot stage
It provide prior_stage_fdt_address which offer a temporary
memory address to keep the dtb address passing from loader(gdb)
to u-boot with a1.

So passing via a2 and CONFIG_SYS_SDRAM_BASE is redundant and
can be removed. And it also somehow may corrupted BBL if it
was be arranged in CONFIG_SYS_SDRAM_BASE.

In board_fdt_blob_setup()
When boting from ram:
prior_stage_fdt_address will be use to reserved dtb temporarily.

When booting from ROM:
dtb will be pre-burned in CONFIG_SYS_FDT_BASE, if it is flash base.
Or CONFIG_SYS_FDT_BASE maybe a memory map space (NOT RAM or ROM)
which is provided by HW.

Signed-off-by: Rick Chen <rick@andestech.com>
Cc: Greentime Hu <greentime@andestech.com>
arch/riscv/cpu/start.S
board/AndesTech/ax25-ae350/ax25-ae350.c

index 3f055bdb7ede06a3a1f1451dd6bc58df0d76401e..64246a4e093eb65722f98b8ba783bd9a3a73ccd0 100644 (file)
@@ -38,8 +38,6 @@ _start:
        mv      s0, a0
        mv      s1, a1
 
-       li      t0, CONFIG_SYS_SDRAM_BASE
-       SREG    a2, 0(t0)
        la      t0, trap_entry
        csrw    MODE_PREFIX(tvec), t0
 
index 5f4ca0f5a7433372ed14b1afd68d6259d9039cf4..d343453f22d01a211a03f74d1f47a925881e1fd8 100644 (file)
@@ -14,6 +14,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+extern phys_addr_t prior_stage_fdt_address;
 /*
  * Miscellaneous platform dependent initializations
  */
@@ -66,7 +67,7 @@ ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
 
 void *board_fdt_blob_setup(void)
 {
-       void **ptr = (void *)CONFIG_SYS_SDRAM_BASE;
+       void **ptr = (void *)&prior_stage_fdt_address;
        if (fdt_magic(*ptr) == FDT_MAGIC)
                        return (void *)*ptr;