Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 2 | /* |
| 3 | * armboot - Startup Code for ARM720 CPU-core |
| 4 | * |
Albert ARIBAUD | 60fbc8d | 2011-08-04 18:45:45 +0200 | [diff] [blame] | 5 | * Copyright (c) 2001 Marius Gröger <mag@sysgo.de> |
| 6 | * Copyright (c) 2002 Alex Züpke <azu@sysgo.de> |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
Wolfgang Denk | 0191e47 | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 9 | #include <asm-offsets.h> |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 10 | #include <config.h> |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 11 | |
| 12 | /* |
| 13 | ************************************************************************* |
| 14 | * |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 15 | * Startup Code (reset vector) |
| 16 | * |
wdenk | 927034e | 2004-02-08 19:38:38 +0000 | [diff] [blame] | 17 | * do important init only if we don't start from RAM! |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 18 | * relocate armboot to ram |
| 19 | * setup stack |
| 20 | * jump to second stage |
| 21 | * |
| 22 | ************************************************************************* |
| 23 | */ |
| 24 | |
Albert ARIBAUD | 9852cc6 | 2014-04-15 16:13:51 +0200 | [diff] [blame] | 25 | .globl reset |
Heiko Schocher | cad80e1 | 2010-09-17 13:10:52 +0200 | [diff] [blame] | 26 | |
| 27 | reset: |
| 28 | /* |
| 29 | * set the cpu to SVC32 mode |
| 30 | */ |
| 31 | mrs r0,cpsr |
| 32 | bic r0,r0,#0x1f |
| 33 | orr r0,r0,#0xd3 |
| 34 | msr cpsr,r0 |
| 35 | |
| 36 | /* |
| 37 | * we do sys-critical inits only at reboot, |
| 38 | * not when booting from ram! |
| 39 | */ |
Simon Glass | 114e566 | 2017-05-31 17:57:11 -0600 | [diff] [blame] | 40 | #if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && \ |
| 41 | !defined(CONFIG_SKIP_LOWLEVEL_INIT_ONLY) |
Heiko Schocher | cad80e1 | 2010-09-17 13:10:52 +0200 | [diff] [blame] | 42 | bl cpu_init_crit |
| 43 | #endif |
| 44 | |
Albert ARIBAUD | facdae5 | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 45 | bl _main |
Heiko Schocher | cad80e1 | 2010-09-17 13:10:52 +0200 | [diff] [blame] | 46 | |
| 47 | /*------------------------------------------------------------------------------*/ |
| 48 | |
Albert ARIBAUD | facdae5 | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 49 | .globl c_runtime_cpu_setup |
| 50 | c_runtime_cpu_setup: |
| 51 | |
| 52 | mov pc, lr |
| 53 | |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 54 | /* |
| 55 | ************************************************************************* |
| 56 | * |
| 57 | * CPU_init_critical registers |
| 58 | * |
| 59 | * setup important registers |
| 60 | * setup memory timing |
| 61 | * |
| 62 | ************************************************************************* |
| 63 | */ |
| 64 | |
Simon Glass | 114e566 | 2017-05-31 17:57:11 -0600 | [diff] [blame] | 65 | #if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && \ |
| 66 | !defined(CONFIG_SKIP_LOWLEVEL_INIT_ONLY) |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 67 | cpu_init_crit: |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 68 | |
Wolfgang Denk | 7f88a5e | 2005-10-06 17:08:18 +0200 | [diff] [blame] | 69 | mov ip, lr |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 70 | /* |
| 71 | * before relocating, we have to setup RAM timing |
wdenk | 927034e | 2004-02-08 19:38:38 +0000 | [diff] [blame] | 72 | * because memory timing is board-dependent, you will |
wdenk | 336b2bc | 2005-04-02 23:52:25 +0000 | [diff] [blame] | 73 | * find a lowlevel_init.S in your board directory. |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 74 | */ |
wdenk | 336b2bc | 2005-04-02 23:52:25 +0000 | [diff] [blame] | 75 | bl lowlevel_init |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 76 | mov lr, ip |
| 77 | |
| 78 | mov pc, lr |
Axel Lin | 89a8f7a | 2013-05-21 13:44:10 +0000 | [diff] [blame] | 79 | #endif /* CONFIG_SKIP_LOWLEVEL_INIT */ |