spl: fix assignment of board info to global data

Commit 15eb1d43bf ("spl: reorder the assignment of board info to
global data") intended to move assignment of board info earlier,
into board_init_r(). However, function preload_console_init() is
called either from spl_board_init() or from board_init_f(). For the
latter case, the board info assignment is much earlier than proposed
board_init_r(). Create a new function to fill gd->bd and call this
function when needed.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Ravi Babu <ravibabu@ti.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
York Sun 2017-09-28 08:42:10 -07:00
parent c48deb9073
commit d1fc0a31b5
3 changed files with 11 additions and 1 deletions

View file

@ -80,6 +80,7 @@ void board_init_f(ulong dummy)
get_clocks(); get_clocks();
preloader_console_init(); preloader_console_init();
spl_set_bd();
#ifdef CONFIG_SPL_I2C_SUPPORT #ifdef CONFIG_SPL_I2C_SUPPORT
i2c_init_all(); i2c_init_all();

View file

@ -258,6 +258,12 @@ static int spl_common_init(bool setup_malloc)
return 0; return 0;
} }
void spl_set_bd(void)
{
if (!gd->bd)
gd->bd = &bdata;
}
int spl_early_init(void) int spl_early_init(void)
{ {
int ret; int ret;
@ -365,7 +371,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
struct spl_image_info spl_image; struct spl_image_info spl_image;
debug(">>spl:board_init_r()\n"); debug(">>spl:board_init_r()\n");
gd->bd = &bdata;
spl_set_bd();
#ifdef CONFIG_SPL_OS_BOOT #ifdef CONFIG_SPL_OS_BOOT
dram_init_banksize(); dram_init_banksize();
#endif #endif

View file

@ -68,6 +68,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
void preloader_console_init(void); void preloader_console_init(void);
u32 spl_boot_device(void); u32 spl_boot_device(void);
u32 spl_boot_mode(const u32 boot_device); u32 spl_boot_mode(const u32 boot_device);
void spl_set_bd(void);
/** /**
* spl_set_header_raw_uboot() - Set up a standard SPL image structure * spl_set_header_raw_uboot() - Set up a standard SPL image structure