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>
31 #define XTENSA_HWVERSION_RC_2009_0 230000
35 #if XCHAL_HAVE_S32C1I && (XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RC_2009_0)
37 * We Have Atomic Operation Control (ATOMCTL) Register; Initialize it.
38 * For details see Documentation/xtensa/atomctl.txt
40 #if XCHAL_DCACHE_IS_COHERENT
41 movi a3
, 0x25 /* For SMP/MX -- internal for writeback,
45 movi a3
, 0x29 /* non-MX -- Most cores use Std Memory
46 * Controlers which usually can't use RCW
50 #endif /* XCHAL_HAVE_S32C1I &&
51 * (XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RC_2009_0)
54 #if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
59 #if !XCHAL_HAVE_VECBASE
60 # error "MMU v3 requires reloc vectors"
68 1: movi a2
, 0x10000000
71 9: bgeu a2
, a3
, 9b
/* PC is out of the expected range */
73 /* Step 1: invalidate mapping at 0x40000000..0x5FFFFFFF. */
80 /* Step 2: map 0x40000000..0x47FFFFFF to paddr containing this code
81 * and jump to the new mapping.
83 #define CA_BYPASS (_PAGE_CA_BYPASS | _PAGE_HW_WRITE | _PAGE_HW_EXEC)
84 #define CA_WRITEBACK (_PAGE_CA_WB | _PAGE_HW_WRITE | _PAGE_HW_EXEC)
88 addi a3
, a3
, CA_BYPASS
100 /* Step 3: unmap everything other than current area.
101 * Start at 0x60000000, wrap around, and end with 0x20000000
103 2: movi a4
, 0x20000000
110 /* Step 4: Setup MMU with the old V2 mappings. */
117 movi a4
, CA_WRITEBACK
127 movi a4
, 0xf0000000 + CA_WRITEBACK
132 movi a4
, 0xf0000000 + CA_BYPASS
138 /* Jump to self, using MMU v2 mappings. */
143 movi a2
, VECBASE_RESET_VADDR
146 /* Step 5: remove temporary mapping. */
155 #endif /* defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU &&
156 XCHAL_HAVE_SPANNING_WAY */
160 #endif /*__ASSEMBLY__*/
162 #endif /* _XTENSA_INITIALIZE_MMU_H */