summaryrefslogtreecommitdiff
path: root/src/soc/cavium/cn81xx/mmu.c
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2018-03-26 15:54:41 +0200
committerPatrick Rudolph <siro@das-labor.org>2018-07-10 07:03:29 +0000
commit06c7d64be9fa0355ed7cfc092db93963a254295a (patch)
tree3082efb85b5e6b0f3c67be16818524039fdea84e /src/soc/cavium/cn81xx/mmu.c
parent8cbd569f74d8929387730e45b0d6e993b1365c02 (diff)
soc/cavium: Enable MMU
* Configure and enable MMU. * Cover the whole I/O space. * A minimum of 512KB TTB space is required. * Use secure mem attribute as firmware is running in ARM TZ region. Tested on Cavium SoC. Change-Id: I969446da62b4cc7adf9393fab69ff84ebf49220d Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/25371 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Diffstat (limited to 'src/soc/cavium/cn81xx/mmu.c')
-rw-r--r--src/soc/cavium/cn81xx/mmu.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/soc/cavium/cn81xx/mmu.c b/src/soc/cavium/cn81xx/mmu.c
new file mode 100644
index 0000000000..d6e7ac5ee1
--- /dev/null
+++ b/src/soc/cavium/cn81xx/mmu.c
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2015 MediaTek Inc.
+ * Copyright 2018-present Facebook, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <symbols.h>
+#include <soc/addressmap.h>
+#include <soc/mmu.h>
+#include <soc/sdram.h>
+#include <arch/mmu.h>
+
+void soc_mmu_init(void)
+{
+ const unsigned long devmem = MA_DEV | MA_S | MA_RW;
+ const unsigned long secure_mem = MA_MEM | MA_S | MA_RW;
+
+ mmu_init();
+
+ /*
+ * Need to use secure mem attribute, as firmware is running in ARM TZ
+ * region.
+ */
+ mmu_config_range((void *)_ttb, _ttb_size, secure_mem);
+ mmu_config_range((void *)_dram, sdram_size_mb() * MiB, secure_mem);
+ /* IO space has the MSB set and is divided into 4 sub-regions:
+ * * NCB
+ * * SLI
+ * * RSL
+ * * AP
+ */
+ mmu_config_range((void *)IO_SPACE_START, IO_SPACE_SIZE, devmem);
+
+ mmu_enable();
+}