1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 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 (at) ti.com> 11 */ 12 13 #include <asm-offsets.h> 14 #include <config.h> 15 #include <linux/linkage.h> 16 17 .pushsection .text.s_init, "ax" 18 WEAK(s_init) 19 bx lr 20 ENDPROC(s_init) 21 .popsection 22 23 .pushsection .text.lowlevel_init, "ax" 24 WEAK(lowlevel_init) 25 /* 26 * Setup a temporary stack. Global data is not available yet. 27 */ 28 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK) 29 ldr sp, =CONFIG_SPL_STACK 30 #else 31 ldr sp, =CONFIG_SYS_INIT_SP_ADDR 32 #endif 33 bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ 34 #ifdef CONFIG_SPL_DM 35 mov r9, #0 36 #else 37 /* 38 * Set up global data for boards that still need it. This will be 39 * removed soon. 40 */ 41 #ifdef CONFIG_SPL_BUILD 42 ldr r9, =gdata 43 #else 44 sub sp, sp, #GD_SIZE 45 bic sp, sp, #7 46 mov r9, sp 47 #endif 48 #endif 49 /* 50 * Save the old lr(passed in ip) and the current lr to stack 51 */ 52 push {ip, lr} 53 54 /* 55 * 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. 66 */ 67 bl s_init 68 pop {ip, pc} 69 ENDPROC(lowlevel_init) 70 .popsection 71