aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2014-10-04 10:50:53 -0400
committerMax Filippov <jcmvbkbc@gmail.com>2014-10-21 05:28:56 -0400
commit2eabc1800d1ef7a850672aedcc266a831572af63 (patch)
tree06e4c80168c5c9611f0c548954f93c8d7b135f11
parent53490121e9ffa3e6314137af016cde8ac83c9bb4 (diff)
xtensa: nommu: set up cache and atomctl in initialize_mmu
initialize_mmu sets up atomctl SR which is needed for s32c1i to function correctly even in noMMU configurations. It's also a good place to set up caching attributes of physical memory. Allow enabling INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX in noMMU configurations for setting up atomctl and cache attributes. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
-rw-r--r--arch/xtensa/Kconfig1
-rw-r--r--arch/xtensa/include/asm/initialize_mmu.h37
2 files changed, 36 insertions, 2 deletions
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 81f57e8c8f1b..cb44f6f95968 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -191,7 +191,6 @@ config HOTPLUG_CPU
191 191
192config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX 192config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
193 bool "Initialize Xtensa MMU inside the Linux kernel code" 193 bool "Initialize Xtensa MMU inside the Linux kernel code"
194 depends on MMU
195 default y 194 default y
196 help 195 help
197 Earlier version initialized the MMU in the exception vector 196 Earlier version initialized the MMU in the exception vector
diff --git a/arch/xtensa/include/asm/initialize_mmu.h b/arch/xtensa/include/asm/initialize_mmu.h
index cdac5584ec0c..e256f2270ec9 100644
--- a/arch/xtensa/include/asm/initialize_mmu.h
+++ b/arch/xtensa/include/asm/initialize_mmu.h
@@ -26,8 +26,16 @@
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
27#include <asm/vectors.h> 27#include <asm/vectors.h>
28 28
29#if XCHAL_HAVE_PTP_MMU
29#define CA_BYPASS (_PAGE_CA_BYPASS | _PAGE_HW_WRITE | _PAGE_HW_EXEC) 30#define CA_BYPASS (_PAGE_CA_BYPASS | _PAGE_HW_WRITE | _PAGE_HW_EXEC)
30#define CA_WRITEBACK (_PAGE_CA_WB | _PAGE_HW_WRITE | _PAGE_HW_EXEC) 31#define CA_WRITEBACK (_PAGE_CA_WB | _PAGE_HW_WRITE | _PAGE_HW_EXEC)
32#else
33#define CA_WRITEBACK (0x4)
34#endif
35
36#ifndef XCHAL_SPANNING_WAY
37#define XCHAL_SPANNING_WAY 0
38#endif
31 39
32#ifdef __ASSEMBLY__ 40#ifdef __ASSEMBLY__
33 41
@@ -75,7 +83,7 @@
75 83
76 /* Step 1: invalidate mapping at 0x40000000..0x5FFFFFFF. */ 84 /* Step 1: invalidate mapping at 0x40000000..0x5FFFFFFF. */
77 85
78 movi a2, 0x40000006 86 movi a2, 0x40000000 | XCHAL_SPANNING_WAY
79 idtlb a2 87 idtlb a2
80 iitlb a2 88 iitlb a2
81 isync 89 isync
@@ -153,6 +161,33 @@
153#endif /* defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && 161#endif /* defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU &&
154 XCHAL_HAVE_SPANNING_WAY */ 162 XCHAL_HAVE_SPANNING_WAY */
155 163
164#if !defined(CONFIG_MMU) && XCHAL_HAVE_TLBS
165 /* Enable data and instruction cache in the DEFAULT_MEMORY region
166 * if the processor has DTLB and ITLB.
167 */
168
169 movi a5, PLATFORM_DEFAULT_MEM_START | XCHAL_SPANNING_WAY
170 movi a6, ~_PAGE_ATTRIB_MASK
171 movi a7, CA_WRITEBACK
172 movi a8, 0x20000000
173 movi a9, PLATFORM_DEFAULT_MEM_SIZE
174 j 2f
1751:
176 sub a9, a9, a8
1772:
178 rdtlb1 a3, a5
179 ritlb1 a4, a5
180 and a3, a3, a6
181 and a4, a4, a6
182 or a3, a3, a7
183 or a4, a4, a7
184 wdtlb a3, a5
185 witlb a4, a5
186 add a5, a5, a8
187 bltu a8, a9, 1b
188
189#endif
190
156 .endm 191 .endm
157 192
158#endif /*__ASSEMBLY__*/ 193#endif /*__ASSEMBLY__*/