summaryrefslogtreecommitdiff
path: root/packages/uboot/u-boot-mkimage-gta01-native/boot-from-ram-and-nand.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/uboot/u-boot-mkimage-gta01-native/boot-from-ram-and-nand.patch')
-rw-r--r--packages/uboot/u-boot-mkimage-gta01-native/boot-from-ram-and-nand.patch98
1 files changed, 98 insertions, 0 deletions
diff --git a/packages/uboot/u-boot-mkimage-gta01-native/boot-from-ram-and-nand.patch b/packages/uboot/u-boot-mkimage-gta01-native/boot-from-ram-and-nand.patch
new file mode 100644
index 0000000000..fa0de39ab7
--- /dev/null
+++ b/packages/uboot/u-boot-mkimage-gta01-native/boot-from-ram-and-nand.patch
@@ -0,0 +1,98 @@
+Auto-detect whether we're booting from RAM or NAND, and act accordingly. This
+allows us to use the same u-boot binary for all boot modes.
+
+include/configs/neo1973.h: introduced new config option
+ CONFIG_LL_INIT_NAND_ONLY to perform low-level initialization only when
+ booting from NAND
+include/configs/neo1973.h: got rid of BUILD_FOR_RAM
+cpu/arm920t/start.S: detect if we need to boot from NAND at run time (i.e., if
+ we're running at address 0)
+
+- Werner Almesberger <werner@openmoko.org>
+
+Index: u-boot/cpu/arm920t/start.S
+===================================================================
+--- u-boot.orig/cpu/arm920t/start.S
++++ u-boot/cpu/arm920t/start.S
+@@ -157,18 +157,26 @@
+ str r1, [r0]
+ #endif /* CONFIG_S3C2400 || CONFIG_S3C2410 */
+
+- /*
+- * we do sys-critical inits only at reboot,
+- * not when booting from ram!
+- */
+ #ifndef CONFIG_SKIP_LOWLEVEL_INIT
++#ifndef CONFIG_LL_INIT_NAND_ONLY
+ bl cpu_init_crit
+ #endif
++#endif
+
+ #ifndef CONFIG_SKIP_RELOCATE_UBOOT
+-#ifndef CONFIG_S3C2410_NAND_BOOT
+-relocate: /* relocate U-Boot to RAM */
+ adr r0, _start /* r0 <- current position of code */
++
++#ifdef CONFIG_S3C2410_NAND_BOOT
++ /* are we running from NAND ? */
++#define BWSCON 0x48000000
++ ldr r1, =BWSCON /* Z = CPU booted from NAND */
++ ldr r1, [r1]
++ tst r1, #6 /* BWSCON[2:1] = OM[1:0] */
++ teqeq r0, #0 /* Z &= running at address 0 */
++ beq nand_load
++#endif /* CONFIG_S3C2410_NAND_BOOT */
++
++relocate: /* relocate U-Boot to RAM */
+ ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
+ cmp r0, r1 /* don't reloc during debug */
+ beq done_relocate
+@@ -188,10 +196,13 @@
+ ldr pc, _done_relocate /* jump to relocated code */
+ _done_relocate:
+ .word done_relocate
+-done_relocate:
+-#else /* NAND_BOOT */
+-relocate:
+-copy_myself:
++
++#ifdef CONFIG_S3C2410_NAND_BOOT
++nand_load:
++#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && defined(CONFIG_LL_INIT_NAND_ONLY)
++ bl cpu_init_crit
++#endif
++
+ /* mov r10, lr */
+
+ @ reset NAND
+@@ -275,7 +286,8 @@
+ #endif
+ 1: b 1b
+ done_nand_read:
+-#endif /* NAND_BOOT */
++#endif /* CONFIG_S3C2410_NAND_BOOT */
++done_relocate:
+ #endif /* CONFIG_SKIP_RELOCATE_UBOOT */
+
+ /* Set up the stack */
+Index: u-boot/include/configs/neo1973_gta01.h
+===================================================================
+--- u-boot.orig/include/configs/neo1973_gta01.h
++++ u-boot/include/configs/neo1973_gta01.h
+@@ -26,14 +26,10 @@
+ #ifndef __CONFIG_H
+ #define __CONFIG_H
+
+-#if defined(BUILD_FOR_RAM)
+-/* If we want to start u-boot from inside RAM */
+-#define CONFIG_SKIP_LOWLEVEL_INIT 1
+-#else
+-/* we want to start u-boot directly from within NAND flash */
++/* we want to be able to start u-boot directly from within NAND flash */
++#define CONFIG_LL_INIT_NAND_ONLY
+ #define CONFIG_S3C2410_NAND_BOOT 1
+ #define CONFIG_S3C2410_NAND_SKIP_BAD 1
+-#endif
+
+ #define CFG_UBOOT_SIZE 0x40000 /* size of u-boot, for NAND loading */
+