Add board_should_load_env() hook which lets board code decide whether environment should be loaded. This is useful when restoring the board over ie. JTAG where the environment may interfere and where it may be desired to ignore the environment present on the board.
The return value of board_should_load_env() is: 0 - do not load environment 1 - load environment -EAGAIN - default behavior Signed-off-by: Marek Vasut <marek.vasut+rene...@gmail.com> Cc: Nobuhiro Iwamatsu <iwama...@nigauri.org> Cc: Tom Rini <tr...@konsulko.com> --- common/board_r.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index 0f4479a58b..8b68140b57 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -438,8 +438,17 @@ static int initr_mmc(void) * * @return 0 if environment should not be loaded, !=0 if it is ok to load */ +__weak int board_should_load_env(void) +{ + return -EAGAIN; +} + static int should_load_env(void) { + int ret = board_should_load_env(); + + if (ret >= 0) + return ret; #ifdef CONFIG_OF_CONTROL return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 1); #elif defined CONFIG_DELAY_ENVIRONMENT -- 2.16.2 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot