Add a weak function spl_mmc_get_uboot_raw_sector to get u-boot raw
sector. At default it returns CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR.
Users can overwrite it to return customized offset.

This is to support i.MX8 specific image type container image type.

Cc: Tien Fong Chee <tien.fong.c...@intel.com>
Cc: Peng Fan <peng....@nxp.com>
Cc: Simon Goldschmidt <simon.k.r.goldschm...@gmail.com>
Cc: York Sun <york....@nxp.com>
Cc: Marek Vasut <ma...@denx.de>
Cc: Alex Kiernan <alex.kier...@gmail.com>
Signed-off-by: Peng Fan <peng....@nxp.com>
---
 common/spl/spl_mmc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 324d91c884..bf53a1dadf 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -149,6 +149,13 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 
boot_device)
        return 0;
 }
 
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
+unsigned long __weak spl_mmc_get_uboot_raw_sector(struct mmc *mmc)
+{
+       return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
+}
+#endif
+
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
 static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
                                        struct mmc *mmc, int partition)
@@ -181,7 +188,7 @@ static int mmc_load_image_raw_partition(struct 
spl_image_info *spl_image,
 
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
        return mmc_load_image_raw_sector(spl_image, mmc,
-                       info.start + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
+                       info.start + spl_mmc_get_uboot_raw_sector(mmc));
 #else
        return mmc_load_image_raw_sector(spl_image, mmc, info.start);
 #endif
@@ -366,7 +373,7 @@ int spl_mmc_load_image(struct spl_image_info *spl_image,
 #endif
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
                err = mmc_load_image_raw_sector(spl_image, mmc,
-                       CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
+                       spl_mmc_get_uboot_raw_sector(mmc));
                if (!err)
                        return err;
 #endif
-- 
2.16.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to