blob: 4bc27f637366c9878db1a433291fc8b5dd9de76f [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
wdenk8ed96042005-01-09 23:16:25 +00002/*
3 * armboot - Startup Code for OMP2420/ARM1136 CPU-core
4 *
wdenk082acfd2005-01-10 00:01:04 +00005 * Copyright (c) 2004 Texas Instruments <r-woodruff2@ti.com>
wdenk8ed96042005-01-09 23:16:25 +00006 *
Albert ARIBAUDfa82f872011-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 Zundel792a09e2009-05-13 10:54:10 +02009 * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de>
wdenk8ed96042005-01-09 23:16:25 +000010 * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
11 * Copyright (c) 2003 Kshitij <kshitij@ti.com>
wdenk8ed96042005-01-09 23:16:25 +000012 */
13
Wolfgang Denk25ddd1f2010-10-26 14:34:52 +020014#include <asm-offsets.h>
wdenk8ed96042005-01-09 23:16:25 +000015#include <config.h>
Kyungmin Park751b9b52008-01-17 16:43:25 +090016
wdenk8ed96042005-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 ARIBAUD41623c92014-04-15 16:13:51 +020030 .globl reset
Heiko Schochere48b7c02010-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 Schochere48b7c02010-09-17 13:10:40 +020041 /* the mask ROM code should have PLL and others stable */
Tom Rinia2ac2b92021-08-27 21:18:30 -040042#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
Heiko Schochere48b7c02010-09-17 13:10:40 +020043 bl cpu_init_crit
44#endif
45
Albert ARIBAUDe05e5de2013-01-08 10:18:02 +000046 bl _main
Heiko Schochere48b7c02010-09-17 13:10:40 +020047
48/*------------------------------------------------------------------------------*/
49
Albert ARIBAUDe05e5de2013-01-08 10:18:02 +000050 .globl c_runtime_cpu_setup
51c_runtime_cpu_setup:
Heiko Schochere48b7c02010-09-17 13:10:40 +020052
Albert ARIBAUDe05e5de2013-01-08 10:18:02 +000053 bx lr
Heiko Schocherbafe7432010-10-13 07:57:14 +020054
wdenk8ed96042005-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 Rinia2ac2b92021-08-27 21:18:30 -040065#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
wdenk8ed96042005-01-09 23:16:25 +000066cpu_init_crit:
67 /*
68 * flush v4 I/D caches
69 */
70 mov r0, #0
George G. Davis409a07c2010-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 */
wdenk8ed96042005-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 Gotoba10b852016-02-25 10:23:34 +090080 orr r0, r0, #0x00000002 @ set bit 1 (A) Align
wdenk8ed96042005-01-09 23:16:25 +000081 orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
wdenk8ed96042005-01-09 23:16:25 +000082 mcr p15, 0, r0, c1, c0, 0
83
Tom Rinia2ac2b92021-08-27 21:18:30 -040084#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT_ONLY)
wdenk8ed96042005-01-09 23:16:25 +000085 /*
wdenk082acfd2005-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.
wdenk8ed96042005-01-09 23:16:25 +000088 */
wdenk082acfd2005-01-10 00:01:04 +000089 mov ip, lr /* persevere link reg across call */
Wolfgang Denk87cb6862005-10-06 17:08:18 +020090 bl lowlevel_init /* go setup pll,mux,memory */
wdenk082acfd2005-01-10 00:01:04 +000091 mov lr, ip /* restore link */
Simon Glassb5bd0982016-05-05 07:28:06 -060092#endif
wdenk082acfd2005-01-10 00:01:04 +000093 mov pc, lr /* back to my caller */
Tom Rinia2ac2b92021-08-27 21:18:30 -040094#endif /* !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) */