[U-Boot] [PATCH 05/22] RFC: x86: Split up arch_cpu_init()
Simon Glass
sjg at chromium.org
Wed Feb 18 22:10:32 CET 2015
At present we do more in this function than we should. Create a new
x86_post_cpu_init() which can be called from the board file when needed
(e.g. in board_early_init_f(). This allows us to use driver model for
our x86_post_cpu_init() function.
It is likely that some future refactoring will improve this and reduce
the number of steps, using driver model's probing features.
Note: this needs more discussion - e.g. I believe it breaks other x86
boards. We may want to plumb this in differently (e.g. promote
x86_post_cpu_init() to the board_init_f() boot sequence).
Signed-off-by: Simon Glass <sjg at chromium.org>
---
arch/x86/cpu/ivybridge/cpu.c | 8 ++++++++
arch/x86/include/asm/u-boot-x86.h | 1 +
board/google/chromebook_link/link.c | 6 ++++++
3 files changed, 15 insertions(+)
diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c
index 5fd3753..2796314 100644
--- a/arch/x86/cpu/ivybridge/cpu.c
+++ b/arch/x86/cpu/ivybridge/cpu.c
@@ -116,6 +116,14 @@ static void set_spi_speed(void)
int arch_cpu_init(void)
{
+ post_code(POST_CPU_INIT);
+ timer_set_base(rdtsc());
+
+ return x86_cpu_init_f();
+}
+
+int x86_post_cpu_init(void)
+{
const void *blob = gd->fdt_blob;
struct pci_controller *hose;
int node;
diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h
index c743efd..d5a9535 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -38,6 +38,7 @@ void reset_cpu(ulong addr);
ulong board_get_usable_ram_top(ulong total_size);
void dram_init_banksize(void);
int default_print_cpuinfo(void);
+int x86_post_cpu_init(void);
/* Set up a UART which can be used with printch(), printhex8(), etc. */
int setup_early_uart(void);
diff --git a/board/google/chromebook_link/link.c b/board/google/chromebook_link/link.c
index 9978e92..9ebbb9f 100644
--- a/board/google/chromebook_link/link.c
+++ b/board/google/chromebook_link/link.c
@@ -120,6 +120,12 @@ static const struct pch_gpio_map link_gpio_map = {
int board_early_init_f(void)
{
+ int ret;
+
+ ret = x86_post_cpu_init();
+ if (ret)
+ return ret;
+
ich_gpio_set_gpio_map(&link_gpio_map);
return 0;
--
2.2.0.rc0.207.ga3a616c
More information about the U-Boot
mailing list