Message ID | 20180416204452.10906-1-marek.vasut+renesas@gmail.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Series | [U-Boot,1/3] common: Let board decide if env should be loaded | expand |
On 04/16/2018 10:44 PM, Marek Vasut wrote: > 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+renesas@gmail.com> > Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> > Cc: Tom Rini <trini@konsulko.com> Please ignore, there's a better way to do this.
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
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+renesas@gmail.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Cc: Tom Rini <trini@konsulko.com> --- common/board_r.c | 9 +++++++++ 1 file changed, 9 insertions(+)