diff options
Diffstat (limited to 'meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-and-nand.patch')
-rw-r--r-- | meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-and-nand.patch | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-and-nand.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-and-nand.patch new file mode 100644 index 0000000000..fa0de39ab7 --- /dev/null +++ b/meta/packages/uboot/u-boot-mkimage-openmoko-native/boot-from-ram-and-nand.patch | |||
@@ -0,0 +1,98 @@ | |||
1 | Auto-detect whether we're booting from RAM or NAND, and act accordingly. This | ||
2 | allows us to use the same u-boot binary for all boot modes. | ||
3 | |||
4 | include/configs/neo1973.h: introduced new config option | ||
5 | CONFIG_LL_INIT_NAND_ONLY to perform low-level initialization only when | ||
6 | booting from NAND | ||
7 | include/configs/neo1973.h: got rid of BUILD_FOR_RAM | ||
8 | cpu/arm920t/start.S: detect if we need to boot from NAND at run time (i.e., if | ||
9 | we're running at address 0) | ||
10 | |||
11 | - Werner Almesberger <werner@openmoko.org> | ||
12 | |||
13 | Index: u-boot/cpu/arm920t/start.S | ||
14 | =================================================================== | ||
15 | --- u-boot.orig/cpu/arm920t/start.S | ||
16 | +++ u-boot/cpu/arm920t/start.S | ||
17 | @@ -157,18 +157,26 @@ | ||
18 | str r1, [r0] | ||
19 | #endif /* CONFIG_S3C2400 || CONFIG_S3C2410 */ | ||
20 | |||
21 | - /* | ||
22 | - * we do sys-critical inits only at reboot, | ||
23 | - * not when booting from ram! | ||
24 | - */ | ||
25 | #ifndef CONFIG_SKIP_LOWLEVEL_INIT | ||
26 | +#ifndef CONFIG_LL_INIT_NAND_ONLY | ||
27 | bl cpu_init_crit | ||
28 | #endif | ||
29 | +#endif | ||
30 | |||
31 | #ifndef CONFIG_SKIP_RELOCATE_UBOOT | ||
32 | -#ifndef CONFIG_S3C2410_NAND_BOOT | ||
33 | -relocate: /* relocate U-Boot to RAM */ | ||
34 | adr r0, _start /* r0 <- current position of code */ | ||
35 | + | ||
36 | +#ifdef CONFIG_S3C2410_NAND_BOOT | ||
37 | + /* are we running from NAND ? */ | ||
38 | +#define BWSCON 0x48000000 | ||
39 | + ldr r1, =BWSCON /* Z = CPU booted from NAND */ | ||
40 | + ldr r1, [r1] | ||
41 | + tst r1, #6 /* BWSCON[2:1] = OM[1:0] */ | ||
42 | + teqeq r0, #0 /* Z &= running at address 0 */ | ||
43 | + beq nand_load | ||
44 | +#endif /* CONFIG_S3C2410_NAND_BOOT */ | ||
45 | + | ||
46 | +relocate: /* relocate U-Boot to RAM */ | ||
47 | ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ | ||
48 | cmp r0, r1 /* don't reloc during debug */ | ||
49 | beq done_relocate | ||
50 | @@ -188,10 +196,13 @@ | ||
51 | ldr pc, _done_relocate /* jump to relocated code */ | ||
52 | _done_relocate: | ||
53 | .word done_relocate | ||
54 | -done_relocate: | ||
55 | -#else /* NAND_BOOT */ | ||
56 | -relocate: | ||
57 | -copy_myself: | ||
58 | + | ||
59 | +#ifdef CONFIG_S3C2410_NAND_BOOT | ||
60 | +nand_load: | ||
61 | +#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && defined(CONFIG_LL_INIT_NAND_ONLY) | ||
62 | + bl cpu_init_crit | ||
63 | +#endif | ||
64 | + | ||
65 | /* mov r10, lr */ | ||
66 | |||
67 | @ reset NAND | ||
68 | @@ -275,7 +286,8 @@ | ||
69 | #endif | ||
70 | 1: b 1b | ||
71 | done_nand_read: | ||
72 | -#endif /* NAND_BOOT */ | ||
73 | +#endif /* CONFIG_S3C2410_NAND_BOOT */ | ||
74 | +done_relocate: | ||
75 | #endif /* CONFIG_SKIP_RELOCATE_UBOOT */ | ||
76 | |||
77 | /* Set up the stack */ | ||
78 | Index: u-boot/include/configs/neo1973_gta01.h | ||
79 | =================================================================== | ||
80 | --- u-boot.orig/include/configs/neo1973_gta01.h | ||
81 | +++ u-boot/include/configs/neo1973_gta01.h | ||
82 | @@ -26,14 +26,10 @@ | ||
83 | #ifndef __CONFIG_H | ||
84 | #define __CONFIG_H | ||
85 | |||
86 | -#if defined(BUILD_FOR_RAM) | ||
87 | -/* If we want to start u-boot from inside RAM */ | ||
88 | -#define CONFIG_SKIP_LOWLEVEL_INIT 1 | ||
89 | -#else | ||
90 | -/* we want to start u-boot directly from within NAND flash */ | ||
91 | +/* we want to be able to start u-boot directly from within NAND flash */ | ||
92 | +#define CONFIG_LL_INIT_NAND_ONLY | ||
93 | #define CONFIG_S3C2410_NAND_BOOT 1 | ||
94 | #define CONFIG_S3C2410_NAND_SKIP_BAD 1 | ||
95 | -#endif | ||
96 | |||
97 | #define CFG_UBOOT_SIZE 0x40000 /* size of u-boot, for NAND loading */ | ||
98 | |||