wdenk | 8ed9604 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * armboot - Startup Code for OMP2420/ARM1136 CPU-core |
| 3 | * |
wdenk | 082acfd | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 4 | * Copyright (c) 2004 Texas Instruments <r-woodruff2@ti.com> |
wdenk | 8ed9604 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 5 | * |
Albert ARIBAUD | fa82f87 | 2011-08-04 18:45:45 +0200 | [diff] [blame] | 6 | * Copyright (c) 2001 Marius Gröger <mag@sysgo.de> |
| 7 | * Copyright (c) 2002 Alex Züpke <azu@sysgo.de> |
Detlev Zundel | 792a09e | 2009-05-13 10:54:10 +0200 | [diff] [blame] | 8 | * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de> |
wdenk | 8ed9604 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 9 | * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com> |
| 10 | * Copyright (c) 2003 Kshitij <kshitij@ti.com> |
| 11 | * |
Wolfgang Denk | 3765b3e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 12 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 8ed9604 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 13 | */ |
| 14 | |
Wolfgang Denk | 25ddd1f | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 15 | #include <asm-offsets.h> |
wdenk | 8ed9604 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 16 | #include <config.h> |
| 17 | #include <version.h> |
Kyungmin Park | 751b9b5 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 18 | |
wdenk | 8ed9604 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 19 | /* |
| 20 | ************************************************************************* |
| 21 | * |
| 22 | * Startup Code (reset vector) |
| 23 | * |
| 24 | * do important init only if we don't start from memory! |
| 25 | * setup Memory and board specific bits prior to relocation. |
| 26 | * relocate armboot to ram |
| 27 | * setup stack |
| 28 | * |
| 29 | ************************************************************************* |
| 30 | */ |
| 31 | |
Albert ARIBAUD | 41623c9 | 2014-04-15 16:13:51 +0200 | [diff] [blame] | 32 | .globl reset |
Heiko Schocher | e48b7c0 | 2010-09-17 13:10:40 +0200 | [diff] [blame] | 33 | |
| 34 | reset: |
| 35 | /* |
| 36 | * set the cpu to SVC32 mode |
| 37 | */ |
| 38 | mrs r0,cpsr |
| 39 | bic r0,r0,#0x1f |
| 40 | orr r0,r0,#0xd3 |
| 41 | msr cpsr,r0 |
| 42 | |
Heiko Schocher | e48b7c0 | 2010-09-17 13:10:40 +0200 | [diff] [blame] | 43 | /* the mask ROM code should have PLL and others stable */ |
| 44 | #ifndef CONFIG_SKIP_LOWLEVEL_INIT |
| 45 | bl cpu_init_crit |
| 46 | #endif |
| 47 | |
Albert ARIBAUD | e05e5de | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 48 | bl _main |
Heiko Schocher | e48b7c0 | 2010-09-17 13:10:40 +0200 | [diff] [blame] | 49 | |
| 50 | /*------------------------------------------------------------------------------*/ |
| 51 | |
Albert ARIBAUD | e05e5de | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 52 | .globl c_runtime_cpu_setup |
| 53 | c_runtime_cpu_setup: |
Heiko Schocher | e48b7c0 | 2010-09-17 13:10:40 +0200 | [diff] [blame] | 54 | |
Albert ARIBAUD | e05e5de | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 55 | bx lr |
Heiko Schocher | bafe743 | 2010-10-13 07:57:14 +0200 | [diff] [blame] | 56 | |
wdenk | 8ed9604 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 57 | /* |
| 58 | ************************************************************************* |
| 59 | * |
| 60 | * CPU_init_critical registers |
| 61 | * |
| 62 | * setup important registers |
| 63 | * setup memory timing |
| 64 | * |
| 65 | ************************************************************************* |
| 66 | */ |
Magnus Lilja | 40c642b | 2009-06-13 20:50:01 +0200 | [diff] [blame] | 67 | #ifndef CONFIG_SKIP_LOWLEVEL_INIT |
wdenk | 8ed9604 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 68 | cpu_init_crit: |
| 69 | /* |
| 70 | * flush v4 I/D caches |
| 71 | */ |
| 72 | mov r0, #0 |
George G. Davis | 409a07c | 2010-05-11 10:15:36 -0400 | [diff] [blame] | 73 | mcr p15, 0, r0, c7, c7, 0 /* Invalidate I+D+BTB caches */ |
| 74 | mcr p15, 0, r0, c8, c7, 0 /* Invalidate Unified TLB */ |
wdenk | 8ed9604 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 75 | |
| 76 | /* |
| 77 | * disable MMU stuff and caches |
| 78 | */ |
| 79 | mrc p15, 0, r0, c1, c0, 0 |
| 80 | bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS) |
| 81 | bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM) |
| 82 | orr r0, r0, #0x00000002 @ set bit 2 (A) Align |
wdenk | 8ed9604 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 83 | orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache |
wdenk | 8ed9604 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 84 | mcr p15, 0, r0, c1, c0, 0 |
| 85 | |
| 86 | /* |
wdenk | 082acfd | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 87 | * Jump to board specific initialization... The Mask ROM will have already initialized |
| 88 | * basic memory. Go here to bump up clock rate and handle wake up conditions. |
wdenk | 8ed9604 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 89 | */ |
wdenk | 082acfd | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 90 | mov ip, lr /* persevere link reg across call */ |
Wolfgang Denk | 87cb686 | 2005-10-06 17:08:18 +0200 | [diff] [blame] | 91 | bl lowlevel_init /* go setup pll,mux,memory */ |
wdenk | 082acfd | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 92 | mov lr, ip /* restore link */ |
| 93 | mov pc, lr /* back to my caller */ |
Magnus Lilja | 40c642b | 2009-06-13 20:50:01 +0200 | [diff] [blame] | 94 | #endif /* CONFIG_SKIP_LOWLEVEL_INIT */ |