riscv: prior_stage_fdt_address should only be used when OF_PRIOR_STAGE is enabled
authorRick Chen <rick@andestech.com>
Tue, 30 Apr 2019 05:49:35 +0000 (13:49 +0800)
committerAndes <uboot@andestech.com>
Thu, 9 May 2019 08:46:46 +0000 (16:46 +0800)
This patch will fix prior_stage_fdt_address write failure problem, when
AE350 boots from flash.

When AE350 boots from flash, prior_stage_fdt_address will be flash
address, we shall avoid it to be written.

Signed-off-by: Rick Chen <rick@andestech.com>
Cc: Greentime Hu <greentime@andestech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
arch/riscv/cpu/cpu.c
arch/riscv/cpu/start.S

index 0cfd7d61a78fde1214db13322b3a803ae09d52e7..e9a8b437ed00a516a4fc8224dc447d7f2129d90b 100644 (file)
@@ -15,7 +15,9 @@
  * The variables here must be stored in the data section since they are used
  * before the bss section is available.
  */
+#ifdef CONFIG_OF_PRIOR_STAGE
 phys_addr_t prior_stage_fdt_address __attribute__((section(".data")));
+#endif
 #ifndef CONFIG_XIP
 u32 hart_lottery __attribute__((section(".data"))) = 0;
 
index 3402d09a05426ebeb86dd4935b13432fd1d70c19..60ac8c621e4d20df2d1a6662725091983a6f5e5d 100644 (file)
@@ -111,8 +111,10 @@ call_board_init_f_0:
        bnez    tp, secondary_hart_loop
 #endif
 
+#ifdef CONFIG_OF_PRIOR_STAGE
        la      t0, prior_stage_fdt_address
        SREG    s1, 0(t0)
+#endif
 
        jal     board_init_f_init_reserve