Skip to content
Snippets Groups Projects
Commit 97d9df0a authored by Simon Glass's avatar Simon Glass Committed by Tom Rini
Browse files

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: default avatarSimon Glass <sjg@chromium.org>
Reviewed-by: default avatarTom Rini <trini@konsulko.com>
parent 7ec03893
Branches
Tags
No related merge requests found
...@@ -133,13 +133,16 @@ static int gpio_init(void) ...@@ -133,13 +133,16 @@ static int gpio_init(void)
return 0; 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); 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_to_fel(fel_stash.sp, fel_stash.lr);
return 0; return 0;
} }
SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
#endif
void s_init(void) void s_init(void)
{ {
......
...@@ -65,7 +65,7 @@ int uniphier_rom_get_mmc_funcptr(int (**send_cmd)(u32, u32), ...@@ -65,7 +65,7 @@ int uniphier_rom_get_mmc_funcptr(int (**send_cmd)(u32, u32),
return 0; 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 (*send_cmd)(u32 cmd, u32 arg);
int (*card_blockaddr)(u32 rca); int (*card_blockaddr)(u32 rca);
...@@ -126,3 +126,4 @@ int spl_board_load_image(struct spl_boot_device *bootdev) ...@@ -126,3 +126,4 @@ int spl_board_load_image(struct spl_boot_device *bootdev)
return 0; return 0;
} }
SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
...@@ -38,7 +38,7 @@ void spl_board_announce_boot_device(void) ...@@ -38,7 +38,7 @@ void spl_board_announce_boot_device(void)
printf("%s\n", fname); 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]; char fname[256];
int ret; int ret;
...@@ -50,6 +50,7 @@ int spl_board_load_image(struct spl_boot_device *bootdev) ...@@ -50,6 +50,7 @@ int spl_board_load_image(struct spl_boot_device *bootdev)
/* Hopefully this will not return */ /* Hopefully this will not return */
return os_spl_to_uboot(fname); return os_spl_to_uboot(fname);
} }
SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
void spl_board_init(void) void spl_board_init(void)
{ {
......
...@@ -383,21 +383,12 @@ static int spl_load_image(u32 boot_device) ...@@ -383,21 +383,12 @@ static int spl_load_image(u32 boot_device)
if (loader) if (loader)
return loader->load_image(&bootdev); 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) #if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
puts("SPL: Unsupported Boot Device!\n"); puts("SPL: Unsupported Boot Device!\n");
#endif #endif
return -ENODEV; return -ENODEV;
} }
return -EINVAL;
}
void board_init_r(gd_t *dummy1, ulong dummy2) void board_init_r(gd_t *dummy1, ulong dummy2)
{ {
int i; int i;
......
...@@ -228,12 +228,4 @@ bool spl_was_boot_source(void); ...@@ -228,12 +228,4 @@ bool spl_was_boot_source(void);
*/ */
int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr); 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 #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment