Nobuhiro Iwamatsu | 940103d | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.Iwamatsu.yj@renesas.com> |
| 3 | * Copyright (C) 2012 Renesas Solutions Corp. |
| 4 | * |
Wolfgang Denk | bd8ec7e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Nobuhiro Iwamatsu | 940103d | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <config.h> |
| 9 | #include <linux/linkage.h> |
| 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 | fe1c4bc | 2012-07-25 15:48:27 +0900 | [diff] [blame] | 25 | #ifdef ICCICR |
Nobuhiro Iwamatsu | 940103d | 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 | fe1c4bc | 2012-07-25 15:48:27 +0900 | [diff] [blame] | 35 | #endif |
Nobuhiro Iwamatsu | 940103d | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 36 | |
| 37 | wait_loop: |
Nobuhiro Iwamatsu | 7cd76e1 | 2012-07-06 08:53:02 +0900 | [diff] [blame] | 38 | .long 0xE320F003 /* wfi */ |
Nobuhiro Iwamatsu | 940103d | 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 | 08d5451 | 2012-10-04 18:39:22 +0000 | [diff] [blame] | 63 | b s_init |
Nobuhiro Iwamatsu | 940103d | 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 |