2008-08-30 22:39:46 +00:00
|
|
|
/*
|
2010-06-07 18:13:27 +00:00
|
|
|
* armboot - Startup Code for ARM1176 CPU-core
|
2008-08-30 22:39:46 +00:00
|
|
|
*
|
|
|
|
* Copyright (c) 2007 Samsung Electronics
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008
|
|
|
|
* Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2008-08-30 22:39:46 +00:00
|
|
|
*
|
|
|
|
* 2007-09-21 - Restructured codes by jsgood (jsgood.yang@samsung.com)
|
|
|
|
* 2007-09-21 - Added MoviNAND and OneNAND boot codes by
|
|
|
|
* jsgood (jsgood.yang@samsung.com)
|
|
|
|
* Base codes by scsuh (sc.suh)
|
|
|
|
*/
|
|
|
|
|
2010-10-26 12:34:52 +00:00
|
|
|
#include <asm-offsets.h>
|
2008-08-30 22:39:46 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2013-04-11 09:36:02 +00:00
|
|
|
#ifndef CONFIG_SYS_PHY_UBOOT_BASE
|
2008-10-16 13:01:15 +00:00
|
|
|
#define CONFIG_SYS_PHY_UBOOT_BASE CONFIG_SYS_UBOOT_BASE
|
2008-08-30 22:39:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
*************************************************************************
|
|
|
|
*
|
|
|
|
* 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:53 +00:00
|
|
|
|
|
|
|
reset:
|
|
|
|
/*
|
|
|
|
* set the cpu to SVC32 mode
|
|
|
|
*/
|
|
|
|
mrs r0, cpsr
|
|
|
|
bic r0, r0, #0x3f
|
|
|
|
orr r0, r0, #0xd3
|
|
|
|
msr cpsr, r0
|
|
|
|
|
|
|
|
/*
|
|
|
|
*************************************************************************
|
|
|
|
*
|
|
|
|
* CPU_init_critical registers
|
|
|
|
*
|
|
|
|
* setup important registers
|
|
|
|
* setup memory timing
|
|
|
|
*
|
|
|
|
*************************************************************************
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* we do sys-critical inits only at reboot,
|
|
|
|
* not when booting from ram!
|
|
|
|
*/
|
|
|
|
cpu_init_crit:
|
|
|
|
/*
|
|
|
|
* When booting from NAND - it has definitely been a reset, so, no need
|
|
|
|
* to flush caches and disable the MMU
|
|
|
|
*/
|
2013-04-11 09:36:01 +00:00
|
|
|
#ifndef CONFIG_SPL_BUILD
|
2010-09-17 11:10:53 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
|
|
|
/* Prepare to disable the MMU */
|
|
|
|
adr r2, mmu_disable_phys
|
2010-10-07 19:51:12 +00:00
|
|
|
sub r2, r2, #(CONFIG_SYS_PHY_UBOOT_BASE - CONFIG_SYS_TEXT_BASE)
|
2010-09-17 11:10:53 +00:00
|
|
|
b mmu_disable
|
|
|
|
|
|
|
|
.align 5
|
|
|
|
/* Run in a single cache-line */
|
|
|
|
mmu_disable:
|
|
|
|
mcr p15, 0, r0, c1, c0, 0
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
mov pc, r2
|
|
|
|
mmu_disable_phys:
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Go setup Memory and board specific bits prior to relocation.
|
|
|
|
*/
|
|
|
|
bl lowlevel_init /* go setup pll,mux,memory */
|
|
|
|
|
2013-01-08 10:18:02 +00:00
|
|
|
bl _main
|
2010-09-17 11:10:53 +00:00
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
2013-01-08 10:18:02 +00:00
|
|
|
.globl c_runtime_cpu_setup
|
|
|
|
c_runtime_cpu_setup:
|
|
|
|
|
|
|
|
mov pc, lr
|