Tom Rini | ee5bce4 | 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 | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 11 | * SPDX-License-Identifier: GPL-2.0+ |
Tom Rini | ee5bce4 | 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 | /* |
| 20 | * Setup a temporary stack |
| 21 | */ |
| 22 | ldr sp, =CONFIG_SYS_INIT_SP_ADDR |
Tom Rini | 7b643a4 | 2012-08-09 08:22:06 -0700 | [diff] [blame] | 23 | bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ |
SRICHARAN R | 3f30b0a | 2013-04-24 00:41:24 +0000 | [diff] [blame] | 24 | #ifdef CONFIG_SPL_BUILD |
Jeroen Hofstee | f2d6076 | 2013-09-21 14:04:41 +0200 | [diff] [blame] | 25 | ldr r9, =gdata |
SRICHARAN R | 3f30b0a | 2013-04-24 00:41:24 +0000 | [diff] [blame] | 26 | #else |
Andreas Bießmann | b65e2c1 | 2013-11-27 16:09:29 +0100 | [diff] [blame] | 27 | sub sp, sp, #GD_SIZE |
SRICHARAN R | 3f30b0a | 2013-04-24 00:41:24 +0000 | [diff] [blame] | 28 | bic sp, sp, #7 |
Jeroen Hofstee | f2d6076 | 2013-09-21 14:04:41 +0200 | [diff] [blame] | 29 | mov r9, sp |
SRICHARAN R | 3f30b0a | 2013-04-24 00:41:24 +0000 | [diff] [blame] | 30 | #endif |
Tom Rini | ee5bce4 | 2012-08-08 17:03:10 -0700 | [diff] [blame] | 31 | /* |
| 32 | * Save the old lr(passed in ip) and the current lr to stack |
| 33 | */ |
| 34 | push {ip, lr} |
| 35 | |
| 36 | /* |
| 37 | * go setup pll, mux, memory |
| 38 | */ |
| 39 | bl s_init |
| 40 | pop {ip, pc} |
| 41 | ENDPROC(lowlevel_init) |