summaryrefslogtreecommitdiff
path: root/arch/arm/include/asm
diff options
context:
space:
mode:
authorYork Sun <yorksun@freescale.com>2014-06-23 15:15:53 -0700
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2014-07-03 08:40:48 +0200
commit22932ffc03e521130cfd33cae1fc2531eb42604a (patch)
tree0f308b28de978baf549fa6c4f09f67a9f87bb327 /arch/arm/include/asm
parent0d031e046c962ffa94449d398d573c3dec7fb3bd (diff)
downloadu-boot-imx-22932ffc03e521130cfd33cae1fc2531eb42604a.zip
u-boot-imx-22932ffc03e521130cfd33cae1fc2531eb42604a.tar.gz
u-boot-imx-22932ffc03e521130cfd33cae1fc2531eb42604a.tar.bz2
ARMv8: Adjust MMU setup
Make MMU function reusable. Platform code can setup its own MMU tables. Signed-off-by: York Sun <yorksun@freescale.com> CC: David Feng <fenghua@phytium.com.cn>
Diffstat (limited to 'arch/arm/include/asm')
-rw-r--r--arch/arm/include/asm/armv8/mmu.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
index 1193e76..4b7b67b 100644
--- a/arch/arm/include/asm/armv8/mmu.h
+++ b/arch/arm/include/asm/armv8/mmu.h
@@ -108,4 +108,28 @@
TCR_IRGN_WBWA | \
TCR_T0SZ(VA_BITS))
+#ifndef __ASSEMBLY__
+void set_pgtable_section(u64 *page_table, u64 index,
+ u64 section, u64 memory_type);
+static inline void set_ttbr_tcr_mair(int el, u64 table, u64 tcr, u64 attr)
+{
+ asm volatile("dsb sy");
+ if (el == 1) {
+ asm volatile("msr ttbr0_el1, %0" : : "r" (table) : "memory");
+ asm volatile("msr tcr_el1, %0" : : "r" (tcr) : "memory");
+ asm volatile("msr mair_el1, %0" : : "r" (attr) : "memory");
+ } else if (el == 2) {
+ asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
+ asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
+ asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
+ } else if (el == 3) {
+ asm volatile("msr ttbr0_el3, %0" : : "r" (table) : "memory");
+ asm volatile("msr tcr_el3, %0" : : "r" (tcr) : "memory");
+ asm volatile("msr mair_el3, %0" : : "r" (attr) : "memory");
+ } else {
+ hang();
+ }
+ asm volatile("isb");
+}
+#endif
#endif /* _ASM_ARMV8_MMU_H_ */