• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* SPDX-License-Identifier: GPL-2.0-only */
2
3/*
4 * Early initialization code for ARM architecture.
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.
8 */
9
10#include <arch/asm.h>
11
12ENTRY(_start)
13	/*
14	 * Set the CPU to System mode with IRQ and FIQ disabled. Prefetch/Data
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	 */
25	ldr	r0, =_stack
26	ldr	r1, =_estack
27	ldr	r2, =0xdeadbeef
28init_stack_loop:
29	str	r2, [r0]
30	add	r0, #4
31	cmp	r0, r1
32	bne	init_stack_loop
33
34/* Set stackpointer in internal RAM to call bootblock main() */
35call_bootblock:
36	ldr	sp, =_estack /* Set up stack pointer */
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	 */
52	bl	tegra124_main
53ENDPROC(_start)
54