blob: 8eb249475e473bbbca5888fd61d9cb1aa9dbb7ae [file] [log] [blame]
wdenk7eaacc52003-08-29 22:00:43 +00001/*
2 * armboot - Startup Code for ARM926EJS CPU-core
3 *
4 * Copyright (c) 2003 Texas Instruments
5 *
wdenke3a06802004-06-06 23:13:55 +00006 * ----- Adapted for OMAP1610 OMAP730 from ARM925t code ------
wdenk7eaacc52003-08-29 22:00:43 +00007 *
Albert ARIBAUD60fbc8d2011-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 Zundelf1b3f2b2009-05-13 10:54:10 +020010 * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de>
wdenk7eaacc52003-08-29 22:00:43 +000011 * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
12 * Copyright (c) 2003 Kshitij <kshitij@ti.com>
Albert ARIBAUD340983d2011-04-22 19:41:02 +020013 * Copyright (c) 2010 Albert Aribaud <albert.u.boot@aribaud.net>
wdenk7eaacc52003-08-29 22:00:43 +000014 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +020015 * SPDX-License-Identifier: GPL-2.0+
wdenk7eaacc52003-08-29 22:00:43 +000016 */
17
Wolfgang Denk0191e472010-10-26 14:34:52 +020018#include <asm-offsets.h>
wdenk7eaacc52003-08-29 22:00:43 +000019#include <config.h>
Wolfgang Denk66e8d442009-07-24 00:17:48 +020020#include <common.h>
wdenk7eaacc52003-08-29 22:00:43 +000021#include <version.h>
22
wdenk7eaacc52003-08-29 22:00:43 +000023/*
24 *************************************************************************
25 *
wdenk7eaacc52003-08-29 22:00:43 +000026 * Startup Code (reset vector)
27 *
28 * do important init only if we don't start from memory!
29 * setup Memory and board specific bits prior to relocation.
30 * relocate armboot to ram
31 * setup stack
32 *
33 *************************************************************************
34 */
35
Albert ARIBAUD9852cc62014-04-15 16:13:51 +020036 .globl reset
Heiko Schocher0e2412a2010-09-17 13:10:42 +020037
38reset:
39 /*
40 * set the cpu to SVC32 mode
41 */
42 mrs r0,cpsr
43 bic r0,r0,#0x1f
44 orr r0,r0,#0xd3
45 msr cpsr,r0
46
47 /*
48 * we do sys-critical inits only at reboot,
49 * not when booting from ram!
50 */
Christian Riesch11bf5762012-02-02 00:44:37 +000051#ifndef CONFIG_SKIP_LOWLEVEL_INIT
Heiko Schocher0e2412a2010-09-17 13:10:42 +020052 bl cpu_init_crit
Christian Riesch11bf5762012-02-02 00:44:37 +000053#endif
Heiko Schocher0e2412a2010-09-17 13:10:42 +020054
Albert ARIBAUDfacdae52013-01-08 10:18:02 +000055 bl _main
Heiko Schocher0e2412a2010-09-17 13:10:42 +020056
57/*------------------------------------------------------------------------------*/
58
Albert ARIBAUDfacdae52013-01-08 10:18:02 +000059 .globl c_runtime_cpu_setup
60c_runtime_cpu_setup:
61
62 bx lr
63
wdenk7eaacc52003-08-29 22:00:43 +000064/*
65 *************************************************************************
66 *
67 * CPU_init_critical registers
68 *
69 * setup important registers
70 * setup memory timing
71 *
72 *************************************************************************
73 */
Christian Riesch11bf5762012-02-02 00:44:37 +000074#ifndef CONFIG_SKIP_LOWLEVEL_INIT
wdenk7eaacc52003-08-29 22:00:43 +000075cpu_init_crit:
76 /*
Sughosh Ganu4cb71862012-02-02 00:44:38 +000077 * flush D cache before disabling it
wdenk7eaacc52003-08-29 22:00:43 +000078 */
79 mov r0, #0
Sughosh Ganu4cb71862012-02-02 00:44:38 +000080flush_dcache:
81 mrc p15, 0, r15, c7, c10, 3
82 bne flush_dcache
83
84 mcr p15, 0, r0, c8, c7, 0 /* invalidate TLB */
85 mcr p15, 0, r0, c7, c5, 0 /* invalidate I Cache */
wdenk7eaacc52003-08-29 22:00:43 +000086
87 /*
Christian Riescha927d262012-02-02 00:44:40 +000088 * disable MMU and D cache
89 * enable I cache if CONFIG_SYS_ICACHE_OFF is not defined
wdenk7eaacc52003-08-29 22:00:43 +000090 */
91 mrc p15, 0, r0, c1, c0, 0
Christian Riesch48c2d6d2012-02-02 00:44:39 +000092 bic r0, r0, #0x00000300 /* clear bits 9:8 (---- --RS) */
wdenk7eaacc52003-08-29 22:00:43 +000093 bic r0, r0, #0x00000087 /* clear bits 7, 2:0 (B--- -CAM) */
Christian Riesch48c2d6d2012-02-02 00:44:39 +000094#ifdef CONFIG_SYS_EXCEPTION_VECTORS_HIGH
95 orr r0, r0, #0x00002000 /* set bit 13 (--V- ----) */
96#else
97 bic r0, r0, #0x00002000 /* clear bit 13 (--V- ----) */
98#endif
wdenk7eaacc52003-08-29 22:00:43 +000099 orr r0, r0, #0x00000002 /* set bit 2 (A) Align */
Christian Riescha927d262012-02-02 00:44:40 +0000100#ifndef CONFIG_SYS_ICACHE_OFF
wdenk7eaacc52003-08-29 22:00:43 +0000101 orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */
Christian Riescha927d262012-02-02 00:44:40 +0000102#endif
wdenk7eaacc52003-08-29 22:00:43 +0000103 mcr p15, 0, r0, c1, c0, 0
104
105 /*
106 * Go setup Memory and board specific bits prior to relocation.
107 */
108 mov ip, lr /* perserve link reg across call */
Wolfgang Denk7f88a5e2005-10-06 17:08:18 +0200109 bl lowlevel_init /* go setup pll,mux,memory */
wdenk7eaacc52003-08-29 22:00:43 +0000110 mov lr, ip /* restore link */
Heiko Schocherc8a6d752011-11-09 20:06:23 +0000111 mov pc, lr /* back to my caller */
Christian Riesch11bf5762012-02-02 00:44:37 +0000112#endif /* CONFIG_SKIP_LOWLEVEL_INIT */