| 1 |
|
| 2 |
|
| 3 |
#include <assert.h> |
| 4 |
#include <soc/mcu_common.h> |
| 5 |
#include <soc/mtk_fsp.h> |
| 6 |
#include <soc/pi_image.h> |
| 7 |
#include <soc/symbols.h> |
| 8 |
|
| 9 |
static struct mtk_mcu pi_image = { |
| 10 |
.firmware_name = CONFIG_PI_IMG_FIRMWARE |
| 11 |
}; |
| 12 |
|
| 13 |
static size_t pi_image_load(void **buffer) |
| 14 |
{ |
| 15 |
*buffer = NULL; |
| 16 |
pi_image.load_buffer = _dram_dma; |
| 17 |
pi_image.buffer_size = REGION_SIZE(dram_dma); |
| 18 |
|
| 19 |
if (mtk_init_mcu(&pi_image)) |
| 20 |
die("%s() failed\n", __func__); |
| 21 |
|
| 22 |
*buffer = pi_image.load_buffer; |
| 23 |
return pi_image.run_size; |
| 24 |
} |
| 25 |
|
| 26 |
void pi_image_add_mtk_fsp_params(void) |
| 27 |
{ |
| 28 |
void *pi_img; |
| 29 |
size_t pi_image_size; |
| 30 |
pi_image_size = pi_image_load(&pi_img); |
| 31 |
|
| 32 |
void *csram = (void *)PI_IMAGE_CSRAM; |
| 33 |
size_t csram_size = PI_IMAGE_CSRAM_SIZE; |
| 34 |
|
| 35 |
mtk_fsp_add_param(FSP_PARAM_TYPE_PI_IMG, pi_image_size, pi_img); |
| 36 |
mtk_fsp_add_param(FSP_PARAM_TYPE_PI_IMG_CSRAM, csram_size, csram); |
| 37 |
} |