aboutsummaryrefslogtreecommitdiff
path: root/arch/microblaze/cpu
diff options
context:
space:
mode:
authorOvidiu Panait2022-05-31 21:14:34 +0300
committerMichal Simek2022-06-24 14:16:00 +0200
commit9df16c5937f68654fb2b67f932319c375f8e4e45 (patch)
treeebc707f01f5adb332eda3759a6ded58d81675161 /arch/microblaze/cpu
parent064057fdbee085dba17f7afc298deb9ffbf3382a (diff)
microblaze: add support for handling PVR data
Add helper code for PVR (Processor Version Register) data handling. It will be used by the UCLASS_CPU driver to populate cpuinfo fields at runtime. Signed-off-by: Ovidiu Panait <ovpanait@gmail.com> Link: https://lore.kernel.org/r/20220531181435.3473549-13-ovpanait@gmail.com Signed-off-by: Michal Simek <michal.simek@amd.com>
Diffstat (limited to 'arch/microblaze/cpu')
-rw-r--r--arch/microblaze/cpu/Makefile1
-rw-r--r--arch/microblaze/cpu/pvr.c41
2 files changed, 42 insertions, 0 deletions
diff --git a/arch/microblaze/cpu/Makefile b/arch/microblaze/cpu/Makefile
index 78d7f83597a..ea65a0976ee 100644
--- a/arch/microblaze/cpu/Makefile
+++ b/arch/microblaze/cpu/Makefile
@@ -7,4 +7,5 @@ extra-y = start.o
obj-y = irq.o
obj-y += interrupts.o cache.o exception.o timer.o cpuinfo.o
obj-$(CONFIG_STATIC_RELA) += relocate.o
+obj-$(CONFIG_XILINX_MICROBLAZE0_PVR) += pvr.o
obj-$(CONFIG_SPL_BUILD) += spl.o
diff --git a/arch/microblaze/cpu/pvr.c b/arch/microblaze/cpu/pvr.c
new file mode 100644
index 00000000000..23c0f912d43
--- /dev/null
+++ b/arch/microblaze/cpu/pvr.c
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2022, Ovidiu Panait <ovpanait@gmail.com>
+ */
+#include <common.h>
+#include <asm/asm.h>
+#include <asm/pvr.h>
+
+int microblaze_cpu_has_pvr_full(void)
+{
+ u32 msr, pvr0;
+
+ MFS(msr, rmsr);
+ if (!(msr & PVR_MSR_BIT))
+ return 0;
+
+ get_pvr(0, pvr0);
+ debug("%s: pvr0 is 0x%08x\n", __func__, pvr0);
+
+ if (!(pvr0 & PVR0_PVR_FULL_MASK))
+ return 0;
+
+ return 1;
+}
+
+void microblaze_get_all_pvrs(u32 pvr[PVR_FULL_COUNT])
+{
+ get_pvr(0, pvr[0]);
+ get_pvr(1, pvr[1]);
+ get_pvr(2, pvr[2]);
+ get_pvr(3, pvr[3]);
+ get_pvr(4, pvr[4]);
+ get_pvr(5, pvr[5]);
+ get_pvr(6, pvr[6]);
+ get_pvr(7, pvr[7]);
+ get_pvr(8, pvr[8]);
+ get_pvr(9, pvr[9]);
+ get_pvr(10, pvr[10]);
+ get_pvr(11, pvr[11]);
+ get_pvr(12, pvr[12]);
+}