blob: 41123716a7430c702d8d80749f9dc9cc69ec7301 [file] [log] [blame]
Wolfgang Denk74f43042005-09-25 01:48:28 +02001/*
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 ARIBAUDfa82f872011-08-04 18:45:45 +02008 * Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
9 * Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
Detlev Zundel792a09e2009-05-13 10:54:10 +020010 * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de>
Wolfgang Denk74f43042005-09-25 01:48:28 +020011 * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
12 * Copyright (c) 2003 Kshitij <kshitij@ti.com>
Albert ARIBAUD57b4bce2011-04-22 19:41:02 +020013 * Copyright (c) 2010 Albert Aribaud <albert.u.boot@aribaud.net>
Wolfgang Denk74f43042005-09-25 01:48:28 +020014 *
Wolfgang Denk1a459662013-07-08 09:37:19 +020015 * SPDX-License-Identifier: GPL-2.0+
Wolfgang Denk74f43042005-09-25 01:48:28 +020016 */
17
Wolfgang Denk25ddd1f2010-10-26 14:34:52 +020018#include <asm-offsets.h>
Wolfgang Denk74f43042005-09-25 01:48:28 +020019#include <config.h>
20#include <version.h>
21
22/*
23 *************************************************************************
24 *
Wolfgang Denk74f43042005-09-25 01:48:28 +020025 * Startup Code (reset vector)
26 *
27 * do important init only if we don't start from memory!
28 * setup Memory and board specific bits prior to relocation.
29 * relocate armboot to ram
30 * setup stack
31 *
32 *************************************************************************
33 */
34
Albert ARIBAUD41623c92014-04-15 16:13:51 +020035 .globl reset
Heiko Schocher5a8a87e2010-09-17 13:10:45 +020036
37reset:
38 /*
39 * set the cpu to SVC32 mode
40 */
41 mrs r0,cpsr
42 bic r0,r0,#0x1f
43 orr r0,r0,#0xd3
44 msr cpsr,r0
45
46 /*
47 * we do sys-critical inits only at reboot,
48 * not when booting from ram!
49 */
50#ifndef CONFIG_SKIP_LOWLEVEL_INIT
51 bl cpu_init_crit
52#endif
53
Albert ARIBAUDe05e5de2013-01-08 10:18:02 +000054 bl _main
Heiko Schocher5a8a87e2010-09-17 13:10:45 +020055
56/*------------------------------------------------------------------------------*/
57
Albert ARIBAUDe05e5de2013-01-08 10:18:02 +000058 .globl c_runtime_cpu_setup
59c_runtime_cpu_setup:
60
61 mov pc, lr
62
Wolfgang Denk74f43042005-09-25 01:48:28 +020063/*
64 *************************************************************************
65 *
66 * CPU_init_critical registers
67 *
68 * setup important registers
69 * setup memory timing
70 *
71 *************************************************************************
72 */
73
74
Jean-Christophe PLAGNIOL-VILLARD8fc3bb42009-05-15 23:45:20 +020075#ifndef CONFIG_SKIP_LOWLEVEL_INIT
Wolfgang Denk74f43042005-09-25 01:48:28 +020076cpu_init_crit:
77 /*
78 * flush v4 I/D caches
79 */
80 mov r0, #0
81 mcr p15, 0, r0, c7, c5, 0 /* flush v4 I-cache */
82 mcr p15, 0, r0, c7, c6, 0 /* flush v4 D-cache */
83
84 /*
85 * disable MMU stuff and caches
86 */
87 mrc p15, 0, r0, c1, c0, 0
88 bic r0, r0, #0x00002300 /* clear bits 13, 9:8 (--V- --RS) */
89 bic r0, r0, #0x00000087 /* clear bits 7, 2:0 (B--- -CAM) */
90 orr r0, r0, #0x00000002 /* set bit 2 (A) Align */
91 orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */
92 mcr p15, 0, r0, c1, c0, 0
93
94 /*
95 * Go setup Memory and board specific bits prior to relocation.
96 */
97 mov ip, lr /* perserve link reg across call */
Wolfgang Denk87cb6862005-10-06 17:08:18 +020098 bl lowlevel_init /* go setup memory */
Wolfgang Denk74f43042005-09-25 01:48:28 +020099 mov lr, ip /* restore link */
100 mov pc, lr /* back to my caller */
Jean-Christophe PLAGNIOL-VILLARD8fc3bb42009-05-15 23:45:20 +0200101#endif