aboutsummaryrefslogtreecommitdiff
path: root/src/soc/mediatek/mt8192/mcupm.c
diff options
context:
space:
mode:
authorYidi Lin <yidi.lin@mediatek.com>2020-07-29 19:18:38 +0800
committerHung-Te Lin <hungte@chromium.org>2020-12-10 03:22:54 +0000
commitf4bf8f5fab33e18eccde7c7db8eb9388cc286297 (patch)
tree591420f208b9c6e616abd4f017b9d63792512050 /src/soc/mediatek/mt8192/mcupm.c
parenta5f472bf57e8897c4c47dce6050f0dfacfca5f13 (diff)
soc/mediatek/mt8192: Load MCUPM firmware and boot up MCUPM
MCUPM is the MediaTek proprietary firmware for MCU power management. TEST=1. emerge-asurada coreboot chromeos-bootimage; 2. See following log during booting. load_blob_file: Load mcupm.bin in 35 msecs, size 115668 bytes 3. Test suspend/resume by: a. suspend (on DUT): powerd_dbus_suspend b. resume (on host): dut-control power_state:on Change-Id: I50bea1942507b4a40df9730b4e1bf98980d74277 Signed-off-by: Yidi Lin <yidi.lin@mediatek.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46392 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
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__);
+}