2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2002-11-03 00:24:07 +00:00
|
|
|
/*
|
2011-10-31 13:12:39 +00:00
|
|
|
* armboot - Startup Code for XScale CPU-core
|
2002-11-03 00:24:07 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
|
|
|
|
* Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
|
|
|
|
* Copyright (C) 2000 Wolfgang Denk <wd@denx.de>
|
2003-12-06 19:49:23 +00:00
|
|
|
* Copyright (C) 2001 Alex Zuepke <azu@sysgo.de>
|
2011-10-31 13:12:39 +00:00
|
|
|
* Copyright (C) 2001 Marius Groger <mag@sysgo.de>
|
|
|
|
* Copyright (C) 2002 Alex Zupke <azu@sysgo.de>
|
|
|
|
* Copyright (C) 2002 Gary Jennejohn <garyj@denx.de>
|
2003-03-06 21:55:29 +00:00
|
|
|
* Copyright (C) 2002 Kyle Harris <kharris@nexus-tech.net>
|
2006-03-06 22:18:48 +00:00
|
|
|
* Copyright (C) 2003 Kai-Uwe Bloem <kai-uwe.bloem@auerswald.de>
|
2011-10-31 13:12:39 +00:00
|
|
|
* Copyright (C) 2003 Kshitij <kshitij@ti.com>
|
|
|
|
* Copyright (C) 2003 Richard Woodruff <r-woodruff2@ti.com>
|
|
|
|
* Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
|
|
|
|
* Copyright (C) 2004 Texas Instruments <r-woodruff2@ti.com>
|
|
|
|
* Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
|
2002-11-03 00:24:07 +00:00
|
|
|
*/
|
|
|
|
|
2010-10-26 12:34:52 +00:00
|
|
|
#include <asm-offsets.h>
|
2002-11-03 00:24:07 +00:00
|
|
|
#include <config.h>
|
2011-11-05 18:26:47 +00:00
|
|
|
|
2002-11-03 00:24:07 +00:00
|
|
|
/*
|
2011-10-31 13:12:39 +00:00
|
|
|
*************************************************************************
|
|
|
|
*
|
2002-11-03 00:24:07 +00:00
|
|
|
* Startup Code (reset vector)
|
|
|
|
*
|
2011-10-31 13:12:39 +00:00
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*************************************************************************
|
2002-11-03 00:24:07 +00:00
|
|
|
*/
|
|
|
|
|
2014-04-15 14:13:51 +00:00
|
|
|
.globl reset
|
2010-09-17 11:10:46 +00:00
|
|
|
|
|
|
|
reset:
|
|
|
|
/*
|
|
|
|
* set the cpu to SVC32 mode
|
|
|
|
*/
|
|
|
|
mrs r0,cpsr
|
|
|
|
bic r0,r0,#0x1f
|
|
|
|
orr r0,r0,#0xd3
|
|
|
|
msr cpsr,r0
|
|
|
|
|
2021-08-28 01:18:30 +00:00
|
|
|
#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
|
2011-10-31 13:12:39 +00:00
|
|
|
bl cpu_init_crit
|
|
|
|
#endif
|
2010-09-17 11:10:46 +00:00
|
|
|
|
2016-03-21 01:37:06 +00:00
|
|
|
#ifdef CONFIG_CPU_PXA27X
|
|
|
|
/*
|
|
|
|
* enable clock for SRAM
|
|
|
|
*/
|
|
|
|
ldr r0,=CKEN
|
|
|
|
ldr r1,[r0]
|
|
|
|
orr r1,r1,#(1 << 20)
|
|
|
|
str r1,[r0]
|
|
|
|
#endif
|
2013-01-08 10:18:02 +00:00
|
|
|
bl _main
|
2010-09-17 11:10:46 +00:00
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
2013-05-19 01:48:15 +00:00
|
|
|
.globl c_runtime_cpu_setup
|
|
|
|
c_runtime_cpu_setup:
|
2013-01-08 10:18:02 +00:00
|
|
|
bx lr
|
|
|
|
|
2011-10-31 13:12:39 +00:00
|
|
|
/*
|
|
|
|
*************************************************************************
|
|
|
|
*
|
|
|
|
* CPU_init_critical registers
|
|
|
|
*
|
|
|
|
* setup important registers
|
|
|
|
* setup memory timing
|
|
|
|
*
|
|
|
|
*************************************************************************
|
|
|
|
*/
|
2022-05-25 20:13:48 +00:00
|
|
|
#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
|
2011-10-31 13:12:39 +00:00
|
|
|
cpu_init_crit:
|
|
|
|
/*
|
|
|
|
* flush v4 I/D caches
|
|
|
|
*/
|
|
|
|
mov r0, #0
|
|
|
|
mcr p15, 0, r0, c7, c7, 0 /* Invalidate I+D+BTB caches */
|
|
|
|
mcr p15, 0, r0, c8, c7, 0 /* Invalidate Unified TLB */
|
2010-09-28 13:44:10 +00:00
|
|
|
|
2011-10-31 13:12:39 +00:00
|
|
|
/*
|
|
|
|
* disable MMU stuff and caches
|
|
|
|
*/
|
|
|
|
mrc p15, 0, r0, c1, c0, 0
|
2013-06-17 17:47:28 +00:00
|
|
|
bic r0, r0, #0x00003300 @ clear bits 13:12, 9:8 (--VI --RS)
|
2011-10-31 13:12:39 +00:00
|
|
|
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
|
2011-10-31 13:12:39 +00:00
|
|
|
mcr p15, 0, r0, c1, c0, 0
|
2003-03-06 13:39:27 +00:00
|
|
|
|
2011-10-31 13:12:39 +00:00
|
|
|
mov pc, lr /* back to my caller */
|
2022-05-25 20:13:48 +00:00
|
|
|
#endif /* !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) */
|