]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - common/spl/spl_mmc.c
spl: eMMC/SD: Provide one __weak spl_boot_mode() function
[people/ms/u-boot.git] / common / spl / spl_mmc.c
index d95f94ca15e0b4b07c4a894247044391be816c9d..351f4edd41e4ed52e8970cadcfc44f69a59e0037 100644 (file)
@@ -52,8 +52,9 @@ static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
        return blk_dread(mmc_get_blk_desc(mmc), sector, count, buf);
 }
 
-static int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
-                                    struct mmc *mmc, unsigned long sector)
+static __maybe_unused
+int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
+                             struct mmc *mmc, unsigned long sector)
 {
        unsigned long count;
        struct image_header *header;
@@ -200,7 +201,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
                CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR,
                CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS,
                (void *) CONFIG_SYS_SPL_ARGS_ADDR);
-       if (count == 0) {
+       if (count != CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
                puts("mmc_load_image_raw_os: mmc block read error\n");
 #endif
@@ -280,6 +281,17 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
 }
 #endif
 
+u32 __weak spl_boot_mode(const u32 boot_device)
+{
+#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
+       return MMCSD_MODE_FS;
+#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
+       return MMCSD_MODE_EMMCBOOT;
+#else
+       return MMCSD_MODE_RAW;
+#endif
+}
+
 int spl_mmc_load_image(struct spl_image_info *spl_image,
                       struct spl_boot_device *bootdev)
 {