2014-02-04 08:56:14 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <asm-offsets.h>
|
|
|
|
#include <config.h>
|
2015-02-19 15:40:58 +00:00
|
|
|
#include <linux/linkage.h>
|
2014-02-04 08:56:14 +00:00
|
|
|
#include <asm/arcregs.h>
|
|
|
|
|
2015-02-19 15:40:58 +00:00
|
|
|
ENTRY(_start)
|
2017-03-30 14:50:45 +00:00
|
|
|
; Non-masters will be halted immediately, they might be kicked later
|
|
|
|
; by platform code right before passing control to the Linux kernel
|
|
|
|
; in bootm.c:boot_jump_linux().
|
|
|
|
lr r5, [identity]
|
|
|
|
lsr r5, r5, 8
|
|
|
|
bmsk r5, r5, 7
|
|
|
|
cmp r5, 0
|
|
|
|
mov.nz r0, r5
|
|
|
|
bz .Lmaster_proceed
|
|
|
|
flag 1
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
|
|
|
.Lmaster_proceed:
|
|
|
|
|
2014-12-24 14:17:11 +00:00
|
|
|
/* Setup interrupt vector base that matches "__text_start" */
|
|
|
|
sr __ivt_start, [ARC_AUX_INTR_VEC_BASE]
|
|
|
|
|
2015-05-18 13:56:26 +00:00
|
|
|
; Disable/enable I-cache according to configuration
|
|
|
|
lr r5, [ARC_BCR_IC_BUILD]
|
|
|
|
breq r5, 0, 1f ; I$ doesn't exist
|
|
|
|
lr r5, [ARC_AUX_IC_CTRL]
|
|
|
|
#ifndef CONFIG_SYS_ICACHE_OFF
|
|
|
|
bclr r5, r5, 0 ; 0 - Enable, 1 is Disable
|
|
|
|
#else
|
|
|
|
bset r5, r5, 0 ; I$ exists, but is not used
|
|
|
|
#endif
|
|
|
|
sr r5, [ARC_AUX_IC_CTRL]
|
|
|
|
|
|
|
|
1:
|
|
|
|
; Disable/enable D-cache according to configuration
|
|
|
|
lr r5, [ARC_BCR_DC_BUILD]
|
|
|
|
breq r5, 0, 1f ; D$ doesn't exist
|
|
|
|
lr r5, [ARC_AUX_DC_CTRL]
|
|
|
|
bclr r5, r5, 6 ; Invalidate (discard w/o wback)
|
|
|
|
#ifndef CONFIG_SYS_DCACHE_OFF
|
|
|
|
bclr r5, r5, 0 ; Enable (+Inv)
|
|
|
|
#else
|
|
|
|
bset r5, r5, 0 ; Disable (+Inv)
|
|
|
|
#endif
|
|
|
|
sr r5, [ARC_AUX_DC_CTRL]
|
2014-12-24 14:17:11 +00:00
|
|
|
|
2015-05-18 13:56:26 +00:00
|
|
|
1:
|
2015-03-30 10:36:04 +00:00
|
|
|
#ifdef CONFIG_ISA_ARCV2
|
2015-05-18 13:56:26 +00:00
|
|
|
; Disable System-Level Cache (SLC)
|
|
|
|
lr r5, [ARC_BCR_SLC]
|
|
|
|
breq r5, 0, 1f ; SLC doesn't exist
|
|
|
|
lr r5, [ARC_AUX_SLC_CTRL]
|
|
|
|
bclr r5, r5, 6 ; Invalidate (discard w/o wback)
|
|
|
|
bclr r5, r5, 0 ; Enable (+Inv)
|
|
|
|
sr r5, [ARC_AUX_SLC_CTRL]
|
|
|
|
|
|
|
|
1:
|
2015-03-30 10:36:04 +00:00
|
|
|
#endif
|
2015-05-18 13:56:26 +00:00
|
|
|
|
2015-11-25 16:56:32 +00:00
|
|
|
/* Establish C runtime stack and frame */
|
2015-05-18 13:56:26 +00:00
|
|
|
mov %sp, CONFIG_SYS_INIT_SP_ADDR
|
|
|
|
mov %fp, %sp
|
2014-12-24 14:17:11 +00:00
|
|
|
|
2015-11-25 16:56:32 +00:00
|
|
|
/* Allocate reserved area from current top of stack */
|
2015-02-25 15:10:18 +00:00
|
|
|
mov %r0, %sp
|
2015-11-25 16:56:32 +00:00
|
|
|
bl board_init_f_alloc_reserve
|
|
|
|
/* Set stack below reserved area, adjust frame pointer accordingly */
|
2015-02-25 15:10:18 +00:00
|
|
|
mov %sp, %r0
|
|
|
|
mov %fp, %sp
|
|
|
|
|
2015-11-25 16:56:32 +00:00
|
|
|
/* Initialize reserved area - note: r0 already contains address */
|
|
|
|
bl board_init_f_init_reserve
|
|
|
|
|
2014-12-24 14:17:11 +00:00
|
|
|
/* Zero the one and only argument of "board_init_f" */
|
|
|
|
mov_s %r0, 0
|
|
|
|
j board_init_f
|
2015-02-19 15:40:58 +00:00
|
|
|
ENDPROC(_start)
|
2014-12-24 14:17:11 +00:00
|
|
|
|
2014-02-04 08:56:14 +00:00
|
|
|
/*
|
2015-02-24 16:40:36 +00:00
|
|
|
* void board_init_f_r_trampoline(stack-pointer address)
|
2014-02-04 08:56:14 +00:00
|
|
|
*
|
|
|
|
* This "function" does not return, instead it continues in RAM
|
|
|
|
* after relocating the monitor code.
|
|
|
|
*
|
2015-02-24 16:40:36 +00:00
|
|
|
* r0 = new stack-pointer
|
2014-02-04 08:56:14 +00:00
|
|
|
*/
|
2015-02-24 16:40:36 +00:00
|
|
|
ENTRY(board_init_f_r_trampoline)
|
|
|
|
/* Set up the stack- and frame-pointers */
|
|
|
|
mov %sp, %r0
|
2014-02-04 08:56:14 +00:00
|
|
|
mov %fp, %sp
|
|
|
|
|
2015-02-24 16:40:36 +00:00
|
|
|
/* Update position of intterupt vector table */
|
|
|
|
lr %r0, [ARC_AUX_INTR_VEC_BASE]
|
|
|
|
ld %r1, [%r25, GD_RELOC_OFF]
|
|
|
|
add %r0, %r0, %r1
|
|
|
|
sr %r0, [ARC_AUX_INTR_VEC_BASE]
|
2014-02-04 08:56:14 +00:00
|
|
|
|
2015-02-24 16:40:36 +00:00
|
|
|
/* Re-enter U-Boot by calling board_init_f_r */
|
|
|
|
j board_init_f_r
|
|
|
|
ENDPROC(board_init_f_r_trampoline)
|