[U-Boot] [PATCH V2 1/5] spl: Add function to get u-boot raw sector
Peng Fan
peng.fan at nxp.com
Wed Jun 19 02:05:29 UTC 2019
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.chee at intel.com>
Cc: Peng Fan <peng.fan at nxp.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt at gmail.com>
Cc: York Sun <york.sun at nxp.com>
Cc: Marek Vasut <marex at denx.de>
Cc: Alex Kiernan <alex.kiernan at gmail.com>
Signed-off-by: Peng Fan <peng.fan at 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
More information about the U-Boot
mailing list