diff mbox series

[v2,09/14] board_f: mips: Factor out mips-specific bdinfo setup

Message ID 20200710101907.11214-9-ovidiu.panait@windriver.com
State Superseded
Delegated to: Tom Rini
Headers show
Series [v2,01/14] Kconfig: Introduce CONFIG_SYS_HAS_SRAM | expand

Commit Message

Ovidiu Panait July 10, 2020, 10:19 a.m. UTC
Factor out mips-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/mips/lib/boot.c. Also, use if(IS_ENABLED())
instead of #ifdef where possible.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
---
v2 updates:
- use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))" instead of 
  "#ifdef CONFIG_SYS_SRAM_BASE"

 arch/mips/lib/boot.c | 18 ++++++++++++++++++
 common/board_f.c     | 25 +------------------------
 2 files changed, 19 insertions(+), 24 deletions(-)

Comments

Simon Glass July 15, 2020, 1:05 a.m. UTC | #1
On Fri, 10 Jul 2020 at 04:25, Ovidiu Panait <ovidiu.panait@windriver.com> wrote:
>
> Factor out mips-specific bdinfo setup from generic init sequence to
> arch_setup_bdinfo in arch/mips/lib/boot.c. Also, use if(IS_ENABLED())
> instead of #ifdef where possible.
>
> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
> ---
> v2 updates:
> - use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))" instead of
>   "#ifdef CONFIG_SYS_SRAM_BASE"
>
>  arch/mips/lib/boot.c | 18 ++++++++++++++++++
>  common/board_f.c     | 25 +------------------------
>  2 files changed, 19 insertions(+), 24 deletions(-)

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

Patch

diff --git a/arch/mips/lib/boot.c b/arch/mips/lib/boot.c
index db862f6379..1ad9993c73 100644
--- a/arch/mips/lib/boot.c
+++ b/arch/mips/lib/boot.c
@@ -9,6 +9,24 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
+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 */
+
+	if (IS_ENABLED(CONFIG_SYS_HAS_SRAM)) {
+		bd->bi_sramstart = CONFIG_SYS_SRAM_BASE;	/* start of SRAM */
+		bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;		/* size  of SRAM */
+	}
+
+	return 0;
+}
+
 unsigned long do_go_exec(ulong (*entry)(int, char * const []),
 			 int argc, char * const argv[])
 {
diff --git a/common/board_f.c b/common/board_f.c
index 9bfcd6b236..fd7e6a17ad 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -602,26 +602,6 @@  __weak int arch_setup_bdinfo(void)
 	return 0;
 }
 
-#if defined(CONFIG_MIPS)
-static int setup_board_part1(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;
-}
-#endif
-
 #ifdef CONFIG_POST
 static int init_post(void)
 {
@@ -942,11 +922,8 @@  static const init_fnc_t init_sequence_f[] = {
 	reserve_stacks,
 	dram_init_banksize,
 	show_dram_config,
-	arch_setup_bdinfo,
-#if defined(CONFIG_MIPS)
-	setup_board_part1,
 	INIT_FUNC_WATCHDOG_RESET
-#endif
+	arch_setup_bdinfo,
 	display_new_sp,
 #ifdef CONFIG_OF_BOARD_FIXUP
 	fix_fdt,