From aa415ed977dfe09ebefc58d99f5e73521a5d3f07 Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Tue, 7 Apr 2020 21:00:04 +0800 Subject: [PATCH] common: spl: fix cherry-pick sync conflict fixes: (1cb393f common: spl: rkfw: support bing-up arm32 firmware) Signed-off-by: Joseph Chen Change-Id: I1b7f1a6269794ea9a4a508933381bbb8e3e7133b --- common/spl/spl_mmc.c | 4 +++- common/spl/spl_rkfw.c | 34 +++++++++++++++++++--------------- include/spl_rkfw.h | 3 ++- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 8933f8ee48..b31cb9c71a 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -65,6 +65,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image, #ifdef CONFIG_SPL_LOAD_RKFW u32 trust_sectors = CONFIG_RKFW_TRUST_SECTOR; u32 uboot_sectors = CONFIG_RKFW_U_BOOT_SECTOR; + u32 boot_sectors = CONFIG_RKFW_BOOT_SECTOR; struct spl_load_info load; load.dev = mmc; @@ -84,7 +85,8 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image, #endif ret = spl_load_rkfw_image(spl_image, &load, trust_sectors, - uboot_sectors); + uboot_sectors, + boot_sectors); /* If boot successfully or can't try others, just go end */ if (!ret || ret != -EAGAIN) goto end; diff --git a/common/spl/spl_rkfw.c b/common/spl/spl_rkfw.c index f59d6b1c4c..e960037af3 100644 --- a/common/spl/spl_rkfw.c +++ b/common/spl/spl_rkfw.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -403,7 +404,8 @@ out: int spl_load_rkfw_image(struct spl_image_info *spl_image, struct spl_load_info *info, - u32 trust_sector, u32 uboot_sector) + u32 trust_sector, u32 uboot_sector, + u32 boot_sector) { int ret, try_count = RKFW_RETRY_SECTOR_TIMES; int found_rkfw = 0; @@ -414,22 +416,24 @@ 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, try_count); - if (ret) - printf("Load uboot image failed! ret=%d\n", ret); - else - goto boot; - - ret = rkfw_load_kernel(info, uboot_sector, - spl_image, 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, try_count); + if (ret) + printf("Load uboot image failed! ret=%d\n", ret); +#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, 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) spl_image->fdt_addr = 0; #endif diff --git a/include/spl_rkfw.h b/include/spl_rkfw.h index 305608279d..3dfc71d544 100644 --- a/include/spl_rkfw.h +++ b/include/spl_rkfw.h @@ -103,5 +103,6 @@ typedef struct tag_second_loader_hdr { */ int spl_load_rkfw_image(struct spl_image_info *spl_image, struct spl_load_info *info, - u32 trust_sector, u32 uboot_sector); + u32 trust_sector, u32 uboot_sector, + u32 boot_sector); #endif