blob: e1ef19cb88997d8a998c463a6997d3733499895d [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 */
Alexey Brodkin6eb15e52015-03-30 13:36:04 +030021#ifdef CONFIG_ISA_ARCV2
22 bl slc_flush
23 bl slc_disable
24#endif
Alexey Brodkin3fb80162015-02-24 19:40:36 +030025 bl flush_dcache_all
26 bl dcache_disable
27 bl icache_disable
Igor Guryanov20a58ac2014-12-24 17:17:11 +030028
Alexey Brodkinf56d6252015-02-25 18:10:18 +030029 /* Allocate and zero GD, update SP */
30 mov %r0, %sp
31 bl board_init_f_mem
32
33 /* Update stack- and frame-pointers */
34 mov %sp, %r0
35 mov %fp, %sp
36
Igor Guryanov20a58ac2014-12-24 17:17:11 +030037 /* Zero the one and only argument of "board_init_f" */
38 mov_s %r0, 0
39 j board_init_f
Alexey Brodkin4d936172015-02-19 18:40:58 +030040ENDPROC(_start)
Igor Guryanov20a58ac2014-12-24 17:17:11 +030041
Alexey Brodkin2f16ac92014-02-04 12:56:14 +040042/*
Alexey Brodkin3fb80162015-02-24 19:40:36 +030043 * void board_init_f_r_trampoline(stack-pointer address)
Alexey Brodkin2f16ac92014-02-04 12:56:14 +040044 *
45 * This "function" does not return, instead it continues in RAM
46 * after relocating the monitor code.
47 *
Alexey Brodkin3fb80162015-02-24 19:40:36 +030048 * r0 = new stack-pointer
Alexey Brodkin2f16ac92014-02-04 12:56:14 +040049 */
Alexey Brodkin3fb80162015-02-24 19:40:36 +030050ENTRY(board_init_f_r_trampoline)
51 /* Set up the stack- and frame-pointers */
52 mov %sp, %r0
Alexey Brodkin2f16ac92014-02-04 12:56:14 +040053 mov %fp, %sp
54
Alexey Brodkin3fb80162015-02-24 19:40:36 +030055 /* Update position of intterupt vector table */
56 lr %r0, [ARC_AUX_INTR_VEC_BASE]
57 ld %r1, [%r25, GD_RELOC_OFF]
58 add %r0, %r0, %r1
59 sr %r0, [ARC_AUX_INTR_VEC_BASE]
Alexey Brodkin2f16ac92014-02-04 12:56:14 +040060
Alexey Brodkin3fb80162015-02-24 19:40:36 +030061 /* Re-enter U-Boot by calling board_init_f_r */
62 j board_init_f_r
63ENDPROC(board_init_f_r_trampoline)