blob: b2cccc6c6e41ca450e49cd68fc28516187d8372e [file] [log] [blame]
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -04001/*
2 * (C) Copyright 2010
3 * Texas Instruments, <www.ti.com>
4 *
5 * Aneesh V <aneesh@ti.com>
6 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02007 * SPDX-License-Identifier: GPL-2.0+
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -04008 */
9#include <common.h>
Simon Glassdc3dedf2015-06-23 15:38:51 -060010#include <dm.h>
Tom Rini47f7bca2012-08-13 12:03:19 -070011#include <spl.h>
Paul Kocialkowski91199f42015-04-27 10:20:22 +020012#include <linux/compiler.h>
Nikita Kiryanov36afd452015-11-08 17:11:49 +020013#include <errno.h>
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -040014#include <asm/u-boot.h>
Nikita Kiryanov4188ba32015-11-08 17:11:44 +020015#include <errno.h>
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -040016#include <mmc.h>
Tom Rinie4c444b2013-06-28 14:43:01 -040017#include <image.h>
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -040018
19DECLARE_GLOBAL_DATA_PTR;
20
Simon Glass2a2ee2a2016-09-24 18:20:13 -060021static int mmc_load_legacy(struct spl_image_info *spl_image, struct mmc *mmc,
22 ulong sector, struct image_header *header)
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -040023{
Peter Korsgaard2e222102013-03-21 04:55:17 +000024 u32 image_size_sectors;
Simon Glass96debd12016-02-22 22:55:58 -070025 unsigned long count;
Marek Vasut7e0f2262016-04-29 00:44:54 +020026 int ret;
Tom Rinie4c444b2013-06-28 14:43:01 -040027
Simon Glass2a2ee2a2016-09-24 18:20:13 -060028 ret = spl_parse_image_header(spl_image, header);
Marek Vasut7e0f2262016-04-29 00:44:54 +020029 if (ret)
30 return ret;
31
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -040032 /* convert size to sectors - round up */
Simon Glass2a2ee2a2016-09-24 18:20:13 -060033 image_size_sectors = (spl_image->size + mmc->read_bl_len - 1) /
Paul Kocialkowski91199f42015-04-27 10:20:22 +020034 mmc->read_bl_len;
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -040035
36 /* Read the header too to avoid extra memcpy */
Simon Glassef5609c2016-05-14 14:03:06 -060037 count = blk_dread(mmc_get_blk_desc(mmc), sector, image_size_sectors,
Simon Glass2a2ee2a2016-09-24 18:20:13 -060038 (void *)(ulong)spl_image->load_addr);
Andre Przywara11e14792017-01-02 11:48:31 +000039 debug("read %x sectors to %lx\n", image_size_sectors,
Simon Glass2a2ee2a2016-09-24 18:20:13 -060040 spl_image->load_addr);
Simon Glass96debd12016-02-22 22:55:58 -070041 if (count != image_size_sectors)
42 return -EIO;
43
44 return 0;
45}
46
Simon Glass96debd12016-02-22 22:55:58 -070047static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
48 ulong count, void *buf)
49{
50 struct mmc *mmc = load->dev;
51
Simon Glassef5609c2016-05-14 14:03:06 -060052 return blk_dread(mmc_get_blk_desc(mmc), sector, count, buf);
Simon Glass96debd12016-02-22 22:55:58 -070053}
Simon Glass96debd12016-02-22 22:55:58 -070054
Simon Glass2a2ee2a2016-09-24 18:20:13 -060055static int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
56 struct mmc *mmc, unsigned long sector)
Simon Glass96debd12016-02-22 22:55:58 -070057{
58 unsigned long count;
59 struct image_header *header;
60 int ret = 0;
61
62 header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
63 sizeof(struct image_header));
64
65 /* read image header to find the image size & load address */
Simon Glassef5609c2016-05-14 14:03:06 -060066 count = blk_dread(mmc_get_blk_desc(mmc), sector, 1, header);
Simon Glass96debd12016-02-22 22:55:58 -070067 debug("hdr read sector %lx, count=%lu\n", sector, count);
68 if (count == 0) {
69 ret = -EIO;
70 goto end;
71 }
72
Masahiro Yamada4976f482016-03-16 12:10:00 +090073 if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
74 image_get_magic(header) == FDT_MAGIC) {
Simon Glass96debd12016-02-22 22:55:58 -070075 struct spl_load_info load;
76
77 debug("Found FIT\n");
78 load.dev = mmc;
79 load.priv = NULL;
Lokesh Vutlaeafd5412016-05-24 10:34:38 +053080 load.filename = NULL;
Simon Glass96debd12016-02-22 22:55:58 -070081 load.bl_len = mmc->read_bl_len;
82 load.read = h_spl_load_read;
Simon Glassf4d7d852016-09-24 18:20:16 -060083 ret = spl_load_simple_fit(spl_image, &load, sector, header);
Masahiro Yamada4976f482016-03-16 12:10:00 +090084 } else {
Simon Glass2a2ee2a2016-09-24 18:20:13 -060085 ret = mmc_load_legacy(spl_image, mmc, sector, header);
Simon Glass96debd12016-02-22 22:55:58 -070086 }
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -040087
88end:
Simon Glass96debd12016-02-22 22:55:58 -070089 if (ret) {
Paul Burton8112f5f2013-09-04 16:12:24 +010090#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
Fabio Estevam5bbf4092016-04-20 23:12:04 -030091 puts("mmc_load_image_raw_sector: mmc block read error\n");
Paul Burton8112f5f2013-09-04 16:12:24 +010092#endif
Paul Kocialkowski3bc37b62015-05-22 12:45:35 +020093 return -1;
Paul Kocialkowski1ec26462015-06-03 18:48:51 +020094 }
Paul Kocialkowski3bc37b62015-05-22 12:45:35 +020095
96 return 0;
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -040097}
98
Masahiro Yamada207d8b32017-06-22 16:52:36 +090099static int spl_mmc_get_device_index(u32 boot_device)
Nikita Kiryanova1e56cf2015-11-08 17:11:54 +0200100{
101 switch (boot_device) {
102 case BOOT_DEVICE_MMC1:
103 return 0;
104 case BOOT_DEVICE_MMC2:
105 case BOOT_DEVICE_MMC2_2:
106 return 1;
107 }
108
109#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
110 printf("spl: unsupported mmc boot device.\n");
111#endif
112
113 return -ENODEV;
114}
115
Simon Glass99c7a512015-12-02 10:59:12 -0700116static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
Nikita Kiryanov4188ba32015-11-08 17:11:44 +0200117{
Simon Glassc4d660d2017-07-04 13:31:19 -0600118#if CONFIG_IS_ENABLED(DM_MMC)
Nikita Kiryanov4188ba32015-11-08 17:11:44 +0200119 struct udevice *dev;
Simon Glassb4857aa2015-12-02 10:59:13 -0700120#endif
Nikita Kiryanova1e56cf2015-11-08 17:11:54 +0200121 int err, mmc_dev;
122
123 mmc_dev = spl_mmc_get_device_index(boot_device);
124 if (mmc_dev < 0)
125 return mmc_dev;
Nikita Kiryanov4188ba32015-11-08 17:11:44 +0200126
127 err = mmc_initialize(NULL);
128 if (err) {
129#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
130 printf("spl: could not initialize mmc. error: %d\n", err);
131#endif
132 return err;
133 }
134
Simon Glassc4d660d2017-07-04 13:31:19 -0600135#if CONFIG_IS_ENABLED(DM_MMC)
Nikita Kiryanova1e56cf2015-11-08 17:11:54 +0200136 err = uclass_get_device(UCLASS_MMC, mmc_dev, &dev);
Simon Glassb4857aa2015-12-02 10:59:13 -0700137 if (!err)
138 *mmcp = mmc_get_mmc_dev(dev);
139#else
140 *mmcp = find_mmc_device(mmc_dev);
141 err = *mmcp ? 0 : -ENODEV;
142#endif
Nikita Kiryanov4188ba32015-11-08 17:11:44 +0200143 if (err) {
144#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
145 printf("spl: could not find mmc device. error: %d\n", err);
146#endif
147 return err;
148 }
149
Nikita Kiryanov4188ba32015-11-08 17:11:44 +0200150 return 0;
151}
Nikita Kiryanov4188ba32015-11-08 17:11:44 +0200152
Dalon Westergreen949123e2017-02-10 17:15:35 -0800153#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600154static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
155 struct mmc *mmc, int partition)
Paul Kocialkowskib97300b2014-11-08 23:14:56 +0100156{
157 disk_partition_t info;
Paul Kocialkowski3bc37b62015-05-22 12:45:35 +0200158 int err;
Paul Kocialkowskib97300b2014-11-08 23:14:56 +0100159
Dalon Westergreenf0fb4fa2017-02-10 17:15:34 -0800160#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
161 int type_part;
162 /* Only support MBR so DOS_ENTRY_NUMBERS */
163 for (type_part = 1; type_part <= DOS_ENTRY_NUMBERS; type_part++) {
164 err = part_get_info(mmc_get_blk_desc(mmc), type_part, &info);
165 if (err)
166 continue;
167 if (info.sys_ind ==
168 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE) {
169 partition = type_part;
170 break;
171 }
172 }
173#endif
174
Simon Glass1e2b3ef2016-07-05 17:10:18 -0600175 err = part_get_info(mmc_get_blk_desc(mmc), partition, &info);
Paul Kocialkowski3bc37b62015-05-22 12:45:35 +0200176 if (err) {
Paul Kocialkowskib97300b2014-11-08 23:14:56 +0100177#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
Paul Kocialkowski1ec26462015-06-03 18:48:51 +0200178 puts("spl: partition error\n");
Paul Kocialkowskib97300b2014-11-08 23:14:56 +0100179#endif
180 return -1;
181 }
182
Semen Protsenko38fed8a2016-11-16 19:19:05 +0200183#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600184 return mmc_load_image_raw_sector(spl_image, mmc,
185 info.start + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
Stefan Roese4bfcc542015-07-20 11:20:39 +0200186#else
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600187 return mmc_load_image_raw_sector(spl_image, mmc, info.start);
Stefan Roese4bfcc542015-07-20 11:20:39 +0200188#endif
Paul Kocialkowskib97300b2014-11-08 23:14:56 +0100189}
190#endif
191
Peter Korsgaard2b75b0a2013-05-13 08:36:29 +0000192#ifdef CONFIG_SPL_OS_BOOT
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600193static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
194 struct mmc *mmc)
Peter Korsgaard2b75b0a2013-05-13 08:36:29 +0000195{
Paul Kocialkowski3bc37b62015-05-22 12:45:35 +0200196 unsigned long count;
Lokesh Vutla811906a2016-04-11 15:24:50 +0530197 int ret;
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200198
Simon Glass87bce4e2016-06-12 23:30:32 -0600199 count = blk_dread(mmc_get_blk_desc(mmc),
Paul Kocialkowski3bc37b62015-05-22 12:45:35 +0200200 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR,
201 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS,
202 (void *) CONFIG_SYS_SPL_ARGS_ADDR);
Tom Rini9585dd32017-08-14 21:01:30 -0400203 if (count != CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS) {
Paul Burton8112f5f2013-09-04 16:12:24 +0100204#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
Fabio Estevam5bbf4092016-04-20 23:12:04 -0300205 puts("mmc_load_image_raw_os: mmc block read error\n");
Paul Burton8112f5f2013-09-04 16:12:24 +0100206#endif
Peter Korsgaard2b75b0a2013-05-13 08:36:29 +0000207 return -1;
208 }
209
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600210 ret = mmc_load_image_raw_sector(spl_image, mmc,
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200211 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR);
Lokesh Vutla811906a2016-04-11 15:24:50 +0530212 if (ret)
213 return ret;
214
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600215 if (spl_image->os != IH_OS_LINUX) {
Lokesh Vutla811906a2016-04-11 15:24:50 +0530216 puts("Expected Linux image is not found. Trying to start U-boot\n");
217 return -ENOENT;
218 }
219
220 return 0;
Peter Korsgaard2b75b0a2013-05-13 08:36:29 +0000221}
Nikita Kiryanov339245b2015-11-08 17:11:45 +0200222#else
223int spl_start_uboot(void)
224{
225 return 1;
226}
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600227static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
228 struct mmc *mmc)
Nikita Kiryanov339245b2015-11-08 17:11:45 +0200229{
230 return -ENOSYS;
231}
Peter Korsgaard2b75b0a2013-05-13 08:36:29 +0000232#endif
233
Nikita Kiryanovf52b7292015-11-08 17:11:47 +0200234#ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600235static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
Nikita Kiryanovf52b7292015-11-08 17:11:47 +0200236{
237 int err = -ENOSYS;
238
239#ifdef CONFIG_SPL_FAT_SUPPORT
240 if (!spl_start_uboot()) {
Simon Glass710e9ca2016-09-24 18:20:15 -0600241 err = spl_load_image_fat_os(spl_image, mmc_get_blk_desc(mmc),
Nikita Kiryanovf52b7292015-11-08 17:11:47 +0200242 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION);
243 if (!err)
244 return err;
245 }
246#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
Simon Glass710e9ca2016-09-24 18:20:15 -0600247 err = spl_load_image_fat(spl_image, mmc_get_blk_desc(mmc),
Nikita Kiryanovf52b7292015-11-08 17:11:47 +0200248 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
249 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
250 if (!err)
251 return err;
252#endif
253#endif
254#ifdef CONFIG_SPL_EXT_SUPPORT
255 if (!spl_start_uboot()) {
Michal Simek1a925412016-12-01 11:09:01 +0100256 err = spl_load_image_ext_os(spl_image, mmc_get_blk_desc(mmc),
Nikita Kiryanovf52b7292015-11-08 17:11:47 +0200257 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION);
258 if (!err)
259 return err;
260 }
261#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
Michal Simek1a925412016-12-01 11:09:01 +0100262 err = spl_load_image_ext(spl_image, mmc_get_blk_desc(mmc),
Nikita Kiryanovf52b7292015-11-08 17:11:47 +0200263 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
264 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
265 if (!err)
266 return err;
267#endif
268#endif
269
270#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
271 err = -ENOENT;
272#endif
273
274 return err;
275}
276#else
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600277static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
Nikita Kiryanovf52b7292015-11-08 17:11:47 +0200278{
279 return -ENOSYS;
280}
281#endif
282
Marek Vasut09410c62016-12-01 02:06:35 +0100283int spl_mmc_load_image(struct spl_image_info *spl_image,
284 struct spl_boot_device *bootdev)
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -0400285{
Simon Glassd773a002015-12-02 10:59:11 -0700286 struct mmc *mmc = NULL;
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -0400287 u32 boot_mode;
Simon Glassdc3dedf2015-06-23 15:38:51 -0600288 int err = 0;
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200289 __maybe_unused int part;
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -0400290
Simon Glassecdfd692016-09-24 18:19:57 -0600291 err = spl_mmc_find_device(&mmc, bootdev->boot_device);
Nikita Kiryanov36afd452015-11-08 17:11:49 +0200292 if (err)
293 return err;
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -0400294
Nikita Kiryanov4188ba32015-11-08 17:11:44 +0200295 err = mmc_init(mmc);
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -0400296 if (err) {
Paul Burton8112f5f2013-09-04 16:12:24 +0100297#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200298 printf("spl: mmc init failed with error: %d\n", err);
Paul Burton8112f5f2013-09-04 16:12:24 +0100299#endif
Nikita Kiryanov36afd452015-11-08 17:11:49 +0200300 return err;
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -0400301 }
Peter Korsgaard79adb7a2013-05-13 08:36:25 +0000302
Simon Glassecdfd692016-09-24 18:19:57 -0600303 boot_mode = spl_boot_mode(bootdev->boot_device);
Nikita Kiryanov36afd452015-11-08 17:11:49 +0200304 err = -EINVAL;
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200305 switch (boot_mode) {
Nikita Kiryanov83cdf6f2015-11-08 17:11:48 +0200306 case MMCSD_MODE_EMMCBOOT:
307 /*
308 * We need to check what the partition is configured to.
309 * 1 and 2 match up to boot0 / boot1 and 7 is user data
310 * which is the first physical partition (0).
311 */
312 part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
313
314 if (part == 7)
315 part = 0;
316
Marek Vasutb5b838f2016-12-01 02:06:33 +0100317 if (CONFIG_IS_ENABLED(MMC_TINY))
318 err = mmc_switch_part(mmc, part);
319 else
320 err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
321
Nikita Kiryanov36afd452015-11-08 17:11:49 +0200322 if (err) {
Nikita Kiryanov83cdf6f2015-11-08 17:11:48 +0200323#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
324 puts("spl: mmc partition switch failed\n");
325#endif
Nikita Kiryanov36afd452015-11-08 17:11:49 +0200326 return err;
Nikita Kiryanov83cdf6f2015-11-08 17:11:48 +0200327 }
328 /* Fall through */
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200329 case MMCSD_MODE_RAW:
330 debug("spl: mmc boot mode: raw\n");
331
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200332 if (!spl_start_uboot()) {
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600333 err = mmc_load_image_raw_os(spl_image, mmc);
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200334 if (!err)
Nikita Kiryanov36afd452015-11-08 17:11:49 +0200335 return err;
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200336 }
Dalon Westergreen949123e2017-02-10 17:15:35 -0800337#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600338 err = mmc_load_image_raw_partition(spl_image, mmc,
Paul Kocialkowskib97300b2014-11-08 23:14:56 +0100339 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION);
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200340 if (!err)
Nikita Kiryanov36afd452015-11-08 17:11:49 +0200341 return err;
Dalon Westergreen949123e2017-02-10 17:15:35 -0800342#endif
Semen Protsenko38fed8a2016-11-16 19:19:05 +0200343#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600344 err = mmc_load_image_raw_sector(spl_image, mmc,
Paul Kocialkowski3ae8f4c2015-06-08 23:05:09 +0200345 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
346 if (!err)
Nikita Kiryanov36afd452015-11-08 17:11:49 +0200347 return err;
Paul Kocialkowski3ae8f4c2015-06-08 23:05:09 +0200348#endif
Guillaume GARDET86a0df72016-02-18 18:17:36 +0100349 /* If RAW mode fails, try FS mode. */
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200350 case MMCSD_MODE_FS:
351 debug("spl: mmc boot mode: fs\n");
352
Simon Glass2a2ee2a2016-09-24 18:20:13 -0600353 err = spl_mmc_do_fs_boot(spl_image, mmc);
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200354 if (!err)
Nikita Kiryanov36afd452015-11-08 17:11:49 +0200355 return err;
Nikita Kiryanovf52b7292015-11-08 17:11:47 +0200356
Nikita Kiryanovfd61d392015-11-08 17:11:43 +0200357 break;
Guillaume GARDET2c84c9a2014-12-16 12:00:44 +0100358#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
Nikita Kiryanovfd61d392015-11-08 17:11:43 +0200359 default:
360 puts("spl: mmc: wrong boot mode\n");
Guillaume GARDET2c84c9a2014-12-16 12:00:44 +0100361#endif
Paul Kocialkowski91199f42015-04-27 10:20:22 +0200362 }
Nikita Kiryanovfd61d392015-11-08 17:11:43 +0200363
Nikita Kiryanov36afd452015-11-08 17:11:49 +0200364 return err;
Simon Schwarz9ea5c6e2011-09-14 15:33:34 -0400365}
Simon Glass0fed9c72016-09-24 18:20:00 -0600366
Simon Glassebc4ef62016-11-30 15:30:50 -0700367SPL_LOAD_IMAGE_METHOD("MMC1", 0, BOOT_DEVICE_MMC1, spl_mmc_load_image);
368SPL_LOAD_IMAGE_METHOD("MMC2", 0, BOOT_DEVICE_MMC2, spl_mmc_load_image);
369SPL_LOAD_IMAGE_METHOD("MMC2_2", 0, BOOT_DEVICE_MMC2_2, spl_mmc_load_image);