1f56348afSSteve Sakoman/* 2f56348afSSteve Sakoman * armboot - Startup Code for OMAP3530/ARM Cortex CPU-core 3f56348afSSteve Sakoman * 4f56348afSSteve Sakoman * Copyright (c) 2004 Texas Instruments <r-woodruff2@ti.com> 5f56348afSSteve Sakoman * 6f56348afSSteve Sakoman * Copyright (c) 2001 Marius Gröger <mag@sysgo.de> 7f56348afSSteve Sakoman * Copyright (c) 2002 Alex Züpke <azu@sysgo.de> 8f56348afSSteve Sakoman * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de> 9f56348afSSteve Sakoman * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com> 10f56348afSSteve Sakoman * Copyright (c) 2003 Kshitij <kshitij@ti.com> 11f56348afSSteve Sakoman * Copyright (c) 2006-2008 Syed Mohammed Khasim <x0khasim@ti.com> 12f56348afSSteve Sakoman * 131a459660SWolfgang Denk * SPDX-License-Identifier: GPL-2.0+ 14f56348afSSteve Sakoman */ 15f56348afSSteve Sakoman 1625ddd1fbSWolfgang Denk#include <asm-offsets.h> 17f56348afSSteve Sakoman#include <config.h> 18f56348afSSteve Sakoman#include <version.h> 19a8c68639SAneesh V#include <asm/system.h> 2074236acaSAneesh V#include <linux/linkage.h> 21f56348afSSteve Sakoman 22f56348afSSteve Sakoman.globl _start 23f56348afSSteve Sakoman_start: b reset 24f56348afSSteve Sakoman ldr pc, _undefined_instruction 25f56348afSSteve Sakoman ldr pc, _software_interrupt 26f56348afSSteve Sakoman ldr pc, _prefetch_abort 27f56348afSSteve Sakoman ldr pc, _data_abort 28f56348afSSteve Sakoman ldr pc, _not_used 29f56348afSSteve Sakoman ldr pc, _irq 30f56348afSSteve Sakoman ldr pc, _fiq 31033ca724SAneesh V#ifdef CONFIG_SPL_BUILD 32033ca724SAneesh V_undefined_instruction: .word _undefined_instruction 33033ca724SAneesh V_software_interrupt: .word _software_interrupt 34033ca724SAneesh V_prefetch_abort: .word _prefetch_abort 35033ca724SAneesh V_data_abort: .word _data_abort 36033ca724SAneesh V_not_used: .word _not_used 37033ca724SAneesh V_irq: .word _irq 38033ca724SAneesh V_fiq: .word _fiq 39033ca724SAneesh V_pad: .word 0x12345678 /* now 16*4=64 */ 40033ca724SAneesh V#else 417cbe638eSMarek Vasut.globl _undefined_instruction 42f56348afSSteve Sakoman_undefined_instruction: .word undefined_instruction 437cbe638eSMarek Vasut.globl _software_interrupt 44f56348afSSteve Sakoman_software_interrupt: .word software_interrupt 457cbe638eSMarek Vasut.globl _prefetch_abort 46f56348afSSteve Sakoman_prefetch_abort: .word prefetch_abort 477cbe638eSMarek Vasut.globl _data_abort 48f56348afSSteve Sakoman_data_abort: .word data_abort 497cbe638eSMarek Vasut.globl _not_used 50f56348afSSteve Sakoman_not_used: .word not_used 517cbe638eSMarek Vasut.globl _irq 52f56348afSSteve Sakoman_irq: .word irq 537cbe638eSMarek Vasut.globl _fiq 54f56348afSSteve Sakoman_fiq: .word fiq 55f56348afSSteve Sakoman_pad: .word 0x12345678 /* now 16*4=64 */ 56033ca724SAneesh V#endif /* CONFIG_SPL_BUILD */ 57033ca724SAneesh V 58f56348afSSteve Sakoman.global _end_vect 59f56348afSSteve Sakoman_end_vect: 60f56348afSSteve Sakoman 61f56348afSSteve Sakoman .balignl 16,0xdeadbeef 62f56348afSSteve Sakoman/************************************************************************* 63f56348afSSteve Sakoman * 64f56348afSSteve Sakoman * Startup Code (reset vector) 65f56348afSSteve Sakoman * 66f56348afSSteve Sakoman * do important init only if we don't start from memory! 67f56348afSSteve Sakoman * setup Memory and board specific bits prior to relocation. 68f56348afSSteve Sakoman * relocate armboot to ram 69f56348afSSteve Sakoman * setup stack 70f56348afSSteve Sakoman * 71f56348afSSteve Sakoman *************************************************************************/ 72f56348afSSteve Sakoman 73f56348afSSteve Sakoman#ifdef CONFIG_USE_IRQ 74f56348afSSteve Sakoman/* IRQ stack memory (calculated at run-time) */ 75f56348afSSteve Sakoman.globl IRQ_STACK_START 76f56348afSSteve SakomanIRQ_STACK_START: 77f56348afSSteve Sakoman .word 0x0badc0de 78f56348afSSteve Sakoman 79f56348afSSteve Sakoman/* IRQ stack memory (calculated at run-time) */ 80f56348afSSteve Sakoman.globl FIQ_STACK_START 81f56348afSSteve SakomanFIQ_STACK_START: 82f56348afSSteve Sakoman .word 0x0badc0de 83f56348afSSteve Sakoman#endif 84f56348afSSteve Sakoman 85561142afSHeiko Schocher/* IRQ stack memory (calculated at run-time) + 8 bytes */ 86561142afSHeiko Schocher.globl IRQ_STACK_START_IN 87561142afSHeiko SchocherIRQ_STACK_START_IN: 88561142afSHeiko Schocher .word 0x0badc0de 89561142afSHeiko Schocher 90561142afSHeiko Schocher/* 91561142afSHeiko Schocher * the actual reset code 92561142afSHeiko Schocher */ 93561142afSHeiko Schocher 94561142afSHeiko Schocherreset: 958cf686e1SAneesh V bl save_boot_params 96561142afSHeiko Schocher /* 97c4a4e2e2SAndre Przywara * disable interrupts (FIQ and IRQ), also set the cpu to SVC32 mode, 98c4a4e2e2SAndre Przywara * except if in HYP mode already 99561142afSHeiko Schocher */ 100561142afSHeiko Schocher mrs r0, cpsr 101c4a4e2e2SAndre Przywara and r1, r0, #0x1f @ mask mode bits 102c4a4e2e2SAndre Przywara teq r1, #0x1a @ test for HYP mode 103c4a4e2e2SAndre Przywara bicne r0, r0, #0x1f @ clear all mode bits 104c4a4e2e2SAndre Przywara orrne r0, r0, #0x13 @ set SVC mode 105c4a4e2e2SAndre Przywara orr r0, r0, #0xc0 @ disable FIQ and IRQ 106561142afSHeiko Schocher msr cpsr,r0 107561142afSHeiko Schocher 108a8c68639SAneesh V/* 109a8c68639SAneesh V * Setup vector: 110a8c68639SAneesh V * (OMAP4 spl TEXT_BASE is not 32 byte aligned. 111a8c68639SAneesh V * Continue to use ROM code vector only in OMAP4 spl) 112a8c68639SAneesh V */ 113a8c68639SAneesh V#if !(defined(CONFIG_OMAP44XX) && defined(CONFIG_SPL_BUILD)) 114a8c68639SAneesh V /* Set V=0 in CP15 SCTRL register - for VBAR to point to vector */ 115a8c68639SAneesh V mrc p15, 0, r0, c1, c0, 0 @ Read CP15 SCTRL Register 116a8c68639SAneesh V bic r0, #CR_V @ V = 0 117a8c68639SAneesh V mcr p15, 0, r0, c1, c0, 0 @ Write CP15 SCTRL Register 118a8c68639SAneesh V 119a8c68639SAneesh V /* Set vector address in CP15 VBAR register */ 120a8c68639SAneesh V ldr r0, =_start 121a8c68639SAneesh V mcr p15, 0, r0, c12, c0, 0 @Set VBAR 122a8c68639SAneesh V#endif 123a8c68639SAneesh V 124561142afSHeiko Schocher /* the mask ROM code should have PLL and others stable */ 125561142afSHeiko Schocher#ifndef CONFIG_SKIP_LOWLEVEL_INIT 12680433c9aSSimon Glass bl cpu_init_cp15 127561142afSHeiko Schocher bl cpu_init_crit 128561142afSHeiko Schocher#endif 129561142afSHeiko Schocher 130e05e5de7SAlbert ARIBAUD bl _main 131561142afSHeiko Schocher 132561142afSHeiko Schocher/*------------------------------------------------------------------------------*/ 133561142afSHeiko Schocher 134e05e5de7SAlbert ARIBAUDENTRY(c_runtime_cpu_setup) 135c2dd0d45SAneesh V/* 136c2dd0d45SAneesh V * If I-cache is enabled invalidate it 137c2dd0d45SAneesh V */ 138c2dd0d45SAneesh V#ifndef CONFIG_SYS_ICACHE_OFF 139c2dd0d45SAneesh V mcr p15, 0, r0, c7, c5, 0 @ invalidate icache 140c2dd0d45SAneesh V mcr p15, 0, r0, c7, c10, 4 @ DSB 141c2dd0d45SAneesh V mcr p15, 0, r0, c7, c5, 4 @ ISB 142c2dd0d45SAneesh V#endif 143f8b9d1d3STetsuyuki Kobayashi/* 144f8b9d1d3STetsuyuki Kobayashi * Move vector table 145f8b9d1d3STetsuyuki Kobayashi */ 146f8b9d1d3STetsuyuki Kobayashi /* Set vector address in CP15 VBAR register */ 147f8b9d1d3STetsuyuki Kobayashi ldr r0, =_start 148f8b9d1d3STetsuyuki Kobayashi mcr p15, 0, r0, c12, c0, 0 @Set VBAR 149f8b9d1d3STetsuyuki Kobayashi 150e05e5de7SAlbert ARIBAUD bx lr 151561142afSHeiko Schocher 152e05e5de7SAlbert ARIBAUDENDPROC(c_runtime_cpu_setup) 153c3d3a541SHeiko Schocher 154f56348afSSteve Sakoman/************************************************************************* 155f56348afSSteve Sakoman * 1566f0dba85STetsuyuki Kobayashi * void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3) 1576f0dba85STetsuyuki Kobayashi * __attribute__((weak)); 1586f0dba85STetsuyuki Kobayashi * 1596f0dba85STetsuyuki Kobayashi * Stack pointer is not yet initialized at this moment 1606f0dba85STetsuyuki Kobayashi * Don't save anything to stack even if compiled with -O0 1616f0dba85STetsuyuki Kobayashi * 1626f0dba85STetsuyuki Kobayashi *************************************************************************/ 1636f0dba85STetsuyuki KobayashiENTRY(save_boot_params) 1646f0dba85STetsuyuki Kobayashi bx lr @ back to my caller 1656f0dba85STetsuyuki KobayashiENDPROC(save_boot_params) 1666f0dba85STetsuyuki Kobayashi .weak save_boot_params 1676f0dba85STetsuyuki Kobayashi 1686f0dba85STetsuyuki Kobayashi/************************************************************************* 1696f0dba85STetsuyuki Kobayashi * 17080433c9aSSimon Glass * cpu_init_cp15 171f56348afSSteve Sakoman * 17280433c9aSSimon Glass * Setup CP15 registers (cache, MMU, TLBs). The I-cache is turned on unless 17380433c9aSSimon Glass * CONFIG_SYS_ICACHE_OFF is defined. 174f56348afSSteve Sakoman * 175f56348afSSteve Sakoman *************************************************************************/ 17674236acaSAneesh VENTRY(cpu_init_cp15) 177f56348afSSteve Sakoman /* 178f56348afSSteve Sakoman * Invalidate L1 I/D 179f56348afSSteve Sakoman */ 180f56348afSSteve Sakoman mov r0, #0 @ set up for MCR 181f56348afSSteve Sakoman mcr p15, 0, r0, c8, c7, 0 @ invalidate TLBs 182f56348afSSteve Sakoman mcr p15, 0, r0, c7, c5, 0 @ invalidate icache 183c2dd0d45SAneesh V mcr p15, 0, r0, c7, c5, 6 @ invalidate BP array 184c2dd0d45SAneesh V mcr p15, 0, r0, c7, c10, 4 @ DSB 185c2dd0d45SAneesh V mcr p15, 0, r0, c7, c5, 4 @ ISB 186f56348afSSteve Sakoman 187f56348afSSteve Sakoman /* 188f56348afSSteve Sakoman * disable MMU stuff and caches 189f56348afSSteve Sakoman */ 190f56348afSSteve Sakoman mrc p15, 0, r0, c1, c0, 0 191f56348afSSteve Sakoman bic r0, r0, #0x00002000 @ clear bits 13 (--V-) 192f56348afSSteve Sakoman bic r0, r0, #0x00000007 @ clear bits 2:0 (-CAM) 193f56348afSSteve Sakoman orr r0, r0, #0x00000002 @ set bit 1 (--A-) Align 194c2dd0d45SAneesh V orr r0, r0, #0x00000800 @ set bit 11 (Z---) BTB 195c2dd0d45SAneesh V#ifdef CONFIG_SYS_ICACHE_OFF 196c2dd0d45SAneesh V bic r0, r0, #0x00001000 @ clear bit 12 (I) I-cache 197c2dd0d45SAneesh V#else 198c2dd0d45SAneesh V orr r0, r0, #0x00001000 @ set bit 12 (I) I-cache 199c2dd0d45SAneesh V#endif 200f56348afSSteve Sakoman mcr p15, 0, r0, c1, c0, 0 2010678587fSStephen Warren 202c5d4752cSStephen Warren#ifdef CONFIG_ARM_ERRATA_716044 203c5d4752cSStephen Warren mrc p15, 0, r0, c1, c0, 0 @ read system control register 204c5d4752cSStephen Warren orr r0, r0, #1 << 11 @ set bit #11 205c5d4752cSStephen Warren mcr p15, 0, r0, c1, c0, 0 @ write system control register 206c5d4752cSStephen Warren#endif 207c5d4752cSStephen Warren 208f71cbfe3SNitin Garg#if (defined(CONFIG_ARM_ERRATA_742230) || defined(CONFIG_ARM_ERRATA_794072)) 2090678587fSStephen Warren mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register 2100678587fSStephen Warren orr r0, r0, #1 << 4 @ set bit #4 2110678587fSStephen Warren mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register 2120678587fSStephen Warren#endif 2130678587fSStephen Warren 2140678587fSStephen Warren#ifdef CONFIG_ARM_ERRATA_743622 2150678587fSStephen Warren mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register 2160678587fSStephen Warren orr r0, r0, #1 << 6 @ set bit #6 2170678587fSStephen Warren mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register 2180678587fSStephen Warren#endif 2190678587fSStephen Warren 2200678587fSStephen Warren#ifdef CONFIG_ARM_ERRATA_751472 2210678587fSStephen Warren mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register 2220678587fSStephen Warren orr r0, r0, #1 << 11 @ set bit #11 2230678587fSStephen Warren mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register 2240678587fSStephen Warren#endif 225*b7588e3bSNitin Garg#ifdef CONFIG_ARM_ERRATA_761320 226*b7588e3bSNitin Garg mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register 227*b7588e3bSNitin Garg orr r0, r0, #1 << 21 @ set bit #21 228*b7588e3bSNitin Garg mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register 229*b7588e3bSNitin Garg#endif 2300678587fSStephen Warren 23180433c9aSSimon Glass mov pc, lr @ back to my caller 23274236acaSAneesh VENDPROC(cpu_init_cp15) 23380433c9aSSimon Glass 23480433c9aSSimon Glass#ifndef CONFIG_SKIP_LOWLEVEL_INIT 23580433c9aSSimon Glass/************************************************************************* 23680433c9aSSimon Glass * 23780433c9aSSimon Glass * CPU_init_critical registers 23880433c9aSSimon Glass * 23980433c9aSSimon Glass * setup important registers 24080433c9aSSimon Glass * setup memory timing 24180433c9aSSimon Glass * 24280433c9aSSimon Glass *************************************************************************/ 24374236acaSAneesh VENTRY(cpu_init_crit) 244f56348afSSteve Sakoman /* 245f56348afSSteve Sakoman * Jump to board specific initialization... 246f56348afSSteve Sakoman * The Mask ROM will have already initialized 247f56348afSSteve Sakoman * basic memory. Go here to bump up clock rate and handle 248f56348afSSteve Sakoman * wake up conditions. 249f56348afSSteve Sakoman */ 25063ee53a7SBenoît Thébaudeau b lowlevel_init @ go setup pll,mux,memory 25174236acaSAneesh VENDPROC(cpu_init_crit) 25222193540SRob Herring#endif 253033ca724SAneesh V 254033ca724SAneesh V#ifndef CONFIG_SPL_BUILD 255f56348afSSteve Sakoman/* 256f56348afSSteve Sakoman ************************************************************************* 257f56348afSSteve Sakoman * 258f56348afSSteve Sakoman * Interrupt handling 259f56348afSSteve Sakoman * 260f56348afSSteve Sakoman ************************************************************************* 261f56348afSSteve Sakoman */ 262f56348afSSteve Sakoman@ 263f56348afSSteve Sakoman@ IRQ stack frame. 264f56348afSSteve Sakoman@ 265f56348afSSteve Sakoman#define S_FRAME_SIZE 72 266f56348afSSteve Sakoman 267f56348afSSteve Sakoman#define S_OLD_R0 68 268f56348afSSteve Sakoman#define S_PSR 64 269f56348afSSteve Sakoman#define S_PC 60 270f56348afSSteve Sakoman#define S_LR 56 271f56348afSSteve Sakoman#define S_SP 52 272f56348afSSteve Sakoman 273f56348afSSteve Sakoman#define S_IP 48 274f56348afSSteve Sakoman#define S_FP 44 275f56348afSSteve Sakoman#define S_R10 40 276f56348afSSteve Sakoman#define S_R9 36 277f56348afSSteve Sakoman#define S_R8 32 278f56348afSSteve Sakoman#define S_R7 28 279f56348afSSteve Sakoman#define S_R6 24 280f56348afSSteve Sakoman#define S_R5 20 281f56348afSSteve Sakoman#define S_R4 16 282f56348afSSteve Sakoman#define S_R3 12 283f56348afSSteve Sakoman#define S_R2 8 284f56348afSSteve Sakoman#define S_R1 4 285f56348afSSteve Sakoman#define S_R0 0 286f56348afSSteve Sakoman 287f56348afSSteve Sakoman#define MODE_SVC 0x13 288f56348afSSteve Sakoman#define I_BIT 0x80 289f56348afSSteve Sakoman 290f56348afSSteve Sakoman/* 291f56348afSSteve Sakoman * use bad_save_user_regs for abort/prefetch/undef/swi ... 292f56348afSSteve Sakoman * use irq_save_user_regs / irq_restore_user_regs for IRQ/FIQ handling 293f56348afSSteve Sakoman */ 294f56348afSSteve Sakoman 295f56348afSSteve Sakoman .macro bad_save_user_regs 296f56348afSSteve Sakoman sub sp, sp, #S_FRAME_SIZE @ carve out a frame on current 297f56348afSSteve Sakoman @ user stack 298f56348afSSteve Sakoman stmia sp, {r0 - r12} @ Save user registers (now in 299f56348afSSteve Sakoman @ svc mode) r0-r12 300561142afSHeiko Schocher ldr r2, IRQ_STACK_START_IN @ set base 2 words into abort 301f56348afSSteve Sakoman @ stack 302f56348afSSteve Sakoman ldmia r2, {r2 - r3} @ get values for "aborted" pc 303f56348afSSteve Sakoman @ and cpsr (into parm regs) 304f56348afSSteve Sakoman add r0, sp, #S_FRAME_SIZE @ grab pointer to old stack 305f56348afSSteve Sakoman 306f56348afSSteve Sakoman add r5, sp, #S_SP 307f56348afSSteve Sakoman mov r1, lr 308f56348afSSteve Sakoman stmia r5, {r0 - r3} @ save sp_SVC, lr_SVC, pc, cpsr 309f56348afSSteve Sakoman mov r0, sp @ save current stack into r0 310f56348afSSteve Sakoman @ (param register) 311f56348afSSteve Sakoman .endm 312f56348afSSteve Sakoman 313f56348afSSteve Sakoman .macro irq_save_user_regs 314f56348afSSteve Sakoman sub sp, sp, #S_FRAME_SIZE 315f56348afSSteve Sakoman stmia sp, {r0 - r12} @ Calling r0-r12 316f56348afSSteve Sakoman add r8, sp, #S_PC @ !! R8 NEEDS to be saved !! 317f56348afSSteve Sakoman @ a reserved stack spot would 318f56348afSSteve Sakoman @ be good. 319f56348afSSteve Sakoman stmdb r8, {sp, lr}^ @ Calling SP, LR 320f56348afSSteve Sakoman str lr, [r8, #0] @ Save calling PC 321f56348afSSteve Sakoman mrs r6, spsr 322f56348afSSteve Sakoman str r6, [r8, #4] @ Save CPSR 323f56348afSSteve Sakoman str r0, [r8, #8] @ Save OLD_R0 324f56348afSSteve Sakoman mov r0, sp 325f56348afSSteve Sakoman .endm 326f56348afSSteve Sakoman 327f56348afSSteve Sakoman .macro irq_restore_user_regs 328f56348afSSteve Sakoman ldmia sp, {r0 - lr}^ @ Calling r0 - lr 329f56348afSSteve Sakoman mov r0, r0 330f56348afSSteve Sakoman ldr lr, [sp, #S_PC] @ Get PC 331f56348afSSteve Sakoman add sp, sp, #S_FRAME_SIZE 332f56348afSSteve Sakoman subs pc, lr, #4 @ return & move spsr_svc into 333f56348afSSteve Sakoman @ cpsr 334f56348afSSteve Sakoman .endm 335f56348afSSteve Sakoman 336f56348afSSteve Sakoman .macro get_bad_stack 337561142afSHeiko Schocher ldr r13, IRQ_STACK_START_IN @ setup our mode stack (enter 338561142afSHeiko Schocher @ in banked mode) 339f56348afSSteve Sakoman 340f56348afSSteve Sakoman str lr, [r13] @ save caller lr in position 0 341f56348afSSteve Sakoman @ of saved stack 342f56348afSSteve Sakoman mrs lr, spsr @ get the spsr 343f56348afSSteve Sakoman str lr, [r13, #4] @ save spsr in position 1 of 344f56348afSSteve Sakoman @ saved stack 345f56348afSSteve Sakoman 346f56348afSSteve Sakoman mov r13, #MODE_SVC @ prepare SVC-Mode 347f56348afSSteve Sakoman @ msr spsr_c, r13 348f56348afSSteve Sakoman msr spsr, r13 @ switch modes, make sure 349f56348afSSteve Sakoman @ moves will execute 350f56348afSSteve Sakoman mov lr, pc @ capture return pc 351f56348afSSteve Sakoman movs pc, lr @ jump to next instruction & 352f56348afSSteve Sakoman @ switch modes. 353f56348afSSteve Sakoman .endm 354f56348afSSteve Sakoman 355f56348afSSteve Sakoman .macro get_bad_stack_swi 356f56348afSSteve Sakoman sub r13, r13, #4 @ space on current stack for 357f56348afSSteve Sakoman @ scratch reg. 358f56348afSSteve Sakoman str r0, [r13] @ save R0's value. 359561142afSHeiko Schocher ldr r0, IRQ_STACK_START_IN @ get data regions start 360f56348afSSteve Sakoman @ spots for abort stack 361f56348afSSteve Sakoman str lr, [r0] @ save caller lr in position 0 362f56348afSSteve Sakoman @ of saved stack 3634411b2aeSTetsuyuki Kobayashi mrs lr, spsr @ get the spsr 364f56348afSSteve Sakoman str lr, [r0, #4] @ save spsr in position 1 of 365f56348afSSteve Sakoman @ saved stack 3664411b2aeSTetsuyuki Kobayashi ldr lr, [r0] @ restore lr 367f56348afSSteve Sakoman ldr r0, [r13] @ restore r0 368f56348afSSteve Sakoman add r13, r13, #4 @ pop stack entry 369f56348afSSteve Sakoman .endm 370f56348afSSteve Sakoman 371f56348afSSteve Sakoman .macro get_irq_stack @ setup IRQ stack 372f56348afSSteve Sakoman ldr sp, IRQ_STACK_START 373f56348afSSteve Sakoman .endm 374f56348afSSteve Sakoman 375f56348afSSteve Sakoman .macro get_fiq_stack @ setup FIQ stack 376f56348afSSteve Sakoman ldr sp, FIQ_STACK_START 377f56348afSSteve Sakoman .endm 378f56348afSSteve Sakoman 379f56348afSSteve Sakoman/* 380f56348afSSteve Sakoman * exception handlers 381f56348afSSteve Sakoman */ 382f56348afSSteve Sakoman .align 5 383f56348afSSteve Sakomanundefined_instruction: 384f56348afSSteve Sakoman get_bad_stack 385f56348afSSteve Sakoman bad_save_user_regs 386f56348afSSteve Sakoman bl do_undefined_instruction 387f56348afSSteve Sakoman 388f56348afSSteve Sakoman .align 5 389f56348afSSteve Sakomansoftware_interrupt: 390f56348afSSteve Sakoman get_bad_stack_swi 391f56348afSSteve Sakoman bad_save_user_regs 392f56348afSSteve Sakoman bl do_software_interrupt 393f56348afSSteve Sakoman 394f56348afSSteve Sakoman .align 5 395f56348afSSteve Sakomanprefetch_abort: 396f56348afSSteve Sakoman get_bad_stack 397f56348afSSteve Sakoman bad_save_user_regs 398f56348afSSteve Sakoman bl do_prefetch_abort 399f56348afSSteve Sakoman 400f56348afSSteve Sakoman .align 5 401f56348afSSteve Sakomandata_abort: 402f56348afSSteve Sakoman get_bad_stack 403f56348afSSteve Sakoman bad_save_user_regs 404f56348afSSteve Sakoman bl do_data_abort 405f56348afSSteve Sakoman 406f56348afSSteve Sakoman .align 5 407f56348afSSteve Sakomannot_used: 408f56348afSSteve Sakoman get_bad_stack 409f56348afSSteve Sakoman bad_save_user_regs 410f56348afSSteve Sakoman bl do_not_used 411f56348afSSteve Sakoman 412f56348afSSteve Sakoman#ifdef CONFIG_USE_IRQ 413f56348afSSteve Sakoman 414f56348afSSteve Sakoman .align 5 415f56348afSSteve Sakomanirq: 416f56348afSSteve Sakoman get_irq_stack 417f56348afSSteve Sakoman irq_save_user_regs 418f56348afSSteve Sakoman bl do_irq 419f56348afSSteve Sakoman irq_restore_user_regs 420f56348afSSteve Sakoman 421f56348afSSteve Sakoman .align 5 422f56348afSSteve Sakomanfiq: 423f56348afSSteve Sakoman get_fiq_stack 424f56348afSSteve Sakoman /* someone ought to write a more effective fiq_save_user_regs */ 425f56348afSSteve Sakoman irq_save_user_regs 426f56348afSSteve Sakoman bl do_fiq 427f56348afSSteve Sakoman irq_restore_user_regs 428f56348afSSteve Sakoman 429f56348afSSteve Sakoman#else 430f56348afSSteve Sakoman 431f56348afSSteve Sakoman .align 5 432f56348afSSteve Sakomanirq: 433f56348afSSteve Sakoman get_bad_stack 434f56348afSSteve Sakoman bad_save_user_regs 435f56348afSSteve Sakoman bl do_irq 436f56348afSSteve Sakoman 437f56348afSSteve Sakoman .align 5 438f56348afSSteve Sakomanfiq: 439f56348afSSteve Sakoman get_bad_stack 440f56348afSSteve Sakoman bad_save_user_regs 441f56348afSSteve Sakoman bl do_fiq 442f56348afSSteve Sakoman 443033ca724SAneesh V#endif /* CONFIG_USE_IRQ */ 444033ca724SAneesh V#endif /* CONFIG_SPL_BUILD */ 445