summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/mt8192/mcupm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/mediatek/mt8192/mcupm.c')
-rw-r--r--src/soc/mediatek/mt8192/mcupm.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/soc/mediatek/mt8192/mcupm.c b/src/soc/mediatek/mt8192/mcupm.c
new file mode 100644
index 0000000000..70981a05ec
--- /dev/null
+++ b/src/soc/mediatek/mt8192/mcupm.c
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <console/console.h>
+#include <device/mmio.h>
+#include <soc/mcu_common.h>
+#include <soc/mcupm.h>
+#include <soc/symbols.h>
+
+#define ABNORMALBOOT_REG 0x0C55FAA0
+
+static void reset_mcupm(struct mtk_mcu *mcu)
+{
+ /* Clear abnormal boot register */
+ write32((void *)ABNORMALBOOT_REG, 0x0);
+ write32(&mt8192_mcupm->sw_rstn, 0x1);
+}
+
+static struct mtk_mcu mcupm = {
+ .firmware_name = CONFIG_MCUPM_FIRMWARE,
+ .run_address = (void *)MCUPM_SRAM_BASE,
+ .reset = reset_mcupm,
+};
+
+void mcupm_init(void)
+{
+ mcupm.load_buffer = _dram_dma;
+ mcupm.buffer_size = REGION_SIZE(dram_dma);
+
+ write32(&mt8192_mcupm->sw_rstn, 0x0);
+
+ if (mtk_init_mcu(&mcupm))
+ die("%s() failed\n", __func__);
+}