wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * armboot - Startup Code for OMP2420/ARM1136 CPU-core |
| 3 | * |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 4 | * Copyright (c) 2004 Texas Instruments <r-woodruff2@ti.com> |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 5 | * |
| 6 | * Copyright (c) 2001 Marius Gröger <mag@sysgo.de> |
| 7 | * Copyright (c) 2002 Alex Züpke <azu@sysgo.de> |
| 8 | * Copyright (c) 2002 Gary Jennejohn <gj@denx.de> |
| 9 | * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com> |
| 10 | * Copyright (c) 2003 Kshitij <kshitij@ti.com> |
| 11 | * |
| 12 | * See file CREDITS for list of people who contributed to this |
| 13 | * project. |
| 14 | * |
| 15 | * This program is free software; you can redistribute it and/or |
| 16 | * modify it under the terms of the GNU General Public License as |
| 17 | * published by the Free Software Foundation; either version 2 of |
| 18 | * the License, or (at your option) any later version. |
| 19 | * |
| 20 | * This program is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 23 | * GNU General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU General Public License |
| 26 | * along with this program; if not, write to the Free Software |
| 27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 28 | * MA 02111-1307 USA |
| 29 | */ |
| 30 | |
| 31 | #include <config.h> |
| 32 | #include <version.h> |
| 33 | #include <asm/arch/omap2420.h> |
| 34 | |
| 35 | .globl _start |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 36 | _start: b reset |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 37 | ldr pc, _undefined_instruction |
| 38 | ldr pc, _software_interrupt |
| 39 | ldr pc, _prefetch_abort |
| 40 | ldr pc, _data_abort |
| 41 | ldr pc, _not_used |
| 42 | ldr pc, _irq |
| 43 | ldr pc, _fiq |
| 44 | |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 45 | _undefined_instruction: .word undefined_instruction |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 46 | _software_interrupt: .word software_interrupt |
| 47 | _prefetch_abort: .word prefetch_abort |
| 48 | _data_abort: .word data_abort |
| 49 | _not_used: .word not_used |
| 50 | _irq: .word irq |
| 51 | _fiq: .word fiq |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 52 | _pad: .word 0x12345678 /* now 16*4=64 */ |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 53 | .global _end_vect |
| 54 | _end_vect: |
| 55 | |
| 56 | .balignl 16,0xdeadbeef |
| 57 | /* |
| 58 | ************************************************************************* |
| 59 | * |
| 60 | * Startup Code (reset vector) |
| 61 | * |
| 62 | * do important init only if we don't start from memory! |
| 63 | * setup Memory and board specific bits prior to relocation. |
| 64 | * relocate armboot to ram |
| 65 | * setup stack |
| 66 | * |
| 67 | ************************************************************************* |
| 68 | */ |
| 69 | |
| 70 | _TEXT_BASE: |
| 71 | .word TEXT_BASE |
| 72 | |
| 73 | .globl _armboot_start |
| 74 | _armboot_start: |
| 75 | .word _start |
| 76 | |
| 77 | /* |
| 78 | * These are defined in the board-specific linker script. |
| 79 | */ |
| 80 | .globl _bss_start |
| 81 | _bss_start: |
| 82 | .word __bss_start |
| 83 | |
| 84 | .globl _bss_end |
| 85 | _bss_end: |
| 86 | .word _end |
| 87 | |
| 88 | #ifdef CONFIG_USE_IRQ |
| 89 | /* IRQ stack memory (calculated at run-time) */ |
| 90 | .globl IRQ_STACK_START |
| 91 | IRQ_STACK_START: |
| 92 | .word 0x0badc0de |
| 93 | |
| 94 | /* IRQ stack memory (calculated at run-time) */ |
| 95 | .globl FIQ_STACK_START |
| 96 | FIQ_STACK_START: |
| 97 | .word 0x0badc0de |
| 98 | #endif |
| 99 | |
| 100 | /* |
| 101 | * the actual reset code |
| 102 | */ |
| 103 | |
| 104 | reset: |
| 105 | /* |
| 106 | * set the cpu to SVC32 mode |
| 107 | */ |
| 108 | mrs r0,cpsr |
| 109 | bic r0,r0,#0x1f |
| 110 | orr r0,r0,#0xd3 |
| 111 | msr cpsr,r0 |
| 112 | |
| 113 | #ifdef CONFIG_OMAP2420H4 |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 114 | /* Copy vectors to mask ROM indirect addr */ |
| 115 | adr r0, _start /* r0 <- current position of code */ |
wdenk | cb99da5 | 2005-01-12 00:15:14 +0000 | [diff] [blame] | 116 | add r0, r0, #4 /* skip reset vector */ |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 117 | mov r2, #64 /* r2 <- size to copy */ |
| 118 | add r2, r0, r2 /* r2 <- source end address */ |
| 119 | mov r1, #SRAM_OFFSET0 /* build vect addr */ |
| 120 | mov r3, #SRAM_OFFSET1 |
| 121 | add r1, r1, r3 |
| 122 | mov r3, #SRAM_OFFSET2 |
| 123 | add r1, r1, r3 |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 124 | next: |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 125 | ldmia r0!, {r3-r10} /* copy from source address [r0] */ |
| 126 | stmia r1!, {r3-r10} /* copy to target address [r1] */ |
| 127 | cmp r0, r2 /* until source end address [r2] */ |
| 128 | bne next /* loop until equal */ |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 129 | bl cpy_clk_code /* put dpll adjust code behind vectors */ |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 130 | #endif |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 131 | /* the mask ROM code should have PLL and others stable */ |
wdenk | 3d3d99f | 2005-04-04 12:44:11 +0000 | [diff] [blame] | 132 | #ifndef CONFIG_SKIP_LOWLEVEL_INIT |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 133 | bl cpu_init_crit |
wdenk | 3d3d99f | 2005-04-04 12:44:11 +0000 | [diff] [blame] | 134 | #endif |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 135 | |
wdenk | 3d3d99f | 2005-04-04 12:44:11 +0000 | [diff] [blame] | 136 | #ifndef CONFIG_SKIP_RELOCATE_UBOOT |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 137 | relocate: /* relocate U-Boot to RAM */ |
| 138 | adr r0, _start /* r0 <- current position of code */ |
| 139 | ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 140 | cmp r0, r1 /* don't reloc during debug */ |
| 141 | beq stack_setup |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 142 | |
| 143 | ldr r2, _armboot_start |
| 144 | ldr r3, _bss_start |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 145 | sub r2, r3, r2 /* r2 <- size of armboot */ |
| 146 | add r2, r0, r2 /* r2 <- source end address */ |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 147 | |
| 148 | copy_loop: |
| 149 | ldmia r0!, {r3-r10} /* copy from source address [r0] */ |
| 150 | stmia r1!, {r3-r10} /* copy to target address [r1] */ |
| 151 | cmp r0, r2 /* until source end addreee [r2] */ |
| 152 | ble copy_loop |
wdenk | 3d3d99f | 2005-04-04 12:44:11 +0000 | [diff] [blame] | 153 | #endif /* CONFIG_SKIP_RELOCATE_UBOOT */ |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 154 | |
| 155 | /* Set up the stack */ |
| 156 | stack_setup: |
| 157 | ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 158 | sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ |
| 159 | sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 160 | #ifdef CONFIG_USE_IRQ |
| 161 | sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) |
| 162 | #endif |
| 163 | sub sp, r0, #12 /* leave 3 words for abort-stack */ |
| 164 | |
| 165 | clear_bss: |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 166 | ldr r0, _bss_start /* find start of bss segment */ |
| 167 | ldr r1, _bss_end /* stop here */ |
| 168 | mov r2, #0x00000000 /* clear */ |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 169 | |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 170 | clbss_l:str r2, [r0] /* clear loop... */ |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 171 | add r0, r0, #4 |
| 172 | cmp r0, r1 |
| 173 | bne clbss_l |
| 174 | |
| 175 | ldr pc, _start_armboot |
| 176 | |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 177 | _start_armboot: .word start_armboot |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 178 | |
| 179 | |
| 180 | /* |
| 181 | ************************************************************************* |
| 182 | * |
| 183 | * CPU_init_critical registers |
| 184 | * |
| 185 | * setup important registers |
| 186 | * setup memory timing |
| 187 | * |
| 188 | ************************************************************************* |
| 189 | */ |
| 190 | cpu_init_crit: |
| 191 | /* |
| 192 | * flush v4 I/D caches |
| 193 | */ |
| 194 | mov r0, #0 |
| 195 | mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */ |
| 196 | mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */ |
| 197 | |
| 198 | /* |
| 199 | * disable MMU stuff and caches |
| 200 | */ |
| 201 | mrc p15, 0, r0, c1, c0, 0 |
| 202 | bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS) |
| 203 | bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM) |
| 204 | orr r0, r0, #0x00000002 @ set bit 2 (A) Align |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 205 | orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 206 | mcr p15, 0, r0, c1, c0, 0 |
| 207 | |
| 208 | /* |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 209 | * Jump to board specific initialization... The Mask ROM will have already initialized |
| 210 | * basic memory. Go here to bump up clock rate and handle wake up conditions. |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 211 | */ |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 212 | mov ip, lr /* persevere link reg across call */ |
| 213 | bl platformsetup /* go setup pll,mux,memory */ |
| 214 | mov lr, ip /* restore link */ |
| 215 | mov pc, lr /* back to my caller */ |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 216 | /* |
| 217 | ************************************************************************* |
| 218 | * |
| 219 | * Interrupt handling |
| 220 | * |
| 221 | ************************************************************************* |
| 222 | */ |
| 223 | @ |
| 224 | @ IRQ stack frame. |
| 225 | @ |
| 226 | #define S_FRAME_SIZE 72 |
| 227 | |
| 228 | #define S_OLD_R0 68 |
| 229 | #define S_PSR 64 |
| 230 | #define S_PC 60 |
| 231 | #define S_LR 56 |
| 232 | #define S_SP 52 |
| 233 | |
| 234 | #define S_IP 48 |
| 235 | #define S_FP 44 |
| 236 | #define S_R10 40 |
| 237 | #define S_R9 36 |
| 238 | #define S_R8 32 |
| 239 | #define S_R7 28 |
| 240 | #define S_R6 24 |
| 241 | #define S_R5 20 |
| 242 | #define S_R4 16 |
| 243 | #define S_R3 12 |
| 244 | #define S_R2 8 |
| 245 | #define S_R1 4 |
| 246 | #define S_R0 0 |
| 247 | |
| 248 | #define MODE_SVC 0x13 |
| 249 | #define I_BIT 0x80 |
| 250 | |
| 251 | /* |
| 252 | * use bad_save_user_regs for abort/prefetch/undef/swi ... |
| 253 | * use irq_save_user_regs / irq_restore_user_regs for IRQ/FIQ handling |
| 254 | */ |
| 255 | |
| 256 | .macro bad_save_user_regs |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 257 | sub sp, sp, #S_FRAME_SIZE @ carve out a frame on current user stack |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 258 | stmia sp, {r0 - r12} @ Save user registers (now in svc mode) r0-r12 |
| 259 | |
| 260 | ldr r2, _armboot_start |
| 261 | sub r2, r2, #(CFG_MALLOC_LEN) |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 262 | sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack |
| 263 | ldmia r2, {r2 - r3} @ get values for "aborted" pc and cpsr (into parm regs) |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 264 | add r0, sp, #S_FRAME_SIZE @ grab pointer to old stack |
| 265 | |
| 266 | add r5, sp, #S_SP |
| 267 | mov r1, lr |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 268 | stmia r5, {r0 - r3} @ save sp_SVC, lr_SVC, pc, cpsr |
| 269 | mov r0, sp @ save current stack into r0 (param register) |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 270 | .endm |
| 271 | |
| 272 | .macro irq_save_user_regs |
| 273 | sub sp, sp, #S_FRAME_SIZE |
| 274 | stmia sp, {r0 - r12} @ Calling r0-r12 |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 275 | add r8, sp, #S_PC @ !!!! R8 NEEDS to be saved !!!! a reserved stack spot would be good. |
| 276 | stmdb r8, {sp, lr}^ @ Calling SP, LR |
| 277 | str lr, [r8, #0] @ Save calling PC |
| 278 | mrs r6, spsr |
| 279 | str r6, [r8, #4] @ Save CPSR |
| 280 | str r0, [r8, #8] @ Save OLD_R0 |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 281 | mov r0, sp |
| 282 | .endm |
| 283 | |
| 284 | .macro irq_restore_user_regs |
| 285 | ldmia sp, {r0 - lr}^ @ Calling r0 - lr |
| 286 | mov r0, r0 |
| 287 | ldr lr, [sp, #S_PC] @ Get PC |
| 288 | add sp, sp, #S_FRAME_SIZE |
| 289 | subs pc, lr, #4 @ return & move spsr_svc into cpsr |
| 290 | .endm |
| 291 | |
| 292 | .macro get_bad_stack |
| 293 | ldr r13, _armboot_start @ setup our mode stack (enter in banked mode) |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 294 | sub r13, r13, #(CFG_MALLOC_LEN) @ move past malloc pool |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 295 | sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ move to reserved a couple spots for abort stack |
| 296 | |
| 297 | str lr, [r13] @ save caller lr in position 0 of saved stack |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 298 | mrs lr, spsr @ get the spsr |
| 299 | str lr, [r13, #4] @ save spsr in position 1 of saved stack |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 300 | |
| 301 | mov r13, #MODE_SVC @ prepare SVC-Mode |
| 302 | @ msr spsr_c, r13 |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 303 | msr spsr, r13 @ switch modes, make sure moves will execute |
| 304 | mov lr, pc @ capture return pc |
| 305 | movs pc, lr @ jump to next instruction & switch modes. |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 306 | .endm |
| 307 | |
| 308 | .macro get_bad_stack_swi |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 309 | sub r13, r13, #4 @ space on current stack for scratch reg. |
| 310 | str r0, [r13] @ save R0's value. |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 311 | ldr r0, _armboot_start @ get data regions start |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 312 | sub r0, r0, #(CFG_MALLOC_LEN) @ move past malloc pool |
| 313 | sub r0, r0, #(CFG_GBL_DATA_SIZE+8) @ move past gbl and a couple spots for abort stack |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 314 | str lr, [r0] @ save caller lr in position 0 of saved stack |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 315 | mrs r0, spsr @ get the spsr |
| 316 | str lr, [r0, #4] @ save spsr in position 1 of saved stack |
| 317 | ldr r0, [r13] @ restore r0 |
| 318 | add r13, r13, #4 @ pop stack entry |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 319 | .endm |
| 320 | |
| 321 | .macro get_irq_stack @ setup IRQ stack |
| 322 | ldr sp, IRQ_STACK_START |
| 323 | .endm |
| 324 | |
| 325 | .macro get_fiq_stack @ setup FIQ stack |
| 326 | ldr sp, FIQ_STACK_START |
| 327 | .endm |
| 328 | |
| 329 | /* |
| 330 | * exception handlers |
| 331 | */ |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 332 | .align 5 |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 333 | undefined_instruction: |
| 334 | get_bad_stack |
| 335 | bad_save_user_regs |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 336 | bl do_undefined_instruction |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 337 | |
| 338 | .align 5 |
| 339 | software_interrupt: |
| 340 | get_bad_stack_swi |
| 341 | bad_save_user_regs |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 342 | bl do_software_interrupt |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 343 | |
| 344 | .align 5 |
| 345 | prefetch_abort: |
| 346 | get_bad_stack |
| 347 | bad_save_user_regs |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 348 | bl do_prefetch_abort |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 349 | |
| 350 | .align 5 |
| 351 | data_abort: |
| 352 | get_bad_stack |
| 353 | bad_save_user_regs |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 354 | bl do_data_abort |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 355 | |
| 356 | .align 5 |
| 357 | not_used: |
| 358 | get_bad_stack |
| 359 | bad_save_user_regs |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 360 | bl do_not_used |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 361 | |
| 362 | #ifdef CONFIG_USE_IRQ |
| 363 | |
| 364 | .align 5 |
| 365 | irq: |
| 366 | get_irq_stack |
| 367 | irq_save_user_regs |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 368 | bl do_irq |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 369 | irq_restore_user_regs |
| 370 | |
| 371 | .align 5 |
| 372 | fiq: |
| 373 | get_fiq_stack |
| 374 | /* someone ought to write a more effiction fiq_save_user_regs */ |
| 375 | irq_save_user_regs |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 376 | bl do_fiq |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 377 | irq_restore_user_regs |
| 378 | |
| 379 | #else |
| 380 | |
| 381 | .align 5 |
| 382 | irq: |
| 383 | get_bad_stack |
| 384 | bad_save_user_regs |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 385 | bl do_irq |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 386 | |
| 387 | .align 5 |
| 388 | fiq: |
| 389 | get_bad_stack |
| 390 | bad_save_user_regs |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 391 | bl do_fiq |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 392 | |
| 393 | #endif |
| 394 | .align 5 |
| 395 | .global arm1136_cache_flush |
| 396 | arm1136_cache_flush: |
| 397 | mcr p15, 0, r1, c7, c5, 0 @ invalidate I cache |
| 398 | mov pc, lr @ back to caller |
| 399 | |
| 400 | .align 5 |
| 401 | .globl reset_cpu |
| 402 | reset_cpu: |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 403 | ldr r1, rstctl /* get addr for global reset reg */ |
wdenk | cb99da5 | 2005-01-12 00:15:14 +0000 | [diff] [blame] | 404 | mov r3, #0x2 /* full reset pll+mpu */ |
wdenk | 2e405bf | 2005-01-10 00:01:04 +0000 | [diff] [blame] | 405 | str r3, [r1] /* force reset */ |
wdenk | f806271 | 2005-01-09 23:16:25 +0000 | [diff] [blame] | 406 | mov r0, r0 |
| 407 | _loop_forever: |
| 408 | b _loop_forever |
| 409 | rstctl: |
| 410 | .word PM_RSTCTRL_WKUP |