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> |
Tom Rini | eaf6ea6 | 2022-05-25 12:16:03 -0400 | [diff] [blame] | 9 | #include <system-constants.h> |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 10 | |
| 11 | ENTRY(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 | |
| 24 | wait_interrupt: |
Nobuhiro Iwamatsu | 2f7ea5b | 2012-07-25 15:48:27 +0900 | [diff] [blame] | 25 | #ifdef ICCICR |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 26 | 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 Iwamatsu | 2f7ea5b | 2012-07-25 15:48:27 +0900 | [diff] [blame] | 35 | #endif |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 36 | |
| 37 | wait_loop: |
Nobuhiro Iwamatsu | c7ee8a5 | 2012-07-06 08:53:02 +0900 | [diff] [blame] | 38 | .long 0xE320F003 /* wfi */ |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 39 | |
| 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 | |
| 50 | wait_loop_end: |
| 51 | .pool |
| 52 | .align 4 |
| 53 | |
| 54 | lowlevel_init__: |
| 55 | |
| 56 | mov r0, #0x200000 |
| 57 | |
| 58 | loop0: |
| 59 | subs r0, r0, #1 |
| 60 | bne loop0 |
| 61 | |
| 62 | ldr sp, MERAM_STACK |
Tetsuyuki Kobayashi | 03eecab | 2012-10-04 18:39:22 +0000 | [diff] [blame] | 63 | b s_init |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 64 | |
| 65 | .pool |
| 66 | .align 4 |
| 67 | |
| 68 | ENDPROC(lowlevel_init) |
| 69 | .ltorg |
| 70 | |
| 71 | MERAM_STACK: |
| 72 | .word LOW_LEVEL_MERAM_STACK |