diff options
author | Jonathan Austin <jonathan.austin@arm.com> | 2016-08-30 12:34:00 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2016-09-06 10:51:08 -0400 |
commit | 6a8146f420be2e59cf511c5a046b762142ff201d (patch) | |
tree | 07b621fd5240ae81efe0361b0bf4dc7c9f612613 | |
parent | c3a6bcbe6a9e7e0d66c279e4a47aa07327040b38 (diff) |
ARM: 8609/1: V7M: Add support for the Cortex-M7 processor
Cortex-M7 is a new member of the V7M processor family that adds, among
other things, caches over the features available in Cortex-M4.
This patch adds support for recognising the processor at boot time, and
make use of recently introduced cache functions.
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/mm/proc-v7m.S | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/arch/arm/mm/proc-v7m.S b/arch/arm/mm/proc-v7m.S index 796a9836cfdb..e6786f007a59 100644 --- a/arch/arm/mm/proc-v7m.S +++ b/arch/arm/mm/proc-v7m.S | |||
@@ -74,14 +74,42 @@ ENTRY(cpu_v7m_do_resume) | |||
74 | ENDPROC(cpu_v7m_do_resume) | 74 | ENDPROC(cpu_v7m_do_resume) |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | ENTRY(cpu_cm7_dcache_clean_area) | ||
78 | dcache_line_size r2, r3 | ||
79 | movw r3, #:lower16:BASEADDR_V7M_SCB + V7M_SCB_DCCMVAC | ||
80 | movt r3, #:upper16:BASEADDR_V7M_SCB + V7M_SCB_DCCMVAC | ||
81 | |||
82 | 1: str r0, [r3] @ clean D entry | ||
83 | add r0, r0, r2 | ||
84 | subs r1, r1, r2 | ||
85 | bhi 1b | ||
86 | dsb | ||
87 | ret lr | ||
88 | ENDPROC(cpu_cm7_dcache_clean_area) | ||
89 | |||
90 | ENTRY(cpu_cm7_proc_fin) | ||
91 | movw r2, #:lower16:(BASEADDR_V7M_SCB + V7M_SCB_CCR) | ||
92 | movt r2, #:upper16:(BASEADDR_V7M_SCB + V7M_SCB_CCR) | ||
93 | ldr r0, [r2] | ||
94 | bic r0, r0, #(V7M_SCB_CCR_DC | V7M_SCB_CCR_IC) | ||
95 | str r0, [r2] | ||
96 | ret lr | ||
97 | ENDPROC(cpu_cm7_proc_fin) | ||
98 | |||
77 | .section ".text.init", #alloc, #execinstr | 99 | .section ".text.init", #alloc, #execinstr |
78 | 100 | ||
101 | __v7m_cm7_setup: | ||
102 | mov r8, #(V7M_SCB_CCR_DC | V7M_SCB_CCR_IC| V7M_SCB_CCR_BP) | ||
103 | b __v7m_setup_cont | ||
79 | /* | 104 | /* |
80 | * __v7m_setup | 105 | * __v7m_setup |
81 | * | 106 | * |
82 | * This should be able to cover all ARMv7-M cores. | 107 | * This should be able to cover all ARMv7-M cores. |
83 | */ | 108 | */ |
84 | __v7m_setup: | 109 | __v7m_setup: |
110 | mov r8, 0 | ||
111 | |||
112 | __v7m_setup_cont: | ||
85 | @ Configure the vector table base address | 113 | @ Configure the vector table base address |
86 | ldr r0, =BASEADDR_V7M_SCB | 114 | ldr r0, =BASEADDR_V7M_SCB |
87 | ldr r12, =vector_table | 115 | ldr r12, =vector_table |
@@ -116,14 +144,32 @@ __v7m_setup: | |||
116 | mov r1, #1 | 144 | mov r1, #1 |
117 | msr control, r1 @ Thread mode has unpriviledged access | 145 | msr control, r1 @ Thread mode has unpriviledged access |
118 | 146 | ||
147 | @ Configure caches (if implemented) | ||
148 | teq r8, #0 | ||
149 | stmneia r12, {r0-r6, lr} @ v7m_invalidate_l1 touches r0-r6 | ||
150 | blne v7m_invalidate_l1 | ||
151 | teq r8, #0 @ re-evalutae condition | ||
152 | ldmneia r12, {r0-r6, lr} | ||
153 | |||
119 | @ Configure the System Control Register to ensure 8-byte stack alignment | 154 | @ Configure the System Control Register to ensure 8-byte stack alignment |
120 | @ Note the STKALIGN bit is either RW or RAO. | 155 | @ Note the STKALIGN bit is either RW or RAO. |
121 | ldr r0, [r0, V7M_SCB_CCR] @ system control register | 156 | ldr r0, [r0, V7M_SCB_CCR] @ system control register |
122 | orr r0, #V7M_SCB_CCR_STKALIGN | 157 | orr r0, #V7M_SCB_CCR_STKALIGN |
158 | orr r0, r0, r8 | ||
159 | |||
123 | ret lr | 160 | ret lr |
124 | ENDPROC(__v7m_setup) | 161 | ENDPROC(__v7m_setup) |
125 | 162 | ||
163 | /* | ||
164 | * Cortex-M7 processor functions | ||
165 | */ | ||
166 | globl_equ cpu_cm7_proc_init, cpu_v7m_proc_init | ||
167 | globl_equ cpu_cm7_reset, cpu_v7m_reset | ||
168 | globl_equ cpu_cm7_do_idle, cpu_v7m_do_idle | ||
169 | globl_equ cpu_cm7_switch_mm, cpu_v7m_switch_mm | ||
170 | |||
126 | define_processor_functions v7m, dabort=nommu_early_abort, pabort=legacy_pabort, nommu=1 | 171 | define_processor_functions v7m, dabort=nommu_early_abort, pabort=legacy_pabort, nommu=1 |
172 | define_processor_functions cm7, dabort=nommu_early_abort, pabort=legacy_pabort, nommu=1 | ||
127 | 173 | ||
128 | .section ".rodata" | 174 | .section ".rodata" |
129 | string cpu_arch_name, "armv7m" | 175 | string cpu_arch_name, "armv7m" |
@@ -147,6 +193,16 @@ ENDPROC(__v7m_setup) | |||
147 | .endm | 193 | .endm |
148 | 194 | ||
149 | /* | 195 | /* |
196 | * Match ARM Cortex-M7 processor. | ||
197 | */ | ||
198 | .type __v7m_cm7_proc_info, #object | ||
199 | __v7m_cm7_proc_info: | ||
200 | .long 0x410fc270 /* ARM Cortex-M7 0xC27 */ | ||
201 | .long 0xff0ffff0 /* Mask off revision, patch release */ | ||
202 | __v7m_proc __v7m_cm7_proc_info, __v7m_cm7_setup, hwcaps = HWCAP_EDSP, cache_fns = v7m_cache_fns, proc_fns = cm7_processor_functions | ||
203 | .size __v7m_cm7_proc_info, . - __v7m_cm7_proc_info | ||
204 | |||
205 | /* | ||
150 | * Match ARM Cortex-M4 processor. | 206 | * Match ARM Cortex-M4 processor. |
151 | */ | 207 | */ |
152 | .type __v7m_cm4_proc_info, #object | 208 | .type __v7m_cm4_proc_info, #object |