diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2010-05-21 13:06:41 -0400 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2013-04-17 15:38:10 -0400 |
commit | 55bdd694116597d2f16510b121463cd579ba78da (patch) | |
tree | c8a31f06f746700a1f9b8418602a43c3ea42627e /arch/arm/kernel | |
parent | 73a09d212ec65b7068a283e6034fa05649d3d075 (diff) |
ARM: Add base support for ARMv7-M
This patch adds the base support for the ARMv7-M
architecture. It consists of the corresponding arch/arm/mm/ files and
various #ifdef's around the kernel. Exception handling is implemented by
a subsequent patch.
[ukleinek: squash in some changes originating from commit
b5717ba (Cortex-M3: Add support for the Microcontroller Prototyping System)
from the v2.6.33-arm1 patch stack, port to post 3.6, drop zImage
support, drop reorganisation of pt_regs, assert CONFIG_CPU_V7M doesn't
leak into installed headers and a few cosmetic changes]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Jonathan Austin <jonathan.austin@arm.com>
Tested-by: Jonathan Austin <jonathan.austin@arm.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/head-nommu.S | 10 | ||||
-rw-r--r-- | arch/arm/kernel/setup.c | 17 | ||||
-rw-r--r-- | arch/arm/kernel/traps.c | 8 |
3 files changed, 30 insertions, 5 deletions
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S index 6a2e09c952c7..8812ce88f7a1 100644 --- a/arch/arm/kernel/head-nommu.S +++ b/arch/arm/kernel/head-nommu.S | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/asm-offsets.h> | 19 | #include <asm/asm-offsets.h> |
20 | #include <asm/cp15.h> | 20 | #include <asm/cp15.h> |
21 | #include <asm/thread_info.h> | 21 | #include <asm/thread_info.h> |
22 | #include <asm/v7m.h> | ||
22 | 23 | ||
23 | /* | 24 | /* |
24 | * Kernel startup entry point. | 25 | * Kernel startup entry point. |
@@ -50,10 +51,13 @@ ENTRY(stext) | |||
50 | 51 | ||
51 | setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode | 52 | setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode |
52 | @ and irqs disabled | 53 | @ and irqs disabled |
53 | #ifndef CONFIG_CPU_CP15 | 54 | #if defined(CONFIG_CPU_CP15) |
54 | ldr r9, =CONFIG_PROCESSOR_ID | ||
55 | #else | ||
56 | mrc p15, 0, r9, c0, c0 @ get processor id | 55 | mrc p15, 0, r9, c0, c0 @ get processor id |
56 | #elif defined(CONFIG_CPU_V7M) | ||
57 | ldr r9, =BASEADDR_V7M_SCB | ||
58 | ldr r9, [r9, V7M_SCB_CPUID] | ||
59 | #else | ||
60 | ldr r9, =CONFIG_PROCESSOR_ID | ||
57 | #endif | 61 | #endif |
58 | bl __lookup_processor_type @ r5=procinfo r9=cpuid | 62 | bl __lookup_processor_type @ r5=procinfo r9=cpuid |
59 | movs r10, r5 @ invalid processor (r5=0)? | 63 | movs r10, r5 @ invalid processor (r5=0)? |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 1cc9e1796415..829124590e4c 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -128,7 +128,9 @@ struct stack { | |||
128 | u32 und[3]; | 128 | u32 und[3]; |
129 | } ____cacheline_aligned; | 129 | } ____cacheline_aligned; |
130 | 130 | ||
131 | #ifndef CONFIG_CPU_V7M | ||
131 | static struct stack stacks[NR_CPUS]; | 132 | static struct stack stacks[NR_CPUS]; |
133 | #endif | ||
132 | 134 | ||
133 | char elf_platform[ELF_PLATFORM_SIZE]; | 135 | char elf_platform[ELF_PLATFORM_SIZE]; |
134 | EXPORT_SYMBOL(elf_platform); | 136 | EXPORT_SYMBOL(elf_platform); |
@@ -207,7 +209,7 @@ static const char *proc_arch[] = { | |||
207 | "5TEJ", | 209 | "5TEJ", |
208 | "6TEJ", | 210 | "6TEJ", |
209 | "7", | 211 | "7", |
210 | "?(11)", | 212 | "7M", |
211 | "?(12)", | 213 | "?(12)", |
212 | "?(13)", | 214 | "?(13)", |
213 | "?(14)", | 215 | "?(14)", |
@@ -216,6 +218,12 @@ static const char *proc_arch[] = { | |||
216 | "?(17)", | 218 | "?(17)", |
217 | }; | 219 | }; |
218 | 220 | ||
221 | #ifdef CONFIG_CPU_V7M | ||
222 | static int __get_cpu_architecture(void) | ||
223 | { | ||
224 | return CPU_ARCH_ARMv7M; | ||
225 | } | ||
226 | #else | ||
219 | static int __get_cpu_architecture(void) | 227 | static int __get_cpu_architecture(void) |
220 | { | 228 | { |
221 | int cpu_arch; | 229 | int cpu_arch; |
@@ -248,6 +256,7 @@ static int __get_cpu_architecture(void) | |||
248 | 256 | ||
249 | return cpu_arch; | 257 | return cpu_arch; |
250 | } | 258 | } |
259 | #endif | ||
251 | 260 | ||
252 | int __pure cpu_architecture(void) | 261 | int __pure cpu_architecture(void) |
253 | { | 262 | { |
@@ -293,7 +302,9 @@ static void __init cacheid_init(void) | |||
293 | { | 302 | { |
294 | unsigned int arch = cpu_architecture(); | 303 | unsigned int arch = cpu_architecture(); |
295 | 304 | ||
296 | if (arch >= CPU_ARCH_ARMv6) { | 305 | if (arch == CPU_ARCH_ARMv7M) { |
306 | cacheid = 0; | ||
307 | } else if (arch >= CPU_ARCH_ARMv6) { | ||
297 | unsigned int cachetype = read_cpuid_cachetype(); | 308 | unsigned int cachetype = read_cpuid_cachetype(); |
298 | if ((cachetype & (7 << 29)) == 4 << 29) { | 309 | if ((cachetype & (7 << 29)) == 4 << 29) { |
299 | /* ARMv7 register format */ | 310 | /* ARMv7 register format */ |
@@ -375,6 +386,7 @@ static void __init feat_v6_fixup(void) | |||
375 | */ | 386 | */ |
376 | void cpu_init(void) | 387 | void cpu_init(void) |
377 | { | 388 | { |
389 | #ifndef CONFIG_CPU_V7M | ||
378 | unsigned int cpu = smp_processor_id(); | 390 | unsigned int cpu = smp_processor_id(); |
379 | struct stack *stk = &stacks[cpu]; | 391 | struct stack *stk = &stacks[cpu]; |
380 | 392 | ||
@@ -425,6 +437,7 @@ void cpu_init(void) | |||
425 | "I" (offsetof(struct stack, und[0])), | 437 | "I" (offsetof(struct stack, und[0])), |
426 | PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE) | 438 | PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE) |
427 | : "r14"); | 439 | : "r14"); |
440 | #endif | ||
428 | } | 441 | } |
429 | 442 | ||
430 | int __cpu_logical_map[NR_CPUS]; | 443 | int __cpu_logical_map[NR_CPUS]; |
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 1c089119b2d7..ec64571462d2 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -819,6 +819,7 @@ static void __init kuser_get_tls_init(unsigned long vectors) | |||
819 | 819 | ||
820 | void __init early_trap_init(void *vectors_base) | 820 | void __init early_trap_init(void *vectors_base) |
821 | { | 821 | { |
822 | #ifndef CONFIG_CPU_V7M | ||
822 | unsigned long vectors = (unsigned long)vectors_base; | 823 | unsigned long vectors = (unsigned long)vectors_base; |
823 | extern char __stubs_start[], __stubs_end[]; | 824 | extern char __stubs_start[], __stubs_end[]; |
824 | extern char __vectors_start[], __vectors_end[]; | 825 | extern char __vectors_start[], __vectors_end[]; |
@@ -850,4 +851,11 @@ void __init early_trap_init(void *vectors_base) | |||
850 | 851 | ||
851 | flush_icache_range(vectors, vectors + PAGE_SIZE); | 852 | flush_icache_range(vectors, vectors + PAGE_SIZE); |
852 | modify_domain(DOMAIN_USER, DOMAIN_CLIENT); | 853 | modify_domain(DOMAIN_USER, DOMAIN_CLIENT); |
854 | #else /* ifndef CONFIG_CPU_V7M */ | ||
855 | /* | ||
856 | * on V7-M there is no need to copy the vector table to a dedicated | ||
857 | * memory area. The address is configurable and so a table in the kernel | ||
858 | * image can be used. | ||
859 | */ | ||
860 | #endif | ||
853 | } | 861 | } |