SPL: Create arch/arm/lib/spl.c for board_init_f and jump_to_image_linux
In SPL (CONFIG_SPL_FRAMEWORK) board_init_f must setup the stack pointer,
clear the BSS and call board_init_r. We mark this as weak as some
platforms may need to perform additional initalization at this point.
We provide a gd that we know will be in a usable location, once the BSS
has been cleared to help with this as well. Finally, we no longer call
relocate_code so remove that from the armv7 version.
Next, both board_init_f and jump_to_image_linux are going to be
inherently arch-specific, so move these versions to arch/arm/lib/spl.c
Signed-off-by: Tom Rini <trini@ti.com>
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 1562f2a..3f41014 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -38,8 +38,7 @@
u32 *boot_params_ptr = NULL;
struct spl_image_info spl_image;
-/* Define global data structure pointer to it*/
-static gd_t gdata __attribute__ ((section(".data")));
+/* Define board data structure */
static bd_t bdata __attribute__ ((section(".data")));
inline void hang(void)
@@ -49,18 +48,6 @@
;
}
-void board_init_f(ulong dummy)
-{
- /*
- * We call relocate_code() with relocation target same as the
- * CONFIG_SYS_SPL_TEXT_BASE. This will result in relocation getting
- * skipped. Instead, only .bss initialization will happen. That's
- * all we need
- */
- debug(">>board_init_f()\n");
- relocate_code(CONFIG_SPL_STACK, &gdata, CONFIG_SPL_TEXT_BASE);
-}
-
/*
* Default function to determine if u-boot or the OS should
* be started. This implementation always returns 1.
@@ -106,24 +93,6 @@
spl_image.name = "U-Boot";
}
}
-
-/*
- * This function jumps to an image with argument. Normally an FDT or ATAGS
- * image.
- * arg: Pointer to paramter image in RAM
- */
-#ifdef CONFIG_SPL_OS_BOOT
-static void __noreturn jump_to_image_linux(void *arg)
-{
- debug("Entering kernel arg pointer: 0x%p\n", arg);
- typedef void (*image_entry_arg_t)(int, int, void *)
- __attribute__ ((noreturn));
- image_entry_arg_t image_entry =
- (image_entry_arg_t) spl_image.entry_point;
- cleanup_before_linux();
- image_entry(0, CONFIG_MACH_TYPE, arg);
-}
-#endif
static void __noreturn jump_to_image_no_args(void)
{
@@ -140,7 +109,7 @@
image_entry((u32 *)boot_params_ptr_addr);
}
-void board_init_r(gd_t *id, ulong dummy)
+void board_init_r(gd_t *dummy1, ulong dummy2)
{
u32 boot_device;
debug(">>spl:board_init_r()\n");
@@ -204,10 +173,12 @@
}
}
-/* This requires UART clocks to be enabled */
+/*
+ * This requires UART clocks to be enabled. In order for this to work the
+ * caller must ensure that the gd pointer is valid.
+ */
void preloader_console_init(void)
{
- gd = &gdata;
gd->bd = &bdata;
gd->flags |= GD_FLG_RELOC;
gd->baudrate = CONFIG_BAUDRATE;