summaryrefslogtreecommitdiffstats
path: root/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-reloc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-reloc.patch')
-rw-r--r--meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-reloc.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-reloc.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-reloc.patch
new file mode 100644
index 0000000000..53a3e05c67
--- /dev/null
+++ b/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-reloc.patch
@@ -0,0 +1,62 @@
1This patch allows us to boot from anywhere in RAM. It mainly sets the stage
2for later patches. The only real changes here is the better handling of already
3cached code (e.g., if we were started by a previous instance of u-boot), and
4that we drop CONFIG_SKIP_RELOCATE_UBOOT from neo1973.h
5
6cpu/arm920t/start.S: if not relocating, instead of going straight to
7 stack_setup, jump to done_relocate, which may perform other setup tasks
8cpu/arm920t/start.S: after relocating, flush the cache and jump to the new code
9include/configs/neo1973.h: remove CONFIG_SKIP_RELOCATE_UBOOT
10
11- Werner Almesberger <werner@openmoko.org>
12
13Index: u-boot/cpu/arm920t/start.S
14===================================================================
15--- u-boot.orig/cpu/arm920t/start.S
16+++ u-boot/cpu/arm920t/start.S
17@@ -171,7 +171,7 @@ relocate: /* relocate U-Boot to RAM
18 adr r0, _start /* r0 <- current position of code */
19 ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
20 cmp r0, r1 /* don't reloc during debug */
21- beq stack_setup
22+ beq done_relocate
23
24 ldr r2, _armboot_start
25 ldr r3, _bss_start
26@@ -181,8 +181,14 @@ relocate: /* relocate U-Boot to RAM
27 copy_loop:
28 ldmia r0!, {r3-r10} /* copy from source address [r0] */
29 stmia r1!, {r3-r10} /* copy to target address [r1] */
30- cmp r0, r2 /* until source end addreee [r2] */
31+ cmp r0, r2 /* until source end address [r2] */
32 ble copy_loop
33+ mov r0, #0 /* flush v3/v4 cache */
34+ mcr p15, 0, r0, c7, c7, 0
35+ ldr pc, _done_relocate /* jump to relocated code */
36+_done_relocate:
37+ .word done_relocate
38+done_relocate:
39 #else /* NAND_BOOT */
40 relocate:
41 copy_myself:
42@@ -270,7 +276,7 @@ notmatch:
43 1: b 1b
44 done_nand_read:
45 #endif /* NAND_BOOT */
46-#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
47+#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
48
49 /* Set up the stack */
50 stack_setup:
51Index: u-boot/include/configs/neo1973_gta01.h
52===================================================================
53--- u-boot.orig/include/configs/neo1973_gta01.h
54+++ u-boot/include/configs/neo1973_gta01.h
55@@ -28,7 +28,6 @@
56
57 #if defined(BUILD_FOR_RAM)
58 /* If we want to start u-boot from inside RAM */
59-#define CONFIG_SKIP_RELOCATE_UBOOT 1
60 #define CONFIG_SKIP_LOWLEVEL_INIT 1
61 #else
62 /* we want to start u-boot directly from within NAND flash */