1/*
2 * A lowlevel_init function that sets up the stack to call a C function to
3 * perform further init.
4 *
5 * (C) Copyright 2010
6 * Texas Instruments, <www.ti.com>
7 *
8 * Author :
9 *	Aneesh V	<aneesh@ti.com>
10 *
11 * SPDX-License-Identifier:	GPL-2.0+
12 */
13
14#include <asm-offsets.h>
15#include <config.h>
16#include <linux/linkage.h>
17
18ENTRY(lowlevel_init)
19	/*
20	 * Setup a temporary stack
21	 */
22	ldr	sp, =CONFIG_SYS_INIT_SP_ADDR
23	bic	sp, sp, #7 /* 8-byte alignment for ABI compliance */
24#ifdef CONFIG_SPL_BUILD
25	ldr	r9, =gdata
26#else
27	sub	sp, sp, #GD_SIZE
28	bic	sp, sp, #7
29	mov	r9, sp
30#endif
31	/*
32	 * Save the old lr(passed in ip) and the current lr to stack
33	 */
34	push	{ip, lr}
35
36	/*
37	 * go setup pll, mux, memory
38	 */
39	bl	s_init
40	pop	{ip, pc}
41ENDPROC(lowlevel_init)
42