diff options
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/Kconfig | 21 | ||||
-rw-r--r-- | arch/arm/mm/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mm/cache-nop.S | 50 | ||||
-rw-r--r-- | arch/arm/mm/nommu.c | 7 | ||||
-rw-r--r-- | arch/arm/mm/proc-v7m.S | 157 |
5 files changed, 236 insertions, 1 deletions
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index 35955b54944c..9e8101ecd63e 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -397,6 +397,15 @@ config CPU_V7 | |||
397 | select CPU_PABRT_V7 | 397 | select CPU_PABRT_V7 |
398 | select CPU_TLB_V7 if MMU | 398 | select CPU_TLB_V7 if MMU |
399 | 399 | ||
400 | # ARMv7M | ||
401 | config CPU_V7M | ||
402 | bool | ||
403 | select CPU_32v7M | ||
404 | select CPU_ABRT_NOMMU | ||
405 | select CPU_CACHE_NOP | ||
406 | select CPU_PABRT_LEGACY | ||
407 | select CPU_THUMBONLY | ||
408 | |||
400 | config CPU_THUMBONLY | 409 | config CPU_THUMBONLY |
401 | bool | 410 | bool |
402 | # There are no CPUs available with MMU that don't implement an ARM ISA: | 411 | # There are no CPUs available with MMU that don't implement an ARM ISA: |
@@ -441,6 +450,9 @@ config CPU_32v6K | |||
441 | config CPU_32v7 | 450 | config CPU_32v7 |
442 | bool | 451 | bool |
443 | 452 | ||
453 | config CPU_32v7M | ||
454 | bool | ||
455 | |||
444 | # The abort model | 456 | # The abort model |
445 | config CPU_ABRT_NOMMU | 457 | config CPU_ABRT_NOMMU |
446 | bool | 458 | bool |
@@ -491,6 +503,9 @@ config CPU_CACHE_V6 | |||
491 | config CPU_CACHE_V7 | 503 | config CPU_CACHE_V7 |
492 | bool | 504 | bool |
493 | 505 | ||
506 | config CPU_CACHE_NOP | ||
507 | bool | ||
508 | |||
494 | config CPU_CACHE_VIVT | 509 | config CPU_CACHE_VIVT |
495 | bool | 510 | bool |
496 | 511 | ||
@@ -613,7 +628,11 @@ config ARCH_DMA_ADDR_T_64BIT | |||
613 | 628 | ||
614 | config ARM_THUMB | 629 | config ARM_THUMB |
615 | bool "Support Thumb user binaries" if !CPU_THUMBONLY | 630 | bool "Support Thumb user binaries" if !CPU_THUMBONLY |
616 | depends on CPU_ARM720T || CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_V6 || CPU_V6K || CPU_V7 || CPU_FEROCEON | 631 | depends on CPU_ARM720T || CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || \ |
632 | CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || \ | ||
633 | CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || \ | ||
634 | CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_V6 || CPU_V6K || \ | ||
635 | CPU_V7 || CPU_FEROCEON || CPU_V7M | ||
617 | default y | 636 | default y |
618 | help | 637 | help |
619 | Say Y if you want to include kernel support for running user space | 638 | Say Y if you want to include kernel support for running user space |
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile index 9e51be96f635..ee558a01f390 100644 --- a/arch/arm/mm/Makefile +++ b/arch/arm/mm/Makefile | |||
@@ -39,6 +39,7 @@ obj-$(CONFIG_CPU_CACHE_V4WB) += cache-v4wb.o | |||
39 | obj-$(CONFIG_CPU_CACHE_V6) += cache-v6.o | 39 | obj-$(CONFIG_CPU_CACHE_V6) += cache-v6.o |
40 | obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o | 40 | obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o |
41 | obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o | 41 | obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o |
42 | obj-$(CONFIG_CPU_CACHE_NOP) += cache-nop.o | ||
42 | 43 | ||
43 | AFLAGS_cache-v6.o :=-Wa,-march=armv6 | 44 | AFLAGS_cache-v6.o :=-Wa,-march=armv6 |
44 | AFLAGS_cache-v7.o :=-Wa,-march=armv7-a | 45 | AFLAGS_cache-v7.o :=-Wa,-march=armv7-a |
@@ -87,6 +88,7 @@ obj-$(CONFIG_CPU_FEROCEON) += proc-feroceon.o | |||
87 | obj-$(CONFIG_CPU_V6) += proc-v6.o | 88 | obj-$(CONFIG_CPU_V6) += proc-v6.o |
88 | obj-$(CONFIG_CPU_V6K) += proc-v6.o | 89 | obj-$(CONFIG_CPU_V6K) += proc-v6.o |
89 | obj-$(CONFIG_CPU_V7) += proc-v7.o | 90 | obj-$(CONFIG_CPU_V7) += proc-v7.o |
91 | obj-$(CONFIG_CPU_V7M) += proc-v7m.o | ||
90 | 92 | ||
91 | AFLAGS_proc-v6.o :=-Wa,-march=armv6 | 93 | AFLAGS_proc-v6.o :=-Wa,-march=armv6 |
92 | AFLAGS_proc-v7.o :=-Wa,-march=armv7-a | 94 | AFLAGS_proc-v7.o :=-Wa,-march=armv7-a |
diff --git a/arch/arm/mm/cache-nop.S b/arch/arm/mm/cache-nop.S new file mode 100644 index 000000000000..8e12ddca0031 --- /dev/null +++ b/arch/arm/mm/cache-nop.S | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License version 2 as | ||
4 | * published by the Free Software Foundation. | ||
5 | */ | ||
6 | #include <linux/linkage.h> | ||
7 | #include <linux/init.h> | ||
8 | |||
9 | #include "proc-macros.S" | ||
10 | |||
11 | ENTRY(nop_flush_icache_all) | ||
12 | mov pc, lr | ||
13 | ENDPROC(nop_flush_icache_all) | ||
14 | |||
15 | .globl nop_flush_kern_cache_all | ||
16 | .equ nop_flush_kern_cache_all, nop_flush_icache_all | ||
17 | |||
18 | .globl nop_flush_kern_cache_louis | ||
19 | .equ nop_flush_kern_cache_louis, nop_flush_icache_all | ||
20 | |||
21 | .globl nop_flush_user_cache_all | ||
22 | .equ nop_flush_user_cache_all, nop_flush_icache_all | ||
23 | |||
24 | .globl nop_flush_user_cache_range | ||
25 | .equ nop_flush_user_cache_range, nop_flush_icache_all | ||
26 | |||
27 | .globl nop_coherent_kern_range | ||
28 | .equ nop_coherent_kern_range, nop_flush_icache_all | ||
29 | |||
30 | ENTRY(nop_coherent_user_range) | ||
31 | mov r0, 0 | ||
32 | mov pc, lr | ||
33 | ENDPROC(nop_coherent_user_range) | ||
34 | |||
35 | .globl nop_flush_kern_dcache_area | ||
36 | .equ nop_flush_kern_dcache_area, nop_flush_icache_all | ||
37 | |||
38 | .globl nop_dma_flush_range | ||
39 | .equ nop_dma_flush_range, nop_flush_icache_all | ||
40 | |||
41 | .globl nop_dma_map_area | ||
42 | .equ nop_dma_map_area, nop_flush_icache_all | ||
43 | |||
44 | .globl nop_dma_unmap_area | ||
45 | .equ nop_dma_unmap_area, nop_flush_icache_all | ||
46 | |||
47 | __INITDATA | ||
48 | |||
49 | @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S) | ||
50 | define_cache_functions nop | ||
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c index d51225f90ae2..dd3a6c670f08 100644 --- a/arch/arm/mm/nommu.c +++ b/arch/arm/mm/nommu.c | |||
@@ -20,12 +20,19 @@ | |||
20 | 20 | ||
21 | void __init arm_mm_memblock_reserve(void) | 21 | void __init arm_mm_memblock_reserve(void) |
22 | { | 22 | { |
23 | #ifndef CONFIG_CPU_V7M | ||
23 | /* | 24 | /* |
24 | * Register the exception vector page. | 25 | * Register the exception vector page. |
25 | * some architectures which the DRAM is the exception vector to trap, | 26 | * some architectures which the DRAM is the exception vector to trap, |
26 | * alloc_page breaks with error, although it is not NULL, but "0." | 27 | * alloc_page breaks with error, although it is not NULL, but "0." |
27 | */ | 28 | */ |
28 | memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE); | 29 | memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE); |
30 | #else /* ifndef CONFIG_CPU_V7M */ | ||
31 | /* | ||
32 | * There is no dedicated vector page on V7-M. So nothing needs to be | ||
33 | * reserved here. | ||
34 | */ | ||
35 | #endif | ||
29 | } | 36 | } |
30 | 37 | ||
31 | void __init sanity_check_meminfo(void) | 38 | void __init sanity_check_meminfo(void) |
diff --git a/arch/arm/mm/proc-v7m.S b/arch/arm/mm/proc-v7m.S new file mode 100644 index 000000000000..0c93588fcb91 --- /dev/null +++ b/arch/arm/mm/proc-v7m.S | |||
@@ -0,0 +1,157 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mm/proc-v7m.S | ||
3 | * | ||
4 | * Copyright (C) 2008 ARM Ltd. | ||
5 | * Copyright (C) 2001 Deep Blue Solutions Ltd. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This is the "shell" of the ARMv7-M processor support. | ||
12 | */ | ||
13 | #include <linux/linkage.h> | ||
14 | #include <asm/assembler.h> | ||
15 | #include <asm/v7m.h> | ||
16 | #include "proc-macros.S" | ||
17 | |||
18 | ENTRY(cpu_v7m_proc_init) | ||
19 | mov pc, lr | ||
20 | ENDPROC(cpu_v7m_proc_init) | ||
21 | |||
22 | ENTRY(cpu_v7m_proc_fin) | ||
23 | mov pc, lr | ||
24 | ENDPROC(cpu_v7m_proc_fin) | ||
25 | |||
26 | /* | ||
27 | * cpu_v7m_reset(loc) | ||
28 | * | ||
29 | * Perform a soft reset of the system. Put the CPU into the | ||
30 | * same state as it would be if it had been reset, and branch | ||
31 | * to what would be the reset vector. | ||
32 | * | ||
33 | * - loc - location to jump to for soft reset | ||
34 | */ | ||
35 | .align 5 | ||
36 | ENTRY(cpu_v7m_reset) | ||
37 | mov pc, r0 | ||
38 | ENDPROC(cpu_v7m_reset) | ||
39 | |||
40 | /* | ||
41 | * cpu_v7m_do_idle() | ||
42 | * | ||
43 | * Idle the processor (eg, wait for interrupt). | ||
44 | * | ||
45 | * IRQs are already disabled. | ||
46 | */ | ||
47 | ENTRY(cpu_v7m_do_idle) | ||
48 | wfi | ||
49 | mov pc, lr | ||
50 | ENDPROC(cpu_v7m_do_idle) | ||
51 | |||
52 | ENTRY(cpu_v7m_dcache_clean_area) | ||
53 | mov pc, lr | ||
54 | ENDPROC(cpu_v7m_dcache_clean_area) | ||
55 | |||
56 | /* | ||
57 | * There is no MMU, so here is nothing to do. | ||
58 | */ | ||
59 | ENTRY(cpu_v7m_switch_mm) | ||
60 | mov pc, lr | ||
61 | ENDPROC(cpu_v7m_switch_mm) | ||
62 | |||
63 | .globl cpu_v7m_suspend_size | ||
64 | .equ cpu_v7m_suspend_size, 0 | ||
65 | |||
66 | #ifdef CONFIG_ARM_CPU_SUSPEND | ||
67 | ENTRY(cpu_v7m_do_suspend) | ||
68 | mov pc, lr | ||
69 | ENDPROC(cpu_v7m_do_suspend) | ||
70 | |||
71 | ENTRY(cpu_v7m_do_resume) | ||
72 | mov pc, lr | ||
73 | ENDPROC(cpu_v7m_do_resume) | ||
74 | #endif | ||
75 | |||
76 | .section ".text.init", #alloc, #execinstr | ||
77 | |||
78 | /* | ||
79 | * __v7m_setup | ||
80 | * | ||
81 | * This should be able to cover all ARMv7-M cores. | ||
82 | */ | ||
83 | __v7m_setup: | ||
84 | @ Configure the vector table base address | ||
85 | ldr r0, =BASEADDR_V7M_SCB | ||
86 | ldr r12, =vector_table | ||
87 | str r12, [r0, V7M_SCB_VTOR] | ||
88 | |||
89 | @ enable UsageFault, BusFault and MemManage fault. | ||
90 | ldr r5, [r0, #V7M_SCB_SHCSR] | ||
91 | orr r5, #(V7M_SCB_SHCSR_USGFAULTENA | V7M_SCB_SHCSR_BUSFAULTENA | V7M_SCB_SHCSR_MEMFAULTENA) | ||
92 | str r5, [r0, #V7M_SCB_SHCSR] | ||
93 | |||
94 | @ Lower the priority of the SVC and PendSV exceptions | ||
95 | mov r5, #0x80000000 | ||
96 | str r5, [r0, V7M_SCB_SHPR2] @ set SVC priority | ||
97 | mov r5, #0x00800000 | ||
98 | str r5, [r0, V7M_SCB_SHPR3] @ set PendSV priority | ||
99 | |||
100 | @ SVC to run the kernel in this mode | ||
101 | adr r1, BSYM(1f) | ||
102 | ldr r5, [r12, #11 * 4] @ read the SVC vector entry | ||
103 | str r1, [r12, #11 * 4] @ write the temporary SVC vector entry | ||
104 | mov r6, lr @ save LR | ||
105 | mov r7, sp @ save SP | ||
106 | ldr sp, =__v7m_setup_stack_top | ||
107 | cpsie i | ||
108 | svc #0 | ||
109 | 1: cpsid i | ||
110 | str r5, [r12, #11 * 4] @ restore the original SVC vector entry | ||
111 | mov lr, r6 @ restore LR | ||
112 | mov sp, r7 @ restore SP | ||
113 | |||
114 | @ Special-purpose control register | ||
115 | mov r1, #1 | ||
116 | msr control, r1 @ Thread mode has unpriviledged access | ||
117 | |||
118 | @ Configure the System Control Register to ensure 8-byte stack alignment | ||
119 | @ Note the STKALIGN bit is either RW or RAO. | ||
120 | ldr r12, [r0, V7M_SCB_CCR] @ system control register | ||
121 | orr r12, #V7M_SCB_CCR_STKALIGN | ||
122 | str r12, [r0, V7M_SCB_CCR] | ||
123 | mov pc, lr | ||
124 | ENDPROC(__v7m_setup) | ||
125 | |||
126 | define_processor_functions v7m, dabort=nommu_early_abort, pabort=legacy_pabort, nommu=1 | ||
127 | |||
128 | .section ".rodata" | ||
129 | string cpu_arch_name, "armv7m" | ||
130 | string cpu_elf_name "v7m" | ||
131 | string cpu_v7m_name "ARMv7-M" | ||
132 | |||
133 | .section ".proc.info.init", #alloc, #execinstr | ||
134 | |||
135 | /* | ||
136 | * Match any ARMv7-M processor core. | ||
137 | */ | ||
138 | .type __v7m_proc_info, #object | ||
139 | __v7m_proc_info: | ||
140 | .long 0x000f0000 @ Required ID value | ||
141 | .long 0x000f0000 @ Mask for ID | ||
142 | .long 0 @ proc_info_list.__cpu_mm_mmu_flags | ||
143 | .long 0 @ proc_info_list.__cpu_io_mmu_flags | ||
144 | b __v7m_setup @ proc_info_list.__cpu_flush | ||
145 | .long cpu_arch_name | ||
146 | .long cpu_elf_name | ||
147 | .long HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT | ||
148 | .long cpu_v7m_name | ||
149 | .long v7m_processor_functions @ proc_info_list.proc | ||
150 | .long 0 @ proc_info_list.tlb | ||
151 | .long 0 @ proc_info_list.user | ||
152 | .long nop_cache_fns @ proc_info_list.cache | ||
153 | .size __v7m_proc_info, . - __v7m_proc_info | ||
154 | |||
155 | __v7m_setup_stack: | ||
156 | .space 4 * 8 @ 8 registers | ||
157 | __v7m_setup_stack_top: | ||