The tispl.bin fit image is packed with the HSM firmware image. Populate the "os" info of the image so that it can be detected and used to load the HSM core. Further, invoke the load and boot of HSM core at R5 SPL stage using the remoteprocessor framework.
Signed-off-by: Beleswar Padhi <[email protected]> --- v3: Changelog: 1. Use remoteproc framework to boot HSM core. Link to v2: https://lore.kernel.org/all/[email protected]/ v2: Changelog: 1. Hang system boot if HSM firmware failed to boot. 2. __maybe_unused to decrease preprocessor usage. 3. Better error messages with return code. 4. Added Error case in if-elseif-else ladder. Note: #define PROC_ID_HSM_M4F seems to have extra tab in the diff/patch. But when patch gets applied in file, all of them have consistent tabs. Link to v1: https://lore.kernel.org/all/[email protected] arch/arm/mach-k3/r5/common.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm/mach-k3/r5/common.c b/arch/arm/mach-k3/r5/common.c index da1d1cb7230..51476722b4c 100644 --- a/arch/arm/mach-k3/r5/common.c +++ b/arch/arm/mach-k3/r5/common.c @@ -28,6 +28,7 @@ enum { IMAGE_ID_TIFSSTUB_HS, IMAGE_ID_TIFSSTUB_FS, IMAGE_ID_TIFSSTUB_GP, + IMAGE_ID_HSM, IMAGE_AMT, }; @@ -40,6 +41,7 @@ static const char *image_os_match[IMAGE_AMT] = { "tifsstub-hs", "tifsstub-fs", "tifsstub-gp", + "hsm", }; #endif @@ -158,6 +160,20 @@ void __noreturn jump_to_image(struct spl_image_info *spl_image) &loadaddr); } + if (IS_ENABLED(CONFIG_REMOTEPROC_TI_K3_HSM_M4F)) { + ret = rproc_load(2, fit_image_info[IMAGE_ID_HSM].load, + fit_image_info[IMAGE_ID_HSM].image_len); + if (ret) { + panic("Error while loading HSM firmware, ret = %d\n", ret); + } else { + ret = rproc_start(2); + if (ret) + panic("Error while starting HSM core\n"); + else + printf("Successfully loaded and started HSM core\n"); + } + } + /* * It is assumed that remoteproc device 1 is the corresponding * Cortex-A core which runs ATF. Make sure DT reflects the same. -- 2.34.1

