soc/mediatek: Move the SSPM driver to common

The SSPM driver can be shared by MT8183, MT8192 and MT8195.

TEST=emerge-{asurada, kukui} coreboot;

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: If9779853becb298eeeabb3dc6096bc474baae202
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55050
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Rex-BC Chen 2021-05-27 21:10:17 +08:00 committed by Hung-Te Lin
parent 098f1fa802
commit e235f9a56b
7 changed files with 17 additions and 56 deletions

View File

@ -0,0 +1,14 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef SOC_MEDIATEK_COMMON_SSPM_H
#define SOC_MEDIATEK_COMMON_SSPM_H
#include <soc/addressmap.h>
#include <types.h>
struct sspm_regs {
u32 sw_rstn;
};
static struct sspm_regs *const sspm_reg = (void *)SSPM_CFG_BASE;
void sspm_init(void);
#endif /* SOC_MEDIATEK_COMMON_SSPM_H */

View File

@ -7,7 +7,7 @@
static void reset_sspm(struct mtk_mcu *mcu) static void reset_sspm(struct mtk_mcu *mcu)
{ {
write32(&mt8183_sspm->sw_rstn, 0x1); write32(&sspm_reg->sw_rstn, 0x1);
} }
static struct mtk_mcu sspm = { static struct mtk_mcu sspm = {

View File

@ -58,7 +58,7 @@ ramstage-y += ../common/rtc.c ../common/rtc_osc_init.c rtc.c
ramstage-y += soc.c ramstage-y += soc.c
ramstage-$(CONFIG_SPI_FLASH) += ../common/spi.c spi.c ramstage-$(CONFIG_SPI_FLASH) += ../common/spi.c spi.c
ramstage-y += spm.c ramstage-y += spm.c
ramstage-y += sspm.c ramstage-y += ../common/sspm.c
ramstage-y += ../common/timer.c ramstage-y += ../common/timer.c
ramstage-y += ../common/uart.c ramstage-y += ../common/uart.c
ramstage-y += ../common/usb.c ramstage-y += ../common/usb.c

View File

@ -1,14 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef SOC_MEDIATEK_MT8183_SSPM_H
#define SOC_MEDIATEK_MT8183_SSPM_H
#include <soc/addressmap.h>
#include <types.h>
struct mt8183_sspm_regs {
u32 sw_rstn;
};
static struct mt8183_sspm_regs *const mt8183_sspm = (void *)SSPM_CFG_BASE;
void sspm_init(void);
#endif /* SOC_MEDIATEK_MT8183_SSPM_H */

View File

@ -61,7 +61,7 @@ ramstage-y += ../common/pmif.c
ramstage-y += ../common/rtc.c ../common/rtc_mt6359p.c ramstage-y += ../common/rtc.c ../common/rtc_mt6359p.c
ramstage-y += soc.c ramstage-y += soc.c
ramstage-y += spm.c ramstage-y += spm.c
ramstage-y += sspm.c ramstage-y += ../common/sspm.c
ramstage-y += ../common/timer.c ramstage-y += ../common/timer.c
ramstage-y += ../common/uart.c ramstage-y += ../common/uart.c
ramstage-y += ../common/ufs.c ramstage-y += ../common/ufs.c

View File

@ -1,14 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef SOC_MEDIATEK_MT8192_SSPM_H
#define SOC_MEDIATEK_MT8192_SSPM_H
#include <soc/addressmap.h>
#include <types.h>
struct mt8192_sspm_regs {
u32 sw_rstn;
};
static struct mt8192_sspm_regs *const mt8192_sspm = (void *)SSPM_CFG_BASE;
void sspm_init(void);
#endif /* SOC_MEDIATEK_MT8192_SSPM_H */

View File

@ -1,25 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <device/mmio.h>
#include <soc/mcu_common.h>
#include <soc/sspm.h>
#include <soc/symbols.h>
static void reset_sspm(struct mtk_mcu *mcu)
{
write32(&mt8192_sspm->sw_rstn, 0x1);
}
static struct mtk_mcu sspm = {
.firmware_name = CONFIG_SSPM_FIRMWARE,
.run_address = (void *)SSPM_SRAM_BASE,
.reset = reset_sspm,
};
void sspm_init(void)
{
sspm.load_buffer = _dram_dma;
sspm.buffer_size = REGION_SIZE(dram_dma);
mtk_init_mcu(&sspm);
}