]> git.sur5r.net Git - u-boot/commitdiff
spl: spl_mmc: provide one weak function spl_boot_partition
authorPatrick Delaunay <patrick.delaunay@st.com>
Tue, 20 Mar 2018 09:54:51 +0000 (10:54 +0100)
committerTom Rini <trini@konsulko.com>
Sat, 7 Apr 2018 00:45:28 +0000 (20:45 -0400)
The spl_boot_partition function has been added in order to have
the possibility to boot on a same binary from different mmc devices
with different partitions.

By default keep the current behavior, SPL use the partition defined
by CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
common/spl/spl_mmc.c
include/spl.h

index 351f4edd41e4ed52e8970cadcfc44f69a59e0037..4aa0b2caf3901c37b69b4836f9e8d6b79fc99f6a 100644 (file)
@@ -292,6 +292,14 @@ u32 __weak spl_boot_mode(const u32 boot_device)
 #endif
 }
 
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+__weak
+int spl_boot_partition(const u32 boot_device)
+{
+       return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION;
+}
+#endif
+
 int spl_mmc_load_image(struct spl_image_info *spl_image,
                       struct spl_boot_device *bootdev)
 {
@@ -347,8 +355,11 @@ int spl_mmc_load_image(struct spl_image_info *spl_image,
                                return err;
                }
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
-               err = mmc_load_image_raw_partition(spl_image, mmc,
-                       CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION);
+               err = spl_boot_partition(bootdev->boot_device);
+               if (!err)
+                       return err;
+
+               err = mmc_load_image_raw_partition(spl_image, mmc, err);
                if (!err)
                        return err;
 #endif
index c14448b8fc98a85c78b231647f948fb584c40ec2..5754012cd0391f5c138c95d26a6a394ab2adfded 100644 (file)
@@ -82,6 +82,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
 void preloader_console_init(void);
 u32 spl_boot_device(void);
 u32 spl_boot_mode(const u32 boot_device);
+int spl_boot_partition(const u32 boot_device);
 void spl_set_bd(void);
 
 /**