wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * armboot - Startup Code for OMP2420/ARM1136 CPU-core |
| 3 | * |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 4 | * Copyright (c) 2004 Texas Instruments <r-woodruff2@ti.com> |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 5 | * |
Albert ARIBAUD | 60fbc8d | 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 | f1b3f2b | 2009-05-13 10:54:10 +0200 | [diff] [blame] | 8 | * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de> |
wdenk | f806271 | 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 | bd8ec7e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 12 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 13 | */ |
| 14 | |
Wolfgang Denk | 0191e47 | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 15 | #include <asm-offsets.h> |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 16 | #include <config.h> |
Kyungmin Park | 3317421 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 17 | |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 18 | /* |
| 19 | ************************************************************************* |
| 20 | * |
| 21 | * Startup Code (reset vector) |
| 22 | * |
| 23 | * do important init only if we don't start from memory! |
| 24 | * setup Memory and board specific bits prior to relocation. |
| 25 | * relocate armboot to ram |
| 26 | * setup stack |
| 27 | * |
| 28 | ************************************************************************* |
| 29 | */ |
| 30 | |
Albert ARIBAUD | 9852cc6 | 2014-04-15 16:13:51 +0200 | [diff] [blame] | 31 | .globl reset |
Heiko Schocher | 504f87c | 2010-09-17 13:10:40 +0200 | [diff] [blame] | 32 | |
| 33 | reset: |
| 34 | /* |
| 35 | * set the cpu to SVC32 mode |
| 36 | */ |
| 37 | mrs r0,cpsr |
| 38 | bic r0,r0,#0x1f |
| 39 | orr r0,r0,#0xd3 |
| 40 | msr cpsr,r0 |
| 41 | |
Heiko Schocher | 504f87c | 2010-09-17 13:10:40 +0200 | [diff] [blame] | 42 | /* the mask ROM code should have PLL and others stable */ |
| 43 | #ifndef CONFIG_SKIP_LOWLEVEL_INIT |
| 44 | bl cpu_init_crit |
| 45 | #endif |
| 46 | |
Albert ARIBAUD | facdae5 | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 47 | bl _main |
Heiko Schocher | 504f87c | 2010-09-17 13:10:40 +0200 | [diff] [blame] | 48 | |
| 49 | /*------------------------------------------------------------------------------*/ |
| 50 | |
Albert ARIBAUD | facdae5 | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 51 | .globl c_runtime_cpu_setup |
| 52 | c_runtime_cpu_setup: |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 53 | |
Albert ARIBAUD | facdae5 | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 54 | bx lr |
Heiko Schocher | 429ddf6 | 2010-10-13 07:57:14 +0200 | [diff] [blame] | 55 | |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 56 | /* |
| 57 | ************************************************************************* |
| 58 | * |
| 59 | * CPU_init_critical registers |
| 60 | * |
| 61 | * setup important registers |
| 62 | * setup memory timing |
| 63 | * |
| 64 | ************************************************************************* |
| 65 | */ |
Magnus Lilja | 4133f65 | 2009-06-13 20:50:01 +0200 | [diff] [blame] | 66 | #ifndef CONFIG_SKIP_LOWLEVEL_INIT |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 67 | cpu_init_crit: |
| 68 | /* |
| 69 | * flush v4 I/D caches |
| 70 | */ |
| 71 | mov r0, #0 |
George G. Davis | 1596789 | 2010-05-11 10:15:36 -0400 | [diff] [blame] | 72 | mcr p15, 0, r0, c7, c7, 0 /* Invalidate I+D+BTB caches */ |
| 73 | mcr p15, 0, r0, c8, c7, 0 /* Invalidate Unified TLB */ |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 74 | |
| 75 | /* |
| 76 | * disable MMU stuff and caches |
| 77 | */ |
| 78 | mrc p15, 0, r0, c1, c0, 0 |
| 79 | bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS) |
| 80 | bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM) |
Yuichiro Goto | 8d4b7e9 | 2016-02-25 10:23:34 +0900 | [diff] [blame] | 81 | orr r0, r0, #0x00000002 @ set bit 1 (A) Align |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 82 | orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 83 | mcr p15, 0, r0, c1, c0, 0 |
| 84 | |
Simon Glass | 9084407 | 2016-05-05 07:28:06 -0600 | [diff] [blame] | 85 | #ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 86 | /* |
wdenk | 2e405bf | 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 | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 89 | */ |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 90 | mov ip, lr /* persevere link reg across call */ |
Wolfgang Denk | 7f88a5e | 2005-10-06 17:08:18 +0200 | [diff] [blame] | 91 | bl lowlevel_init /* go setup pll,mux,memory */ |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 92 | mov lr, ip /* restore link */ |
Simon Glass | 9084407 | 2016-05-05 07:28:06 -0600 | [diff] [blame] | 93 | #endif |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 94 | mov pc, lr /* back to my caller */ |
Magnus Lilja | 4133f65 | 2009-06-13 20:50:01 +0200 | [diff] [blame] | 95 | #endif /* CONFIG_SKIP_LOWLEVEL_INIT */ |