2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2003-08-29 22:00:43 +00:00
|
|
|
/*
|
|
|
|
* armboot - Startup Code for ARM926EJS CPU-core
|
|
|
|
*
|
|
|
|
* Copyright (c) 2003 Texas Instruments
|
|
|
|
*
|
2004-06-06 23:13:55 +00:00
|
|
|
* ----- Adapted for OMAP1610 OMAP730 from ARM925t code ------
|
2003-08-29 22:00:43 +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>
|
2003-08-29 22:00:43 +00:00
|
|
|
* Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
|
|
|
|
* Copyright (c) 2003 Kshitij <kshitij@ti.com>
|
2011-04-22 17:41:02 +00:00
|
|
|
* Copyright (c) 2010 Albert Aribaud <albert.u.boot@aribaud.net>
|
2003-08-29 22:00:43 +00:00
|
|
|
*/
|
|
|
|
|
2010-10-26 12:34:52 +00:00
|
|
|
#include <asm-offsets.h>
|
2003-08-29 22:00:43 +00:00
|
|
|
#include <config.h>
|
2009-07-23 22:17:48 +00:00
|
|
|
#include <common.h>
|
2022-01-29 15:23:00 +00:00
|
|
|
#include <linux/linkage.h>
|
2003-08-29 22:00:43 +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
|
2022-01-29 15:23:00 +00:00
|
|
|
.globl save_boot_params_ret
|
|
|
|
.type save_boot_params_ret,%function
|
2003-08-29 22:00:43 +00:00
|
|
|
|
|
|
|
reset:
|
2022-01-29 15:23:00 +00:00
|
|
|
/* Allow the board to save important registers */
|
|
|
|
b save_boot_params
|
|
|
|
save_boot_params_ret:
|
2003-08-29 22:00:43 +00:00
|
|
|
/*
|
|
|
|
* set the cpu to SVC32 mode
|
|
|
|
*/
|
|
|
|
mrs r0,cpsr
|
|
|
|
bic r0,r0,#0x1f
|
|
|
|
orr r0,r0,#0xd3
|
|
|
|
msr cpsr,r0
|
|
|
|
|
|
|
|
/*
|
2003-12-06 19:49:23 +00:00
|
|
|
* we do sys-critical inits only at reboot,
|
|
|
|
* not when booting from ram!
|
2003-08-29 22:00:43 +00:00
|
|
|
*/
|
2021-08-28 01:18:30 +00:00
|
|
|
#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
|
2003-12-06 19:49:23 +00:00
|
|
|
bl cpu_init_crit
|
2012-02-02 00:44:37 +00:00
|
|
|
#endif
|
2003-12-06 19:49:23 +00:00
|
|
|
|
2013-01-08 10:18:02 +00:00
|
|
|
bl _main
|
2010-09-17 11:10:42 +00:00
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
2013-01-08 10:18:02 +00:00
|
|
|
.globl c_runtime_cpu_setup
|
|
|
|
c_runtime_cpu_setup:
|
|
|
|
|
|
|
|
bx lr
|
|
|
|
|
2003-08-29 22:00:43 +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)
|
2003-08-29 22:00:43 +00:00
|
|
|
cpu_init_crit:
|
|
|
|
/*
|
2012-02-02 00:44:38 +00:00
|
|
|
* flush D cache before disabling it
|
2003-08-29 22:00:43 +00:00
|
|
|
*/
|
|
|
|
mov r0, #0
|
2012-02-02 00:44:38 +00:00
|
|
|
flush_dcache:
|
|
|
|
mrc p15, 0, r15, c7, c10, 3
|
|
|
|
bne flush_dcache
|
|
|
|
|
|
|
|
mcr p15, 0, r0, c8, c7, 0 /* invalidate TLB */
|
|
|
|
mcr p15, 0, r0, c7, c5, 0 /* invalidate I Cache */
|
2003-08-29 22:00:43 +00:00
|
|
|
|
|
|
|
/*
|
2012-02-02 00:44:40 +00:00
|
|
|
* disable MMU and D cache
|
2019-05-03 13:41:00 +00:00
|
|
|
* enable I cache if SYS_ICACHE_OFF is not defined
|
2003-08-29 22:00:43 +00:00
|
|
|
*/
|
|
|
|
mrc p15, 0, r0, c1, c0, 0
|
2012-02-02 00:44:39 +00:00
|
|
|
bic r0, r0, #0x00000300 /* clear bits 9:8 (---- --RS) */
|
2003-08-29 22:00:43 +00:00
|
|
|
bic r0, r0, #0x00000087 /* clear bits 7, 2:0 (B--- -CAM) */
|
2012-02-02 00:44:39 +00:00
|
|
|
#ifdef CONFIG_SYS_EXCEPTION_VECTORS_HIGH
|
|
|
|
orr r0, r0, #0x00002000 /* set bit 13 (--V- ----) */
|
|
|
|
#else
|
|
|
|
bic r0, r0, #0x00002000 /* clear bit 13 (--V- ----) */
|
|
|
|
#endif
|
2016-02-25 01:23:34 +00:00
|
|
|
orr r0, r0, #0x00000002 /* set bit 1 (A) Align */
|
2019-05-03 13:41:00 +00:00
|
|
|
#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
|
2003-08-29 22:00:43 +00:00
|
|
|
orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */
|
2012-02-02 00:44:40 +00:00
|
|
|
#endif
|
2003-08-29 22:00:43 +00:00
|
|
|
mcr p15, 0, r0, c1, c0, 0
|
|
|
|
|
2021-08-28 01:18:30 +00:00
|
|
|
#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT_ONLY)
|
2003-08-29 22:00:43 +00:00
|
|
|
/*
|
|
|
|
* Go setup Memory and board specific bits prior to relocation.
|
|
|
|
*/
|
2018-04-21 15:11:07 +00:00
|
|
|
mov r4, lr /* perserve link reg across call */
|
2005-10-06 15:08:18 +00:00
|
|
|
bl lowlevel_init /* go setup pll,mux,memory */
|
2018-04-21 15:11:07 +00:00
|
|
|
mov lr, r4 /* restore link */
|
2016-05-05 13:28:06 +00:00
|
|
|
#endif
|
2011-11-09 20:06:23 +00:00
|
|
|
mov pc, lr /* back to my caller */
|
2021-08-28 01:18:30 +00:00
|
|
|
#endif /* CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) */
|
2022-01-29 15:23:00 +00:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3)
|
|
|
|
* __attribute__((weak));
|
|
|
|
*
|
|
|
|
* Stack pointer is not yet initialized at this moment
|
|
|
|
* Don't save anything to stack even if compiled with -O0
|
|
|
|
*
|
|
|
|
*************************************************************************/
|
|
|
|
WEAK(save_boot_params)
|
|
|
|
b save_boot_params_ret /* back to my caller */
|
|
|
|
ENDPROC(save_boot_params)
|