1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <arch/barrier.h>
5 #include <console/console.h>
6 #include <soc/mcu_common.h>
7 #include <soc/symbols.h>
10 enum cb_err
mtk_init_mcu(struct mtk_mcu
*mcu
)
19 mcu
->run_size
= cbfs_load(mcu
->firmware_name
, mcu
->load_buffer
, mcu
->buffer_size
);
20 if (mcu
->run_size
== 0) {
21 printk(BIOS_ERR
, "%s: Failed to load %s\n", __func__
, mcu
->firmware_name
);
25 if (mcu
->run_address
) {
26 memcpy(mcu
->run_address
, mcu
->load_buffer
, mcu
->run_size
);
27 /* Memory barrier to ensure data is flushed before resetting MCU. */
34 printk(BIOS_DEBUG
, "%s: Loaded (and reset) %s in %lld msecs (%zd bytes)\n",
35 __func__
, mcu
->firmware_name
, stopwatch_duration_msecs(&sw
), mcu
->run_size
);