blob: 658934d664a4ab5827169da13aa2728a395bc171 [file] [log] [blame]
Tom Riniee5bce42012-08-08 17:03:10 -07001/*
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 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +020011 * SPDX-License-Identifier: GPL-2.0+
Tom Riniee5bce42012-08-08 17:03:10 -070012 */
13
14#include <asm-offsets.h>
15#include <config.h>
16#include <linux/linkage.h>
17
18ENTRY(lowlevel_init)
19 /*
Simon Glass8071c8e2015-03-03 08:02:57 -070020 * Setup a temporary stack. Global data is not available yet.
Tom Riniee5bce42012-08-08 17:03:10 -070021 */
Siarhei Siamashka39cb8342016-09-05 06:36:10 +030022#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
23 ldr sp, =CONFIG_SPL_STACK
24#else
Tom Riniee5bce42012-08-08 17:03:10 -070025 ldr sp, =CONFIG_SYS_INIT_SP_ADDR
Siarhei Siamashka39cb8342016-09-05 06:36:10 +030026#endif
Tom Rini7b643a42012-08-09 08:22:06 -070027 bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
Tom Rinif295d9e2015-07-31 19:55:10 -040028#ifdef CONFIG_SPL_DM
Simon Glass8071c8e2015-03-03 08:02:57 -070029 mov r9, #0
30#else
31 /*
32 * Set up global data for boards that still need it. This will be
33 * removed soon.
34 */
SRICHARAN R3f30b0a2013-04-24 00:41:24 +000035#ifdef CONFIG_SPL_BUILD
Jeroen Hofsteef2d60762013-09-21 14:04:41 +020036 ldr r9, =gdata
SRICHARAN R3f30b0a2013-04-24 00:41:24 +000037#else
Andreas Bießmannb65e2c12013-11-27 16:09:29 +010038 sub sp, sp, #GD_SIZE
SRICHARAN R3f30b0a2013-04-24 00:41:24 +000039 bic sp, sp, #7
Jeroen Hofsteef2d60762013-09-21 14:04:41 +020040 mov r9, sp
SRICHARAN R3f30b0a2013-04-24 00:41:24 +000041#endif
Simon Glass8071c8e2015-03-03 08:02:57 -070042#endif
Tom Riniee5bce42012-08-08 17:03:10 -070043 /*
44 * Save the old lr(passed in ip) and the current lr to stack
45 */
46 push {ip, lr}
47
48 /*
Simon Glass8071c8e2015-03-03 08:02:57 -070049 * Call the very early init function. This should do only the
50 * absolute bare minimum to get started. It should not:
51 *
52 * - set up DRAM
53 * - use global_data
54 * - clear BSS
55 * - try to start a console
56 *
57 * For boards with SPL this should be empty since SPL can do all of
58 * this init in the SPL board_init_f() function which is called
59 * immediately after this.
Tom Riniee5bce42012-08-08 17:03:10 -070060 */
61 bl s_init
62 pop {ip, pc}
63ENDPROC(lowlevel_init)