blob: 82045aeb6dd5a5e0b739e4eae6e5a107dbba0745 [file] [log] [blame]
Alexey Brodkin2f16ac92014-02-04 12:56:14 +04001/*
2 * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <asm-offsets.h>
8#include <config.h>
Alexey Brodkin4d936172015-02-19 18:40:58 +03009#include <linux/linkage.h>
Alexey Brodkin2f16ac92014-02-04 12:56:14 +040010#include <asm/arcregs.h>
11
Alexey Brodkin4d936172015-02-19 18:40:58 +030012ENTRY(_start)
Igor Guryanov20a58ac2014-12-24 17:17:11 +030013 /* Setup interrupt vector base that matches "__text_start" */
14 sr __ivt_start, [ARC_AUX_INTR_VEC_BASE]
15
Alexey Brodkin3fb80162015-02-24 19:40:36 +030016 /* Setup stack- and frame-pointers */
Igor Guryanov20a58ac2014-12-24 17:17:11 +030017 mov %sp, CONFIG_SYS_INIT_SP_ADDR
18 mov %fp, %sp
19
Alexey Brodkin3fb80162015-02-24 19:40:36 +030020 /* Unconditionally disable caches */
21 bl flush_dcache_all
22 bl dcache_disable
23 bl icache_disable
Igor Guryanov20a58ac2014-12-24 17:17:11 +030024
25 /* Zero the one and only argument of "board_init_f" */
26 mov_s %r0, 0
27 j board_init_f
Alexey Brodkin4d936172015-02-19 18:40:58 +030028ENDPROC(_start)
Igor Guryanov20a58ac2014-12-24 17:17:11 +030029
Alexey Brodkin2f16ac92014-02-04 12:56:14 +040030/*
Alexey Brodkin3fb80162015-02-24 19:40:36 +030031 * void board_init_f_r_trampoline(stack-pointer address)
Alexey Brodkin2f16ac92014-02-04 12:56:14 +040032 *
33 * This "function" does not return, instead it continues in RAM
34 * after relocating the monitor code.
35 *
Alexey Brodkin3fb80162015-02-24 19:40:36 +030036 * r0 = new stack-pointer
Alexey Brodkin2f16ac92014-02-04 12:56:14 +040037 */
Alexey Brodkin3fb80162015-02-24 19:40:36 +030038ENTRY(board_init_f_r_trampoline)
39 /* Set up the stack- and frame-pointers */
40 mov %sp, %r0
Alexey Brodkin2f16ac92014-02-04 12:56:14 +040041 mov %fp, %sp
42
Alexey Brodkin3fb80162015-02-24 19:40:36 +030043 /* Update position of intterupt vector table */
44 lr %r0, [ARC_AUX_INTR_VEC_BASE]
45 ld %r1, [%r25, GD_RELOC_OFF]
46 add %r0, %r0, %r1
47 sr %r0, [ARC_AUX_INTR_VEC_BASE]
Alexey Brodkin2f16ac92014-02-04 12:56:14 +040048
Alexey Brodkin3fb80162015-02-24 19:40:36 +030049 /* Re-enter U-Boot by calling board_init_f_r */
50 j board_init_f_r
51ENDPROC(board_init_f_r_trampoline)