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