diff mbox series

[U-Boot,v3,1/7] spl: fix assignment of board info to global data

Message ID 1506613337-19467-2-git-send-email-york.sun@nxp.com
State Accepted
Commit d1fc0a31b5f307c92b7a047d4f90d5ad2e54cdcc
Delegated to: York Sun
Headers show
Series Enable falcon boot for LS1043ARDB | expand

Commit Message

York Sun Sept. 28, 2017, 3:42 p.m. UTC
Commit 15eb1d43bf47 ("spl: reorder the assignment of board info to
global data") intended to move assignment of board info earlier,
into board_init_r(). However, function preload_console_init() is
called either from spl_board_init() or from board_init_f(). For the
latter case, the board info assignment is much earlier than proposed
board_init_r(). Create a new function to fill gd->bd and call this
function when needed.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Ravi Babu <ravibabu@ti.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Tom Rini <trini@konsulko.com>

---

Changes in v3:
Create new function to fill gd->bd for spl.
Use git commit description style when mentioning previous commit.

Changes in v2:
New patch to fix spl after rebasing to latest master.

 arch/arm/cpu/armv8/fsl-layerscape/spl.c |  1 +
 common/spl/spl.c                        | 10 +++++++++-
 include/spl.h                           |  1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

Comments

York Sun Oct. 3, 2017, 3:08 p.m. UTC | #1
On 09/28/2017 08:42 AM, York Sun wrote:
> Commit 15eb1d43bf47 ("spl: reorder the assignment of board info to
> global data") intended to move assignment of board info earlier,
> into board_init_r(). However, function preload_console_init() is
> called either from spl_board_init() or from board_init_f(). For the
> latter case, the board info assignment is much earlier than proposed
> board_init_r(). Create a new function to fill gd->bd and call this
> function when needed.
> 
> Signed-off-by: York Sun <york.sun@nxp.com>
> CC: Lokesh Vutla <lokeshvutla@ti.com>
> CC: Ravi Babu <ravibabu@ti.com>
> CC: Lukasz Majewski <lukma@denx.de>
> CC: Tom Rini <trini@konsulko.com>
> 
> ---
> 
> Changes in v3:
> Create new function to fill gd->bd for spl.
> Use git commit description style when mentioning previous commit.
> 

Simon,

Is this version OK?

York
Simon Glass Oct. 9, 2017, 4:44 a.m. UTC | #2
On 28 September 2017 at 09:42, York Sun <york.sun@nxp.com> wrote:
> Commit 15eb1d43bf47 ("spl: reorder the assignment of board info to
> global data") intended to move assignment of board info earlier,
> into board_init_r(). However, function preload_console_init() is
> called either from spl_board_init() or from board_init_f(). For the
> latter case, the board info assignment is much earlier than proposed
> board_init_r(). Create a new function to fill gd->bd and call this
> function when needed.
>
> Signed-off-by: York Sun <york.sun@nxp.com>
> CC: Lokesh Vutla <lokeshvutla@ti.com>
> CC: Ravi Babu <ravibabu@ti.com>
> CC: Lukasz Majewski <lukma@denx.de>
> CC: Tom Rini <trini@konsulko.com>
>
> ---
>
> Changes in v3:
> Create new function to fill gd->bd for spl.
> Use git commit description style when mentioning previous commit.
>
> Changes in v2:
> New patch to fix spl after rebasing to latest master.
>
>  arch/arm/cpu/armv8/fsl-layerscape/spl.c |  1 +
>  common/spl/spl.c                        | 10 +++++++++-
>  include/spl.h                           |  1 +
>  3 files changed, 11 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
York Sun Oct. 13, 2017, 6:34 p.m. UTC | #3
On 09/28/2017 08:42 AM, York Sun wrote:
> Commit 15eb1d43bf47 ("spl: reorder the assignment of board info to
> global data") intended to move assignment of board info earlier,
> into board_init_r(). However, function preload_console_init() is
> called either from spl_board_init() or from board_init_f(). For the
> latter case, the board info assignment is much earlier than proposed
> board_init_r(). Create a new function to fill gd->bd and call this
> function when needed.
> 
> Signed-off-by: York Sun <york.sun@nxp.com>
> CC: Lokesh Vutla <lokeshvutla@ti.com>
> CC: Ravi Babu <ravibabu@ti.com>
> CC: Lukasz Majewski <lukma@denx.de>
> CC: Tom Rini <trini@konsulko.com>
> 
> ---
> 
> Changes in v3:
> Create new function to fill gd->bd for spl.
> Use git commit description style when mentioning previous commit.
> 
> Changes in v2:
> New patch to fix spl after rebasing to latest master.
> 

This set is applied to fsl-qoriq master.

York
diff mbox series

Patch

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/spl.c b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
index 2776240..2534b4b 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/spl.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
@@ -80,6 +80,7 @@  void board_init_f(ulong dummy)
 	get_clocks();
 
 	preloader_console_init();
+	spl_set_bd();
 
 #ifdef CONFIG_SPL_I2C_SUPPORT
 	i2c_init_all();
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 4afbe97..aaddddd 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -258,6 +258,12 @@  static int spl_common_init(bool setup_malloc)
 	return 0;
 }
 
+void spl_set_bd(void)
+{
+	if (!gd->bd)
+		gd->bd = &bdata;
+}
+
 int spl_early_init(void)
 {
 	int ret;
@@ -365,7 +371,9 @@  void board_init_r(gd_t *dummy1, ulong dummy2)
 	struct spl_image_info spl_image;
 
 	debug(">>spl:board_init_r()\n");
-	gd->bd = &bdata;
+
+	spl_set_bd();
+
 #ifdef CONFIG_SPL_OS_BOOT
 	dram_init_banksize();
 #endif
diff --git a/include/spl.h b/include/spl.h
index ce4cf0a..b14a29c 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -68,6 +68,7 @@  int spl_load_simple_fit(struct spl_image_info *spl_image,
 void preloader_console_init(void);
 u32 spl_boot_device(void);
 u32 spl_boot_mode(const u32 boot_device);
+void spl_set_bd(void);
 
 /**
  * spl_set_header_raw_uboot() - Set up a standard SPL image structure