blob: 1cfcca9fa6d3cb32355d628982d959f351f409c2 [file] [log] [blame]
wdenk8ed96042005-01-09 23:16:25 +00001/*
2 * armboot - Startup Code for OMP2420/ARM1136 CPU-core
3 *
wdenk082acfd2005-01-10 00:01:04 +00004 * Copyright (c) 2004 Texas Instruments <r-woodruff2@ti.com>
wdenk8ed96042005-01-09 23:16:25 +00005 *
Albert ARIBAUDfa82f872011-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 Zundel792a09e2009-05-13 10:54:10 +02008 * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de>
wdenk8ed96042005-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 Denk3765b3e2013-10-07 13:07:26 +020012 * SPDX-License-Identifier: GPL-2.0+
wdenk8ed96042005-01-09 23:16:25 +000013 */
14
Wolfgang Denk25ddd1f2010-10-26 14:34:52 +020015#include <asm-offsets.h>
wdenk8ed96042005-01-09 23:16:25 +000016#include <config.h>
17#include <version.h>
Kyungmin Park751b9b52008-01-17 16:43:25 +090018
wdenk8ed96042005-01-09 23:16:25 +000019/*
20 *************************************************************************
21 *
22 * Startup Code (reset vector)
23 *
24 * do important init only if we don't start from memory!
25 * setup Memory and board specific bits prior to relocation.
26 * relocate armboot to ram
27 * setup stack
28 *
29 *************************************************************************
30 */
31
Albert ARIBAUD41623c92014-04-15 16:13:51 +020032 .globl reset
Heiko Schochere48b7c02010-09-17 13:10:40 +020033
34reset:
35 /*
36 * set the cpu to SVC32 mode
37 */
38 mrs r0,cpsr
39 bic r0,r0,#0x1f
40 orr r0,r0,#0xd3
41 msr cpsr,r0
42
Heiko Schochere48b7c02010-09-17 13:10:40 +020043 /* the mask ROM code should have PLL and others stable */
44#ifndef CONFIG_SKIP_LOWLEVEL_INIT
45 bl cpu_init_crit
46#endif
47
Albert ARIBAUDe05e5de2013-01-08 10:18:02 +000048 bl _main
Heiko Schochere48b7c02010-09-17 13:10:40 +020049
50/*------------------------------------------------------------------------------*/
51
Albert ARIBAUDe05e5de2013-01-08 10:18:02 +000052 .globl c_runtime_cpu_setup
53c_runtime_cpu_setup:
Heiko Schochere48b7c02010-09-17 13:10:40 +020054
Albert ARIBAUDe05e5de2013-01-08 10:18:02 +000055 bx lr
Heiko Schocherbafe7432010-10-13 07:57:14 +020056
wdenk8ed96042005-01-09 23:16:25 +000057/*
58 *************************************************************************
59 *
60 * CPU_init_critical registers
61 *
62 * setup important registers
63 * setup memory timing
64 *
65 *************************************************************************
66 */
Magnus Lilja40c642b2009-06-13 20:50:01 +020067#ifndef CONFIG_SKIP_LOWLEVEL_INIT
wdenk8ed96042005-01-09 23:16:25 +000068cpu_init_crit:
69 /*
70 * flush v4 I/D caches
71 */
72 mov r0, #0
George G. Davis409a07c2010-05-11 10:15:36 -040073 mcr p15, 0, r0, c7, c7, 0 /* Invalidate I+D+BTB caches */
74 mcr p15, 0, r0, c8, c7, 0 /* Invalidate Unified TLB */
wdenk8ed96042005-01-09 23:16:25 +000075
76 /*
77 * disable MMU stuff and caches
78 */
79 mrc p15, 0, r0, c1, c0, 0
80 bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS)
81 bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM)
82 orr r0, r0, #0x00000002 @ set bit 2 (A) Align
wdenk8ed96042005-01-09 23:16:25 +000083 orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
wdenk8ed96042005-01-09 23:16:25 +000084 mcr p15, 0, r0, c1, c0, 0
85
86 /*
wdenk082acfd2005-01-10 00:01:04 +000087 * 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.
wdenk8ed96042005-01-09 23:16:25 +000089 */
wdenk082acfd2005-01-10 00:01:04 +000090 mov ip, lr /* persevere link reg across call */
Wolfgang Denk87cb6862005-10-06 17:08:18 +020091 bl lowlevel_init /* go setup pll,mux,memory */
wdenk082acfd2005-01-10 00:01:04 +000092 mov lr, ip /* restore link */
93 mov pc, lr /* back to my caller */
Magnus Lilja40c642b2009-06-13 20:50:01 +020094#endif /* CONFIG_SKIP_LOWLEVEL_INIT */