blob: 3c8c07fe016401dbff0c1cdb94f80b80cb88b705 [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>
Tom Rini4ddbade2022-05-25 12:16:03 -040016#include <system-constants.h>
Tom Riniee5bce42012-08-08 17:03:10 -070017
Tom Rini2ca39ca2017-05-16 14:46:34 -040018.pushsection .text.s_init, "ax"
19WEAK(s_init)
20 bx lr
21ENDPROC(s_init)
22.popsection
23
24.pushsection .text.lowlevel_init, "ax"
25WEAK(lowlevel_init)
Tom Riniee5bce42012-08-08 17:03:10 -070026 /*
Simon Glass8071c8e2015-03-03 08:02:57 -070027 * Setup a temporary stack. Global data is not available yet.
Tom Riniee5bce42012-08-08 17:03:10 -070028 */
Siarhei Siamashka39cb8342016-09-05 06:36:10 +030029#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
30 ldr sp, =CONFIG_SPL_STACK
31#else
Tom Rini4ddbade2022-05-25 12:16:03 -040032 ldr sp, =SYS_INIT_SP_ADDR
Siarhei Siamashka39cb8342016-09-05 06:36:10 +030033#endif
Tom Rini7b643a42012-08-09 08:22:06 -070034 bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
Tom Rinif295d9e2015-07-31 19:55:10 -040035#ifdef CONFIG_SPL_DM
Simon Glass8071c8e2015-03-03 08:02:57 -070036 mov r9, #0
37#else
38 /*
39 * Set up global data for boards that still need it. This will be
40 * removed soon.
41 */
SRICHARAN R3f30b0a2013-04-24 00:41:24 +000042#ifdef CONFIG_SPL_BUILD
Jeroen Hofsteef2d60762013-09-21 14:04:41 +020043 ldr r9, =gdata
SRICHARAN R3f30b0a2013-04-24 00:41:24 +000044#else
Andreas Bießmannb65e2c12013-11-27 16:09:29 +010045 sub sp, sp, #GD_SIZE
SRICHARAN R3f30b0a2013-04-24 00:41:24 +000046 bic sp, sp, #7
Jeroen Hofsteef2d60762013-09-21 14:04:41 +020047 mov r9, sp
SRICHARAN R3f30b0a2013-04-24 00:41:24 +000048#endif
Simon Glass8071c8e2015-03-03 08:02:57 -070049#endif
Tom Riniee5bce42012-08-08 17:03:10 -070050 /*
51 * Save the old lr(passed in ip) and the current lr to stack
52 */
53 push {ip, lr}
54
55 /*
Simon Glass8071c8e2015-03-03 08:02:57 -070056 * 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.
Tom Riniee5bce42012-08-08 17:03:10 -070067 */
68 bl s_init
69 pop {ip, pc}
70ENDPROC(lowlevel_init)
Tom Rini2ca39ca2017-05-16 14:46:34 -040071.popsection