aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Austin <jonathan.austin@arm.com>2016-08-30 12:31:22 -0400
committerRussell King <rmk+kernel@armlinux.org.uk>2016-09-06 10:51:08 -0400
commitbc0ee9d24ad21a5c2b5944f66623a02e9c8831aa (patch)
tree8bcff63e1b50e2d1c7211935092cff827867cded
parent9a1af5f2206bd303ed201c6895c42ac3ac120a20 (diff)
ARM: 8607/1: V7M: Wire up caches for V7M processors with cache support.
This patch does the plumbing required to invoke the V7M cache code added in earlier patches in this series, although there is no users for that yet. In order to honour the I/D cache disable config options, this patch changes the mechanism by which the CCR is set on boot, to be more like V7A/R. Signed-off-by: Jonathan Austin <jonathan.austin@arm.com> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com> Tested-by: Andras Szemzo <sza@esh.hu> Tested-by: Joachim Eastwood <manabian@gmail.com> Tested-by: Alexandre TORGUE <alexandre.torgue@st.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/include/asm/glue-cache.h4
-rw-r--r--arch/arm/kernel/head-nommu.S16
-rw-r--r--arch/arm/mm/Kconfig10
-rw-r--r--arch/arm/mm/Makefile2
-rw-r--r--arch/arm/mm/proc-v7m.S5
5 files changed, 26 insertions, 11 deletions
diff --git a/arch/arm/include/asm/glue-cache.h b/arch/arm/include/asm/glue-cache.h
index cab07f69382d..01c3d92624e5 100644
--- a/arch/arm/include/asm/glue-cache.h
+++ b/arch/arm/include/asm/glue-cache.h
@@ -118,11 +118,7 @@
118#endif 118#endif
119 119
120#if defined(CONFIG_CPU_V7M) 120#if defined(CONFIG_CPU_V7M)
121# ifdef _CACHE
122# define MULTI_CACHE 1 121# define MULTI_CACHE 1
123# else
124# define _CACHE nop
125# endif
126#endif 122#endif
127 123
128#if !defined(_CACHE) && !defined(MULTI_CACHE) 124#if !defined(_CACHE) && !defined(MULTI_CACHE)
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index fb1a69eb49c1..6b4eb27b8758 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -158,7 +158,21 @@ __after_proc_init:
158 bic r0, r0, #CR_V 158 bic r0, r0, #CR_V
159#endif 159#endif
160 mcr p15, 0, r0, c1, c0, 0 @ write control reg 160 mcr p15, 0, r0, c1, c0, 0 @ write control reg
161#endif /* CONFIG_CPU_CP15 */ 161#elif defined (CONFIG_CPU_V7M)
162 /* For V7M systems we want to modify the CCR similarly to the SCTLR */
163#ifdef CONFIG_CPU_DCACHE_DISABLE
164 bic r0, r0, #V7M_SCB_CCR_DC
165#endif
166#ifdef CONFIG_CPU_BPREDICT_DISABLE
167 bic r0, r0, #V7M_SCB_CCR_BP
168#endif
169#ifdef CONFIG_CPU_ICACHE_DISABLE
170 bic r0, r0, #V7M_SCB_CCR_IC
171#endif
172 movw r3, #:lower16:(BASEADDR_V7M_SCB + V7M_SCB_CCR)
173 movt r3, #:upper16:(BASEADDR_V7M_SCB + V7M_SCB_CCR)
174 str r0, [r3]
175#endif /* CONFIG_CPU_CP15 elif CONFIG_CPU_V7M */
162 ret lr 176 ret lr
163ENDPROC(__after_proc_init) 177ENDPROC(__after_proc_init)
164 .ltorg 178 .ltorg
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index d15a7fe51618..e613122e5e1b 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -403,6 +403,7 @@ config CPU_V7M
403 bool 403 bool
404 select CPU_32v7M 404 select CPU_32v7M
405 select CPU_ABRT_NOMMU 405 select CPU_ABRT_NOMMU
406 select CPU_CACHE_V7M
406 select CPU_CACHE_NOP 407 select CPU_CACHE_NOP
407 select CPU_PABRT_LEGACY 408 select CPU_PABRT_LEGACY
408 select CPU_THUMBONLY 409 select CPU_THUMBONLY
@@ -518,6 +519,9 @@ config CPU_CACHE_VIPT
518config CPU_CACHE_FA 519config CPU_CACHE_FA
519 bool 520 bool
520 521
522config CPU_CACHE_V7M
523 bool
524
521if MMU 525if MMU
522# The copy-page model 526# The copy-page model
523config CPU_COPY_V4WT 527config CPU_COPY_V4WT
@@ -750,14 +754,14 @@ config CPU_HIGH_VECTOR
750 754
751config CPU_ICACHE_DISABLE 755config CPU_ICACHE_DISABLE
752 bool "Disable I-Cache (I-bit)" 756 bool "Disable I-Cache (I-bit)"
753 depends on CPU_CP15 && !(CPU_ARM720T || CPU_ARM740T || CPU_XSCALE || CPU_XSC3) 757 depends on (CPU_CP15 && !(CPU_ARM720T || CPU_ARM740T || CPU_XSCALE || CPU_XSC3)) || CPU_V7M
754 help 758 help
755 Say Y here to disable the processor instruction cache. Unless 759 Say Y here to disable the processor instruction cache. Unless
756 you have a reason not to or are unsure, say N. 760 you have a reason not to or are unsure, say N.
757 761
758config CPU_DCACHE_DISABLE 762config CPU_DCACHE_DISABLE
759 bool "Disable D-Cache (C-bit)" 763 bool "Disable D-Cache (C-bit)"
760 depends on CPU_CP15 && !SMP 764 depends on (CPU_CP15 && !SMP) || CPU_V7M
761 help 765 help
762 Say Y here to disable the processor data cache. Unless 766 Say Y here to disable the processor data cache. Unless
763 you have a reason not to or are unsure, say N. 767 you have a reason not to or are unsure, say N.
@@ -792,7 +796,7 @@ config CPU_CACHE_ROUND_ROBIN
792 796
793config CPU_BPREDICT_DISABLE 797config CPU_BPREDICT_DISABLE
794 bool "Disable branch prediction" 798 bool "Disable branch prediction"
795 depends on CPU_ARM1020 || CPU_V6 || CPU_V6K || CPU_MOHAWK || CPU_XSC3 || CPU_V7 || CPU_FA526 799 depends on CPU_ARM1020 || CPU_V6 || CPU_V6K || CPU_MOHAWK || CPU_XSC3 || CPU_V7 || CPU_FA526 || CPU_V7M
796 help 800 help
797 Say Y here to disable branch prediction. If unsure, say N. 801 Say Y here to disable branch prediction. If unsure, say N.
798 802
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index 7f76d96ce546..e75abaeb16db 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -43,9 +43,11 @@ obj-$(CONFIG_CPU_CACHE_V6) += cache-v6.o
43obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o 43obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o
44obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o 44obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o
45obj-$(CONFIG_CPU_CACHE_NOP) += cache-nop.o 45obj-$(CONFIG_CPU_CACHE_NOP) += cache-nop.o
46obj-$(CONFIG_CPU_CACHE_V7M) += cache-v7m.o
46 47
47AFLAGS_cache-v6.o :=-Wa,-march=armv6 48AFLAGS_cache-v6.o :=-Wa,-march=armv6
48AFLAGS_cache-v7.o :=-Wa,-march=armv7-a 49AFLAGS_cache-v7.o :=-Wa,-march=armv7-a
50AFLAGS_cache-v7m.o :=-Wa,-march=armv7-m
49 51
50obj-$(CONFIG_CPU_COPY_V4WT) += copypage-v4wt.o 52obj-$(CONFIG_CPU_COPY_V4WT) += copypage-v4wt.o
51obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o 53obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o
diff --git a/arch/arm/mm/proc-v7m.S b/arch/arm/mm/proc-v7m.S
index 7229d8d0be1a..11f5816e2680 100644
--- a/arch/arm/mm/proc-v7m.S
+++ b/arch/arm/mm/proc-v7m.S
@@ -118,9 +118,8 @@ __v7m_setup:
118 118
119 @ Configure the System Control Register to ensure 8-byte stack alignment 119 @ Configure the System Control Register to ensure 8-byte stack alignment
120 @ Note the STKALIGN bit is either RW or RAO. 120 @ Note the STKALIGN bit is either RW or RAO.
121 ldr r12, [r0, V7M_SCB_CCR] @ system control register 121 ldr r0, [r0, V7M_SCB_CCR] @ system control register
122 orr r12, #V7M_SCB_CCR_STKALIGN 122 orr r0, #V7M_SCB_CCR_STKALIGN
123 str r12, [r0, V7M_SCB_CCR]
124 ret lr 123 ret lr
125ENDPROC(__v7m_setup) 124ENDPROC(__v7m_setup)
126 125