All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] common: Let board decide if env should be loaded
@ 2018-04-16 20:44 Marek Vasut
  2018-04-16 20:44 ` [U-Boot] [PATCH 2/3] ARM: rmobile: Ignore U-Boot env when started via JTAG on Porter Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marek Vasut @ 2018-04-16 20:44 UTC (permalink / raw)
  To: u-boot

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(+)

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 2/3] ARM: rmobile: Ignore U-Boot env when started via JTAG on Porter
  2018-04-16 20:44 [U-Boot] [PATCH 1/3] common: Let board decide if env should be loaded Marek Vasut
@ 2018-04-16 20:44 ` Marek Vasut
  2018-04-16 20:44 ` [U-Boot] [PATCH 3/3] ARM: rmobile: Ignore U-Boot env when started via JTAG on Stout Marek Vasut
  2018-04-17  1:02 ` [U-Boot] [PATCH 1/3] common: Let board decide if env should be loaded Marek Vasut
  2 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2018-04-16 20:44 UTC (permalink / raw)
  To: u-boot

When U-Boot is started via JTAG, ignore the installed environment
as it may interfere with the recovery of the board.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Tom Rini <trini@konsulko.com>
---
 board/renesas/porter/porter.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c
index acd4f91d59..052e1abe08 100644
--- a/board/renesas/porter/porter.c
+++ b/board/renesas/porter/porter.c
@@ -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;
+}
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 3/3] ARM: rmobile: Ignore U-Boot env when started via JTAG on Stout
  2018-04-16 20:44 [U-Boot] [PATCH 1/3] common: Let board decide if env should be loaded Marek Vasut
  2018-04-16 20:44 ` [U-Boot] [PATCH 2/3] ARM: rmobile: Ignore U-Boot env when started via JTAG on Porter Marek Vasut
@ 2018-04-16 20:44 ` Marek Vasut
  2018-04-17  1:02 ` [U-Boot] [PATCH 1/3] common: Let board decide if env should be loaded Marek Vasut
  2 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2018-04-16 20:44 UTC (permalink / raw)
  To: u-boot

When U-Boot is started via JTAG, ignore the installed environment
as it may interfere with the recovery of the board.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Tom Rini <trini@konsulko.com>
---
 board/renesas/stout/stout.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/board/renesas/stout/stout.c b/board/renesas/stout/stout.c
index d7e81292a0..16f4837502 100644
--- a/board/renesas/stout/stout.c
+++ b/board/renesas/stout/stout.c
@@ -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;
+}
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 1/3] common: Let board decide if env should be loaded
  2018-04-16 20:44 [U-Boot] [PATCH 1/3] common: Let board decide if env should be loaded Marek Vasut
  2018-04-16 20:44 ` [U-Boot] [PATCH 2/3] ARM: rmobile: Ignore U-Boot env when started via JTAG on Porter Marek Vasut
  2018-04-16 20:44 ` [U-Boot] [PATCH 3/3] ARM: rmobile: Ignore U-Boot env when started via JTAG on Stout Marek Vasut
@ 2018-04-17  1:02 ` Marek Vasut
  2 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2018-04-17  1:02 UTC (permalink / raw)
  To: u-boot

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.

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-17  1:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-16 20:44 [U-Boot] [PATCH 1/3] common: Let board decide if env should be loaded Marek Vasut
2018-04-16 20:44 ` [U-Boot] [PATCH 2/3] ARM: rmobile: Ignore U-Boot env when started via JTAG on Porter Marek Vasut
2018-04-16 20:44 ` [U-Boot] [PATCH 3/3] ARM: rmobile: Ignore U-Boot env when started via JTAG on Stout Marek Vasut
2018-04-17  1:02 ` [U-Boot] [PATCH 1/3] common: Let board decide if env should be loaded Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.