soc/meidatek/mt8196: Move PI image related code to common
To promote code reuse and maintainability, move PI image related code to common folder. The function add_pi_image_params is renamed to pi_image_add_mtk_fsp_params for prefix consistency. BUG=b:379008996 BRANCH=none TEST=build passed. Signed-off-by: Vince Liu <vince-wl.liu@mediatek.corp-partner.google.com> Change-Id: If5e3d9e6d5f97ead763ef9adc2d23bce0ed68877 Reviewed-on: https://review.coreboot.org/c/coreboot/+/88265 Reviewed-by: Yidi Lin <yidilin@google.com> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
e96bf7e094
commit
e3ffa3c14f
5 changed files with 26 additions and 23 deletions
8
src/soc/mediatek/common/include/soc/pi_image_common.h
Normal file
8
src/soc/mediatek/common/include/soc/pi_image_common.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
|
||||
|
||||
#ifndef __SOC_MEDIATEK_COMMON_PI_IMAGE_COMMON_H__
|
||||
#define __SOC_MEDIATEK_COMMON_PI_IMAGE_COMMON_H__
|
||||
|
||||
void pi_image_add_mtk_fsp_params(void);
|
||||
|
||||
#endif /* __SOC_MEDIATEK_COMMON_PI_IMAGE_COMMON_H__ */
|
||||
|
|
@ -1,18 +1,16 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
|
||||
|
||||
#include <arch/cache.h>
|
||||
#include <assert.h>
|
||||
#include <soc/mcu_common.h>
|
||||
#include <soc/mtk_fsp.h>
|
||||
#include <soc/pi_image.h>
|
||||
#include <soc/symbols.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
static struct mtk_mcu pi_image = {
|
||||
.firmware_name = CONFIG_PI_IMG_FIRMWARE
|
||||
};
|
||||
|
||||
size_t pi_image_load(void **buffer)
|
||||
static size_t pi_image_load(void **buffer)
|
||||
{
|
||||
*buffer = NULL;
|
||||
pi_image.load_buffer = _dram_dma;
|
||||
|
|
@ -24,3 +22,16 @@ size_t pi_image_load(void **buffer)
|
|||
*buffer = pi_image.load_buffer;
|
||||
return pi_image.run_size;
|
||||
}
|
||||
|
||||
void pi_image_add_mtk_fsp_params(void)
|
||||
{
|
||||
void *pi_img;
|
||||
size_t pi_image_size;
|
||||
pi_image_size = pi_image_load(&pi_img);
|
||||
|
||||
void *csram = (void *)PI_IMAGE_CSRAM;
|
||||
size_t csram_size = PI_IMAGE_CSRAM_SIZE;
|
||||
|
||||
mtk_fsp_add_param(FSP_PARAM_TYPE_PI_IMG, pi_image_size, pi_img);
|
||||
mtk_fsp_add_param(FSP_PARAM_TYPE_PI_IMG_CSRAM, csram_size, csram);
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ ramstage-y += ../common/mt6685.c mt6685.c
|
|||
ramstage-y += mt6685_rtc.c
|
||||
ramstage-y += mtcmos.c
|
||||
ramstage-y += ../common/mtk_fsp.c
|
||||
ramstage-y += pi_image.c
|
||||
ramstage-y += ../common/pi_image.c
|
||||
ramstage-y += soc.c
|
||||
ramstage-y += ../common/spm.c ../common/spm_v2.c spm.c
|
||||
ramstage-y += ../common/sspm.c ../common/sspm_sram.c
|
||||
|
|
|
|||
|
|
@ -3,12 +3,9 @@
|
|||
#ifndef __SOC_MEDIATEK_MT8196_PI_IMAGE_H__
|
||||
#define __SOC_MEDIATEK_MT8196_PI_IMAGE_H__
|
||||
|
||||
#include <commonlib/bsd/helpers.h>
|
||||
#include <soc/mcu_common.h>
|
||||
#include <soc/pi_image_common.h>
|
||||
|
||||
#define PI_IMAGE_CSRAM 0x00120000
|
||||
#define PI_IMAGE_CSRAM_SIZE (16 * KiB)
|
||||
|
||||
size_t pi_image_load(void **buffer);
|
||||
|
||||
#endif /* __SOC_MEDIATEK_MT8196_PI_IMAGE_H__ */
|
||||
|
|
|
|||
|
|
@ -36,19 +36,6 @@ static void soc_read_resources(struct device *dev)
|
|||
ram_range(dev, 0, (uintptr_t)_dram, sdram_size());
|
||||
}
|
||||
|
||||
static void add_pi_image_params(void)
|
||||
{
|
||||
void *pi_image;
|
||||
size_t pi_image_size;
|
||||
pi_image_size = pi_image_load(&pi_image);
|
||||
|
||||
void *csram = (void *)PI_IMAGE_CSRAM;
|
||||
size_t csram_size = PI_IMAGE_CSRAM_SIZE;
|
||||
|
||||
mtk_fsp_add_param(FSP_PARAM_TYPE_PI_IMG, pi_image_size, pi_image);
|
||||
mtk_fsp_add_param(FSP_PARAM_TYPE_PI_IMG_CSRAM, csram_size, csram);
|
||||
}
|
||||
|
||||
static void soc_init(struct device *dev)
|
||||
{
|
||||
uint32_t storage_type = mainboard_get_storage_type();
|
||||
|
|
@ -56,7 +43,7 @@ static void soc_init(struct device *dev)
|
|||
dcc_init();
|
||||
mtk_fsp_init(RAMSTAGE_SOC_INIT);
|
||||
mtk_fsp_add_param(FSP_PARAM_TYPE_STORAGE, sizeof(storage_type), &storage_type);
|
||||
add_pi_image_params();
|
||||
pi_image_add_mtk_fsp_params();
|
||||
mtk_fsp_load_and_run();
|
||||
|
||||
mtk_mmu_disable_l2c_sram();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue