[PATCH 3/3] arm64: board: virt: set up mmu

Raphael Poggi poggi.raph at gmail.com
Thu May 19 18:11:09 PDT 2016


Enable mmu and set correct mapping for periph and flash memory ranges.

Signed-off-by: Raphael Poggi <poggi.raph at gmail.com>
---
 arch/arm64/boards/virt/init.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm64/boards/virt/init.c b/arch/arm64/boards/virt/init.c
index 81e742d..9626067 100644
--- a/arch/arm64/boards/virt/init.c
+++ b/arch/arm64/boards/virt/init.c
@@ -13,6 +13,7 @@
 #include <linux/sizes.h>
 #include <io.h>
 #include <globalvar.h>
+#include <asm/mmu.h>
 
 static int virt_mem_init(void)
 {
@@ -50,3 +51,17 @@ static int virt_core_init(void)
 	return 0;
 }
 postcore_initcall(virt_core_init);
+
+static int virt_mmu_enable(void)
+{
+	/* Mapping all periph range */
+	arch_remap_range(0x09000000, 0x01000000, PMD_SECT_DEF_CACHED);
+
+	/* Mapping all flash range */
+	arch_remap_range(0x00000000, 0x08000000, PMD_SECT_DEF_CACHED);
+
+	mmu_enable();
+
+	return 0;
+}
+postmmu_initcall(virt_mmu_enable);
-- 
2.1.0




More information about the barebox mailing list