aboutsummaryrefslogtreecommitdiff
path: root/common/spl
diff options
context:
space:
mode:
authorSimon Glass2016-09-24 18:19:59 -0600
committerTom Rini2016-10-06 15:06:35 -0400
commit98136b2f26fa4afc8e3a9954cb85038d29b2e4e3 (patch)
tree0f2b3b35f1c8f8d1e8badd598938226764f335d7 /common/spl
parenta0a8029058e11b8eda1a3d61fdf497bc687b30f8 (diff)
spl: Convert spl_ram_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit switch() code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> [trini: Include updating the DFU case] Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'common/spl')
-rw-r--r--common/spl/spl.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c
index eb3b808e468..b8ec72c64e9 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -191,6 +191,11 @@ static int spl_ram_load_image(struct spl_boot_device *bootdev)
header = (struct image_header *)CONFIG_SPL_LOAD_FIT_ADDRESS;
+#if defined(CONFIG_SPL_DFU_SUPPORT)
+ if (bootdev->boot_device == BOOT_DEVICE_DFU)
+ spl_dfu_cmd(0, "dfu_alt_info_ram", "ram", "0");
+#endif
+
if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
image_get_magic(header) == FDT_MAGIC) {
struct spl_load_info load;
@@ -215,6 +220,10 @@ static int spl_ram_load_image(struct spl_boot_device *bootdev)
return 0;
}
+SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_RAM, spl_ram_load_image);
+#if defined(CONFIG_SPL_DFU_SUPPORT)
+SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_DFU, spl_ram_load_image);
+#endif
#endif
int spl_init(void)
@@ -375,10 +384,6 @@ static int spl_load_image(u32 boot_device)
return loader->load_image(&bootdev);
switch (boot_device) {
-#ifdef CONFIG_SPL_RAM_DEVICE
- case BOOT_DEVICE_RAM:
- return spl_ram_load_image(&bootdev);
-#endif
#ifdef CONFIG_SPL_MMC_SUPPORT
case BOOT_DEVICE_MMC1:
case BOOT_DEVICE_MMC2:
@@ -427,11 +432,6 @@ static int spl_load_image(u32 boot_device)
case BOOT_DEVICE_USB:
return spl_usb_load_image(&bootdev);
#endif
-#ifdef CONFIG_SPL_DFU_SUPPORT
- case BOOT_DEVICE_DFU:
- spl_dfu_cmd(0, "dfu_alt_info_ram", "ram", "0");
- return spl_ram_load_image(&bootdev);
-#endif
#ifdef CONFIG_SPL_SATA_SUPPORT
case BOOT_DEVICE_SATA:
return spl_sata_load_image(&bootdev);