1/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
2/*
3 * Copyright (c) 2018 Microsemi Corporation
4 */
5
6#include <asm/asm.h>
7#include <asm/regdef.h>
8
9    .set noreorder
10    .extern     vcoreiii_tlb_init
11    .extern     vcoreiii_ddr_init
12#ifdef CONFIG_SOC_LUTON
13    .extern     pll_init
14#endif
15
16LEAF(lowlevel_init)
17	/*
18	 * As we have no stack yet, we can assume the restricted
19	 * luxury of the sX-registers without saving them
20	 */
21
22	/* Modify ra/s0 such we return to physical NOR location */
23	li	t0, 0x0fffffff
24	li	t1, CONFIG_SYS_TEXT_BASE
25	and	s0, ra, t0
26	add	s0, s0, t1
27
28	jal	vcoreiii_tlb_init
29	 nop
30
31#ifdef CONFIG_SOC_LUTON
32	jal	pll_init
33	 nop
34#endif
35
36	/* Initialize DDR controller to enable stack/gd/heap */
370:
38	jal	vcoreiii_ddr_init
39	 nop
40	bnez	v0, 0b		/* Retry on error */
41	 nop
42
43	jr	s0
44	 nop
45	END(lowlevel_init)
46