Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 1 | /* |
| 2 | * armboot - Startup Code for ARM926EJS CPU-core |
| 3 | * |
| 4 | * Copyright (c) 2003 Texas Instruments |
| 5 | * |
| 6 | * ----- Adapted for OMAP1610 OMAP730 from ARM925t code ------ |
| 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> |
Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [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> |
Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 14 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 15 | * SPDX-License-Identifier: GPL-2.0+ |
Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 16 | */ |
| 17 | |
Wolfgang Denk | 25ddd1f | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 18 | #include <asm-offsets.h> |
Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 19 | #include <config.h> |
Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 20 | |
| 21 | /* |
| 22 | ************************************************************************* |
| 23 | * |
Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 24 | * Startup Code (reset vector) |
| 25 | * |
| 26 | * do important init only if we don't start from memory! |
| 27 | * setup Memory and board specific bits prior to relocation. |
| 28 | * relocate armboot to ram |
| 29 | * setup stack |
| 30 | * |
| 31 | ************************************************************************* |
| 32 | */ |
| 33 | |
Albert ARIBAUD | 41623c9 | 2014-04-15 16:13:51 +0200 | [diff] [blame] | 34 | .globl reset |
Heiko Schocher | 5a8a87e | 2010-09-17 13:10:45 +0200 | [diff] [blame] | 35 | |
| 36 | reset: |
| 37 | /* |
| 38 | * set the cpu to SVC32 mode |
| 39 | */ |
| 40 | mrs r0,cpsr |
| 41 | bic r0,r0,#0x1f |
| 42 | orr r0,r0,#0xd3 |
| 43 | msr cpsr,r0 |
| 44 | |
| 45 | /* |
| 46 | * we do sys-critical inits only at reboot, |
| 47 | * not when booting from ram! |
| 48 | */ |
| 49 | #ifndef CONFIG_SKIP_LOWLEVEL_INIT |
| 50 | bl cpu_init_crit |
| 51 | #endif |
| 52 | |
Albert ARIBAUD | e05e5de | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 53 | bl _main |
Heiko Schocher | 5a8a87e | 2010-09-17 13:10:45 +0200 | [diff] [blame] | 54 | |
| 55 | /*------------------------------------------------------------------------------*/ |
| 56 | |
Albert ARIBAUD | e05e5de | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 57 | .globl c_runtime_cpu_setup |
| 58 | c_runtime_cpu_setup: |
| 59 | |
| 60 | mov pc, lr |
| 61 | |
Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 62 | /* |
| 63 | ************************************************************************* |
| 64 | * |
| 65 | * CPU_init_critical registers |
| 66 | * |
| 67 | * setup important registers |
| 68 | * setup memory timing |
| 69 | * |
| 70 | ************************************************************************* |
| 71 | */ |
| 72 | |
| 73 | |
Jean-Christophe PLAGNIOL-VILLARD | 8fc3bb4 | 2009-05-15 23:45:20 +0200 | [diff] [blame] | 74 | #ifndef CONFIG_SKIP_LOWLEVEL_INIT |
Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 75 | cpu_init_crit: |
| 76 | /* |
| 77 | * flush v4 I/D caches |
| 78 | */ |
| 79 | mov r0, #0 |
| 80 | mcr p15, 0, r0, c7, c5, 0 /* flush v4 I-cache */ |
| 81 | mcr p15, 0, r0, c7, c6, 0 /* flush v4 D-cache */ |
| 82 | |
| 83 | /* |
| 84 | * disable MMU stuff and caches |
| 85 | */ |
| 86 | mrc p15, 0, r0, c1, c0, 0 |
| 87 | bic r0, r0, #0x00002300 /* clear bits 13, 9:8 (--V- --RS) */ |
| 88 | bic r0, r0, #0x00000087 /* clear bits 7, 2:0 (B--- -CAM) */ |
Yuichiro Goto | ba10b85 | 2016-02-25 10:23:34 +0900 | [diff] [blame] | 89 | orr r0, r0, #0x00000002 /* set bit 1 (A) Align */ |
Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 90 | orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */ |
| 91 | mcr p15, 0, r0, c1, c0, 0 |
| 92 | |
Simon Glass | b5bd098 | 2016-05-05 07:28:06 -0600 | [diff] [blame] | 93 | #ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY |
Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 94 | /* |
| 95 | * Go setup Memory and board specific bits prior to relocation. |
| 96 | */ |
| 97 | mov ip, lr /* perserve link reg across call */ |
Wolfgang Denk | 87cb686 | 2005-10-06 17:08:18 +0200 | [diff] [blame] | 98 | bl lowlevel_init /* go setup memory */ |
Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 99 | mov lr, ip /* restore link */ |
Simon Glass | b5bd098 | 2016-05-05 07:28:06 -0600 | [diff] [blame] | 100 | #endif |
Wolfgang Denk | 74f4304 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 101 | mov pc, lr /* back to my caller */ |
Jean-Christophe PLAGNIOL-VILLARD | 8fc3bb4 | 2009-05-15 23:45:20 +0200 | [diff] [blame] | 102 | #endif |