common: Let board decide if env should be loaded
PATCH 1/3 common: Let board decide if env should be loaded
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
--- common/board_r.c | 9 +++++++++ 1 file changed, 9 insertions(+)
common/board_r.c +9 -0
@@ -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 definedCONFIG_DELAY_ENVIRONMENT
Signature · 1 line
2.16.2
PATCH 2/3 ARM: rmobile: Ignore U-Boot env when started via JTAG on Porter
When U-Boot is started via JTAG, ignore the installed environment as it may interfere with the recovery of the board.
--- board/renesas/porter/porter.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
board/renesas/porter/porter.c +10 -0
@@ -136,3 +136,13 @@ void reset_cpu(ulong addr)if (ret)hang (); } + +int board_should_load_env (void ) +{ +const u32 load_magic =0xb33fc0de ; + +if (readl (CONFIG_SPL_TEXT_BASE +0x24 ) == load_magic) +return 0 ; + +return -EAGAIN ; +}
Signature · 1 line
2.16.2
PATCH 3/3 ARM: rmobile: Ignore U-Boot env when started via JTAG on Stout
In reply to Marek VasutWhen U-Boot is started via JTAG, ignore the installed environment as it may interfere with the recovery of the board.
--- board/renesas/stout/stout.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
board/renesas/stout/stout.c +10 -0
@@ -128,3 +128,13 @@ int board_phy_config(struct phy_device *phydev)const struct rmobile_sysinfo sysinfo = {CONFIG_ARCH_RMOBILE_BOARD_STRING }; + +int board_should_load_env (void ) +{ +const u32 load_magic =0xb33fc0de ; + +if (readl (CONFIG_SPL_TEXT_BASE +0x24 ) == load_magic) +return 0 ; + +return -EAGAIN ; +}
Signature · 1 line
2.16.2
PATCH 1/3 common: Let board decide if env should be loaded
In reply to Marek VasutQuoted 5 lines · Marek Vasut
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.
Quoted 8 lines
The return value of
board_should_load_env()is:
0 - do not load environment
1 - load environment-EAGAIN- default behaviorSigned-off-by Marek Vasut <[email protected]>Cc Nobuhiro Iwamatsu <[email protected]>Cc Tom Rini <[email protected]>
Please ignore, there's a better way to do this.
Signature · 2 lines
Best regards, Marek Vasut