diff mbox series

[01/10] board_f: Introduce arch_setup_bdinfo initcall

Message ID 20200709080457.26850-1-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
Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

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

 common/board_f.c |  6 ++++++
 include/init.h   | 12 ++++++++++++
 2 files changed, 18 insertions(+)

Comments

Simon Glass July 10, 2020, 12:35 a.m. UTC | #1
On Thu, 9 Jul 2020 at 02:07, Ovidiu Panait <ovidiu.panait at windriver.com> wrote:
>
> Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
> setup_board_part2 calls during pre-relocation init to populate gd->bd
> boardinfo fields. This makes the generic init sequence cluttered with
> arch-specific ifdefs.
>
> In order to clean these arch-specific sequences from generic init,
> introduce arch_setup_bdinfo weak initcall so that everyone can define their
> own bdinfo setup routines.
>
> Signed-off-by: Ovidiu Panait <ovidiu.panait at windriver.com>
> ---
>
>  common/board_f.c |  6 ++++++
>  include/init.h   | 12 ++++++++++++
>  2 files changed, 18 insertions(+)

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

Patch

diff --git a/common/board_f.c b/common/board_f.c
index dcad551ae4..e597749d2f 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -597,6 +597,11 @@  static int display_new_sp(void)
 	return 0;
 }
 
+__weak int arch_setup_bdinfo(void)
+{
+	return 0;
+}
+
 #if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \
 	defined(CONFIG_SH)
 static int setup_board_part1(void)
@@ -974,6 +979,7 @@  static const init_fnc_t init_sequence_f[] = {
 	reserve_stacks,
 	dram_init_banksize,
 	show_dram_config,
+	arch_setup_bdinfo,
 #if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \
 	defined(CONFIG_SH)
 	setup_board_part1,
diff --git a/include/init.h b/include/init.h
index e727031514..ccb766a348 100644
--- a/include/init.h
+++ b/include/init.h
@@ -141,6 +141,18 @@  int arch_reserve_stacks(void);
  */
 int arch_reserve_mmu(void);
 
+/**
+ * arch_setup_bdinfo() - Architecture dependent boardinfo setup
+ *
+ * Architecture-specific routine for populating various boardinfo fields of
+ * gd->bd. It is called during the generic board init sequence.
+ *
+ * If an implementation is not provided, it will just be a nop stub.
+ *
+ * Return: 0 if OK
+ */
+int arch_setup_bdinfo(void);
+
 /**
  * init_cache_f_r() - Turn on the cache in preparation for relocation
  *