Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 2 | /* |
| 3 | * armboot - Startup Code for OMP2420/ARM1136 CPU-core |
| 4 | * |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 5 | * Copyright (c) 2004 Texas Instruments <r-woodruff2@ti.com> |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 6 | * |
Albert ARIBAUD | 60fbc8d | 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 | f1b3f2b | 2009-05-13 10:54:10 +0200 | [diff] [blame] | 9 | * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de> |
wdenk | f806271 | 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 | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 12 | */ |
| 13 | |
Wolfgang Denk | 0191e47 | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 14 | #include <asm-offsets.h> |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 15 | #include <config.h> |
Kyungmin Park | 3317421 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 16 | |
wdenk | f806271 | 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 | 9852cc6 | 2014-04-15 16:13:51 +0200 | [diff] [blame] | 30 | .globl reset |
Heiko Schocher | 504f87c | 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 | 504f87c | 2010-09-17 13:10:40 +0200 | [diff] [blame] | 41 | /* the mask ROM code should have PLL and others stable */ |
Tom Rini | e1e8544 | 2021-08-27 21:18:30 -0400 | [diff] [blame] | 42 | #if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) |
Heiko Schocher | 504f87c | 2010-09-17 13:10:40 +0200 | [diff] [blame] | 43 | bl cpu_init_crit |
| 44 | #endif |
| 45 | |
Albert ARIBAUD | facdae5 | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 46 | bl _main |
Heiko Schocher | 504f87c | 2010-09-17 13:10:40 +0200 | [diff] [blame] | 47 | |
| 48 | /*------------------------------------------------------------------------------*/ |
| 49 | |
Albert ARIBAUD | facdae5 | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 50 | .globl c_runtime_cpu_setup |
| 51 | c_runtime_cpu_setup: |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 52 | |
Albert ARIBAUD | facdae5 | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 53 | bx lr |
Heiko Schocher | 429ddf6 | 2010-10-13 07:57:14 +0200 | [diff] [blame] | 54 | |
wdenk | f806271 | 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 | */ |
Tom Rini | e1e8544 | 2021-08-27 21:18:30 -0400 | [diff] [blame] | 65 | #if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) |
wdenk | f806271 | 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 | 1596789 | 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 | f806271 | 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 | 8d4b7e9 | 2016-02-25 10:23:34 +0900 | [diff] [blame] | 80 | orr r0, r0, #0x00000002 @ set bit 1 (A) Align |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 81 | orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 82 | mcr p15, 0, r0, c1, c0, 0 |
| 83 | |
Tom Rini | e1e8544 | 2021-08-27 21:18:30 -0400 | [diff] [blame] | 84 | #if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT_ONLY) |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 85 | /* |
wdenk | 2e405bf | 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 | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 88 | */ |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 89 | mov ip, lr /* persevere link reg across call */ |
Wolfgang Denk | 7f88a5e | 2005-10-06 17:08:18 +0200 | [diff] [blame] | 90 | bl lowlevel_init /* go setup pll,mux,memory */ |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 91 | mov lr, ip /* restore link */ |
Simon Glass | 9084407 | 2016-05-05 07:28:06 -0600 | [diff] [blame] | 92 | #endif |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 93 | mov pc, lr /* back to my caller */ |
Tom Rini | e1e8544 | 2021-08-27 21:18:30 -0400 | [diff] [blame] | 94 | #endif /* !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) */ |