1*4882a593Smuzhiyun/* 2*4882a593Smuzhiyun * armboot - Startup Code for ARM926EJS CPU-core 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Copyright (c) 2003 Texas Instruments 5*4882a593Smuzhiyun * 6*4882a593Smuzhiyun * ----- Adapted for OMAP1610 OMAP730 from ARM925t code ------ 7*4882a593Smuzhiyun * 8*4882a593Smuzhiyun * Copyright (c) 2001 Marius Gröger <mag@sysgo.de> 9*4882a593Smuzhiyun * Copyright (c) 2002 Alex Züpke <azu@sysgo.de> 10*4882a593Smuzhiyun * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de> 11*4882a593Smuzhiyun * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com> 12*4882a593Smuzhiyun * Copyright (c) 2003 Kshitij <kshitij@ti.com> 13*4882a593Smuzhiyun * Copyright (c) 2010 Albert Aribaud <albert.u.boot@aribaud.net> 14*4882a593Smuzhiyun * 15*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0+ 16*4882a593Smuzhiyun */ 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun#include <asm-offsets.h> 19*4882a593Smuzhiyun#include <config.h> 20*4882a593Smuzhiyun 21*4882a593Smuzhiyun/* 22*4882a593Smuzhiyun ************************************************************************* 23*4882a593Smuzhiyun * 24*4882a593Smuzhiyun * Startup Code (reset vector) 25*4882a593Smuzhiyun * 26*4882a593Smuzhiyun * do important init only if we don't start from memory! 27*4882a593Smuzhiyun * setup Memory and board specific bits prior to relocation. 28*4882a593Smuzhiyun * relocate armboot to ram 29*4882a593Smuzhiyun * setup stack 30*4882a593Smuzhiyun * 31*4882a593Smuzhiyun ************************************************************************* 32*4882a593Smuzhiyun */ 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun .globl reset 35*4882a593Smuzhiyun 36*4882a593Smuzhiyunreset: 37*4882a593Smuzhiyun /* 38*4882a593Smuzhiyun * set the cpu to SVC32 mode 39*4882a593Smuzhiyun */ 40*4882a593Smuzhiyun mrs r0,cpsr 41*4882a593Smuzhiyun bic r0,r0,#0x1f 42*4882a593Smuzhiyun orr r0,r0,#0xd3 43*4882a593Smuzhiyun msr cpsr,r0 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun /* 46*4882a593Smuzhiyun * we do sys-critical inits only at reboot, 47*4882a593Smuzhiyun * not when booting from ram! 48*4882a593Smuzhiyun */ 49*4882a593Smuzhiyun#ifndef CONFIG_SKIP_LOWLEVEL_INIT 50*4882a593Smuzhiyun bl cpu_init_crit 51*4882a593Smuzhiyun#endif 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun bl _main 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun/*------------------------------------------------------------------------------*/ 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun .globl c_runtime_cpu_setup 58*4882a593Smuzhiyunc_runtime_cpu_setup: 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun mov pc, lr 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun/* 63*4882a593Smuzhiyun ************************************************************************* 64*4882a593Smuzhiyun * 65*4882a593Smuzhiyun * CPU_init_critical registers 66*4882a593Smuzhiyun * 67*4882a593Smuzhiyun * setup important registers 68*4882a593Smuzhiyun * setup memory timing 69*4882a593Smuzhiyun * 70*4882a593Smuzhiyun ************************************************************************* 71*4882a593Smuzhiyun */ 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun#ifndef CONFIG_SKIP_LOWLEVEL_INIT 75*4882a593Smuzhiyuncpu_init_crit: 76*4882a593Smuzhiyun /* 77*4882a593Smuzhiyun * flush v4 I/D caches 78*4882a593Smuzhiyun */ 79*4882a593Smuzhiyun mov r0, #0 80*4882a593Smuzhiyun mcr p15, 0, r0, c7, c5, 0 /* flush v4 I-cache */ 81*4882a593Smuzhiyun mcr p15, 0, r0, c7, c6, 0 /* flush v4 D-cache */ 82*4882a593Smuzhiyun 83*4882a593Smuzhiyun /* 84*4882a593Smuzhiyun * disable MMU stuff and caches 85*4882a593Smuzhiyun */ 86*4882a593Smuzhiyun mrc p15, 0, r0, c1, c0, 0 87*4882a593Smuzhiyun bic r0, r0, #0x00002300 /* clear bits 13, 9:8 (--V- --RS) */ 88*4882a593Smuzhiyun bic r0, r0, #0x00000087 /* clear bits 7, 2:0 (B--- -CAM) */ 89*4882a593Smuzhiyun orr r0, r0, #0x00000002 /* set bit 1 (A) Align */ 90*4882a593Smuzhiyun orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */ 91*4882a593Smuzhiyun mcr p15, 0, r0, c1, c0, 0 92*4882a593Smuzhiyun 93*4882a593Smuzhiyun#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY 94*4882a593Smuzhiyun /* 95*4882a593Smuzhiyun * Go setup Memory and board specific bits prior to relocation. 96*4882a593Smuzhiyun */ 97*4882a593Smuzhiyun mov ip, lr /* perserve link reg across call */ 98*4882a593Smuzhiyun bl lowlevel_init /* go setup memory */ 99*4882a593Smuzhiyun mov lr, ip /* restore link */ 100*4882a593Smuzhiyun#endif 101*4882a593Smuzhiyun mov pc, lr /* back to my caller */ 102*4882a593Smuzhiyun#endif 103