]> Git Repo - J-u-boot.git/blobdiff - arch/x86/cpu/broadwell/cpu.c
xpl: Rename spl_phase() to xpl_phase()
[J-u-boot.git] / arch / x86 / cpu / broadwell / cpu.c
index b77301118cdf2b1fe5d42be62986bf3aef8e4d4f..87463748c4de8a172a8a1e89a9140ea1dca17783 100644 (file)
@@ -5,14 +5,16 @@
  * Based on code from coreboot src/soc/intel/broadwell/cpu.c
  */
 
-#include <common.h>
 #include <dm.h>
 #include <cpu.h>
+#include <event.h>
 #include <init.h>
 #include <log.h>
+#include <spl.h>
 #include <asm/cpu.h>
 #include <asm/cpu_x86.h>
 #include <asm/cpu_common.h>
+#include <asm/global_data.h>
 #include <asm/intel_regs.h>
 #include <asm/lpc_common.h>
 #include <asm/msr.h>
 #include <asm/arch/pch.h>
 #include <asm/arch/rcb.h>
 
-int arch_cpu_init_dm(void)
+static int broadwell_init_cpu(void)
 {
        struct udevice *dev;
        int ret;
 
        /* Start up the LPC so we have serial */
-       ret = uclass_first_device(UCLASS_LPC, &dev);
+       ret = uclass_first_device_err(UCLASS_LPC, &dev);
        if (ret)
                return ret;
-       if (!dev)
-               return -ENODEV;
        ret = cpu_set_flex_ratio_to_tdp_nominal();
        if (ret)
                return ret;
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, broadwell_init_cpu);
 
 void set_max_freq(void)
 {
@@ -66,12 +67,11 @@ int arch_cpu_init(void)
 {
        post_code(POST_CPU_INIT);
 
-#ifdef CONFIG_TPL
        /* Do a mini-init if TPL has already done the full init */
-       return x86_cpu_reinit_f();
-#else
-       return x86_cpu_init_f();
-#endif
+       if (IS_ENABLED(CONFIG_TPL) && xpl_phase() != PHASE_TPL)
+               return x86_cpu_reinit_f();
+       else
+               return x86_cpu_init_f();
 }
 
 int checkcpu(void)
This page took 0.026715 seconds and 4 git commands to generate.