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