x86: broadwell: Update PCH to work in TPL
authorSimon Glass <sjg@chromium.org>
Thu, 2 May 2019 16:52:26 +0000 (10:52 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Wed, 8 May 2019 05:02:18 +0000 (13:02 +0800)
The early init should only happen once. Update the probe method to
deal with TPL, SPL and U-Boot proper.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/cpu/broadwell/pch.c

index e61efa7b16cd71a672dc4a0b5955a64a31a9e44d..a48945adf11820e2e6da9210ecdcb6474df8172e 100644 (file)
@@ -599,10 +599,16 @@ static int broadwell_pch_init(struct udevice *dev)
 
 static int broadwell_pch_probe(struct udevice *dev)
 {
-       if (!(gd->flags & GD_FLG_RELOC))
-               return broadwell_pch_early_init(dev);
-       else
+       if (CONFIG_IS_ENABLED(X86_32BIT_INIT)) {
+               if (!(gd->flags & GD_FLG_RELOC))
+                       return broadwell_pch_early_init(dev);
+               else
+                       return broadwell_pch_init(dev);
+       } else if (IS_ENABLED(CONFIG_SPL) && !IS_ENABLED(CONFIG_SPL_BUILD)) {
                return broadwell_pch_init(dev);
+       } else {
+               return 0;
+       }
 }
 
 static int broadwell_pch_get_spi_base(struct udevice *dev, ulong *sbasep)