diff options
author | Rex-BC Chen <rex-bc.chen@mediatek.com> | 2021-05-21 11:12:19 +0800 |
---|---|---|
committer | Hung-Te Lin <hungte@chromium.org> | 2021-05-26 07:32:51 +0000 |
commit | 9cf07f0cb90245e50489e98984ee2aa3c1da043e (patch) | |
tree | 706ecd91112a14cb8538863f2df1fbc622be9c4b /src/soc/mediatek/common/mcupm.c | |
parent | a36a68b02719cb661d35038fa78600d0b890607c (diff) |
soc/mediatek: Move the MT8192 MCUPM driver to common
The MPUCM drivers can be shared by MT8192 and MT8195.
TEST=emerge-asurada coreboot;
Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: I07a66bcf5a149582f34df1cfd08b5514fc5c2eb9
Reviewed-on: https://review.coreboot.org/c/coreboot/+/54898
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'src/soc/mediatek/common/mcupm.c')
-rw-r--r-- | src/soc/mediatek/common/mcupm.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/soc/mediatek/common/mcupm.c b/src/soc/mediatek/common/mcupm.c new file mode 100644 index 0000000000..dde10e21ca --- /dev/null +++ b/src/soc/mediatek/common/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(&mcupm_reg->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(&mcupm_reg->sw_rstn, 0x0); + + if (mtk_init_mcu(&mcupm)) + die("%s() failed\n", __func__); +} |