blob: 3ebdfddc8098a4de195166de4f30c43fdba1f07b [file] [log] [blame]
wdenkf8062712005-01-09 23:16:25 +00001/*
2 * armboot - Startup Code for OMP2420/ARM1136 CPU-core
3 *
wdenk2e405bf2005-01-10 00:01:04 +00004 * Copyright (c) 2004 Texas Instruments <r-woodruff2@ti.com>
wdenkf8062712005-01-09 23:16:25 +00005 *
Albert ARIBAUD60fbc8d2011-08-04 18:45:45 +02006 * Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
7 * Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
Detlev Zundelf1b3f2b2009-05-13 10:54:10 +02008 * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de>
wdenkf8062712005-01-09 23:16:25 +00009 * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
10 * Copyright (c) 2003 Kshitij <kshitij@ti.com>
11 *
Wolfgang Denkbd8ec7e2013-10-07 13:07:26 +020012 * SPDX-License-Identifier: GPL-2.0+
wdenkf8062712005-01-09 23:16:25 +000013 */
14
Wolfgang Denk0191e472010-10-26 14:34:52 +020015#include <asm-offsets.h>
wdenkf8062712005-01-09 23:16:25 +000016#include <config.h>
Kyungmin Park33174212008-01-17 16:43:25 +090017
wdenkf8062712005-01-09 23:16:25 +000018/*
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 ARIBAUD9852cc62014-04-15 16:13:51 +020031 .globl reset
Heiko Schocher504f87c2010-09-17 13:10:40 +020032
33reset:
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 Schocher504f87c2010-09-17 13:10:40 +020042 /* 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 ARIBAUDfacdae52013-01-08 10:18:02 +000047 bl _main
Heiko Schocher504f87c2010-09-17 13:10:40 +020048
49/*------------------------------------------------------------------------------*/
50
Albert ARIBAUDfacdae52013-01-08 10:18:02 +000051 .globl c_runtime_cpu_setup
52c_runtime_cpu_setup:
wdenkf8062712005-01-09 23:16:25 +000053
Albert ARIBAUDfacdae52013-01-08 10:18:02 +000054 bx lr
Heiko Schocher429ddf62010-10-13 07:57:14 +020055
wdenkf8062712005-01-09 23:16:25 +000056/*
57 *************************************************************************
58 *
59 * CPU_init_critical registers
60 *
61 * setup important registers
62 * setup memory timing
63 *
64 *************************************************************************
65 */
Magnus Lilja4133f652009-06-13 20:50:01 +020066#ifndef CONFIG_SKIP_LOWLEVEL_INIT
wdenkf8062712005-01-09 23:16:25 +000067cpu_init_crit:
68 /*
69 * flush v4 I/D caches
70 */
71 mov r0, #0
George G. Davis15967892010-05-11 10:15:36 -040072 mcr p15, 0, r0, c7, c7, 0 /* Invalidate I+D+BTB caches */
73 mcr p15, 0, r0, c8, c7, 0 /* Invalidate Unified TLB */
wdenkf8062712005-01-09 23:16:25 +000074
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 Goto8d4b7e92016-02-25 10:23:34 +090081 orr r0, r0, #0x00000002 @ set bit 1 (A) Align
wdenkf8062712005-01-09 23:16:25 +000082 orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
wdenkf8062712005-01-09 23:16:25 +000083 mcr p15, 0, r0, c1, c0, 0
84
85 /*
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 */
92 mov pc, lr /* back to my caller */
Magnus Lilja4133f652009-06-13 20:50:01 +020093#endif /* CONFIG_SKIP_LOWLEVEL_INIT */