]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
xilinx: common: Separate display cpu info function
authorStefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Mon, 20 Jun 2022 16:36:45 +0000 (18:36 +0200)
committerMichal Simek <michal.simek@amd.com>
Fri, 24 Jun 2022 12:37:27 +0000 (14:37 +0200)
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@weidmueller.com>
Link: https://lore.kernel.org/r/20220620163650.18756-10-stefan.herbrechtsmeier-oss@weidmueller.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
board/xilinx/common/Makefile
board/xilinx/common/board.c
board/xilinx/common/cpu-info.c [new file with mode: 0644]

index 212028478c0e275089b7a9d1728871e7d15f6aa2..cdc3c9677432ef30452e7f4e241571b1834ac58d 100644 (file)
@@ -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
index 402fa770063fea55d9c49e4129344d922105d5f3..5f2afb9def4eef68441198bfc161c4c6f52dae9d 100644 (file)
@@ -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 (file)
index 0000000..4a863d0
--- /dev/null
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2014 - 2020 Xilinx, Inc.
+ * Michal Simek <michal.simek@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;
+}