ti: k3: common: Enable MMU using xlat_tables_v2 library

This library will be used to properly set up mappings from different
bootloaders at different exception levels. It ensures that memory mapped
devices such as UARTs are still accessible and memory regions have the
correct access permissions.

Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
diff --git a/plat/ti/k3/common/k3_bl31_setup.c b/plat/ti/k3/common/k3_bl31_setup.c
index fe68d56..11289df 100644
--- a/plat/ti/k3/common/k3_bl31_setup.c
+++ b/plat/ti/k3/common/k3_bl31_setup.c
@@ -9,9 +9,16 @@
 #include <assert.h>
 #include <bl_common.h>
 #include <debug.h>
+#include <plat_arm.h>
 #include <platform_def.h>
 #include <string.h>
 
+/* Table of regions to map using the MMU */
+const mmap_region_t plat_arm_mmap[] = {
+	MAP_REGION_FLAT(SHARED_RAM_BASE, SHARED_RAM_SIZE, MT_DEVICE | MT_RW | MT_SECURE),
+	{ /* sentinel */ }
+};
+
 /*
  * Placeholder variables for maintaining information about the next image(s)
  */
@@ -85,7 +92,13 @@
 
 void bl31_plat_arch_setup(void)
 {
-	/* TODO: Initialize the MMU tables */
+	arm_setup_page_tables(BL31_BASE,
+			      BL31_END - BL31_BASE,
+			      BL_CODE_BASE,
+			      BL_CODE_END,
+			      BL_RO_DATA_BASE,
+			      BL_RO_DATA_END);
+	enable_mmu_el3(0);
 }
 
 void bl31_platform_setup(void)