Debian Codegraph @

src/soc/mediatek/common/mcupm.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <console/console.h>
4 #include <device/mmio.h>
5 #include <soc/mcu_common.h>
6 #include <soc/mcupm.h>
7 #include <soc/symbols.h>
8
9 #define ABNORMALBOOT_REG 0x0C55FAA0
10
11 static void reset_mcupm(struct mtk_mcu *mcu)
12 {
13 /* Clear abnormal boot register */
14 write32p(ABNORMALBOOT_REG, 0x0);
15 write32(&mcupm_reg->sw_rstn, 0x1);
16 }
17
18 static struct mtk_mcu mcupm = {
19 .firmware_name = CONFIG_MCUPM_FIRMWARE,
20 .run_address = (void *)MCUPM_SRAM_BASE,
21 .reset = reset_mcupm,
22 };
23
24 void mcupm_init(void)
25 {
26 mcupm.load_buffer = _dram_dma;
27 mcupm.buffer_size = REGION_SIZE(dram_dma);
28
29 write32(&mcupm_reg->sw_rstn, 0x0);
30
31 if (mtk_init_mcu(&mcupm))
32 die("%s() failed\n", __func__);
33 }