[U-Boot] [PATCH 2/2] zynq: Support CPU info display

Ezequiel Garcia ezequiel at vanguardiasur.com.ar
Mon Jan 15 15:46:49 UTC 2018


This commit adds CPU and silicon version information
consuming the SLCR IDCODE and DEVCFG MCTRL registers,
respectively.

Signed-off-by: Ariel D'Alessandro <ariel at vanguardiasur.com.ar>
Signed-off-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
---
 arch/arm/mach-zynq/Makefile   |  1 +
 arch/arm/mach-zynq/cpu_info.c | 49 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 arch/arm/mach-zynq/cpu_info.c

diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile
index e3f0117da563..31f1e0d5a8ad 100644
--- a/arch/arm/mach-zynq/Makefile
+++ b/arch/arm/mach-zynq/Makefile
@@ -14,5 +14,6 @@ obj-y	+= ddrc.o
 obj-y	+= slcr.o
 obj-y	+= clk.o
 obj-y	+= lowlevel_init.o
+obj-$(CONFIG_DISPLAY_CPUINFO) += cpu_info.o
 AFLAGS_lowlevel_init.o := -mfpu=neon
 obj-$(CONFIG_SPL_BUILD)	+= spl.o ps7_spl_init.o
diff --git a/arch/arm/mach-zynq/cpu_info.c b/arch/arm/mach-zynq/cpu_info.c
new file mode 100644
index 000000000000..730ccccb73da
--- /dev/null
+++ b/arch/arm/mach-zynq/cpu_info.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2018 VanguardiaSur - www.vanguardiasur.com.ar
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <stdio.h>
+#include <zynqpl.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/ps7_init_gpl.h>
+
+static const struct {
+	u8 idcode;
+	const char *cpuinfo;
+} zynq_cpu_info[] = {
+	{ .idcode = XILINX_ZYNQ_7007S,	.cpuinfo = "7007S" },
+	{ .idcode = XILINX_ZYNQ_7010,	.cpuinfo = "7010" },
+	{ .idcode = XILINX_ZYNQ_7012S,	.cpuinfo = "7012S" },
+	{ .idcode = XILINX_ZYNQ_7014S,	.cpuinfo = "7014S" },
+	{ .idcode = XILINX_ZYNQ_7015,	.cpuinfo = "7015" },
+	{ .idcode = XILINX_ZYNQ_7020,	.cpuinfo = "7020" },
+	{ .idcode = XILINX_ZYNQ_7030,	.cpuinfo = "7030" },
+	{ .idcode = XILINX_ZYNQ_7035,	.cpuinfo = "7035" },
+	{ .idcode = XILINX_ZYNQ_7045,	.cpuinfo = "7045" },
+	{ .idcode = XILINX_ZYNQ_7100,	.cpuinfo = "7100"},
+	{ /* Sentinel */ },
+};
+
+int print_cpuinfo(void)
+{
+	u32 idcode, version;
+	u8 i;
+
+	idcode = zynq_slcr_get_idcode();
+
+	for (i = 0; zynq_cpu_info[i].idcode; i++) {
+		if (zynq_cpu_info[i].idcode == idcode) {
+			printf("CPU:   Zynq %s\n", zynq_cpu_info[i].cpuinfo);
+			break;
+		}
+	}
+
+	version = zynq_get_silicon_version() << 1;
+	if (version > (PCW_SILICON_VERSION_3 << 1))
+		version += 1;
+	printf("Silicon: v%d.%d\n", version >> 1, version & 1);
+	return 0;
+}
-- 
2.15.1



More information about the U-Boot mailing list