summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/soc/mediatek/common/Kconfig7
-rw-r--r--src/soc/mediatek/common/bootblock.c10
-rw-r--r--src/soc/mediatek/common/mmu_operations.c7
-rw-r--r--src/soc/mediatek/mt8188/Makefile.inc2
4 files changed, 25 insertions, 1 deletions
diff --git a/src/soc/mediatek/common/Kconfig b/src/soc/mediatek/common/Kconfig
index 8092aa7699..268f2f30f5 100644
--- a/src/soc/mediatek/common/Kconfig
+++ b/src/soc/mediatek/common/Kconfig
@@ -91,4 +91,11 @@ config DEVAPC_DEBUG
When this option is enabled, the DEVAPC driver prints the settings after
initialization.
+config EARLY_MMU_INIT
+ bool
+ default n
+ help
+ When this option is enabled, `mtk_mmu_init()` will be done in
+ `bootblock_soc_early_init()` to reduce the boot time.
+
endif
diff --git a/src/soc/mediatek/common/bootblock.c b/src/soc/mediatek/common/bootblock.c
new file mode 100644
index 0000000000..6474a8f53c
--- /dev/null
+++ b/src/soc/mediatek/common/bootblock.c
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <bootblock_common.h>
+#include <soc/mmu_operations.h>
+
+void bootblock_soc_early_init(void)
+{
+ if (CONFIG(EARLY_MMU_INIT))
+ mtk_mmu_init();
+}
diff --git a/src/soc/mediatek/common/mmu_operations.c b/src/soc/mediatek/common/mmu_operations.c
index 340f9ec989..cbd6c094dd 100644
--- a/src/soc/mediatek/common/mmu_operations.c
+++ b/src/soc/mediatek/common/mmu_operations.c
@@ -9,6 +9,13 @@ __weak void mtk_soc_after_dram(void) { /* do nothing */ }
void mtk_mmu_init(void)
{
+ static bool mmu_inited;
+
+ if (mmu_inited)
+ return;
+
+ mmu_inited = true;
+
mmu_init();
/*
diff --git a/src/soc/mediatek/mt8188/Makefile.inc b/src/soc/mediatek/mt8188/Makefile.inc
index 4731fab14c..14f7d38e3b 100644
--- a/src/soc/mediatek/mt8188/Makefile.inc
+++ b/src/soc/mediatek/mt8188/Makefile.inc
@@ -9,7 +9,7 @@ all-$(CONFIG_SPI_FLASH) += ../common/spi.c spi.c
all-y += timer.c ../common/timer_prepare.c
all-y += ../common/uart.c
-bootblock-y += bootblock.c
+bootblock-y += ../common/bootblock.c bootblock.c
bootblock-y += ../common/eint_event.c
bootblock-y += ../common/lastbus_v2.c lastbus.c
bootblock-y += ../common/mmu_operations.c