2 * arch/xtensa/include/asm/initialize_mmu.h
6 * For the new V3 MMU we remap the TLB from virtual == physical
7 * to the standard Linux mapping used in earlier MMU's.
9 * The the MMU we also support a new configuration register that
10 * specifies how the S32C1I instruction operates with the cache
13 * This file is subject to the terms and conditions of the GNU General
14 * Public License. See the file "COPYING" in the main directory of
15 * this archive for more details.
17 * Copyright (C) 2008 - 2012 Tensilica, Inc.
19 * Marc Gauthier <marc@tensilica.com>
20 * Pete Delaney <piet@tensilica.com>
23 #ifndef _XTENSA_INITIALIZE_MMU_H
24 #define _XTENSA_INITIALIZE_MMU_H
26 #include <asm/pgtable.h>
27 #include <asm/vectors.h>
29 #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)
34 #define XTENSA_HWVERSION_RC_2009_0 230000
38 #if XCHAL_HAVE_S32C1I && (XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RC_2009_0)
40 * We Have Atomic Operation Control (ATOMCTL) Register; Initialize it.
41 * For details see Documentation/xtensa/atomctl.txt
43 #if XCHAL_DCACHE_IS_COHERENT
44 movi a3
, 0x25 /* For SMP/MX -- internal for writeback,
48 movi a3
, 0x29 /* non-MX -- Most cores use Std Memory
49 * Controlers which usually can't use RCW
53 #endif /* XCHAL_HAVE_S32C1I &&
54 * (XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RC_2009_0)
57 #if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
62 #if !XCHAL_HAVE_VECBASE
63 # error "MMU v3 requires reloc vectors"
71 1: movi a2
, 0x10000000
74 9: bgeu a2
, a3
, 9b
/* PC is out of the expected range */
76 /* Step 1: invalidate mapping at 0x40000000..0x5FFFFFFF. */
83 /* Step 2: map 0x40000000..0x47FFFFFF to paddr containing this code
84 * and jump to the new mapping.
89 addi a3
, a3
, CA_BYPASS
101 /* Step 3: unmap everything other than current area.
102 * Start at 0x60000000, wrap around, and end with 0x20000000
104 2: movi a4
, 0x20000000
111 /* Step 4: Setup MMU with the old V2 mappings. */
118 movi a4
, CA_WRITEBACK
127 movi a5
, XCHAL_KIO_CACHED_VADDR
+ 6
128 movi a4
, XCHAL_KIO_DEFAULT_PADDR
+ CA_WRITEBACK
132 movi a5
, XCHAL_KIO_BYPASS_VADDR
+ 6
133 movi a4
, XCHAL_KIO_DEFAULT_PADDR
+ CA_BYPASS
139 /* Jump to self, using MMU v2 mappings. */
144 movi a2
, VECBASE_RESET_VADDR
147 /* Step 5: remove temporary mapping. */
156 #endif /* defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU &&
157 XCHAL_HAVE_SPANNING_WAY */
161 #endif /*__ASSEMBLY__*/
163 #endif /* _XTENSA_INITIALIZE_MMU_H */