[PATCH 06/10] xilinx: common: Separate display cpu info function
Stefan Herbrechtsmeier
stefan.herbrechtsmeier-oss at weidmueller.com
Wed Jun 8 18:20:49 CEST 2022
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>
Move the print_cpuinfo function of CONFIG_DISPLAY_CPUINFO into its own
source file to support reuse by other board vendors.
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>
---
board/xilinx/common/Makefile | 3 +++
board/xilinx/common/board.c | 29 ----------------------------
board/xilinx/common/cpu-info.c | 35 ++++++++++++++++++++++++++++++++++
3 files changed, 38 insertions(+), 29 deletions(-)
create mode 100644 board/xilinx/common/cpu-info.c
diff --git a/board/xilinx/common/Makefile b/board/xilinx/common/Makefile
index 212028478c..cdc3c96774 100644
--- a/board/xilinx/common/Makefile
+++ b/board/xilinx/common/Makefile
@@ -5,6 +5,9 @@
#
obj-y += board.o
+ifndef CONFIG_ARCH_ZYNQ
+obj-$(CONFIG_DISPLAY_CPUINFO) += cpu-info.o
+endif
ifndef CONFIG_SPL_BUILD
obj-$(CONFIG_CMD_FRU) += fru.o fru_ops.o
endif
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 402fa77006..5f2afb9def 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -485,35 +485,6 @@ int __maybe_unused board_fit_config_name_match(const char *name)
return -1;
}
-#if defined(CONFIG_DISPLAY_CPUINFO) && !defined(CONFIG_ARCH_ZYNQ)
-int print_cpuinfo(void)
-{
- struct udevice *soc;
- char name[SOC_MAX_STR_SIZE];
- int ret;
-
- ret = soc_get(&soc);
- if (ret) {
- printf("CPU: UNKNOWN\n");
- return 0;
- }
-
- ret = soc_get_family(soc, name, SOC_MAX_STR_SIZE);
- if (ret)
- printf("CPU: %s\n", name);
-
- ret = soc_get_revision(soc, name, SOC_MAX_STR_SIZE);
- if (ret)
- printf("Silicon: %s\n", name);
-
- ret = soc_get_machine(soc, name, SOC_MAX_STR_SIZE);
- if (ret)
- printf("Chip: %s\n", name);
-
- return 0;
-}
-#endif
-
#if CONFIG_IS_ENABLED(DTB_RESELECT)
#define MAX_NAME_LENGTH 50
diff --git a/board/xilinx/common/cpu-info.c b/board/xilinx/common/cpu-info.c
new file mode 100644
index 0000000000..4a863d00de
--- /dev/null
+++ b/board/xilinx/common/cpu-info.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2014 - 2020 Xilinx, Inc.
+ * Michal Simek <michal.simek at xilinx.com>
+ */
+
+#include <common.h>
+#include <soc.h>
+
+int print_cpuinfo(void)
+{
+ struct udevice *soc;
+ char name[SOC_MAX_STR_SIZE];
+ int ret;
+
+ ret = soc_get(&soc);
+ if (ret) {
+ printf("CPU: UNKNOWN\n");
+ return 0;
+ }
+
+ ret = soc_get_family(soc, name, SOC_MAX_STR_SIZE);
+ if (ret)
+ printf("CPU: %s\n", name);
+
+ ret = soc_get_revision(soc, name, SOC_MAX_STR_SIZE);
+ if (ret)
+ printf("Silicon: %s\n", name);
+
+ ret = soc_get_machine(soc, name, SOC_MAX_STR_SIZE);
+ if (ret)
+ printf("Chip: %s\n", name);
+
+ return 0;
+}
--
2.30.2
More information about the U-Boot
mailing list