2011-09-15 04:33:34 +09:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2010
|
|
|
|
* Texas Instruments, <www.ti.com>
|
|
|
|
*
|
|
|
|
* Aneesh V <aneesh@ti.com>
|
|
|
|
*
|
2013-07-08 16:37:19 +09:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2011-09-15 04:33:34 +09:00
|
|
|
*/
|
|
|
|
#include <common.h>
|
2015-06-24 06:38:51 +09:00
|
|
|
#include <dm.h>
|
2012-08-14 04:03:19 +09:00
|
|
|
#include <spl.h>
|
2015-04-27 17:20:22 +09:00
|
|
|
#include <linux/compiler.h>
|
2015-11-09 00:11:49 +09:00
|
|
|
#include <errno.h>
|
2011-09-15 04:33:34 +09:00
|
|
|
#include <asm/u-boot.h>
|
2015-11-09 00:11:44 +09:00
|
|
|
#include <errno.h>
|
2011-09-15 04:33:34 +09:00
|
|
|
#include <mmc.h>
|
2013-06-29 03:43:01 +09:00
|
|
|
#include <image.h>
|
2011-09-15 04:33:34 +09:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2016-09-25 09:20:13 +09:00
|
|
|
static int mmc_load_legacy(struct spl_image_info *spl_image, struct mmc *mmc,
|
|
|
|
ulong sector, struct image_header *header)
|
2016-02-23 14:55:58 +09:00
|
|
|
{
|
|
|
|
u32 image_size_sectors;
|
|
|
|
unsigned long count;
|
2016-04-29 07:44:54 +09:00
|
|
|
int ret;
|
|
|
|
|
2016-09-25 09:20:13 +09:00
|
|
|
ret = spl_parse_image_header(spl_image, header);
|
2016-04-29 07:44:54 +09:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
2016-02-23 14:55:58 +09:00
|
|
|
|
|
|
|
/* convert size to sectors - round up */
|
2016-09-25 09:20:13 +09:00
|
|
|
image_size_sectors = (spl_image->size + mmc->read_bl_len - 1) /
|
2016-02-23 14:55:58 +09:00
|
|
|
mmc->read_bl_len;
|
|
|
|
|
|
|
|
/* Read the header too to avoid extra memcpy */
|
2016-05-15 05:03:06 +09:00
|
|
|
count = blk_dread(mmc_get_blk_desc(mmc), sector, image_size_sectors,
|
2016-09-25 09:20:13 +09:00
|
|
|
(void *)(ulong)spl_image->load_addr);
|
2017-01-02 20:48:31 +09:00
|
|
|
debug("read %x sectors to %lx\n", image_size_sectors,
|
2016-09-25 09:20:13 +09:00
|
|
|
spl_image->load_addr);
|
2016-02-23 14:55:58 +09:00
|
|
|
if (count != image_size_sectors)
|
|
|
|
return -EIO;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
|
|
|
|
ulong count, void *buf)
|
|
|
|
{
|
|
|
|
struct mmc *mmc = load->dev;
|
|
|
|
|
2016-05-15 05:03:06 +09:00
|
|
|
return blk_dread(mmc_get_blk_desc(mmc), sector, count, buf);
|
2016-02-23 14:55:58 +09:00
|
|
|
}
|
|
|
|
|
2016-09-25 09:20:13 +09:00
|
|
|
static int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
|
|
|
|
struct mmc *mmc, unsigned long sector)
|
2011-09-15 04:33:34 +09:00
|
|
|
{
|
2015-05-22 19:45:35 +09:00
|
|
|
unsigned long count;
|
2013-03-21 13:55:17 +09:00
|
|
|
struct image_header *header;
|
2016-02-23 14:55:58 +09:00
|
|
|
int ret = 0;
|
2011-09-15 04:33:34 +09:00
|
|
|
|
|
|
|
header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
|
2015-04-27 17:20:22 +09:00
|
|
|
sizeof(struct image_header));
|
2011-09-15 04:33:34 +09:00
|
|
|
|
|
|
|
/* read image header to find the image size & load address */
|
2016-05-15 05:03:06 +09:00
|
|
|
count = blk_dread(mmc_get_blk_desc(mmc), sector, 1, header);
|
2016-02-23 14:55:58 +09:00
|
|
|
debug("hdr read sector %lx, count=%lu\n", sector, count);
|
|
|
|
if (count == 0) {
|
|
|
|
ret = -EIO;
|
2011-09-15 04:33:34 +09:00
|
|
|
goto end;
|
2016-02-23 14:55:58 +09:00
|
|
|
}
|
2011-09-15 04:33:34 +09:00
|
|
|
|
2016-03-16 12:10:00 +09:00
|
|
|
if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
|
|
|
|
image_get_magic(header) == FDT_MAGIC) {
|
2016-02-23 14:55:58 +09:00
|
|
|
struct spl_load_info load;
|
|
|
|
|
|
|
|
debug("Found FIT\n");
|
|
|
|
load.dev = mmc;
|
|
|
|
load.priv = NULL;
|
2016-05-24 14:04:38 +09:00
|
|
|
load.filename = NULL;
|
2016-02-23 14:55:58 +09:00
|
|
|
load.bl_len = mmc->read_bl_len;
|
|
|
|
load.read = h_spl_load_read;
|
2016-09-25 09:20:16 +09:00
|
|
|
ret = spl_load_simple_fit(spl_image, &load, sector, header);
|
2016-03-16 12:10:00 +09:00
|
|
|
} else {
|
2016-09-25 09:20:13 +09:00
|
|
|
ret = mmc_load_legacy(spl_image, mmc, sector, header);
|
2015-06-24 06:38:47 +09:00
|
|
|
}
|
2013-06-29 03:43:01 +09:00
|
|
|
|
2011-09-15 04:33:34 +09:00
|
|
|
end:
|
2016-02-23 14:55:58 +09:00
|
|
|
if (ret) {
|
2013-09-05 00:12:24 +09:00
|
|
|
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
|
2016-04-21 11:12:04 +09:00
|
|
|
puts("mmc_load_image_raw_sector: mmc block read error\n");
|
2013-09-05 00:12:24 +09:00
|
|
|
#endif
|
2015-05-22 19:45:35 +09:00
|
|
|
return -1;
|
2015-06-04 01:48:51 +09:00
|
|
|
}
|
2015-05-22 19:45:35 +09:00
|
|
|
|
|
|
|
return 0;
|
2011-09-15 04:33:34 +09:00
|
|
|
}
|
|
|
|
|
2017-06-22 16:52:36 +09:00
|
|
|
static int spl_mmc_get_device_index(u32 boot_device)
|
2015-11-09 00:11:54 +09:00
|
|
|
{
|
|
|
|
switch (boot_device) {
|
|
|
|
case BOOT_DEVICE_MMC1:
|
|
|
|
return 0;
|
|
|
|
case BOOT_DEVICE_MMC2:
|
|
|
|
case BOOT_DEVICE_MMC2_2:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
|
|
|
|
printf("spl: unsupported mmc boot device.\n");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2015-12-03 02:59:12 +09:00
|
|
|
static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
|
2015-11-09 00:11:44 +09:00
|
|
|
{
|
2017-07-05 04:31:19 +09:00
|
|
|
#if CONFIG_IS_ENABLED(DM_MMC)
|
2015-11-09 00:11:44 +09:00
|
|
|
struct udevice *dev;
|
2015-12-03 02:59:13 +09:00
|
|
|
#endif
|
2015-11-09 00:11:54 +09:00
|
|
|
int err, mmc_dev;
|
|
|
|
|
|
|
|
mmc_dev = spl_mmc_get_device_index(boot_device);
|
|
|
|
if (mmc_dev < 0)
|
|
|
|
return mmc_dev;
|
2015-11-09 00:11:44 +09:00
|
|
|
|
|
|
|
err = mmc_initialize(NULL);
|
|
|
|
if (err) {
|
|
|
|
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
|
|
|
|
printf("spl: could not initialize mmc. error: %d\n", err);
|
|
|
|
#endif
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2017-07-05 04:31:19 +09:00
|
|
|
#if CONFIG_IS_ENABLED(DM_MMC)
|
2015-11-09 00:11:54 +09:00
|
|
|
err = uclass_get_device(UCLASS_MMC, mmc_dev, &dev);
|
2015-12-03 02:59:13 +09:00
|
|
|
if (!err)
|
|
|
|
*mmcp = mmc_get_mmc_dev(dev);
|
2015-11-09 00:11:44 +09:00
|
|
|
#else
|
2015-12-03 02:59:13 +09:00
|
|
|
*mmcp = find_mmc_device(mmc_dev);
|
|
|
|
err = *mmcp ? 0 : -ENODEV;
|
|
|
|
#endif
|
2015-11-09 00:11:44 +09:00
|
|
|
if (err) {
|
|
|
|
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
|
2015-12-03 02:59:13 +09:00
|
|
|
printf("spl: could not find mmc device. error: %d\n", err);
|
2015-11-09 00:11:44 +09:00
|
|
|
#endif
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-02-11 10:15:35 +09:00
|
|
|
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
|
2016-09-25 09:20:13 +09:00
|
|
|
static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
|
|
|
|
struct mmc *mmc, int partition)
|
2014-11-09 07:14:56 +09:00
|
|
|
{
|
|
|
|
disk_partition_t info;
|
2015-05-22 19:45:35 +09:00
|
|
|
int err;
|
2014-11-09 07:14:56 +09:00
|
|
|
|
2017-02-11 10:15:34 +09:00
|
|
|
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
|
|
|
|
int type_part;
|
|
|
|
/* Only support MBR so DOS_ENTRY_NUMBERS */
|
|
|
|
for (type_part = 1; type_part <= DOS_ENTRY_NUMBERS; type_part++) {
|
|
|
|
err = part_get_info(mmc_get_blk_desc(mmc), type_part, &info);
|
|
|
|
if (err)
|
|
|
|
continue;
|
|
|
|
if (info.sys_ind ==
|
|
|
|
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE) {
|
|
|
|
partition = type_part;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-07-06 08:10:18 +09:00
|
|
|
err = part_get_info(mmc_get_blk_desc(mmc), partition, &info);
|
2015-05-22 19:45:35 +09:00
|
|
|
if (err) {
|
2014-11-09 07:14:56 +09:00
|
|
|
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
|
2015-06-04 01:48:51 +09:00
|
|
|
puts("spl: partition error\n");
|
2014-11-09 07:14:56 +09:00
|
|
|
#endif
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-11-17 02:19:05 +09:00
|
|
|
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
|
2016-09-25 09:20:13 +09:00
|
|
|
return mmc_load_image_raw_sector(spl_image, mmc,
|
|
|
|
info.start + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
|
2015-07-20 18:20:39 +09:00
|
|
|
#else
|
2016-09-25 09:20:13 +09:00
|
|
|
return mmc_load_image_raw_sector(spl_image, mmc, info.start);
|
2015-07-20 18:20:39 +09:00
|
|
|
#endif
|
2014-11-09 07:14:56 +09:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-05-13 17:36:29 +09:00
|
|
|
#ifdef CONFIG_SPL_OS_BOOT
|
2016-09-25 09:20:13 +09:00
|
|
|
static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
|
|
|
|
struct mmc *mmc)
|
2013-05-13 17:36:29 +09:00
|
|
|
{
|
2015-05-22 19:45:35 +09:00
|
|
|
unsigned long count;
|
2016-04-11 18:54:50 +09:00
|
|
|
int ret;
|
2015-04-27 17:20:22 +09:00
|
|
|
|
2016-06-13 14:30:32 +09:00
|
|
|
count = blk_dread(mmc_get_blk_desc(mmc),
|
2015-05-22 19:45:35 +09:00
|
|
|
CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR,
|
|
|
|
CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS,
|
|
|
|
(void *) CONFIG_SYS_SPL_ARGS_ADDR);
|
|
|
|
if (count == 0) {
|
2013-09-05 00:12:24 +09:00
|
|
|
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
|
2016-04-21 11:12:04 +09:00
|
|
|
puts("mmc_load_image_raw_os: mmc block read error\n");
|
2013-09-05 00:12:24 +09:00
|
|
|
#endif
|
2013-05-13 17:36:29 +09:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-25 09:20:13 +09:00
|
|
|
ret = mmc_load_image_raw_sector(spl_image, mmc,
|
2015-04-27 17:20:22 +09:00
|
|
|
CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR);
|
2016-04-11 18:54:50 +09:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2016-09-25 09:20:13 +09:00
|
|
|
if (spl_image->os != IH_OS_LINUX) {
|
2016-04-11 18:54:50 +09:00
|
|
|
puts("Expected Linux image is not found. Trying to start U-boot\n");
|
|
|
|
return -ENOENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2013-05-13 17:36:29 +09:00
|
|
|
}
|
2015-11-09 00:11:45 +09:00
|
|
|
#else
|
|
|
|
int spl_start_uboot(void)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2016-09-25 09:20:13 +09:00
|
|
|
static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
|
|
|
|
struct mmc *mmc)
|
2015-11-09 00:11:45 +09:00
|
|
|
{
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
2013-05-13 17:36:29 +09:00
|
|
|
#endif
|
|
|
|
|
2015-11-09 00:11:47 +09:00
|
|
|
#ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
|
2016-09-25 09:20:13 +09:00
|
|
|
static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
|
2015-11-09 00:11:47 +09:00
|
|
|
{
|
|
|
|
int err = -ENOSYS;
|
|
|
|
|
|
|
|
#ifdef CONFIG_SPL_FAT_SUPPORT
|
|
|
|
if (!spl_start_uboot()) {
|
2016-09-25 09:20:15 +09:00
|
|
|
err = spl_load_image_fat_os(spl_image, mmc_get_blk_desc(mmc),
|
2015-11-09 00:11:47 +09:00
|
|
|
CONFIG_SYS_MMCSD_FS_BOOT_PARTITION);
|
|
|
|
if (!err)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
|
2016-09-25 09:20:15 +09:00
|
|
|
err = spl_load_image_fat(spl_image, mmc_get_blk_desc(mmc),
|
2015-11-09 00:11:47 +09:00
|
|
|
CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
|
|
|
|
CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
|
|
|
|
if (!err)
|
|
|
|
return err;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SPL_EXT_SUPPORT
|
|
|
|
if (!spl_start_uboot()) {
|
2016-12-01 19:09:01 +09:00
|
|
|
err = spl_load_image_ext_os(spl_image, mmc_get_blk_desc(mmc),
|
2015-11-09 00:11:47 +09:00
|
|
|
CONFIG_SYS_MMCSD_FS_BOOT_PARTITION);
|
|
|
|
if (!err)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
|
2016-12-01 19:09:01 +09:00
|
|
|
err = spl_load_image_ext(spl_image, mmc_get_blk_desc(mmc),
|
2015-11-09 00:11:47 +09:00
|
|
|
CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
|
|
|
|
CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
|
|
|
|
if (!err)
|
|
|
|
return err;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
|
|
|
|
err = -ENOENT;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
#else
|
2016-09-25 09:20:13 +09:00
|
|
|
static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
|
2015-11-09 00:11:47 +09:00
|
|
|
{
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-12-01 10:06:35 +09:00
|
|
|
int spl_mmc_load_image(struct spl_image_info *spl_image,
|
|
|
|
struct spl_boot_device *bootdev)
|
2011-09-15 04:33:34 +09:00
|
|
|
{
|
2015-12-03 02:59:11 +09:00
|
|
|
struct mmc *mmc = NULL;
|
2011-09-15 04:33:34 +09:00
|
|
|
u32 boot_mode;
|
2015-06-24 06:38:51 +09:00
|
|
|
int err = 0;
|
2015-04-27 17:20:22 +09:00
|
|
|
__maybe_unused int part;
|
2011-09-15 04:33:34 +09:00
|
|
|
|
2016-09-25 09:19:57 +09:00
|
|
|
err = spl_mmc_find_device(&mmc, bootdev->boot_device);
|
2015-11-09 00:11:49 +09:00
|
|
|
if (err)
|
|
|
|
return err;
|
2011-09-15 04:33:34 +09:00
|
|
|
|
2015-11-09 00:11:44 +09:00
|
|
|
err = mmc_init(mmc);
|
2011-09-15 04:33:34 +09:00
|
|
|
if (err) {
|
2013-09-05 00:12:24 +09:00
|
|
|
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
|
2015-04-27 17:20:22 +09:00
|
|
|
printf("spl: mmc init failed with error: %d\n", err);
|
2013-09-05 00:12:24 +09:00
|
|
|
#endif
|
2015-11-09 00:11:49 +09:00
|
|
|
return err;
|
2011-09-15 04:33:34 +09:00
|
|
|
}
|
2013-05-13 17:36:25 +09:00
|
|
|
|
2016-09-25 09:19:57 +09:00
|
|
|
boot_mode = spl_boot_mode(bootdev->boot_device);
|
2015-11-09 00:11:49 +09:00
|
|
|
err = -EINVAL;
|
2015-04-27 17:20:22 +09:00
|
|
|
switch (boot_mode) {
|
2015-11-09 00:11:48 +09:00
|
|
|
case MMCSD_MODE_EMMCBOOT:
|
|
|
|
/*
|
|
|
|
* We need to check what the partition is configured to.
|
|
|
|
* 1 and 2 match up to boot0 / boot1 and 7 is user data
|
|
|
|
* which is the first physical partition (0).
|
|
|
|
*/
|
|
|
|
part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
|
|
|
|
|
|
|
|
if (part == 7)
|
|
|
|
part = 0;
|
|
|
|
|
2016-12-01 10:06:33 +09:00
|
|
|
if (CONFIG_IS_ENABLED(MMC_TINY))
|
|
|
|
err = mmc_switch_part(mmc, part);
|
|
|
|
else
|
|
|
|
err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
|
|
|
|
|
2015-11-09 00:11:49 +09:00
|
|
|
if (err) {
|
2015-11-09 00:11:48 +09:00
|
|
|
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
|
|
|
|
puts("spl: mmc partition switch failed\n");
|
|
|
|
#endif
|
2015-11-09 00:11:49 +09:00
|
|
|
return err;
|
2015-11-09 00:11:48 +09:00
|
|
|
}
|
|
|
|
/* Fall through */
|
2015-04-27 17:20:22 +09:00
|
|
|
case MMCSD_MODE_RAW:
|
|
|
|
debug("spl: mmc boot mode: raw\n");
|
|
|
|
|
|
|
|
if (!spl_start_uboot()) {
|
2016-09-25 09:20:13 +09:00
|
|
|
err = mmc_load_image_raw_os(spl_image, mmc);
|
2015-04-27 17:20:22 +09:00
|
|
|
if (!err)
|
2015-11-09 00:11:49 +09:00
|
|
|
return err;
|
2015-04-27 17:20:22 +09:00
|
|
|
}
|
2017-02-11 10:15:35 +09:00
|
|
|
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
|
2016-09-25 09:20:13 +09:00
|
|
|
err = mmc_load_image_raw_partition(spl_image, mmc,
|
2014-11-09 07:14:56 +09:00
|
|
|
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION);
|
2015-06-09 06:05:09 +09:00
|
|
|
if (!err)
|
2015-11-09 00:11:49 +09:00
|
|
|
return err;
|
2017-02-11 10:15:35 +09:00
|
|
|
#endif
|
2016-11-17 02:19:05 +09:00
|
|
|
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
|
2016-09-25 09:20:13 +09:00
|
|
|
err = mmc_load_image_raw_sector(spl_image, mmc,
|
2014-01-17 02:23:29 +09:00
|
|
|
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
|
2015-04-27 17:20:22 +09:00
|
|
|
if (!err)
|
2015-11-09 00:11:49 +09:00
|
|
|
return err;
|
2015-06-09 06:05:09 +09:00
|
|
|
#endif
|
2016-02-19 02:17:36 +09:00
|
|
|
/* If RAW mode fails, try FS mode. */
|
2015-04-27 17:20:22 +09:00
|
|
|
case MMCSD_MODE_FS:
|
|
|
|
debug("spl: mmc boot mode: fs\n");
|
|
|
|
|
2016-09-25 09:20:13 +09:00
|
|
|
err = spl_mmc_do_fs_boot(spl_image, mmc);
|
2015-04-27 17:20:22 +09:00
|
|
|
if (!err)
|
2015-11-09 00:11:49 +09:00
|
|
|
return err;
|
2015-11-09 00:11:47 +09:00
|
|
|
|
2015-11-09 00:11:43 +09:00
|
|
|
break;
|
2013-09-05 00:12:24 +09:00
|
|
|
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
|
2015-11-09 00:11:43 +09:00
|
|
|
default:
|
|
|
|
puts("spl: mmc: wrong boot mode\n");
|
2013-09-05 00:12:24 +09:00
|
|
|
#endif
|
2015-04-27 17:20:22 +09:00
|
|
|
}
|
2015-11-09 00:11:43 +09:00
|
|
|
|
2015-11-09 00:11:49 +09:00
|
|
|
return err;
|
2011-09-15 04:33:34 +09:00
|
|
|
}
|
2016-09-25 09:20:00 +09:00
|
|
|
|
2016-12-01 07:30:50 +09:00
|
|
|
SPL_LOAD_IMAGE_METHOD("MMC1", 0, BOOT_DEVICE_MMC1, spl_mmc_load_image);
|
|
|
|
SPL_LOAD_IMAGE_METHOD("MMC2", 0, BOOT_DEVICE_MMC2, spl_mmc_load_image);
|
|
|
|
SPL_LOAD_IMAGE_METHOD("MMC2_2", 0, BOOT_DEVICE_MMC2_2, spl_mmc_load_image);
|