aboutsummaryrefslogtreecommitdiff
path: root/common/spl/spl_mmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/spl/spl_mmc.c')
-rw-r--r--common/spl/spl_mmc.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index e1a7d25bd05..d550da2d97e 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -17,7 +17,9 @@
#include <mmc.h>
#include <image.h>
-static int mmc_load_legacy(struct spl_image_info *spl_image, struct mmc *mmc,
+static int mmc_load_legacy(struct spl_image_info *spl_image,
+ struct spl_boot_device *bootdev,
+ struct mmc *mmc,
ulong sector, struct image_header *header)
{
u32 image_offset_sectors;
@@ -26,7 +28,7 @@ static int mmc_load_legacy(struct spl_image_info *spl_image, struct mmc *mmc,
u32 image_offset;
int ret;
- ret = spl_parse_image_header(spl_image, header);
+ ret = spl_parse_image_header(spl_image, bootdev, header);
if (ret)
return ret;
@@ -77,6 +79,7 @@ static __maybe_unused unsigned long spl_mmc_raw_uboot_offset(int part)
static __maybe_unused
int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
+ struct spl_boot_device *bootdev,
struct mmc *mmc, unsigned long sector)
{
unsigned long count;
@@ -116,7 +119,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
ret = spl_load_imx_container(spl_image, &load, sector);
} else {
- ret = mmc_load_legacy(spl_image, mmc, sector, header);
+ ret = mmc_load_legacy(spl_image, bootdev, mmc, sector, header);
}
end:
@@ -181,6 +184,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
+ struct spl_boot_device *bootdev,
struct mmc *mmc, int partition,
unsigned long sector)
{
@@ -211,15 +215,16 @@ 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 + sector);
+ return mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start + sector);
#else
- return mmc_load_image_raw_sector(spl_image, mmc, info.start);
+ return mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start);
#endif
}
#endif
#if CONFIG_IS_ENABLED(OS_BOOT)
static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
+ struct spl_boot_device *bootdev,
struct mmc *mmc)
{
int ret;
@@ -239,7 +244,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
}
#endif /* CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR */
- ret = mmc_load_image_raw_sector(spl_image, mmc,
+ ret = mmc_load_image_raw_sector(spl_image, bootdev, mmc,
CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR);
if (ret)
return ret;
@@ -257,6 +262,7 @@ int spl_start_uboot(void)
return 1;
}
static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
+ struct spl_boot_device *bootdev,
struct mmc *mmc)
{
return -ENOSYS;
@@ -264,20 +270,22 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
#endif
#ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
-static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc,
+static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
+ struct spl_boot_device *bootdev,
+ struct mmc *mmc,
const char *filename)
{
int err = -ENOSYS;
#ifdef CONFIG_SPL_FS_FAT
if (!spl_start_uboot()) {
- err = spl_load_image_fat_os(spl_image, mmc_get_blk_desc(mmc),
+ err = spl_load_image_fat_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
CONFIG_SYS_MMCSD_FS_BOOT_PARTITION);
if (!err)
return err;
}
#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
- err = spl_load_image_fat(spl_image, mmc_get_blk_desc(mmc),
+ err = spl_load_image_fat(spl_image, bootdev, mmc_get_blk_desc(mmc),
CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
filename);
if (!err)
@@ -286,13 +294,13 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc,
#endif
#ifdef CONFIG_SPL_FS_EXT4
if (!spl_start_uboot()) {
- err = spl_load_image_ext_os(spl_image, mmc_get_blk_desc(mmc),
+ err = spl_load_image_ext_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
CONFIG_SYS_MMCSD_FS_BOOT_PARTITION);
if (!err)
return err;
}
#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
- err = spl_load_image_ext(spl_image, mmc_get_blk_desc(mmc),
+ err = spl_load_image_ext(spl_image, bootdev, mmc_get_blk_desc(mmc),
CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
filename);
if (!err)
@@ -307,7 +315,9 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc,
return err;
}
#else
-static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc,
+static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
+ struct spl_boot_device *bootdev,
+ struct mmc *mmc,
const char *filename)
{
return -ENOSYS;
@@ -410,7 +420,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
debug("spl: mmc boot mode: raw\n");
if (!spl_start_uboot()) {
- err = mmc_load_image_raw_os(spl_image, mmc);
+ err = mmc_load_image_raw_os(spl_image, bootdev, mmc);
if (!err)
return err;
}
@@ -418,13 +428,14 @@ int spl_mmc_load(struct spl_image_info *spl_image,
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,
+ err = mmc_load_image_raw_partition(spl_image, bootdev,
+ mmc, raw_part,
raw_sect);
if (!err)
return err;
#endif
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
- err = mmc_load_image_raw_sector(spl_image, mmc,
+ err = mmc_load_image_raw_sector(spl_image, bootdev, mmc,
raw_sect + spl_mmc_raw_uboot_offset(part));
if (!err)
return err;
@@ -433,7 +444,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
case MMCSD_MODE_FS:
debug("spl: mmc boot mode: fs\n");
- err = spl_mmc_do_fs_boot(spl_image, mmc, filename);
+ err = spl_mmc_do_fs_boot(spl_image, bootdev, mmc, filename);
if (!err)
return err;