diff options
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/imx31/rolo_restart.S | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/firmware/target/arm/imx31/rolo_restart.S b/firmware/target/arm/imx31/rolo_restart.S new file mode 100644 index 0000000000..39053de96f --- /dev/null +++ b/firmware/target/arm/imx31/rolo_restart.S | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Michael Sevakis | ||
11 | * | ||
12 | * RoLo restart code for IMX31 | ||
13 | * | ||
14 | * All files in this archive are subject to the GNU General Public License. | ||
15 | * See the file COPYING in the source tree root for full license agreement. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "config.h" | ||
22 | #include "cpu.h" | ||
23 | |||
24 | /**************************************************************************** | ||
25 | * void rolo_restart(const unsigned char* source, unsigned char* dest, | ||
26 | * int length) __attribute__((noreturn)); | ||
27 | */ | ||
28 | .section .text, "ax", %progbits | ||
29 | .align 2 | ||
30 | .global rolo_restart | ||
31 | rolo_restart: | ||
32 | adr r4, restart_copy_start | ||
33 | adr r5, restart_copy_end | ||
34 | ldr r6, =IRAM_BASE_ADDR | ||
35 | mov r7, r6 | ||
36 | |||
37 | @ Copy stub to IRAM | ||
38 | 1: | ||
39 | ldr r8, [r4], #4 | ||
40 | str r8, [r7], #4 | ||
41 | cmp r5, r4 | ||
42 | bhi 1b | ||
43 | |||
44 | @ Branch to stub | ||
45 | bx r6 | ||
46 | |||
47 | restart_copy_start: | ||
48 | @ Trivial copy of firmware to final location | ||
49 | mov r4, r1 | ||
50 | 1: | ||
51 | subs r2, r2, #1 | ||
52 | ldrb r7, [r0], #1 | ||
53 | strb r7, [r4], #1 | ||
54 | bge 1b | ||
55 | |||
56 | @ Clean and invalidate all caches | ||
57 | mov r0, #0 | ||
58 | mcr p15, 0, r0, c7, c14, 0 | ||
59 | mcr p15, 0, r0, c7, c5, 0 | ||
60 | mcr p15, 0, r0, c7, c10, 4 | ||
61 | mcr p15, 0, r0, c7, c5, 4 | ||
62 | |||
63 | @ Branch to destination (should be address 0x00000000) | ||
64 | bx r1 | ||
65 | restart_copy_end: | ||
66 | .size rolo_restart,.-rolo_restart | ||