blob: b31f8965688e9b872b9d637deed9894f7c8ee7fe [file] [log] [blame]
Angel Ponsa2ee7612020-04-04 18:51:15 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2
Gabe Black7f074752013-09-29 06:32:27 -07003/*
Gabe Black51edd542013-09-30 23:00:33 -07004 * Early initialization code for ARM architecture.
Gabe Black7f074752013-09-29 06:32:27 -07005 *
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 Black7f074752013-09-29 06:32:27 -07008 */
9
Julius Werner64b9ca92013-12-12 20:24:48 -080010#include <arch/asm.h>
11
Julius Werner64b9ca92013-12-12 20:24:48 -080012ENTRY(_start)
Gabe Black7f074752013-09-29 06:32:27 -070013 /*
Elyes HAOUAS038e7242016-07-29 18:31:16 +020014 * Set the CPU to System mode with IRQ and FIQ disabled. Prefetch/Data
Gabe Black7f074752013-09-29 06:32:27 -070015 * 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 Wernerec5e5e02014-08-20 15:29:56 -070025 ldr r0, =_stack
26 ldr r1, =_estack
Gabe Black7f074752013-09-29 06:32:27 -070027 ldr r2, =0xdeadbeef
28init_stack_loop:
29 str r2, [r0]
30 add r0, #4
31 cmp r0, r1
32 bne init_stack_loop
33
David Hendricksa4a44a72013-10-03 14:02:45 -070034/* Set stackpointer in internal RAM to call bootblock main() */
Gabe Black7f074752013-09-29 06:32:27 -070035call_bootblock:
Julius Wernerec5e5e02014-08-20 15:29:56 -070036 ldr sp, =_estack /* Set up stack pointer */
Gabe Black7f074752013-09-29 06:32:27 -070037 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 Doi44443692019-07-12 12:46:02 +090052 bl tegra124_main
Julius Werner64b9ca92013-12-12 20:24:48 -080053ENDPROC(_start)