mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
spl: mmc: split spl_mmc_do_fs_boot into regular/os_boot
Currently the logic to handle falcon mode as well as the regular boot is inside spl_mmc_do_fs_boot, this prevents us from cleanly extending falcon mode functionality like toggleable fallback to U-Boot proper. Therefore this patch splits the logic into spl_mmc_fs_load and spl_mmc_fs_load_os to handle the regular boot and falcon mode use case. Signed-off-by: Anshul Dalal <anshuld@ti.com>
This commit is contained in:
@@ -194,6 +194,46 @@ int spl_start_uboot(void)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYS_MMCSD_FS_BOOT
|
||||
static int spl_mmc_fs_load_os(struct spl_image_info *spl_image,
|
||||
struct spl_boot_device *bootdev,
|
||||
struct blk_desc *blk_dev, int part)
|
||||
{
|
||||
int err = -ENOSYS;
|
||||
|
||||
if (CONFIG_IS_ENABLED(FS_FAT)) {
|
||||
err = spl_load_image_fat_os(spl_image, bootdev, blk_dev, part);
|
||||
if (!err)
|
||||
return 0;
|
||||
}
|
||||
if (CONFIG_IS_ENABLED(FS_EXT4)) {
|
||||
err = spl_load_image_ext_os(spl_image, bootdev, blk_dev, part);
|
||||
if (!err)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int __maybe_unused spl_mmc_fs_load(struct spl_image_info *spl_image,
|
||||
struct spl_boot_device *bootdev,
|
||||
struct blk_desc *blk_dev, int part, const char *file)
|
||||
{
|
||||
int err = -ENOENT;
|
||||
|
||||
if (CONFIG_IS_ENABLED(FS_FAT)) {
|
||||
err = spl_load_image_fat(spl_image, bootdev, blk_dev, part, file);
|
||||
if (!err)
|
||||
return 0;
|
||||
}
|
||||
if (CONFIG_IS_ENABLED(FS_EXT4)) {
|
||||
err = spl_load_image_ext(spl_image, bootdev, blk_dev, part, file);
|
||||
if (!err)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
|
||||
struct spl_boot_device *bootdev,
|
||||
struct mmc *mmc,
|
||||
@@ -225,42 +265,22 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SPL_FS_FAT
|
||||
if (!spl_start_uboot()) {
|
||||
ret = spl_load_image_fat_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
|
||||
partition);
|
||||
ret = spl_mmc_fs_load_os(spl_image, bootdev,
|
||||
mmc_get_blk_desc(mmc), partition);
|
||||
if (!ret)
|
||||
return 0;
|
||||
printf("%s, Failed to load falcon payload: %d\n", __func__,
|
||||
ret);
|
||||
printf("Fallback to U-Boot\n");
|
||||
}
|
||||
#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
|
||||
ret = spl_load_image_fat(spl_image, bootdev, mmc_get_blk_desc(mmc),
|
||||
partition,
|
||||
filename);
|
||||
if (!ret)
|
||||
return ret;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CONFIG_SPL_FS_EXT4
|
||||
if (!spl_start_uboot()) {
|
||||
ret = spl_load_image_ext_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
|
||||
partition);
|
||||
if (!ret)
|
||||
return 0;
|
||||
}
|
||||
#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
|
||||
ret = spl_load_image_ext(spl_image, bootdev, mmc_get_blk_desc(mmc),
|
||||
partition,
|
||||
filename);
|
||||
if (!ret)
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
|
||||
ret = -ENOENT;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
|
||||
return spl_mmc_fs_load(spl_image, bootdev, mmc_get_blk_desc(mmc),
|
||||
partition, filename);
|
||||
#else
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user