2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2014-02-04 08:56:14 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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)
|
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]
|
|
|
|
|
2018-01-16 18:52:25 +00:00
|
|
|
mov r5, 1
|
|
|
|
sr r5, [ARC_AUX_IC_IVIC]
|
|
|
|
; As per ARC HS databook (see chapter 5.3.3.2)
|
|
|
|
; it is required to add 3 NOPs after each write to IC_IVIC.
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
2015-05-18 13:56:26 +00:00
|
|
|
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
|
|
|
|
2018-01-16 18:52:25 +00:00
|
|
|
mov r5, 1
|
|
|
|
sr r5, [ARC_AUX_DC_IVDC]
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2018-05-03 12:01:58 +00:00
|
|
|
#ifdef CONFIG_DEBUG_UART
|
|
|
|
/* Earliest point to set up early debug uart */
|
|
|
|
bl debug_uart_init
|
|
|
|
#endif
|
|
|
|
|
2014-12-24 14:17:11 +00:00
|
|
|
/* Zero the one and only argument of "board_init_f" */
|
|
|
|
mov_s %r0, 0
|
2015-12-16 16:24:10 +00:00
|
|
|
bl board_init_f
|
|
|
|
|
|
|
|
/* We only get here if relocation is disabled by GD_FLG_SKIP_RELOC */
|
|
|
|
/* Make sure we don't lose GD overwritten by zero new GD */
|
|
|
|
mov %r0, %r25
|
|
|
|
mov %r1, 0
|
|
|
|
bl board_init_r
|
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)
|