Yidi Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/48233 )
Change subject: soc/mediatek/mt8183/sspm.c: Use mtlib_load_and_run API ......................................................................
soc/mediatek/mt8183/sspm.c: Use mtlib_load_and_run API
Use mtlib_load_and_run API to load and run sspm firmware. TEST=emerge-kukui coreboot
Change-Id: I63c4b99342bdebb2a94cbf0c6380b0a6817853e7 Signed-off-by: Yidi Lin yidi.lin@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/sspm.c 2 files changed, 9 insertions(+), 20 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/48233/1
diff --git a/src/soc/mediatek/mt8183/Makefile.inc b/src/soc/mediatek/mt8183/Makefile.inc index 43893c3..d2d0390 100644 --- a/src/soc/mediatek/mt8183/Makefile.inc +++ b/src/soc/mediatek/mt8183/Makefile.inc @@ -52,6 +52,7 @@ ramstage-y += ../common/i2c.c i2c.c ramstage-y += ../common/mmu_operations.c mmu_operations.c ramstage-y += ../common/mtcmos.c mtcmos.c +ramstage-y += ../common/mtlib.c ramstage-y += ../common/pmic_wrap.c ramstage-y += ../common/rtc.c rtc.c ramstage-y += soc.c diff --git a/src/soc/mediatek/mt8183/sspm.c b/src/soc/mediatek/mt8183/sspm.c index efcf545..fca108b 100644 --- a/src/soc/mediatek/mt8183/sspm.c +++ b/src/soc/mediatek/mt8183/sspm.c @@ -1,29 +1,17 @@ /* SPDX-License-Identifier: GPL-2.0-only */
-#include <arch/barrier.h> -#include <cbfs.h> -#include <console/console.h> #include <device/mmio.h> +#include <soc/mtlib_common.h> #include <soc/sspm.h> -#include <string.h>
-#define BUF_SIZE (64 * KiB) -static uint8_t sspm_bin[BUF_SIZE] __aligned(8); +#define SSPM_FW_FILE "sspm.bin" + +static void reset_sspm(void) +{ + write32(&mt8183_sspm->sw_rstn, 0x1); +}
void sspm_init(void) { - const char *file_name = "sspm.bin"; - size_t fw_size = cbfs_boot_load_file(file_name, - sspm_bin, - sizeof(sspm_bin), - CBFS_TYPE_RAW); - - if (fw_size == 0) - die("SSPM file :sspm.bin not found."); - - memcpy((void *)SSPM_SRAM_BASE, sspm_bin, fw_size); - /* Memory barrier to ensure that all fw code is loaded - before we release the reset pin. */ - mb(); - write32(&mt8183_sspm->sw_rstn, 0x1); + mtlib_load_and_run(SSPM_FW_FILE, (void *)SSPM_SRAM_BASE, reset_sspm); }
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48233 )
Change subject: soc/mediatek/mt8183/sspm.c: Use mtlib_load_and_run API ......................................................................
Patch Set 1: Code-Review+2
Hello Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48233
to look at the new patch set (#3).
Change subject: soc/mediatek/mt8183/sspm.c: Use mtlib_init_mcu API ......................................................................
soc/mediatek/mt8183/sspm.c: Use mtlib_init_mcu API
Use mtlib_init_mcu API to load and run sspm firmware. TEST=emerge-kukui coreboot
Change-Id: I63c4b99342bdebb2a94cbf0c6380b0a6817853e7 Signed-off-by: Yidi Lin yidi.lin@mediatek.com --- M src/soc/mediatek/mt8183/Kconfig M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/sspm.c 3 files changed, 23 insertions(+), 16 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/48233/3
Hello Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48233
to look at the new patch set (#4).
Change subject: soc/mediatek/mt8183/sspm.c: Use mtlib_init_mcu API ......................................................................
soc/mediatek/mt8183/sspm.c: Use mtlib_init_mcu API
Use mtlib_init_mcu API to load and run sspm firmware. TEST=emerge-kukui coreboot
Change-Id: I63c4b99342bdebb2a94cbf0c6380b0a6817853e7 Signed-off-by: Yidi Lin yidi.lin@mediatek.com --- M src/soc/mediatek/mt8183/Kconfig M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/sspm.c 3 files changed, 23 insertions(+), 16 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/48233/4
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48233 )
Change subject: soc/mediatek/mt8183/sspm.c: Use mtlib_init_mcu API ......................................................................
Patch Set 4:
(2 comments)
https://review.coreboot.org/c/coreboot/+/48233/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/48233/4//COMMIT_MSG@6 PS4, Line 6: : soc/mediatek/mt8183/sspm.c: Use mtlib_init_mcu API nit: rename this to
soc/mediatek/mt8183: Use mtlib_init_mcu to init SSPM
https://review.coreboot.org/c/coreboot/+/48233/4//COMMIT_MSG@10 PS4, Line 10: TEST=emerge-kukui coreboot Add a blank line before TEST=
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48233 )
Change subject: soc/mediatek/mt8183/sspm.c: Use mtlib_init_mcu API ......................................................................
Patch Set 4: Code-Review+1
Hello Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48233
to look at the new patch set (#5).
Change subject: soc/mediatek/mt8183: Use mtlib_init_mcu to init SSPM ......................................................................
soc/mediatek/mt8183: Use mtlib_init_mcu to init SSPM
Use mtlib_init_mcu API to load and run sspm firmware.
TEST=emerge-kukui coreboot
Change-Id: I63c4b99342bdebb2a94cbf0c6380b0a6817853e7 Signed-off-by: Yidi Lin yidi.lin@mediatek.com --- M src/soc/mediatek/mt8183/Kconfig M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/sspm.c 3 files changed, 23 insertions(+), 16 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/48233/5
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48233 )
Change subject: soc/mediatek/mt8183: Use mtlib_init_mcu to init SSPM ......................................................................
Patch Set 5:
(2 comments)
https://review.coreboot.org/c/coreboot/+/48233/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/48233/4//COMMIT_MSG@6 PS4, Line 6: : soc/mediatek/mt8183/sspm.c: Use mtlib_init_mcu API
nit: rename this to […]
Done
https://review.coreboot.org/c/coreboot/+/48233/4//COMMIT_MSG@10 PS4, Line 10: TEST=emerge-kukui coreboot
Add a blank line before TEST=
Done
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48233 )
Change subject: soc/mediatek/mt8183: Use mtlib_init_mcu to init SSPM ......................................................................
Patch Set 5: Code-Review+2
Hello Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48233
to look at the new patch set (#6).
Change subject: soc/mediatek/mt8183: Use mtk_init_mcu to init SSPM ......................................................................
soc/mediatek/mt8183: Use mtk_init_mcu to init SSPM
Use mtk_init_mcu API to load and run sspm firmware.
TEST=emerge-kukui coreboot
Change-Id: I63c4b99342bdebb2a94cbf0c6380b0a6817853e7 Signed-off-by: Yidi Lin yidi.lin@mediatek.com --- M src/soc/mediatek/mt8183/Kconfig M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/sspm.c 3 files changed, 23 insertions(+), 16 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/48233/6
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48233 )
Change subject: soc/mediatek/mt8183: Use mtk_init_mcu to init SSPM ......................................................................
Patch Set 6: Code-Review+2
Hung-Te Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/48233 )
Change subject: soc/mediatek/mt8183: Use mtk_init_mcu to init SSPM ......................................................................
soc/mediatek/mt8183: Use mtk_init_mcu to init SSPM
Use mtk_init_mcu API to load and run sspm firmware.
TEST=emerge-kukui coreboot
Change-Id: I63c4b99342bdebb2a94cbf0c6380b0a6817853e7 Signed-off-by: Yidi Lin yidi.lin@mediatek.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/48233 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Hung-Te Lin hungte@chromium.org --- M src/soc/mediatek/mt8183/Kconfig M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/sspm.c 3 files changed, 23 insertions(+), 16 deletions(-)
Approvals: build bot (Jenkins): Verified Hung-Te Lin: Looks good to me, approved
diff --git a/src/soc/mediatek/mt8183/Kconfig b/src/soc/mediatek/mt8183/Kconfig index 82827d1..ce99c76 100644 --- a/src/soc/mediatek/mt8183/Kconfig +++ b/src/soc/mediatek/mt8183/Kconfig @@ -45,4 +45,11 @@ bool default y
+config SSPM_FIRMWARE + string + default "sspm.bin" + help + The file name of the MediaTek SSPM firmware. + + endif diff --git a/src/soc/mediatek/mt8183/Makefile.inc b/src/soc/mediatek/mt8183/Makefile.inc index 43893c3..b5d5173 100644 --- a/src/soc/mediatek/mt8183/Makefile.inc +++ b/src/soc/mediatek/mt8183/Makefile.inc @@ -50,6 +50,7 @@ ramstage-y += ../common/dsi.c dsi.c ramstage-y += ../common/gpio.c gpio.c ramstage-y += ../common/i2c.c i2c.c +ramstage-y += ../common/mcu.c ramstage-y += ../common/mmu_operations.c mmu_operations.c ramstage-y += ../common/mtcmos.c mtcmos.c ramstage-y += ../common/pmic_wrap.c diff --git a/src/soc/mediatek/mt8183/sspm.c b/src/soc/mediatek/mt8183/sspm.c index 1a4ba9e..e0ac84a 100644 --- a/src/soc/mediatek/mt8183/sspm.c +++ b/src/soc/mediatek/mt8183/sspm.c @@ -1,26 +1,25 @@ /* SPDX-License-Identifier: GPL-2.0-only */
-#include <arch/barrier.h> -#include <cbfs.h> -#include <console/console.h> #include <device/mmio.h> +#include <soc/mcu_common.h> #include <soc/sspm.h> -#include <string.h> +#include <soc/symbols.h>
-#define BUF_SIZE (64 * KiB) -static uint8_t sspm_bin[BUF_SIZE] __aligned(8); +static void reset_sspm(struct mtk_mcu *mcu) +{ + write32(&mt8183_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) { - const char *file_name = "sspm.bin"; - size_t fw_size = cbfs_load(file_name, sspm_bin, sizeof(sspm_bin)); + sspm.load_buffer = _dram_dma; + sspm.buffer_size = REGION_SIZE(dram_dma);
- if (fw_size == 0) - die("SSPM file :sspm.bin not found."); - - memcpy((void *)SSPM_SRAM_BASE, sspm_bin, fw_size); - /* Memory barrier to ensure that all fw code is loaded - before we release the reset pin. */ - mb(); - write32(&mt8183_sspm->sw_rstn, 0x1); + mtk_init_mcu(&sspm); }