[U-Boot] [PATCH 20/29] blackfin: Set up bd_info later
Simon Glass
sjg at chromium.org
Thu Dec 15 04:27:51 CET 2016
At present bd_info is set up very early in boot, before board_init_f() is
called. But the board info is supposed to be allocated in board_init_f(),
with a call to reserve_board().
To fix this, drop the current static variable for board info and set up
the information at the end of the board_init_f() init sequence, just
before relocating.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
arch/blackfin/cpu/cpu.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/arch/blackfin/cpu/cpu.c b/arch/blackfin/cpu/cpu.c
index afb2b0a..a8aaee4 100644
--- a/arch/blackfin/cpu/cpu.c
+++ b/arch/blackfin/cpu/cpu.c
@@ -65,24 +65,8 @@ static inline void serial_early_puts(const char *s)
#endif
}
-static int global_board_data_init(void)
+static int board_data_init(bd_t *bd)
{
-#ifndef CONFIG_SYS_BD_INFO_ADDR
-# define CONFIG_SYS_BD_INFO_ADDR 0
-#endif
-
- bd_t *bd;
-
- if (CONFIG_SYS_BD_INFO_ADDR) {
- bd = (bd_t *)(CONFIG_SYS_BD_INFO_ADDR);
- memset(bd, 0, GENERATED_BD_INFO_SIZE);
- } else {
- static bd_t _bfin_bd;
- bd = &_bfin_bd;
- }
-
- gd->bd = bd;
-
bd->bi_r_version = version_string;
bd->bi_cpu = __stringify(CONFIG_BFIN_CPU);
bd->bi_board_name = CONFIG_SYS_BOARD;
@@ -347,11 +331,13 @@ void cpu_init_f(ulong bootflag, ulong loaded_from_ldr)
serial_early_puts("Init global data\n");
gd->ram_size = CONFIG_SYS_MAX_RAM_SIZE;
- global_board_data_init();
}
void relocate_code(ulong sp, gd_t *new_gd, ulong relocaddr)
{
+ /* Set up the board data now, since we have a valid bd pointer */
+ board_data_init(new_gd->bd);
+
/* Jump to board_init_r() with a new stack */
asm_relocate_code(sp, new_gd);
}
--
2.8.0.rc3.226.g39d4020
More information about the U-Boot
mailing list