2012-08-09 00:03:10 +00:00
|
|
|
/*
|
|
|
|
* A lowlevel_init function that sets up the stack to call a C function to
|
|
|
|
* perform further init.
|
|
|
|
*
|
|
|
|
* (C) Copyright 2010
|
|
|
|
* Texas Instruments, <www.ti.com>
|
|
|
|
*
|
|
|
|
* Author :
|
|
|
|
* Aneesh V <aneesh@ti.com>
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2012-08-09 00:03:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <asm-offsets.h>
|
|
|
|
#include <config.h>
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
|
2017-05-16 18:46:34 +00:00
|
|
|
.pushsection .text.s_init, "ax"
|
|
|
|
WEAK(s_init)
|
|
|
|
bx lr
|
|
|
|
ENDPROC(s_init)
|
|
|
|
.popsection
|
|
|
|
|
|
|
|
.pushsection .text.lowlevel_init, "ax"
|
|
|
|
WEAK(lowlevel_init)
|
2012-08-09 00:03:10 +00:00
|
|
|
/*
|
2015-03-03 15:02:57 +00:00
|
|
|
* Setup a temporary stack. Global data is not available yet.
|
2012-08-09 00:03:10 +00:00
|
|
|
*/
|
2016-09-05 03:36:10 +00:00
|
|
|
#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
|
|
|
|
ldr sp, =CONFIG_SPL_STACK
|
|
|
|
#else
|
2012-08-09 00:03:10 +00:00
|
|
|
ldr sp, =CONFIG_SYS_INIT_SP_ADDR
|
2016-09-05 03:36:10 +00:00
|
|
|
#endif
|
2012-08-09 15:22:06 +00:00
|
|
|
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
|
2015-07-31 23:55:10 +00:00
|
|
|
#ifdef CONFIG_SPL_DM
|
2015-03-03 15:02:57 +00:00
|
|
|
mov r9, #0
|
|
|
|
#else
|
|
|
|
/*
|
|
|
|
* Set up global data for boards that still need it. This will be
|
|
|
|
* removed soon.
|
|
|
|
*/
|
2013-04-24 00:41:24 +00:00
|
|
|
#ifdef CONFIG_SPL_BUILD
|
2013-09-21 12:04:41 +00:00
|
|
|
ldr r9, =gdata
|
2013-04-24 00:41:24 +00:00
|
|
|
#else
|
2013-11-27 15:09:29 +00:00
|
|
|
sub sp, sp, #GD_SIZE
|
2013-04-24 00:41:24 +00:00
|
|
|
bic sp, sp, #7
|
2013-09-21 12:04:41 +00:00
|
|
|
mov r9, sp
|
2015-03-03 15:02:57 +00:00
|
|
|
#endif
|
2013-04-24 00:41:24 +00:00
|
|
|
#endif
|
2012-08-09 00:03:10 +00:00
|
|
|
/*
|
|
|
|
* Save the old lr(passed in ip) and the current lr to stack
|
|
|
|
*/
|
|
|
|
push {ip, lr}
|
|
|
|
|
|
|
|
/*
|
2015-03-03 15:02:57 +00:00
|
|
|
* Call the very early init function. This should do only the
|
|
|
|
* absolute bare minimum to get started. It should not:
|
|
|
|
*
|
|
|
|
* - set up DRAM
|
|
|
|
* - use global_data
|
|
|
|
* - clear BSS
|
|
|
|
* - try to start a console
|
|
|
|
*
|
|
|
|
* For boards with SPL this should be empty since SPL can do all of
|
|
|
|
* this init in the SPL board_init_f() function which is called
|
|
|
|
* immediately after this.
|
2012-08-09 00:03:10 +00:00
|
|
|
*/
|
|
|
|
bl s_init
|
|
|
|
pop {ip, pc}
|
|
|
|
ENDPROC(lowlevel_init)
|
2017-05-16 18:46:34 +00:00
|
|
|
.popsection
|