From 7ba377511420e99575b3ae74d67e2c63e7700ecd Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Thu, 29 Oct 2020 13:01:28 +0800 Subject: soc/mediatek/common: Add common API for loading firmwares Add mtk_init_mcu to load the firmware to the specified memory address and run the firmware. This function also measures the load time and the blob size. For example: mtk_init_mcu: Loaded (and reset) dpm.pm in 15 msecs (14004 bytes) Signed-off-by: Yidi Lin Change-Id: Ie94001bbda25fe015f43172e92a1006e059de223 Reviewed-on: https://review.coreboot.org/c/coreboot/+/46930 Tested-by: build bot (Jenkins) Reviewed-by: Hung-Te Lin --- src/soc/mediatek/common/include/soc/mcu_common.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/soc/mediatek/common/include/soc/mcu_common.h (limited to 'src/soc/mediatek/common/include') diff --git a/src/soc/mediatek/common/include/soc/mcu_common.h b/src/soc/mediatek/common/include/soc/mcu_common.h new file mode 100644 index 0000000000..974da52f35 --- /dev/null +++ b/src/soc/mediatek/common/include/soc/mcu_common.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef SOC_MEDIATEK_MTLIB_COMMON_H +#define SOC_MEDIATEK_MTLIB_COMMON_H + +struct mtk_mcu { + const char *firmware_name; /* The firmware file name in CBFS */ + void *run_address; /* The address for running the firmware */ + size_t run_size; /* The buffer for loading the firmware */ + void *load_buffer; /* The buffer size */ + size_t buffer_size; /* The firmware real size */ + void *priv; /* The additional data required by the reset callback */ + void (*reset)(struct mtk_mcu *mcu); /* The reset callback */ +}; + +int mtk_init_mcu(struct mtk_mcu *mcu); + +#endif /* SOC_MEDIATEK_MTLIB_COMMON_H */ -- cgit v1.2.3