1*aa9226f0SAndre Przywara/* 2*aa9226f0SAndre Przywara * A lowlevel_init function that sets up the stack to call a C function to 3*aa9226f0SAndre Przywara * perform further init. 4*aa9226f0SAndre Przywara * 5*aa9226f0SAndre Przywara * SPDX-License-Identifier: GPL-2.0+ 6*aa9226f0SAndre Przywara */ 7*aa9226f0SAndre Przywara 8*aa9226f0SAndre Przywara#include <asm-offsets.h> 9*aa9226f0SAndre Przywara#include <config.h> 10*aa9226f0SAndre Przywara#include <linux/linkage.h> 11*aa9226f0SAndre Przywara 12*aa9226f0SAndre PrzywaraENTRY(lowlevel_init) 13*aa9226f0SAndre Przywara /* 14*aa9226f0SAndre Przywara * Setup a temporary stack. Global data is not available yet. 15*aa9226f0SAndre Przywara */ 16*aa9226f0SAndre Przywara#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK) 17*aa9226f0SAndre Przywara ldr w0, =CONFIG_SPL_STACK 18*aa9226f0SAndre Przywara#else 19*aa9226f0SAndre Przywara ldr w0, =CONFIG_SYS_INIT_SP_ADDR 20*aa9226f0SAndre Przywara#endif 21*aa9226f0SAndre Przywara bic sp, x0, #0xf /* 16-byte alignment for ABI compliance */ 22*aa9226f0SAndre Przywara 23*aa9226f0SAndre Przywara /* 24*aa9226f0SAndre Przywara * Save the old LR(passed in x29) and the current LR to stack 25*aa9226f0SAndre Przywara */ 26*aa9226f0SAndre Przywara stp x29, x30, [sp, #-16]! 27*aa9226f0SAndre Przywara 28*aa9226f0SAndre Przywara /* 29*aa9226f0SAndre Przywara * Call the very early init function. This should do only the 30*aa9226f0SAndre Przywara * absolute bare minimum to get started. It should not: 31*aa9226f0SAndre Przywara * 32*aa9226f0SAndre Przywara * - set up DRAM 33*aa9226f0SAndre Przywara * - use global_data 34*aa9226f0SAndre Przywara * - clear BSS 35*aa9226f0SAndre Przywara * - try to start a console 36*aa9226f0SAndre Przywara * 37*aa9226f0SAndre Przywara * For boards with SPL this should be empty since SPL can do all of 38*aa9226f0SAndre Przywara * this init in the SPL board_init_f() function which is called 39*aa9226f0SAndre Przywara * immediately after this. 40*aa9226f0SAndre Przywara */ 41*aa9226f0SAndre Przywara bl s_init 42*aa9226f0SAndre Przywara ldp x29, x30, [sp] 43*aa9226f0SAndre Przywara ret 44*aa9226f0SAndre PrzywaraENDPROC(lowlevel_init) 45