• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.Iwamatsu.yj@renesas.com>
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 */
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:
24#ifdef ICCICR
25	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]
34#endif
35
36wait_loop:
37	.long	0xE320F003 /* wfi */
38
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
62	b s_init
63
64	.pool
65	.align 4
66
67ENDPROC(lowlevel_init)
68	.ltorg
69
70MERAM_STACK:
71	.word LOW_LEVEL_MERAM_STACK
72