Angel Pons | a2ee761 | 2020-04-04 18:51:15 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Gabe Black | 7f07475 | 2013-09-29 06:32:27 -0700 | [diff] [blame] | 3 | /* |
Gabe Black | 51edd54 | 2013-09-30 23:00:33 -0700 | [diff] [blame] | 4 | * Early initialization code for ARM architecture. |
Gabe Black | 7f07475 | 2013-09-29 06:32:27 -0700 | [diff] [blame] | 5 | * |
| 6 | * This file is based off of the OMAP3530/ARM Cortex start.S file from Das |
| 7 | * U-Boot, which itself got the file from armboot. |
Gabe Black | 7f07475 | 2013-09-29 06:32:27 -0700 | [diff] [blame] | 8 | */ |
| 9 | |
Julius Werner | 64b9ca9 | 2013-12-12 20:24:48 -0800 | [diff] [blame] | 10 | #include <arch/asm.h> |
| 11 | |
Julius Werner | 64b9ca9 | 2013-12-12 20:24:48 -0800 | [diff] [blame] | 12 | ENTRY(_start) |
Gabe Black | 7f07475 | 2013-09-29 06:32:27 -0700 | [diff] [blame] | 13 | /* |
Elyes HAOUAS | 038e724 | 2016-07-29 18:31:16 +0200 | [diff] [blame] | 14 | * Set the CPU to System mode with IRQ and FIQ disabled. Prefetch/Data |
Gabe Black | 7f07475 | 2013-09-29 06:32:27 -0700 | [diff] [blame] | 15 | * aborts may happen early and crash before the abort handlers are |
| 16 | * installed, but at least the problem will show up near the code that |
| 17 | * causes it. |
| 18 | */ |
| 19 | msr cpsr_cxf, #0xdf |
| 20 | |
| 21 | /* |
| 22 | * Initialize the stack to a known value. This is used to check for |
| 23 | * stack overflow later in the boot process. |
| 24 | */ |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 25 | ldr r0, =_stack |
| 26 | ldr r1, =_estack |
Gabe Black | 7f07475 | 2013-09-29 06:32:27 -0700 | [diff] [blame] | 27 | ldr r2, =0xdeadbeef |
| 28 | init_stack_loop: |
| 29 | str r2, [r0] |
| 30 | add r0, #4 |
| 31 | cmp r0, r1 |
| 32 | bne init_stack_loop |
| 33 | |
David Hendricks | a4a44a7 | 2013-10-03 14:02:45 -0700 | [diff] [blame] | 34 | /* Set stackpointer in internal RAM to call bootblock main() */ |
Gabe Black | 7f07475 | 2013-09-29 06:32:27 -0700 | [diff] [blame] | 35 | call_bootblock: |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 36 | ldr sp, =_estack /* Set up stack pointer */ |
Gabe Black | 7f07475 | 2013-09-29 06:32:27 -0700 | [diff] [blame] | 37 | ldr r0,=0x00000000 |
| 38 | /* |
| 39 | * The current design of cpu_info places the |
| 40 | * struct at the top of the stack. The number of |
| 41 | * words pushed must be at least as large as that |
| 42 | * struct. |
| 43 | */ |
| 44 | push {r0-r2} |
| 45 | bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ |
| 46 | /* |
| 47 | * Use "bl" instead of "b" even though we do not intend to return. |
| 48 | * "bl" gets compiled to "blx" if we're transitioning from ARM to |
| 49 | * Thumb. However, "b" will not and GCC may attempt to create a |
| 50 | * wrapper which is currently broken. |
| 51 | */ |
Asami Doi | 4444369 | 2019-07-12 12:46:02 +0900 | [diff] [blame] | 52 | bl tegra124_main |
Julius Werner | 64b9ca9 | 2013-12-12 20:24:48 -0800 | [diff] [blame] | 53 | ENDPROC(_start) |