2002-11-03 00:38:21 +00:00
|
|
|
/*
|
|
|
|
* armboot - Startup Code for ARM920 CPU-core
|
|
|
|
*
|
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>
|
2002-11-03 00:38:21 +00:00
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2002-11-03 00:38:21 +00:00
|
|
|
*/
|
|
|
|
|
2010-10-26 12:34:52 +00:00
|
|
|
#include <asm-offsets.h>
|
2009-07-27 08:06:39 +00:00
|
|
|
#include <common.h>
|
2002-11-03 00:38:21 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
*************************************************************************
|
|
|
|
*
|
2007-09-05 15:04:41 +00:00
|
|
|
* Startup Code (called from the ARM reset exception vector)
|
2002-11-03 00:38:21 +00:00
|
|
|
*
|
|
|
|
* do important init only if we don't start from memory!
|
|
|
|
* relocate armboot to ram
|
|
|
|
* setup stack
|
|
|
|
* jump to second stage
|
|
|
|
*
|
|
|
|
*************************************************************************
|
|
|
|
*/
|
|
|
|
|
2014-04-15 14:13:51 +00:00
|
|
|
.globl reset
|
2010-09-17 11:10:43 +00:00
|
|
|
|
2014-04-15 14:13:51 +00:00
|
|
|
reset:
|
2002-11-03 00:38:21 +00:00
|
|
|
/*
|
|
|
|
* set the cpu to SVC32 mode
|
|
|
|
*/
|
2009-10-10 04:30:22 +00:00
|
|
|
mrs r0, cpsr
|
|
|
|
bic r0, r0, #0x1f
|
|
|
|
orr r0, r0, #0xd3
|
|
|
|
msr cpsr, r0
|
2007-09-05 15:04:41 +00:00
|
|
|
|
2008-11-30 18:36:50 +00:00
|
|
|
#if defined(CONFIG_AT91RM9200DK) || defined(CONFIG_AT91RM9200EK)
|
2007-08-14 09:10:52 +00:00
|
|
|
/*
|
2007-09-05 15:04:41 +00:00
|
|
|
* relocate exception table
|
2007-08-14 09:10:52 +00:00
|
|
|
*/
|
|
|
|
ldr r0, =_start
|
|
|
|
ldr r1, =0x0
|
|
|
|
mov r2, #16
|
|
|
|
copyex:
|
|
|
|
subs r2, r2, #1
|
|
|
|
ldr r3, [r0], #4
|
|
|
|
str r3, [r1], #4
|
|
|
|
bne copyex
|
|
|
|
#endif
|
|
|
|
|
2009-11-17 09:30:34 +00:00
|
|
|
#ifdef CONFIG_S3C24X0
|
2007-09-05 15:04:41 +00:00
|
|
|
/* turn off the watchdog */
|
|
|
|
|
|
|
|
# if defined(CONFIG_S3C2400)
|
2009-10-10 04:30:22 +00:00
|
|
|
# define pWTCON 0x15300000
|
2011-07-22 04:01:30 +00:00
|
|
|
# define INTMSK 0x14400008 /* Interrupt-Controller base addresses */
|
2007-09-05 15:04:41 +00:00
|
|
|
# define CLKDIVN 0x14800014 /* clock divisor register */
|
|
|
|
#else
|
2009-10-10 04:30:22 +00:00
|
|
|
# define pWTCON 0x53000000
|
2011-07-22 04:01:30 +00:00
|
|
|
# define INTMSK 0x4A000008 /* Interrupt-Controller base addresses */
|
2007-09-05 15:04:41 +00:00
|
|
|
# define INTSUBMSK 0x4A00001C
|
|
|
|
# define CLKDIVN 0x4C000014 /* clock divisor register */
|
|
|
|
# endif
|
|
|
|
|
2009-10-10 04:30:22 +00:00
|
|
|
ldr r0, =pWTCON
|
|
|
|
mov r1, #0x0
|
|
|
|
str r1, [r0]
|
2002-11-03 00:38:21 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* mask all IRQs by setting all bits in the INTMR - default
|
|
|
|
*/
|
|
|
|
mov r1, #0xffffffff
|
|
|
|
ldr r0, =INTMSK
|
|
|
|
str r1, [r0]
|
2004-08-01 22:48:16 +00:00
|
|
|
# if defined(CONFIG_S3C2410)
|
2002-11-03 00:38:21 +00:00
|
|
|
ldr r1, =0x3ff
|
|
|
|
ldr r0, =INTSUBMSK
|
|
|
|
str r1, [r0]
|
2004-08-01 22:48:16 +00:00
|
|
|
# endif
|
2002-11-03 00:38:21 +00:00
|
|
|
|
|
|
|
/* FCLK:HCLK:PCLK = 1:2:4 */
|
|
|
|
/* default FCLK is 120 MHz ! */
|
|
|
|
ldr r0, =CLKDIVN
|
|
|
|
mov r1, #3
|
|
|
|
str r1, [r0]
|
2009-11-17 09:30:34 +00:00
|
|
|
#endif /* CONFIG_S3C24X0 */
|
2002-11-03 00:38:21 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* we do sys-critical inits only at reboot,
|
|
|
|
* not when booting from ram!
|
|
|
|
*/
|
2005-04-04 12:44:11 +00:00
|
|
|
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
|
2002-11-03 00:38:21 +00:00
|
|
|
bl cpu_init_crit
|
|
|
|
#endif
|
|
|
|
|
2013-01-08 10:18:02 +00:00
|
|
|
bl _main
|
2010-09-17 11:10:43 +00:00
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
2013-01-08 10:18:02 +00:00
|
|
|
.globl c_runtime_cpu_setup
|
|
|
|
c_runtime_cpu_setup:
|
|
|
|
|
|
|
|
mov pc, lr
|
|
|
|
|
2002-11-03 00:38:21 +00:00
|
|
|
/*
|
|
|
|
*************************************************************************
|
|
|
|
*
|
|
|
|
* CPU_init_critical registers
|
|
|
|
*
|
|
|
|
* setup important registers
|
|
|
|
* setup memory timing
|
|
|
|
*
|
|
|
|
*************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2006-04-03 13:46:10 +00:00
|
|
|
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
|
2002-11-03 00:38:21 +00:00
|
|
|
cpu_init_crit:
|
|
|
|
/*
|
|
|
|
* flush v4 I/D caches
|
|
|
|
*/
|
|
|
|
mov r0, #0
|
|
|
|
mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
|
|
|
|
mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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)
|
|
|
|
orr r0, r0, #0x00000002 @ set bit 2 (A) Align
|
|
|
|
orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
|
|
|
|
mcr p15, 0, r0, c1, c0, 0
|
|
|
|
|
|
|
|
/*
|
|
|
|
* before relocating, we have to setup RAM timing
|
|
|
|
* because memory timing is board-dependend, you will
|
2005-04-02 23:52:25 +00:00
|
|
|
* find a lowlevel_init.S in your board directory.
|
2002-11-03 00:38:21 +00:00
|
|
|
*/
|
|
|
|
mov ip, lr
|
2007-08-14 09:10:52 +00:00
|
|
|
|
2005-04-02 23:52:25 +00:00
|
|
|
bl lowlevel_init
|
2009-03-27 22:26:43 +00:00
|
|
|
|
2002-11-03 00:38:21 +00:00
|
|
|
mov lr, ip
|
|
|
|
mov pc, lr
|
2006-04-03 13:46:10 +00:00
|
|
|
#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
|