MA-17382 spl: Add weak function at the end of image load
authorJi Luo <ji.luo@nxp.com>
Wed, 17 Jun 2020 07:44:05 +0000 (15:44 +0800)
committerJi Luo <ji.luo@nxp.com>
Thu, 13 May 2021 01:49:18 +0000 (09:49 +0800)
Add a weak function after the image load in case we have extra
steps to complete, like check the rpmb keyblob for trusty enabled
platform.

Test: Boots with trusty.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: Ie8181fcb32d1640e39fdcc3cebb2dbf50cbfdbab
(cherry picked from commit b16fc52cf9a9ea4d63bced50b949d0bc2328ddea)
(cherry picked from commit 3e40454cdac6b7b63cdff36ab48f86e4b98502be)

arch/arm/mach-imx/spl.c
common/spl/spl_mmc.c

index 27641bf..9ca152a 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <g_dnl.h>
 #include <linux/libfdt.h>
+#include <mmc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -355,3 +356,13 @@ int dram_init_banksize(void)
        return 0;
 }
 #endif
+
+#ifdef CONFIG_IMX_TRUSTY_OS
+int check_rpmb_blob(struct mmc *mmc);
+
+int mmc_image_load_late(struct mmc *mmc)
+{
+       /* Check the rpmb key blob for trusty enabled platfrom. */
+       return check_rpmb_blob(mmc);
+}
+#endif
index c9fd3a4..8a7fa01 100644 (file)
@@ -62,12 +62,15 @@ static __maybe_unused unsigned long spl_mmc_raw_uboot_offset(int part)
 }
 
 #if defined(CONFIG_IMX_TRUSTY_OS)
-/* Pre-declaration of check_rpmb_blob. */
-int check_rpmb_blob(struct mmc *mmc);
 int mmc_load_image_raw_sector_dual_uboot(struct spl_image_info *spl_image,
                                         struct mmc *mmc);
 #endif
 
+int __weak mmc_image_load_late(struct mmc *mmc)
+{
+       return 0;
+}
+
 static __maybe_unused
 int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
                              struct mmc *mmc, unsigned long sector)
@@ -120,11 +123,7 @@ end:
                return -1;
        }
 
-       /* Images loaded, now check the rpmb keyblob for Trusty OS. */
-#if defined(CONFIG_IMX_TRUSTY_OS) && !defined(CONFIG_AVB_ATX)
-               ret = check_rpmb_blob(mmc);
-#endif
-
+       ret = mmc_image_load_late(mmc);
        return ret;
 }