Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.Iwamatsu.yj@renesas.com> |
| 4 | * Copyright (C) 2012 Renesas Solutions Corp. |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <config.h> |
| 8 | #include <linux/linkage.h> |
| 9 | |
| 10 | ENTRY(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 | |
| 23 | wait_interrupt: |
Nobuhiro Iwamatsu | 2f7ea5b | 2012-07-25 15:48:27 +0900 | [diff] [blame] | 24 | #ifdef ICCICR |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 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] |
Nobuhiro Iwamatsu | 2f7ea5b | 2012-07-25 15:48:27 +0900 | [diff] [blame] | 34 | #endif |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 35 | |
| 36 | wait_loop: |
Nobuhiro Iwamatsu | c7ee8a5 | 2012-07-06 08:53:02 +0900 | [diff] [blame] | 37 | .long 0xE320F003 /* wfi */ |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 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 | |
| 49 | wait_loop_end: |
| 50 | .pool |
| 51 | .align 4 |
| 52 | |
| 53 | lowlevel_init__: |
| 54 | |
| 55 | mov r0, #0x200000 |
| 56 | |
| 57 | loop0: |
| 58 | subs r0, r0, #1 |
| 59 | bne loop0 |
| 60 | |
| 61 | ldr sp, MERAM_STACK |
Tetsuyuki Kobayashi | 03eecab | 2012-10-04 18:39:22 +0000 | [diff] [blame] | 62 | b s_init |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 63 | |
| 64 | .pool |
| 65 | .align 4 |
| 66 | |
| 67 | ENDPROC(lowlevel_init) |
| 68 | .ltorg |
| 69 | |
| 70 | MERAM_STACK: |
| 71 | .word LOW_LEVEL_MERAM_STACK |