From: Marek Vasut Date: Mon, 16 Apr 2018 22:44:50 +0200 Subject: [U-Boot] [PATCH 1/3] common: Let board decide if env should be loaded Message-ID: <20180416204452.10906-1-marek.vasut+renesas@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 Cc: Nobuhiro Iwamatsu Cc: Tom Rini --- 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