2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2005-01-09 23:16:25 +00:00
|
|
|
/*
|
|
|
|
* armboot - Startup Code for OMP2420/ARM1136 CPU-core
|
|
|
|
*
|
2005-01-10 00:01:04 +00:00
|
|
|
* Copyright (c) 2004 Texas Instruments <r-woodruff2@ti.com>
|
2005-01-09 23:16:25 +00:00
|
|
|
*
|
2011-08-04 16:45:45 +00:00
|
|
|
* Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
|
|
|
|
* Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
|
2009-05-13 08:54:10 +00:00
|
|
|
* Copyright (c) 2002 Gary Jennejohn <garyj@denx.de>
|
2005-01-09 23:16:25 +00:00
|
|
|
* Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
|
|
|
|
* Copyright (c) 2003 Kshitij <kshitij@ti.com>
|
|
|
|
*/
|
|
|
|
|
2010-10-26 12:34:52 +00:00
|
|
|
#include <asm-offsets.h>
|
2005-01-09 23:16:25 +00:00
|
|
|
#include <config.h>
|
2008-01-17 07:43:25 +00:00
|
|
|
|
2005-01-09 23:16:25 +00:00
|
|
|
/*
|
|
|
|
*************************************************************************
|
|
|
|
*
|
|
|
|
* Startup Code (reset vector)
|
|
|
|
*
|
|
|
|
* do important init only if we don't start from memory!
|
|
|
|
* setup Memory and board specific bits prior to relocation.
|
|
|
|
* relocate armboot to ram
|
|
|
|
* setup stack
|
|
|
|
*
|
|
|
|
*************************************************************************
|
|
|
|
*/
|
|
|
|
|
2014-04-15 14:13:51 +00:00
|
|
|
.globl reset
|
2010-09-17 11:10:40 +00:00
|
|
|
|
|
|
|
reset:
|
|
|
|
/*
|
|
|
|
* set the cpu to SVC32 mode
|
|
|
|
*/
|
|
|
|
mrs r0,cpsr
|
|
|
|
bic r0,r0,#0x1f
|
|
|
|
orr r0,r0,#0xd3
|
|
|
|
msr cpsr,r0
|
|
|
|
|
|
|
|
/* the mask ROM code should have PLL and others stable */
|
2021-08-28 01:18:30 +00:00
|
|
|
#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
|
2010-09-17 11:10:40 +00:00
|
|
|
bl cpu_init_crit
|
|
|
|
#endif
|
|
|
|
|
2013-01-08 10:18:02 +00:00
|
|
|
bl _main
|
2010-09-17 11:10:40 +00:00
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
2013-01-08 10:18:02 +00:00
|
|
|
.globl c_runtime_cpu_setup
|
|
|
|
c_runtime_cpu_setup:
|
2010-09-17 11:10:40 +00:00
|
|
|
|
2013-01-08 10:18:02 +00:00
|
|
|
bx lr
|
2010-10-13 05:57:14 +00:00
|
|
|
|
2005-01-09 23:16:25 +00:00
|
|
|
/*
|
|
|
|
*************************************************************************
|
|
|
|
*
|
|
|
|
* CPU_init_critical registers
|
|
|
|
*
|
|
|
|
* setup important registers
|
|
|
|
* setup memory timing
|
|
|
|
*
|
|
|
|
*************************************************************************
|
|
|
|
*/
|
2021-08-28 01:18:30 +00:00
|
|
|
#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
|
2005-01-09 23:16:25 +00:00
|
|
|
cpu_init_crit:
|
|
|
|
/*
|
|
|
|
* flush v4 I/D caches
|
|
|
|
*/
|
|
|
|
mov r0, #0
|
ARM1136: Fix cache_flush() error and correct cpu_init_crit() comments
The ARM1136 cache_flush() function uses the "mcr p15, 0, rn, c7, c7, 0"
instruction which means "Invalidate Both Caches" when in fact the intent
is to clean and invalidate all caches. So add an "mcr p15, 0, %0, c7,
c10, 0" instruction to "Clean Entire Data Cache" prior to the "Invalidate
Both Caches" instruction to insure that memory is consistent with any
dirty cache lines.
Also fix a couple of "flush v*" comments in ARM1136 cpu_init_crit() so
that they correctly describe the actual ARM1136 CP15 C7 Cache Operations
used.
Signed-off-by: George G. Davis <gdavis@mvista.com>
2010-05-11 14:15:36 +00:00
|
|
|
mcr p15, 0, r0, c7, c7, 0 /* Invalidate I+D+BTB caches */
|
|
|
|
mcr p15, 0, r0, c8, c7, 0 /* Invalidate Unified TLB */
|
2005-01-09 23:16:25 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* disable MMU stuff and caches
|
|
|
|
*/
|
|
|
|
mrc p15, 0, r0, c1, c0, 0
|
|
|
|
bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS)
|
|
|
|
bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM)
|
2016-02-25 01:23:34 +00:00
|
|
|
orr r0, r0, #0x00000002 @ set bit 1 (A) Align
|
2005-01-09 23:16:25 +00:00
|
|
|
orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
|
|
|
|
mcr p15, 0, r0, c1, c0, 0
|
|
|
|
|
2021-08-28 01:18:30 +00:00
|
|
|
#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT_ONLY)
|
2005-01-09 23:16:25 +00:00
|
|
|
/*
|
2005-01-10 00:01:04 +00:00
|
|
|
* Jump to board specific initialization... The Mask ROM will have already initialized
|
|
|
|
* basic memory. Go here to bump up clock rate and handle wake up conditions.
|
2005-01-09 23:16:25 +00:00
|
|
|
*/
|
2005-01-10 00:01:04 +00:00
|
|
|
mov ip, lr /* persevere link reg across call */
|
2005-10-06 15:08:18 +00:00
|
|
|
bl lowlevel_init /* go setup pll,mux,memory */
|
2005-01-10 00:01:04 +00:00
|
|
|
mov lr, ip /* restore link */
|
2016-05-05 13:28:06 +00:00
|
|
|
#endif
|
2005-01-10 00:01:04 +00:00
|
|
|
mov pc, lr /* back to my caller */
|
2021-08-28 01:18:30 +00:00
|
|
|
#endif /* !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) */
|