MLK-19219-1 spl: Add function to get u-boot raw sector
authorYe Li <ye.li@nxp.com>
Tue, 14 Aug 2018 10:52:16 +0000 (03:52 -0700)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 09:36:38 +0000 (02:36 -0700)
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.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 9f2ffbe41493fb9233d79e2933e337d7a6c2e20a)

common/spl/spl_mmc.c

index 324d91c..ef01f8d 100644 (file)
@@ -301,6 +301,13 @@ int spl_boot_partition(const u32 boot_device)
 }
 #endif
 
+#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
+
 int spl_mmc_load_image(struct spl_image_info *spl_image,
                       struct spl_boot_device *bootdev)
 {
@@ -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