summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/common
diff options
context:
space:
mode:
authorRex-BC Chen <rex-bc.chen@mediatek.com>2021-05-27 21:10:17 +0800
committerHung-Te Lin <hungte@chromium.org>2021-06-01 08:28:30 +0000
commite235f9a56be94c621019b54d7748969c5d66ba79 (patch)
treed3447e8cca393708eb6e8c7c2482cd6f8c6d43f8 /src/soc/mediatek/common
parent098f1fa802a3ab2c74d26d8f1bb01e183a6db74d (diff)
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>
Diffstat (limited to 'src/soc/mediatek/common')
-rw-r--r--src/soc/mediatek/common/include/soc/sspm.h14
-rw-r--r--src/soc/mediatek/common/sspm.c25
2 files changed, 39 insertions, 0 deletions
diff --git a/src/soc/mediatek/common/include/soc/sspm.h b/src/soc/mediatek/common/include/soc/sspm.h
new file mode 100644
index 0000000000..ff405ce762
--- /dev/null
+++ b/src/soc/mediatek/common/include/soc/sspm.h
@@ -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 */
diff --git a/src/soc/mediatek/common/sspm.c b/src/soc/mediatek/common/sspm.c
new file mode 100644
index 0000000000..0a4d5b0cd6
--- /dev/null
+++ b/src/soc/mediatek/common/sspm.c
@@ -0,0 +1,25 @@
+/* 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(&sspm_reg->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);
+}