blob: eb6012a87409bea9c8c4206ad803edea59da6c07 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +00002/*
3 * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.Iwamatsu.yj@renesas.com>
4 * Copyright (C) 2012 Renesas Solutions Corp.
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +00005 */
6
7#include <config.h>
8#include <linux/linkage.h>
9
10ENTRY(lowlevel_init)
11 ldr r0, =MERAM_BASE
12 mov r1, #0x0
13 str r1, [r0]
14
15 mrc p15, 0, r0, c0, c0, 5
16 ands r0, r0, #0xF
17 beq lowlevel_init__
18 b wait_interrupt
19
20 .pool
21 .align 4
22
23wait_interrupt:
Nobuhiro Iwamatsu2f7ea5b2012-07-25 15:48:27 +090024#ifdef ICCICR
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000025 ldr r1, =ICCICR
26 mov r2, #0x0
27 str r2, [r1]
28 mov r2, #0xF0
29 adds r1, r1, #4 /* ICCPMR */
30 str r2, [r1]
31 ldr r1, =ICCICR
32 mov r2, #0x1
33 str r2, [r1]
Nobuhiro Iwamatsu2f7ea5b2012-07-25 15:48:27 +090034#endif
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000035
36wait_loop:
Nobuhiro Iwamatsuc7ee8a52012-07-06 08:53:02 +090037 .long 0xE320F003 /* wfi */
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000038
39 ldr r2, [r1, #0xC]
40 str r2, [r1, #0x10]
41
42 ldr r0, =MERAM_BASE
43 ldr r2, [r0]
44 cmp r2, #0
45 movne pc, r2
46
47 b wait_loop
48
49wait_loop_end:
50 .pool
51 .align 4
52
53lowlevel_init__:
54
55 mov r0, #0x200000
56
57loop0:
58 subs r0, r0, #1
59 bne loop0
60
61 ldr sp, MERAM_STACK
Tetsuyuki Kobayashi03eecab2012-10-04 18:39:22 +000062 b s_init
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000063
64 .pool
65 .align 4
66
67ENDPROC(lowlevel_init)
68 .ltorg
69
70MERAM_STACK:
71 .word LOW_LEVEL_MERAM_STACK