blob: ba4b374a8bd9a5315bf3065e5e7715a72458d50c [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Tom Riniee5bce42012-08-08 17:03:10 -07002/*
3 * A lowlevel_init function that sets up the stack to call a C function to
4 * perform further init.
5 *
6 * (C) Copyright 2010
7 * Texas Instruments, <www.ti.com>
8 *
9 * Author :
10 * Aneesh V <aneesh@ti.com>
Tom Riniee5bce42012-08-08 17:03:10 -070011 */
12
13#include <asm-offsets.h>
14#include <config.h>
15#include <linux/linkage.h>
16
Tom Rini2ca39ca2017-05-16 14:46:34 -040017.pushsection .text.s_init, "ax"
18WEAK(s_init)
19 bx lr
20ENDPROC(s_init)
21.popsection
22
23.pushsection .text.lowlevel_init, "ax"
24WEAK(lowlevel_init)
Tom Riniee5bce42012-08-08 17:03:10 -070025 /*
Simon Glass8071c8e2015-03-03 08:02:57 -070026 * Setup a temporary stack. Global data is not available yet.
Tom Riniee5bce42012-08-08 17:03:10 -070027 */
Siarhei Siamashka39cb8342016-09-05 06:36:10 +030028#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
29 ldr sp, =CONFIG_SPL_STACK
30#else
Tom Riniee5bce42012-08-08 17:03:10 -070031 ldr sp, =CONFIG_SYS_INIT_SP_ADDR
Siarhei Siamashka39cb8342016-09-05 06:36:10 +030032#endif
Tom Rini7b643a42012-08-09 08:22:06 -070033 bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
Tom Rinif295d9e2015-07-31 19:55:10 -040034#ifdef CONFIG_SPL_DM
Simon Glass8071c8e2015-03-03 08:02:57 -070035 mov r9, #0
36#else
37 /*
38 * Set up global data for boards that still need it. This will be
39 * removed soon.
40 */
SRICHARAN R3f30b0a2013-04-24 00:41:24 +000041#ifdef CONFIG_SPL_BUILD
Jeroen Hofsteef2d60762013-09-21 14:04:41 +020042 ldr r9, =gdata
SRICHARAN R3f30b0a2013-04-24 00:41:24 +000043#else
Andreas Bießmannb65e2c12013-11-27 16:09:29 +010044 sub sp, sp, #GD_SIZE
SRICHARAN R3f30b0a2013-04-24 00:41:24 +000045 bic sp, sp, #7
Jeroen Hofsteef2d60762013-09-21 14:04:41 +020046 mov r9, sp
SRICHARAN R3f30b0a2013-04-24 00:41:24 +000047#endif
Simon Glass8071c8e2015-03-03 08:02:57 -070048#endif
Tom Riniee5bce42012-08-08 17:03:10 -070049 /*
50 * Save the old lr(passed in ip) and the current lr to stack
51 */
52 push {ip, lr}
53
54 /*
Simon Glass8071c8e2015-03-03 08:02:57 -070055 * Call the very early init function. This should do only the
56 * absolute bare minimum to get started. It should not:
57 *
58 * - set up DRAM
59 * - use global_data
60 * - clear BSS
61 * - try to start a console
62 *
63 * For boards with SPL this should be empty since SPL can do all of
64 * this init in the SPL board_init_f() function which is called
65 * immediately after this.
Tom Riniee5bce42012-08-08 17:03:10 -070066 */
67 bl s_init
68 pop {ip, pc}
69ENDPROC(lowlevel_init)
Tom Rini2ca39ca2017-05-16 14:46:34 -040070.popsection