diff mbox

[U-Boot,v2,01/10] board_f: Add a mach_cpu_init callback

Message ID 20160909134412.24643-2-paul.burton@imgtec.com
State Accepted
Commit 8ebf50692ee9694e1b4baa61228376e83c0e106e
Delegated to: Daniel Schwierzeck
Headers show

Commit Message

Paul Burton Sept. 9, 2016, 1:44 p.m. UTC
Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>

---

Changes in v2:
- Use a weak function, make it generic not MIPS-specific

 common/board_f.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Simon Glass Sept. 19, 2016, 12:57 a.m. UTC | #1
On 9 September 2016 at 07:44, Paul Burton <paul.burton@imgtec.com> wrote:
> Currently we have a mismash of architectures which use arch_cpu_init
> from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
> and architectures which use arch_cpu_init from machine/SoC level code
> (arm, x86).
>
> In order to clean this mess up & allow for both use cases, introduce a
> new mach_cpu_init callback which is run immediately after arch_cpu_init.
> This will allow for architectures to have arch-wide code without needing
> individual machines to all implement their own arch_cpu_init with a call
> to some common function.
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
>
> ---
>
> Changes in v2:
> - Use a weak function, make it generic not MIPS-specific
>
>  common/board_f.c | 6 ++++++
>  1 file changed, 6 insertions(+)

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

Patch

diff --git a/common/board_f.c b/common/board_f.c
index da381db..9ef998f 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -290,6 +290,11 @@  __weak int arch_cpu_init(void)
 	return 0;
 }
 
+__weak int mach_cpu_init(void)
+{
+	return 0;
+}
+
 #ifdef CONFIG_SANDBOX
 static int setup_ram_buf(void)
 {
@@ -860,6 +865,7 @@  static init_fnc_t init_sequence_f[] = {
 	x86_fsp_init,
 #endif
 	arch_cpu_init,		/* basic arch cpu dependent setup */
+	mach_cpu_init,		/* SoC/machine dependent CPU setup */
 	initf_dm,
 	arch_cpu_init_dm,
 	mark_bootstage,		/* need timer, go after init dm */