xref: /rk3399_rockchip-uboot/arch/arm/cpu/armv7/lowlevel_init.S (revision 24a6bc010e7ce00a91c795562058044e9f9d5dc0)
141aebf81STom Rini/*
241aebf81STom Rini * A lowlevel_init function that sets up the stack to call a C function to
341aebf81STom Rini * perform further init.
441aebf81STom Rini *
541aebf81STom Rini * (C) Copyright 2010
641aebf81STom Rini * Texas Instruments, <www.ti.com>
741aebf81STom Rini *
841aebf81STom Rini * Author :
941aebf81STom Rini *	Aneesh V	<aneesh@ti.com>
1041aebf81STom Rini *
111a459660SWolfgang Denk * SPDX-License-Identifier:	GPL-2.0+
1241aebf81STom Rini */
1341aebf81STom Rini
1441aebf81STom Rini#include <asm-offsets.h>
1541aebf81STom Rini#include <config.h>
1641aebf81STom Rini#include <linux/linkage.h>
1741aebf81STom Rini
1841aebf81STom RiniENTRY(lowlevel_init)
1941aebf81STom Rini	/*
20*24a6bc01SSimon Glass	 * Setup a temporary stack. Global data is not available yet.
2141aebf81STom Rini	 */
2241aebf81STom Rini	ldr	sp, =CONFIG_SYS_INIT_SP_ADDR
23975b71bcSTom Rini	bic	sp, sp, #7 /* 8-byte alignment for ABI compliance */
24*24a6bc01SSimon Glass#ifdef CONFIG_DM
25*24a6bc01SSimon Glass	mov	r9, #0
26*24a6bc01SSimon Glass#else
27*24a6bc01SSimon Glass	/*
28*24a6bc01SSimon Glass	 * Set up global data for boards that still need it. This will be
29*24a6bc01SSimon Glass	 * removed soon.
30*24a6bc01SSimon Glass	 */
314a0eb757SSRICHARAN R#ifdef CONFIG_SPL_BUILD
32fe1378a9SJeroen Hofstee	ldr	r9, =gdata
334a0eb757SSRICHARAN R#else
346ba2bc8fSAndreas Bießmann	sub	sp, sp, #GD_SIZE
354a0eb757SSRICHARAN R	bic	sp, sp, #7
36fe1378a9SJeroen Hofstee	mov	r9, sp
374a0eb757SSRICHARAN R#endif
38*24a6bc01SSimon Glass#endif
3941aebf81STom Rini	/*
4041aebf81STom Rini	 * Save the old lr(passed in ip) and the current lr to stack
4141aebf81STom Rini	 */
4241aebf81STom Rini	push	{ip, lr}
4341aebf81STom Rini
4441aebf81STom Rini	/*
45*24a6bc01SSimon Glass	 * Call the very early init function. This should do only the
46*24a6bc01SSimon Glass	 * absolute bare minimum to get started. It should not:
47*24a6bc01SSimon Glass	 *
48*24a6bc01SSimon Glass	 * - set up DRAM
49*24a6bc01SSimon Glass	 * - use global_data
50*24a6bc01SSimon Glass	 * - clear BSS
51*24a6bc01SSimon Glass	 * - try to start a console
52*24a6bc01SSimon Glass	 *
53*24a6bc01SSimon Glass	 * For boards with SPL this should be empty since SPL can do all of
54*24a6bc01SSimon Glass	 * this init in the SPL board_init_f() function which is called
55*24a6bc01SSimon Glass	 * immediately after this.
5641aebf81STom Rini	 */
5741aebf81STom Rini	bl	s_init
5841aebf81STom Rini	pop	{ip, pc}
5941aebf81STom RiniENDPROC(lowlevel_init)
60