summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-09-24 18:20:12 -0600
committerTom Rini <trini@konsulko.com>2016-10-06 15:08:50 -0400
commit97d9df0a91f1c68695913518d8dfaf26c41dbb32 (patch)
tree78671e0558f13a3c3716950fdd2ee0552d43b68e
parent7ec0389354b8fd27ed1d1fb2d4f451e74f40534c (diff)
spl: Convert spl_board_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit switch() code. Update existing users. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
-rw-r--r--arch/arm/mach-sunxi/board.c5
-rw-r--r--arch/arm/mach-uniphier/boot-mode/spl_board.c3
-rw-r--r--arch/sandbox/cpu/spl.c3
-rw-r--r--common/spl/spl.c13
-rw-r--r--include/spl.h8
5 files changed, 10 insertions, 22 deletions
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 8a385a25fd..22f3e3c116 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -133,13 +133,16 @@ static int gpio_init(void)
return 0;
}
-int spl_board_load_image(struct spl_boot_device *bootdev)
+#ifdef CONFIG_SPL_BUILD
+static int spl_board_load_image(struct spl_boot_device *bootdev)
{
debug("Returning to FEL sp=%x, lr=%x\n", fel_stash.sp, fel_stash.lr);
return_to_fel(fel_stash.sp, fel_stash.lr);
return 0;
}
+SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
+#endif
void s_init(void)
{
diff --git a/arch/arm/mach-uniphier/boot-mode/spl_board.c b/arch/arm/mach-uniphier/boot-mode/spl_board.c
index 4eadc2f26a..e2b202ea1d 100644
--- a/arch/arm/mach-uniphier/boot-mode/spl_board.c
+++ b/arch/arm/mach-uniphier/boot-mode/spl_board.c
@@ -65,7 +65,7 @@ int uniphier_rom_get_mmc_funcptr(int (**send_cmd)(u32, u32),
return 0;
}
-int spl_board_load_image(struct spl_boot_device *bootdev)
+static int spl_board_load_image(struct spl_boot_device *bootdev)
{
int (*send_cmd)(u32 cmd, u32 arg);
int (*card_blockaddr)(u32 rca);
@@ -126,3 +126,4 @@ int spl_board_load_image(struct spl_boot_device *bootdev)
return 0;
}
+SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index 4cee293f76..2c45354ca0 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -38,7 +38,7 @@ void spl_board_announce_boot_device(void)
printf("%s\n", fname);
}
-int spl_board_load_image(struct spl_boot_device *bootdev)
+static int spl_board_load_image(struct spl_boot_device *bootdev)
{
char fname[256];
int ret;
@@ -50,6 +50,7 @@ int spl_board_load_image(struct spl_boot_device *bootdev)
/* Hopefully this will not return */
return os_spl_to_uboot(fname);
}
+SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
void spl_board_init(void)
{
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 713c27fa2c..84c80345b6 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -383,19 +383,10 @@ static int spl_load_image(u32 boot_device)
if (loader)
return loader->load_image(&bootdev);
- switch (boot_device) {
-#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
- case BOOT_DEVICE_BOARD:
- return spl_board_load_image(&bootdev);
-#endif
- default:
#if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
- puts("SPL: Unsupported Boot Device!\n");
+ puts("SPL: Unsupported Boot Device!\n");
#endif
- return -ENODEV;
- }
-
- return -EINVAL;
+ return -ENODEV;
}
void board_init_r(gd_t *dummy1, ulong dummy2)
diff --git a/include/spl.h b/include/spl.h
index d6b2c9079f..895240d28e 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -228,12 +228,4 @@ bool spl_was_boot_source(void);
*/
int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr);
-/**
- * Board-specific load method for boards that have a special way of loading
- * U-Boot, which does not fit with the existing SPL code.
- *
- * @return 0 on success, negative errno value on failure.
- */
-int spl_board_load_image(struct spl_boot_device *bootdev);
-
#endif