blob: 212e95539bc90742d06a9acd6e848d1b96b9f095 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Nobuhiro Iwamatsu940103d2012-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 Iwamatsu940103d2012-08-19 04:40:05 +00005 */
6
7#include <config.h>
8#include <linux/linkage.h>
Tom Rini4ddbade2022-05-25 12:16:03 -04009#include <system-constants.h>
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +000010
11ENTRY(lowlevel_init)
12 ldr r0, =MERAM_BASE
13 mov r1, #0x0
14 str r1, [r0]
15
16 mrc p15, 0, r0, c0, c0, 5
17 ands r0, r0, #0xF
18 beq lowlevel_init__
19 b wait_interrupt
20
21 .pool
22 .align 4
23
24wait_interrupt:
Nobuhiro Iwamatsufe1c4bc2012-07-25 15:48:27 +090025#ifdef ICCICR
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +000026 ldr r1, =ICCICR
27 mov r2, #0x0
28 str r2, [r1]
29 mov r2, #0xF0
30 adds r1, r1, #4 /* ICCPMR */
31 str r2, [r1]
32 ldr r1, =ICCICR
33 mov r2, #0x1
34 str r2, [r1]
Nobuhiro Iwamatsufe1c4bc2012-07-25 15:48:27 +090035#endif
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +000036
37wait_loop:
Nobuhiro Iwamatsu7cd76e12012-07-06 08:53:02 +090038 .long 0xE320F003 /* wfi */
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +000039
40 ldr r2, [r1, #0xC]
41 str r2, [r1, #0x10]
42
43 ldr r0, =MERAM_BASE
44 ldr r2, [r0]
45 cmp r2, #0
46 movne pc, r2
47
48 b wait_loop
49
50wait_loop_end:
51 .pool
52 .align 4
53
54lowlevel_init__:
55
56 mov r0, #0x200000
57
58loop0:
59 subs r0, r0, #1
60 bne loop0
61
62 ldr sp, MERAM_STACK
Tetsuyuki Kobayashi08d54512012-10-04 18:39:22 +000063 b s_init
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +000064
65 .pool
66 .align 4
67
68ENDPROC(lowlevel_init)
69 .ltorg
70
71MERAM_STACK:
72 .word LOW_LEVEL_MERAM_STACK