Alexey Brodkin | 3a59d91 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 1 | /* |
| 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 Brodkin | 7a5f30d | 2015-02-19 18:40:58 +0300 | [diff] [blame] | 9 | #include <linux/linkage.h> |
Alexey Brodkin | 3a59d91 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 10 | #include <asm/arcregs.h> |
| 11 | |
Alexey Brodkin | 7a5f30d | 2015-02-19 18:40:58 +0300 | [diff] [blame] | 12 | ENTRY(_start) |
Igor Guryanov | 4fec6aa | 2014-12-24 17:17:11 +0300 | [diff] [blame] | 13 | /* Setup interrupt vector base that matches "__text_start" */ |
| 14 | sr __ivt_start, [ARC_AUX_INTR_VEC_BASE] |
| 15 | |
Alexey Brodkin | 913e9f0 | 2015-02-24 19:40:36 +0300 | [diff] [blame] | 16 | /* Setup stack- and frame-pointers */ |
Igor Guryanov | 4fec6aa | 2014-12-24 17:17:11 +0300 | [diff] [blame] | 17 | mov %sp, CONFIG_SYS_INIT_SP_ADDR |
| 18 | mov %fp, %sp |
| 19 | |
Alexey Brodkin | 913e9f0 | 2015-02-24 19:40:36 +0300 | [diff] [blame] | 20 | /* Unconditionally disable caches */ |
Alexey Brodkin | 275583e | 2015-03-30 13:36:04 +0300 | [diff] [blame^] | 21 | #ifdef CONFIG_ISA_ARCV2 |
| 22 | bl slc_flush |
| 23 | bl slc_disable |
| 24 | #endif |
Alexey Brodkin | 913e9f0 | 2015-02-24 19:40:36 +0300 | [diff] [blame] | 25 | bl flush_dcache_all |
| 26 | bl dcache_disable |
| 27 | bl icache_disable |
Igor Guryanov | 4fec6aa | 2014-12-24 17:17:11 +0300 | [diff] [blame] | 28 | |
Alexey Brodkin | 7f188f2 | 2015-02-25 18:10:18 +0300 | [diff] [blame] | 29 | /* 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 Guryanov | 4fec6aa | 2014-12-24 17:17:11 +0300 | [diff] [blame] | 37 | /* Zero the one and only argument of "board_init_f" */ |
| 38 | mov_s %r0, 0 |
| 39 | j board_init_f |
Alexey Brodkin | 7a5f30d | 2015-02-19 18:40:58 +0300 | [diff] [blame] | 40 | ENDPROC(_start) |
Igor Guryanov | 4fec6aa | 2014-12-24 17:17:11 +0300 | [diff] [blame] | 41 | |
Alexey Brodkin | 3a59d91 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 42 | /* |
Alexey Brodkin | 913e9f0 | 2015-02-24 19:40:36 +0300 | [diff] [blame] | 43 | * void board_init_f_r_trampoline(stack-pointer address) |
Alexey Brodkin | 3a59d91 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 44 | * |
| 45 | * This "function" does not return, instead it continues in RAM |
| 46 | * after relocating the monitor code. |
| 47 | * |
Alexey Brodkin | 913e9f0 | 2015-02-24 19:40:36 +0300 | [diff] [blame] | 48 | * r0 = new stack-pointer |
Alexey Brodkin | 3a59d91 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 49 | */ |
Alexey Brodkin | 913e9f0 | 2015-02-24 19:40:36 +0300 | [diff] [blame] | 50 | ENTRY(board_init_f_r_trampoline) |
| 51 | /* Set up the stack- and frame-pointers */ |
| 52 | mov %sp, %r0 |
Alexey Brodkin | 3a59d91 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 53 | mov %fp, %sp |
| 54 | |
Alexey Brodkin | 913e9f0 | 2015-02-24 19:40:36 +0300 | [diff] [blame] | 55 | /* 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 Brodkin | 3a59d91 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 60 | |
Alexey Brodkin | 913e9f0 | 2015-02-24 19:40:36 +0300 | [diff] [blame] | 61 | /* Re-enter U-Boot by calling board_init_f_r */ |
| 62 | j board_init_f_r |
| 63 | ENDPROC(board_init_f_r_trampoline) |