1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * (C) Copyright 2010-2012
3*4882a593Smuzhiyun * Texas Instruments, <www.ti.com>
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Aneesh V <aneesh@ti.com>
6*4882a593Smuzhiyun * Tom Rini <trini@ti.com>
7*4882a593Smuzhiyun *
8*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0+
9*4882a593Smuzhiyun */
10*4882a593Smuzhiyun #include <common.h>
11*4882a593Smuzhiyun #include <config.h>
12*4882a593Smuzhiyun #include <spl.h>
13*4882a593Smuzhiyun #include <image.h>
14*4882a593Smuzhiyun #include <linux/compiler.h>
15*4882a593Smuzhiyun #include <asm/mach-types.h>
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun #ifndef CONFIG_SPL_DM
18*4882a593Smuzhiyun /* Pointer to as well as the global data structure for SPL */
19*4882a593Smuzhiyun DECLARE_GLOBAL_DATA_PTR;
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun /*
22*4882a593Smuzhiyun * WARNING: This is going away very soon. Don't use it and don't submit
23*4882a593Smuzhiyun * pafches that rely on it. The global_data area is set up in crt0.S.
24*4882a593Smuzhiyun */
25*4882a593Smuzhiyun gd_t gdata __attribute__ ((section(".data")));
26*4882a593Smuzhiyun #endif
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun /*
29*4882a593Smuzhiyun * In the context of SPL, board_init_f() prepares the hardware for execution
30*4882a593Smuzhiyun * from system RAM (DRAM, DDR...). As system RAM may not be available yet,
31*4882a593Smuzhiyun * board_init_f() must use the current GD to store any data which must be
32*4882a593Smuzhiyun * passed on to later stages. These data include the relocation destination,
33*4882a593Smuzhiyun * the future stack, and the future GD location. BSS is cleared after this
34*4882a593Smuzhiyun * function (and therefore must be accessible).
35*4882a593Smuzhiyun *
36*4882a593Smuzhiyun * We provide this version by default but mark it as __weak to allow for
37*4882a593Smuzhiyun * platforms to do this in their own way if needed. Please see the top
38*4882a593Smuzhiyun * level U-Boot README "Board Initialization Flow" section for info on what
39*4882a593Smuzhiyun * to put in this function.
40*4882a593Smuzhiyun */
board_init_f(ulong dummy)41*4882a593Smuzhiyun void __weak board_init_f(ulong dummy)
42*4882a593Smuzhiyun {
43*4882a593Smuzhiyun }
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun /*
46*4882a593Smuzhiyun * This function jumps to an image with argument. Normally an FDT or ATAGS
47*4882a593Smuzhiyun * image.
48*4882a593Smuzhiyun */
49*4882a593Smuzhiyun #ifdef CONFIG_SPL_OS_BOOT
jump_to_image_linux(struct spl_image_info * spl_image)50*4882a593Smuzhiyun void __noreturn jump_to_image_linux(struct spl_image_info *spl_image)
51*4882a593Smuzhiyun {
52*4882a593Smuzhiyun unsigned long machid = 0xffffffff;
53*4882a593Smuzhiyun #ifdef CONFIG_MACH_TYPE
54*4882a593Smuzhiyun machid = CONFIG_MACH_TYPE;
55*4882a593Smuzhiyun #endif
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun debug("Entering kernel arg pointer: 0x%p\n", spl_image->arg);
58*4882a593Smuzhiyun typedef void (*image_entry_arg_t)(int, int, void *)
59*4882a593Smuzhiyun __attribute__ ((noreturn));
60*4882a593Smuzhiyun image_entry_arg_t image_entry =
61*4882a593Smuzhiyun (image_entry_arg_t)(uintptr_t) spl_image->entry_point;
62*4882a593Smuzhiyun cleanup_before_linux();
63*4882a593Smuzhiyun image_entry(0, machid, spl_image->arg);
64*4882a593Smuzhiyun }
65*4882a593Smuzhiyun #endif
66