wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * armboot - Startup Code for ARM926EJS CPU-core |
| 3 | * |
| 4 | * Copyright (c) 2003 Texas Instruments |
| 5 | * |
wdenk | a56bd92 | 2004-06-06 23:13:55 +0000 | [diff] [blame] | 6 | * ----- Adapted for OMAP1610 OMAP730 from ARM925t code ------ |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 7 | * |
Albert ARIBAUD | fa82f87 | 2011-08-04 18:45:45 +0200 | [diff] [blame] | 8 | * Copyright (c) 2001 Marius Gröger <mag@sysgo.de> |
| 9 | * Copyright (c) 2002 Alex Züpke <azu@sysgo.de> |
Detlev Zundel | 792a09e | 2009-05-13 10:54:10 +0200 | [diff] [blame] | 10 | * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de> |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 11 | * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com> |
| 12 | * Copyright (c) 2003 Kshitij <kshitij@ti.com> |
Albert ARIBAUD | 57b4bce | 2011-04-22 19:41:02 +0200 | [diff] [blame] | 13 | * Copyright (c) 2010 Albert Aribaud <albert.u.boot@aribaud.net> |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 14 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 15 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
Wolfgang Denk | 25ddd1f | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 18 | #include <asm-offsets.h> |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 19 | #include <config.h> |
Wolfgang Denk | fcd3c87 | 2009-07-24 00:17:48 +0200 | [diff] [blame] | 20 | #include <common.h> |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 21 | #include <version.h> |
| 22 | |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 23 | /* |
| 24 | ************************************************************************* |
| 25 | * |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 26 | * Startup Code (reset vector) |
| 27 | * |
| 28 | * do important init only if we don't start from memory! |
| 29 | * setup Memory and board specific bits prior to relocation. |
| 30 | * relocate armboot to ram |
| 31 | * setup stack |
| 32 | * |
| 33 | ************************************************************************* |
| 34 | */ |
| 35 | |
Albert ARIBAUD | 41623c9 | 2014-04-15 16:13:51 +0200 | [diff] [blame] | 36 | .globl reset |
Heiko Schocher | ab86f72 | 2010-09-17 13:10:42 +0200 | [diff] [blame] | 37 | |
| 38 | reset: |
| 39 | /* |
| 40 | * set the cpu to SVC32 mode |
| 41 | */ |
| 42 | mrs r0,cpsr |
| 43 | bic r0,r0,#0x1f |
| 44 | orr r0,r0,#0xd3 |
| 45 | msr cpsr,r0 |
| 46 | |
| 47 | /* |
| 48 | * we do sys-critical inits only at reboot, |
| 49 | * not when booting from ram! |
| 50 | */ |
Christian Riesch | 27b6662 | 2012-02-02 00:44:37 +0000 | [diff] [blame] | 51 | #ifndef CONFIG_SKIP_LOWLEVEL_INIT |
Heiko Schocher | ab86f72 | 2010-09-17 13:10:42 +0200 | [diff] [blame] | 52 | bl cpu_init_crit |
Christian Riesch | 27b6662 | 2012-02-02 00:44:37 +0000 | [diff] [blame] | 53 | #endif |
Heiko Schocher | ab86f72 | 2010-09-17 13:10:42 +0200 | [diff] [blame] | 54 | |
Albert ARIBAUD | e05e5de | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 55 | bl _main |
Heiko Schocher | ab86f72 | 2010-09-17 13:10:42 +0200 | [diff] [blame] | 56 | |
| 57 | /*------------------------------------------------------------------------------*/ |
| 58 | |
Albert ARIBAUD | e05e5de | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 59 | .globl c_runtime_cpu_setup |
| 60 | c_runtime_cpu_setup: |
| 61 | |
| 62 | bx lr |
| 63 | |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 64 | /* |
| 65 | ************************************************************************* |
| 66 | * |
| 67 | * CPU_init_critical registers |
| 68 | * |
| 69 | * setup important registers |
| 70 | * setup memory timing |
| 71 | * |
| 72 | ************************************************************************* |
| 73 | */ |
Christian Riesch | 27b6662 | 2012-02-02 00:44:37 +0000 | [diff] [blame] | 74 | #ifndef CONFIG_SKIP_LOWLEVEL_INIT |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 75 | cpu_init_crit: |
| 76 | /* |
Sughosh Ganu | da104e0 | 2012-02-02 00:44:38 +0000 | [diff] [blame] | 77 | * flush D cache before disabling it |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 78 | */ |
| 79 | mov r0, #0 |
Sughosh Ganu | da104e0 | 2012-02-02 00:44:38 +0000 | [diff] [blame] | 80 | flush_dcache: |
| 81 | mrc p15, 0, r15, c7, c10, 3 |
| 82 | bne flush_dcache |
| 83 | |
| 84 | mcr p15, 0, r0, c8, c7, 0 /* invalidate TLB */ |
| 85 | mcr p15, 0, r0, c7, c5, 0 /* invalidate I Cache */ |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 86 | |
| 87 | /* |
Christian Riesch | d735a99 | 2012-02-02 00:44:40 +0000 | [diff] [blame] | 88 | * disable MMU and D cache |
| 89 | * enable I cache if CONFIG_SYS_ICACHE_OFF is not defined |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 90 | */ |
| 91 | mrc p15, 0, r0, c1, c0, 0 |
Christian Riesch | b67d881 | 2012-02-02 00:44:39 +0000 | [diff] [blame] | 92 | bic r0, r0, #0x00000300 /* clear bits 9:8 (---- --RS) */ |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 93 | bic r0, r0, #0x00000087 /* clear bits 7, 2:0 (B--- -CAM) */ |
Christian Riesch | b67d881 | 2012-02-02 00:44:39 +0000 | [diff] [blame] | 94 | #ifdef CONFIG_SYS_EXCEPTION_VECTORS_HIGH |
| 95 | orr r0, r0, #0x00002000 /* set bit 13 (--V- ----) */ |
| 96 | #else |
| 97 | bic r0, r0, #0x00002000 /* clear bit 13 (--V- ----) */ |
| 98 | #endif |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 99 | orr r0, r0, #0x00000002 /* set bit 2 (A) Align */ |
Christian Riesch | d735a99 | 2012-02-02 00:44:40 +0000 | [diff] [blame] | 100 | #ifndef CONFIG_SYS_ICACHE_OFF |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 101 | orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */ |
Christian Riesch | d735a99 | 2012-02-02 00:44:40 +0000 | [diff] [blame] | 102 | #endif |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 103 | mcr p15, 0, r0, c1, c0, 0 |
| 104 | |
| 105 | /* |
| 106 | * Go setup Memory and board specific bits prior to relocation. |
| 107 | */ |
| 108 | mov ip, lr /* perserve link reg across call */ |
Wolfgang Denk | 87cb686 | 2005-10-06 17:08:18 +0200 | [diff] [blame] | 109 | bl lowlevel_init /* go setup pll,mux,memory */ |
wdenk | 6f21347 | 2003-08-29 22:00:43 +0000 | [diff] [blame] | 110 | mov lr, ip /* restore link */ |
Heiko Schocher | ca4b558 | 2011-11-09 20:06:23 +0000 | [diff] [blame] | 111 | mov pc, lr /* back to my caller */ |
Christian Riesch | 27b6662 | 2012-02-02 00:44:37 +0000 | [diff] [blame] | 112 | #endif /* CONFIG_SKIP_LOWLEVEL_INIT */ |