Merge branch 'master' of git://git.denx.de/u-boot-net
[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 ENTRY(lowlevel_init)
19         /*
20          * Setup a temporary stack. Global data is not available yet.
21          */
22         ldr     sp, =CONFIG_SYS_INIT_SP_ADDR
23         bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
24 #ifdef CONFIG_SPL_DM
25         mov     r9, #0
26 #else
27         /*
28          * Set up global data for boards that still need it. This will be
29          * removed soon.
30          */
31 #ifdef CONFIG_SPL_BUILD
32         ldr     r9, =gdata
33 #else
34         sub     sp, sp, #GD_SIZE
35         bic     sp, sp, #7
36         mov     r9, sp
37 #endif
38 #endif
39         /*
40          * Save the old lr(passed in ip) and the current lr to stack
41          */
42         push    {ip, lr}
43
44         /*
45          * Call the very early init function. This should do only the
46          * absolute bare minimum to get started. It should not:
47          *
48          * - set up DRAM
49          * - use global_data
50          * - clear BSS
51          * - try to start a console
52          *
53          * For boards with SPL this should be empty since SPL can do all of
54          * this init in the SPL board_init_f() function which is called
55          * immediately after this.
56          */
57         bl      s_init
58         pop     {ip, pc}
59 ENDPROC(lowlevel_init)