Merge branch 'master' of git://git.denx.de/u-boot-samsung
[platform/kernel/u-boot.git] / arch / arm / cpu / armv7 / lowlevel_init.S
1 /*
2  * A lowlevel_init function that sets up the stack to call a C function to
3  * perform further init.
4  *
5  * (C) Copyright 2010
6  * Texas Instruments, <www.ti.com>
7  *
8  * Author :
9  *      Aneesh V        <aneesh@ti.com>
10  *
11  * SPDX-License-Identifier:     GPL-2.0+
12  */
13
14 #include <asm-offsets.h>
15 #include <config.h>
16 #include <linux/linkage.h>
17
18 .pushsection .text.s_init, "ax"
19 WEAK(s_init)
20         bx      lr
21 ENDPROC(s_init)
22 .popsection
23
24 .pushsection .text.lowlevel_init, "ax"
25 WEAK(lowlevel_init)
26         /*
27          * Setup a temporary stack. Global data is not available yet.
28          */
29 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
30         ldr     sp, =CONFIG_SPL_STACK
31 #else
32         ldr     sp, =CONFIG_SYS_INIT_SP_ADDR
33 #endif
34         bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
35 #ifdef CONFIG_SPL_DM
36         mov     r9, #0
37 #else
38         /*
39          * Set up global data for boards that still need it. This will be
40          * removed soon.
41          */
42 #ifdef CONFIG_SPL_BUILD
43         ldr     r9, =gdata
44 #else
45         sub     sp, sp, #GD_SIZE
46         bic     sp, sp, #7
47         mov     r9, sp
48 #endif
49 #endif
50         /*
51          * Save the old lr(passed in ip) and the current lr to stack
52          */
53         push    {ip, lr}
54
55         /*
56          * Call the very early init function. This should do only the
57          * absolute bare minimum to get started. It should not:
58          *
59          * - set up DRAM
60          * - use global_data
61          * - clear BSS
62          * - try to start a console
63          *
64          * For boards with SPL this should be empty since SPL can do all of
65          * this init in the SPL board_init_f() function which is called
66          * immediately after this.
67          */
68         bl      s_init
69         pop     {ip, pc}
70 ENDPROC(lowlevel_init)
71 .popsection