Tom Rini | 41aebf8 | 2012-08-08 17:03:10 -0700 | [diff] [blame] | 1 | /* |
| 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 Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 11 | * SPDX-License-Identifier: GPL-2.0+ |
Tom Rini | 41aebf8 | 2012-08-08 17:03:10 -0700 | [diff] [blame] | 12 | */ |
| 13 | |
| 14 | #include <asm-offsets.h> |
| 15 | #include <config.h> |
| 16 | #include <linux/linkage.h> |
| 17 | |
| 18 | ENTRY(lowlevel_init) |
| 19 | /* |
Simon Glass | 24a6bc0 | 2015-03-03 08:02:57 -0700 | [diff] [blame] | 20 | * Setup a temporary stack. Global data is not available yet. |
Tom Rini | 41aebf8 | 2012-08-08 17:03:10 -0700 | [diff] [blame] | 21 | */ |
| 22 | ldr sp, =CONFIG_SYS_INIT_SP_ADDR |
Tom Rini | 975b71b | 2012-08-09 08:22:06 -0700 | [diff] [blame] | 23 | bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ |
Simon Glass | 24a6bc0 | 2015-03-03 08:02:57 -0700 | [diff] [blame] | 24 | #ifdef CONFIG_DM |
| 25 | mov r9, #0 |
| 26 | #else |
| 27 | /* |
| 28 | * Set up global data for boards that still need it. This will be |
| 29 | * removed soon. |
| 30 | */ |
SRICHARAN R | 4a0eb75 | 2013-04-24 00:41:24 +0000 | [diff] [blame] | 31 | #ifdef CONFIG_SPL_BUILD |
Jeroen Hofstee | fe1378a | 2013-09-21 14:04:41 +0200 | [diff] [blame] | 32 | ldr r9, =gdata |
SRICHARAN R | 4a0eb75 | 2013-04-24 00:41:24 +0000 | [diff] [blame] | 33 | #else |
Andreas Bießmann | 6ba2bc8 | 2013-11-27 16:09:29 +0100 | [diff] [blame] | 34 | sub sp, sp, #GD_SIZE |
SRICHARAN R | 4a0eb75 | 2013-04-24 00:41:24 +0000 | [diff] [blame] | 35 | bic sp, sp, #7 |
Jeroen Hofstee | fe1378a | 2013-09-21 14:04:41 +0200 | [diff] [blame] | 36 | mov r9, sp |
SRICHARAN R | 4a0eb75 | 2013-04-24 00:41:24 +0000 | [diff] [blame] | 37 | #endif |
Simon Glass | 24a6bc0 | 2015-03-03 08:02:57 -0700 | [diff] [blame] | 38 | #endif |
Tom Rini | 41aebf8 | 2012-08-08 17:03:10 -0700 | [diff] [blame] | 39 | /* |
| 40 | * Save the old lr(passed in ip) and the current lr to stack |
| 41 | */ |
| 42 | push {ip, lr} |
| 43 | |
| 44 | /* |
Simon Glass | 24a6bc0 | 2015-03-03 08:02:57 -0700 | [diff] [blame] | 45 | * Call the very early init function. This should do only the |
| 46 | * absolute bare minimum to get started. It should not: |
| 47 | * |
| 48 | * - set up DRAM |
| 49 | * - use global_data |
| 50 | * - clear BSS |
| 51 | * - try to start a console |
| 52 | * |
| 53 | * For boards with SPL this should be empty since SPL can do all of |
| 54 | * this init in the SPL board_init_f() function which is called |
| 55 | * immediately after this. |
Tom Rini | 41aebf8 | 2012-08-08 17:03:10 -0700 | [diff] [blame] | 56 | */ |
| 57 | bl s_init |
| 58 | pop {ip, pc} |
| 59 | ENDPROC(lowlevel_init) |