diff --git a/common/spl/spl_rkfw.c b/common/spl/spl_rkfw.c index 2cdcf7794f..102e5a1b56 100644 --- a/common/spl/spl_rkfw.c +++ b/common/spl/spl_rkfw.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -362,20 +363,27 @@ int spl_load_rkfw_image(struct spl_image_info *spl_image, printf("Load trust image failed! ret=%d\n", ret); goto out; } - - ret = rkfw_load_uboot(info, uboot_sector, - &spl_image->entry_point_bl33, try_count); - if (ret) - printf("Load uboot image failed! ret=%d\n", ret); - else - goto boot; - - ret = rkfw_load_kernel(info, boot_sector, - &spl_image->entry_point_bl33, try_count); - if (ret) { - printf("Load kernel image failed! ret=%d\n", ret); - goto out; +#ifdef CONFIG_SPL_KERNEL_BOOT + if (spl_image->next_stage == SPL_NEXT_STAGE_UBOOT) { +#endif + ret = rkfw_load_uboot(info, uboot_sector, + &spl_image->entry_point_bl33, try_count); + if (ret) + printf("Load uboot image failed! ret=%d\n", ret); + else + goto boot; +#ifdef CONFIG_SPL_KERNEL_BOOT + } else if (spl_image->next_stage == SPL_NEXT_STAGE_KERNEL) { +#endif + ret = rkfw_load_kernel(info, boot_sector, + &spl_image->entry_point_bl33, try_count); + if (ret) { + printf("Load kernel image failed! ret=%d\n", ret); + goto out; + } +#ifdef CONFIG_SPL_KERNEL_BOOT } +#endif boot: #if CONFIG_IS_ENABLED(LOAD_FIT)