2011-11-09 08:18:21 +09:00
|
|
|
/*
|
|
|
|
* armboot - Startup Code for ARM926EJS CPU-core
|
|
|
|
*
|
|
|
|
* Copyright (c) 2003 Texas Instruments
|
|
|
|
*
|
|
|
|
* ----- Adapted for OMAP1610 OMAP730 from ARM925t code ------
|
|
|
|
*
|
|
|
|
* Copyright (c) 2001 Marius Groger <mag@sysgo.de>
|
|
|
|
* Copyright (c) 2002 Alex Zupke <azu@sysgo.de>
|
|
|
|
* Copyright (c) 2002 Gary Jennejohn <garyj@denx.de>
|
|
|
|
* Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
|
|
|
|
* Copyright (c) 2003 Kshitij <kshitij@ti.com>
|
|
|
|
* Copyright (c) 2010 Albert Aribaud <albert.u.boot@aribaud.net>
|
|
|
|
*
|
|
|
|
* Change to support call back into iMX28 bootrom
|
|
|
|
* Copyright (c) 2011 Marek Vasut <marek.vasut@gmail.com>
|
|
|
|
* on behalf of DENX Software Engineering GmbH
|
|
|
|
*
|
2013-07-08 16:37:19 +09:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2011-11-09 08:18:21 +09:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <asm-offsets.h>
|
|
|
|
#include <config.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <version.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
*************************************************************************
|
|
|
|
*
|
|
|
|
* Jump vector table as in table 3.1 in [1]
|
|
|
|
*
|
|
|
|
*************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
.globl _start
|
|
|
|
_start:
|
|
|
|
b reset
|
2011-11-09 08:18:23 +09:00
|
|
|
b undefined_instruction
|
|
|
|
b software_interrupt
|
|
|
|
b prefetch_abort
|
|
|
|
b data_abort
|
|
|
|
b not_used
|
|
|
|
b irq
|
|
|
|
b fiq
|
2011-11-09 08:18:21 +09:00
|
|
|
|
2011-11-09 08:18:23 +09:00
|
|
|
/*
|
|
|
|
* Vector table, located at address 0x20.
|
|
|
|
* This table allows the code running AFTER SPL, the U-Boot, to install it's
|
|
|
|
* interrupt handlers here. The problem is that the U-Boot is loaded into RAM,
|
|
|
|
* including it's interrupt vectoring table and the table at 0x0 is still the
|
|
|
|
* SPLs. So if interrupt happens in U-Boot, the SPLs interrupt vectoring table
|
|
|
|
* is still used.
|
|
|
|
*/
|
|
|
|
_vt_reset:
|
|
|
|
.word _reset
|
|
|
|
_vt_undefined_instruction:
|
|
|
|
.word _hang
|
|
|
|
_vt_software_interrupt:
|
|
|
|
.word _hang
|
|
|
|
_vt_prefetch_abort:
|
|
|
|
.word _hang
|
|
|
|
_vt_data_abort:
|
|
|
|
.word _hang
|
|
|
|
_vt_not_used:
|
|
|
|
.word _reset
|
|
|
|
_vt_irq:
|
|
|
|
.word _hang
|
|
|
|
_vt_fiq:
|
|
|
|
.word _hang
|
2011-11-09 08:18:21 +09:00
|
|
|
|
2011-11-09 08:18:23 +09:00
|
|
|
reset:
|
|
|
|
ldr pc, _vt_reset
|
|
|
|
undefined_instruction:
|
|
|
|
ldr pc, _vt_undefined_instruction
|
|
|
|
software_interrupt:
|
|
|
|
ldr pc, _vt_software_interrupt
|
|
|
|
prefetch_abort:
|
|
|
|
ldr pc, _vt_prefetch_abort
|
|
|
|
data_abort:
|
|
|
|
ldr pc, _vt_data_abort
|
|
|
|
not_used:
|
|
|
|
ldr pc, _vt_not_used
|
|
|
|
irq:
|
|
|
|
ldr pc, _vt_irq
|
|
|
|
fiq:
|
|
|
|
ldr pc, _vt_fiq
|
2011-11-09 08:18:21 +09:00
|
|
|
|
|
|
|
.balignl 16,0xdeadbeef
|
|
|
|
|
|
|
|
/*
|
|
|
|
*************************************************************************
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef CONFIG_USE_IRQ
|
|
|
|
/* IRQ stack memory (calculated at run-time) */
|
|
|
|
.globl IRQ_STACK_START
|
|
|
|
IRQ_STACK_START:
|
|
|
|
.word 0x0badc0de
|
|
|
|
|
|
|
|
/* IRQ stack memory (calculated at run-time) */
|
|
|
|
.globl FIQ_STACK_START
|
|
|
|
FIQ_STACK_START:
|
|
|
|
.word 0x0badc0de
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* IRQ stack memory (calculated at run-time) + 8 bytes */
|
|
|
|
.globl IRQ_STACK_START_IN
|
|
|
|
IRQ_STACK_START_IN:
|
|
|
|
.word 0x0badc0de
|
|
|
|
|
|
|
|
/*
|
|
|
|
* the actual reset code
|
|
|
|
*/
|
|
|
|
|
2011-11-09 08:18:23 +09:00
|
|
|
_reset:
|
2013-09-20 08:36:44 +09:00
|
|
|
/*
|
|
|
|
* If the CPU is configured in "Wait JTAG connection mode", the stack
|
|
|
|
* pointer is not configured and is zero. This will cause crash when
|
|
|
|
* trying to push data onto stack right below here. Load the SP and make
|
|
|
|
* it point to the end of OCRAM if the SP is zero.
|
|
|
|
*/
|
|
|
|
cmp sp, #0x00000000
|
|
|
|
ldreq sp, =CONFIG_SYS_INIT_SP_ADDR
|
|
|
|
|
2011-11-09 08:18:21 +09:00
|
|
|
/*
|
|
|
|
* Store all registers on old stack pointer, this will allow us later to
|
|
|
|
* return to the BootROM and let the BootROM load U-Boot into RAM.
|
2013-08-31 22:53:44 +09:00
|
|
|
*
|
|
|
|
* WARNING: Register r0 and r1 are used by the BootROM to pass data
|
|
|
|
* to the called code. Register r0 will contain arbitrary
|
|
|
|
* data that are set in the BootStream. In case this code
|
|
|
|
* was started with CALL instruction, register r1 will contain
|
|
|
|
* pointer to the return value this function can then set.
|
|
|
|
* The code below MUST NOT CHANGE register r0 and r1 !
|
2011-11-09 08:18:21 +09:00
|
|
|
*/
|
|
|
|
push {r0-r12,r14}
|
|
|
|
|
2013-08-31 22:53:44 +09:00
|
|
|
/* Save control register c1 */
|
|
|
|
mrc p15, 0, r2, c1, c0, 0
|
|
|
|
push {r2}
|
2012-02-07 08:32:42 +09:00
|
|
|
|
2013-08-31 22:53:44 +09:00
|
|
|
/* Set the cpu to SVC32 mode and store old CPSR register content. */
|
|
|
|
mrs r2, cpsr
|
|
|
|
push {r2}
|
|
|
|
bic r2, r2, #0x1f
|
|
|
|
orr r2, r2, #0xd3
|
|
|
|
msr cpsr, r2
|
2011-11-09 08:18:21 +09:00
|
|
|
|
|
|
|
bl board_init_ll
|
|
|
|
|
2013-08-31 22:53:44 +09:00
|
|
|
/* Restore BootROM's CPU mode (especially FIQ). */
|
|
|
|
pop {r2}
|
|
|
|
msr cpsr,r2
|
|
|
|
|
2012-02-07 08:32:42 +09:00
|
|
|
/*
|
2013-08-31 22:53:44 +09:00
|
|
|
* Restore c1 register. Especially set exception vector location
|
|
|
|
* back to BootROM space which is required by bootrom for USB boot.
|
2012-02-07 08:32:42 +09:00
|
|
|
*/
|
2013-08-31 22:53:44 +09:00
|
|
|
pop {r2}
|
|
|
|
mcr p15, 0, r2, c1, c0, 0
|
|
|
|
|
|
|
|
pop {r0-r12,r14}
|
2012-02-07 08:32:42 +09:00
|
|
|
|
|
|
|
/*
|
2013-08-31 22:53:44 +09:00
|
|
|
* In case this code was started by the CALL instruction, the register
|
|
|
|
* r0 is examined by the BootROM after this code returns. The value in
|
|
|
|
* r0 must be set to 0 to indicate successful return.
|
2012-02-07 08:32:42 +09:00
|
|
|
*/
|
2013-08-31 22:53:44 +09:00
|
|
|
mov r0, #0
|
2012-02-07 08:32:42 +09:00
|
|
|
|
2011-11-09 08:18:21 +09:00
|
|
|
bx lr
|
|
|
|
|
2011-11-09 08:18:23 +09:00
|
|
|
_hang:
|
2011-11-09 08:18:21 +09:00
|
|
|
1:
|
|
|
|
bl 1b /* hang and never return */
|