board_f: Use static print_cpuinfo if CONFIG_CPU is active
authorMario Six <mario.six@gdsys.cc>
Mon, 6 Aug 2018 08:23:41 +0000 (10:23 +0200)
committerSimon Glass <sjg@chromium.org>
Tue, 18 Sep 2018 14:12:16 +0000 (08:12 -0600)
When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>
common/board_f.c
include/init.h

index afafec5e4d02657926f164f7a06abaf76914e851..213d0440667f871812d039ba03061058662bebc4 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <cpu.h>
 #include <dm.h>
 #include <environment.h>
 #include <fdtdec.h>
@@ -165,6 +166,33 @@ static int print_resetinfo(void)
 }
 #endif
 
+#if defined(CONFIG_DISPLAY_CPUINFO) && CONFIG_IS_ENABLED(CPU)
+static int print_cpuinfo(void)
+{
+       struct udevice *dev;
+       char desc[512];
+       int ret;
+
+       ret = uclass_first_device_err(UCLASS_CPU, &dev);
+       if (ret) {
+               debug("%s: Could not get CPU device (err = %d)\n",
+                     __func__, ret);
+               return ret;
+       }
+
+       ret = cpu_get_desc(dev, desc, sizeof(desc));
+       if (ret) {
+               debug("%s: Could not get CPU description (err = %d)\n",
+                     dev->name, ret);
+               return ret;
+       }
+
+       printf("%s", desc);
+
+       return 0;
+}
+#endif
+
 static int announce_dram_init(void)
 {
        puts("DRAM:  ");
index a58d7a6917f23625d59e24200d7448a90c56a03d..afc953d51e2d07cdbcde9459b7c2d275c3e60dee 100644 (file)
@@ -109,7 +109,14 @@ int arch_reserve_stacks(void);
  */
 int init_cache_f_r(void);
 
+#if !CONFIG_IS_ENABLED(CPU)
+/**
+ * print_cpuinfo() - Display information about the CPU
+ *
+ * Return: 0 if OK, -ve on error
+ */
 int print_cpuinfo(void);
+#endif
 int timer_init(void);
 int reserve_mmu(void);
 int misc_init_f(void);