summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/mt8192/mcupm.c
blob: 70981a05ec59d6b0fa928bd38d833ba022d08561 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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__);
}