blob: 4bc27f637366c9878db1a433291fc8b5dd9de76f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
wdenkf8062712005-01-09 23:16:25 +00002/*
3 * armboot - Startup Code for OMP2420/ARM1136 CPU-core
4 *
wdenk2e405bf2005-01-10 00:01:04 +00005 * Copyright (c) 2004 Texas Instruments <r-woodruff2@ti.com>
wdenkf8062712005-01-09 23:16:25 +00006 *
Albert ARIBAUD60fbc8d2011-08-04 18:45:45 +02007 * Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
8 * Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
Detlev Zundelf1b3f2b2009-05-13 10:54:10 +02009 * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de>
wdenkf8062712005-01-09 23:16:25 +000010 * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
11 * Copyright (c) 2003 Kshitij <kshitij@ti.com>
wdenkf8062712005-01-09 23:16:25 +000012 */
13
Wolfgang Denk0191e472010-10-26 14:34:52 +020014#include <asm-offsets.h>
wdenkf8062712005-01-09 23:16:25 +000015#include <config.h>
Kyungmin Park33174212008-01-17 16:43:25 +090016
wdenkf8062712005-01-09 23:16:25 +000017/*
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 ARIBAUD9852cc62014-04-15 16:13:51 +020030 .globl reset
Heiko Schocher504f87c2010-09-17 13:10:40 +020031
32reset:
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 Schocher504f87c2010-09-17 13:10:40 +020041 /* the mask ROM code should have PLL and others stable */
Tom Rinie1e85442021-08-27 21:18:30 -040042#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
Heiko Schocher504f87c2010-09-17 13:10:40 +020043 bl cpu_init_crit
44#endif
45
Albert ARIBAUDfacdae52013-01-08 10:18:02 +000046 bl _main
Heiko Schocher504f87c2010-09-17 13:10:40 +020047
48/*------------------------------------------------------------------------------*/
49
Albert ARIBAUDfacdae52013-01-08 10:18:02 +000050 .globl c_runtime_cpu_setup
51c_runtime_cpu_setup:
wdenkf8062712005-01-09 23:16:25 +000052
Albert ARIBAUDfacdae52013-01-08 10:18:02 +000053 bx lr
Heiko Schocher429ddf62010-10-13 07:57:14 +020054
wdenkf8062712005-01-09 23:16:25 +000055/*
56 *************************************************************************
57 *
58 * CPU_init_critical registers
59 *
60 * setup important registers
61 * setup memory timing
62 *
63 *************************************************************************
64 */
Tom Rinie1e85442021-08-27 21:18:30 -040065#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
wdenkf8062712005-01-09 23:16:25 +000066cpu_init_crit:
67 /*
68 * flush v4 I/D caches
69 */
70 mov r0, #0
George G. Davis15967892010-05-11 10:15:36 -040071 mcr p15, 0, r0, c7, c7, 0 /* Invalidate I+D+BTB caches */
72 mcr p15, 0, r0, c8, c7, 0 /* Invalidate Unified TLB */
wdenkf8062712005-01-09 23:16:25 +000073
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 Goto8d4b7e92016-02-25 10:23:34 +090080 orr r0, r0, #0x00000002 @ set bit 1 (A) Align
wdenkf8062712005-01-09 23:16:25 +000081 orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
wdenkf8062712005-01-09 23:16:25 +000082 mcr p15, 0, r0, c1, c0, 0
83
Tom Rinie1e85442021-08-27 21:18:30 -040084#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT_ONLY)
wdenkf8062712005-01-09 23:16:25 +000085 /*
wdenk2e405bf2005-01-10 00:01:04 +000086 * 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.
wdenkf8062712005-01-09 23:16:25 +000088 */
wdenk2e405bf2005-01-10 00:01:04 +000089 mov ip, lr /* persevere link reg across call */
Wolfgang Denk7f88a5e2005-10-06 17:08:18 +020090 bl lowlevel_init /* go setup pll,mux,memory */
wdenk2e405bf2005-01-10 00:01:04 +000091 mov lr, ip /* restore link */
Simon Glass90844072016-05-05 07:28:06 -060092#endif
wdenk2e405bf2005-01-10 00:01:04 +000093 mov pc, lr /* back to my caller */
Tom Rinie1e85442021-08-27 21:18:30 -040094#endif /* !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) */