[U-Boot] [PATCH v3 09/11] board_f: Use static print_cpuinfo if CONFIG_CPU is active

Mario Six mario.six at gdsys.cc
Thu May 24 08:42:07 UTC 2018


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.

Signed-off-by: Mario Six <mario.six at gdsys.cc>

---

v2 -> v3:
No changes

v1 -> v2:
New in v2

---
 common/board_f.c | 16 ++++++++++++++++
 include/init.h   |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/common/board_f.c b/common/board_f.c
index a716eeb8990..327c7d83e2c 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -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,21 @@ static int print_resetinfo(void)
 }
 #endif

+#if defined(CONFIG_DISPLAY_CPUINFO) && defined(CONFIG_CPU)
+static int print_cpuinfo(void)
+{
+	struct udevice *dev;
+	char desc[512];
+
+	uclass_first_device_err(UCLASS_CPU, &dev);
+
+	cpu_get_desc(dev, desc, sizeof(desc));
+	printf("%s", desc);
+
+	return 0;
+}
+#endif
+
 static int announce_dram_init(void)
 {
 	puts("DRAM:  ");
diff --git a/include/init.h b/include/init.h
index f114a889631..38c9680c7a7 100644
--- a/include/init.h
+++ b/include/init.h
@@ -107,7 +107,9 @@ int arch_reserve_stacks(void);
  */
 int init_cache_f_r(void);

+#ifndef CONFIG_CPU
 int print_cpuinfo(void);
+#endif
 int timer_init(void);
 int reserve_mmu(void);
 int misc_init_f(void);
--
2.11.0



More information about the U-Boot mailing list