aboutsummaryrefslogtreecommitdiff
path: root/arch/mips/cpu
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2016-09-21 11:18:53 +0100
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>2016-09-21 15:04:04 +0200
commitb2b135d980a7171c9b0eefbb38861ccbe9a47f97 (patch)
tree21ec78ca322ced104ccc3066ba9b932b03a89015 /arch/mips/cpu
parent5c72e5a62e998ce374a27b0589328bb284a27c8c (diff)
downloadu-boot-b2b135d980a7171c9b0eefbb38861ccbe9a47f97.zip
u-boot-b2b135d980a7171c9b0eefbb38861ccbe9a47f97.tar.gz
u-boot-b2b135d980a7171c9b0eefbb38861ccbe9a47f97.tar.bz2
MIPS: Map CM Global Control Registers
Map the Global Control Registers (GCRs) provided by the MIPS Coherence Manager (CM) in preparation for using some of them in later patches. Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Diffstat (limited to 'arch/mips/cpu')
-rw-r--r--arch/mips/cpu/Makefile2
-rw-r--r--arch/mips/cpu/cm_init.S45
-rw-r--r--arch/mips/cpu/start.S6
3 files changed, 53 insertions, 0 deletions
diff --git a/arch/mips/cpu/Makefile b/arch/mips/cpu/Makefile
index fc6b455..429fd3a 100644
--- a/arch/mips/cpu/Makefile
+++ b/arch/mips/cpu/Makefile
@@ -7,3 +7,5 @@ extra-y = start.o
obj-y += time.o
obj-y += interrupts.o
obj-y += cpu.o
+
+obj-$(CONFIG_MIPS_CM) += cm_init.o
diff --git a/arch/mips/cpu/cm_init.S b/arch/mips/cpu/cm_init.S
new file mode 100644
index 0000000..ddcaa49
--- /dev/null
+++ b/arch/mips/cpu/cm_init.S
@@ -0,0 +1,45 @@
+/*
+ * MIPS Coherence Manager (CM) Initialisation
+ *
+ * Copyright (c) 2016 Imagination Technologies Ltd.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <asm/addrspace.h>
+#include <asm/asm.h>
+#include <asm/cm.h>
+#include <asm/mipsregs.h>
+#include <asm/regdef.h>
+
+LEAF(mips_cm_map)
+ /* Config3 must exist for a CM to be present */
+ mfc0 t0, CP0_CONFIG, 1
+ bgez t0, 2f
+ mfc0 t0, CP0_CONFIG, 2
+ bgez t0, 2f
+
+ /* Check Config3.CMGCR to determine CM presence */
+ mfc0 t0, CP0_CONFIG, 3
+ and t0, t0, MIPS_CONF3_CMGCR
+ beqz t0, 2f
+
+ /* Find the current physical GCR base address */
+1: MFC0 t0, CP0_CMGCRBASE
+ PTR_SLL t0, t0, 4
+
+ /* If the GCRs are where we want, we're done */
+ PTR_LI t1, CONFIG_MIPS_CM_BASE
+ beq t0, t1, 2f
+
+ /* Move the GCRs to our configured base address */
+ PTR_LI t2, CKSEG1
+ PTR_ADDU t0, t0, t2
+ sw zero, GCR_BASE_UPPER(t0)
+ sw t1, GCR_BASE(t0)
+
+ /* Re-check the GCR base */
+ b 1b
+
+2: jr ra
+ END(mips_cm_map)
diff --git a/arch/mips/cpu/start.S b/arch/mips/cpu/start.S
index 6f1d219..c157d03 100644
--- a/arch/mips/cpu/start.S
+++ b/arch/mips/cpu/start.S
@@ -141,6 +141,12 @@ reset:
1:
PTR_L gp, 0(ra)
+#ifdef CONFIG_MIPS_CM
+ PTR_LA t9, mips_cm_map
+ jalr t9
+ nop
+#endif
+
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
# ifdef CONFIG_SYS_MIPS_CACHE_INIT_RAM_LOAD
/* Initialize any external memory */