diff mbox series

[04/10] board_f: sh: Factor out sh-specific bdinfo setup

Message ID 20200709080457.26850-4-ovidiu.panait@windriver.com
State Superseded
Headers show
Series [01/10] board_f: Introduce arch_setup_bdinfo initcall | expand

Commit Message

Ovidiu Panait July 9, 2020, 8:04 a.m. UTC
Factor out sh-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/sh/lib/board.c.

Signed-off-by: Ovidiu Panait <ovidiu.panait at windriver.com>
---

 arch/sh/lib/board.c | 18 ++++++++++++++++++
 common/board_f.c    |  4 ++--
 2 files changed, 20 insertions(+), 2 deletions(-)

Comments

Simon Glass July 10, 2020, 12:35 a.m. UTC | #1
On Thu, 9 Jul 2020 at 02:08, Ovidiu Panait <ovidiu.panait at windriver.com> wrote:
>
> Factor out sh-specific bdinfo setup from generic init sequence to
> arch_setup_bdinfo in arch/sh/lib/board.c.
>
> Signed-off-by: Ovidiu Panait <ovidiu.panait at windriver.com>
> ---
>
>  arch/sh/lib/board.c | 18 ++++++++++++++++++
>  common/board_f.c    |  4 ++--
>  2 files changed, 20 insertions(+), 2 deletions(-)
>

Reviewed-by: Simon Glass <sjg at chromium.org>
diff mbox series

Patch

diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c
index a6a8f07e6f..32e87e742b 100644
--- a/arch/sh/lib/board.c
+++ b/arch/sh/lib/board.c
@@ -16,6 +16,24 @@  int dram_init(void)
 	return 0;
 }
 
+int arch_setup_bdinfo(void)
+{
+	bd_t *bd = gd->bd;
+
+	/*
+	 * Save local variables to board info struct
+	 */
+	bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;	/* start of memory */
+	bd->bi_memsize = gd->ram_size;			/* size in bytes */
+
+#ifdef CONFIG_SYS_SRAM_BASE
+	bd->bi_sramstart = CONFIG_SYS_SRAM_BASE;	/* start of SRAM */
+	bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;		/* size  of SRAM */
+#endif
+
+	return 0;
+}
+
 void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaddr)
 {
 	void (*reloc_board_init_r)(gd_t *gd, ulong dest) = board_init_r;
diff --git a/common/board_f.c b/common/board_f.c
index 960a9c83db..9bfcd6b236 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -602,7 +602,7 @@  __weak int arch_setup_bdinfo(void)
 	return 0;
 }
 
-#if defined(CONFIG_MIPS) || defined(CONFIG_SH)
+#if defined(CONFIG_MIPS)
 static int setup_board_part1(void)
 {
 	bd_t *bd = gd->bd;
@@ -943,7 +943,7 @@  static const init_fnc_t init_sequence_f[] = {
 	dram_init_banksize,
 	show_dram_config,
 	arch_setup_bdinfo,
-#if defined(CONFIG_MIPS) || defined(CONFIG_SH)
+#if defined(CONFIG_MIPS)
 	setup_board_part1,
 	INIT_FUNC_WATCHDOG_RESET
 #endif