From 86ceedd84e2052db5497dbb51fa373d3229d83e1 Mon Sep 17 00:00:00 2001 From: Stefan Herbrechtsmeier Date: Mon, 20 Jun 2022 18:36:45 +0200 Subject: xilinx: common: Separate display cpu info function 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 Link: https://lore.kernel.org/r/20220620163650.18756-10-stefan.herbrechtsmeier-oss@weidmueller.com Signed-off-by: Michal Simek --- board/xilinx/common/cpu-info.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 board/xilinx/common/cpu-info.c (limited to 'board/xilinx/common/cpu-info.c') diff --git a/board/xilinx/common/cpu-info.c b/board/xilinx/common/cpu-info.c new file mode 100644 index 00000000000..4a863d00dec --- /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 + */ + +#include +#include + +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; +} -- cgit v1.2.3