spl: mmc: Fix spl_mmc_get_uboot_raw_sector() implementation
authorFaiz Abbas <faiz_abbas@ti.com>
Wed, 26 Feb 2020 08:14:35 +0000 (13:44 +0530)
committerPeng Fan <peng.fan@nxp.com>
Mon, 9 Mar 2020 00:33:16 +0000 (08:33 +0800)
The call to spl_mmc_get_uboot_raw_sector() completely ignores and
overwrites the raw_sect value passed from the caller of spl_mmc_load().

Fix this by passing raw_sect to the function and returning the same
value in the default case.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
arch/arm/mach-imx/imx8/image.c
common/spl/spl_mmc.c

index c956a8092d888be44634bddcea74ce1a122d7684..e6b299691de26d9ca5b0ac70e8a0ca3ab0940fcb 100644 (file)
@@ -197,7 +197,8 @@ unsigned long spl_spi_get_uboot_offs(struct spi_flash *flash)
 #endif
 
 #ifdef CONFIG_SPL_MMC_SUPPORT
-unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc)
+unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
+                                          unsigned long raw_sect)
 {
        int end;
 
index 3e6a17c110cdb8420f05fa33be332366a531d7c4..a2ea363e96a9a8d561519ba5634c60fe32cb106f 100644 (file)
@@ -317,13 +317,10 @@ int spl_boot_partition(const u32 boot_device)
 }
 #endif
 
-unsigned long __weak spl_mmc_get_uboot_raw_sector(struct mmc *mmc)
+unsigned long __weak spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
+                                                 unsigned long raw_sect)
 {
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
-       return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
-#else
-       return 0;
-#endif
+       return raw_sect;
 }
 
 int spl_mmc_load(struct spl_image_info *spl_image,
@@ -392,7 +389,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
                                return err;
                }
 
-               raw_sect = spl_mmc_get_uboot_raw_sector(mmc);
+               raw_sect = spl_mmc_get_uboot_raw_sector(mmc, raw_sect);
 
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
                err = mmc_load_image_raw_partition(spl_image, mmc, raw_part,