aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSRICHARAN R2013-04-23 19:41:23 -0500
committerTom Rini2013-05-10 07:25:56 -0500
commitfda06812a068f916f64d9d1b3d1730e8213195b3 (patch)
treeb6efdc49f508ec4ec805200b6fe621ed1ba8b8c7
parentf92f2277a6cadfdc703a6700593cac3d8211bf53 (diff)
downloadu-boot-fda06812a068f916f64d9d1b3d1730e8213195b3.tar.gz
u-boot-fda06812a068f916f64d9d1b3d1730e8213195b3.tar.xz
u-boot-fda06812a068f916f64d9d1b3d1730e8213195b3.zip
ARM: OMAP: Correct save_boot_params and replace with 'C' function
Currently save_boot_params saves the boot parameters passed from romcode. But this is not stored in a writable location consistently. So the current code would not work for a 'XIP' boot. Change this by saving the boot parameters in 'gd' which is always writable. Also add a 'C' function instead of an assembly code that is more readable. Signed-off-by: Sricharan R <r.sricharan@ti.com>
-rw-r--r--arch/arm/cpu/armv7/omap-common/hwinit-common.c50
-rw-r--r--arch/arm/include/asm/global_data.h8
-rw-r--r--arch/arm/include/asm/omap_boot.h1
-rw-r--r--arch/arm/include/asm/omap_common.h4
4 files changed, 56 insertions, 7 deletions
diff --git a/arch/arm/cpu/armv7/omap-common/hwinit-common.c b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
index 70d16a8160..c7107847c4 100644
--- a/arch/arm/cpu/armv7/omap-common/hwinit-common.c
+++ b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
@@ -101,11 +101,6 @@ void omap_rev_string(void)
101} 101}
102 102
103#ifdef CONFIG_SPL_BUILD 103#ifdef CONFIG_SPL_BUILD
104static void init_boot_params(void)
105{
106 boot_params_ptr = (u32 *) &boot_params;
107}
108
109void spl_display_print(void) 104void spl_display_print(void)
110{ 105{
111 omap_rev_string(); 106 omap_rev_string();
@@ -116,6 +111,42 @@ void __weak srcomp_enable(void)
116{ 111{
117} 112}
118 113
114static void save_omap_boot_params(void)
115{
116 u32 rom_params = *((u32 *)OMAP_SRAM_SCRATCH_BOOT_PARAMS);
117 u8 boot_device;
118 u32 dev_desc, dev_data;
119
120 if ((rom_params < NON_SECURE_SRAM_START) ||
121 (rom_params > NON_SECURE_SRAM_END))
122 return;
123
124 /*
125 * rom_params can be type casted to omap_boot_parameters and
126 * used. But it not correct to assume that romcode structure
127 * encoding would be same as u-boot. So use the defined offsets.
128 */
129 gd->arch.omap_boot_params.omap_bootdevice = boot_device =
130 *((u8 *)(rom_params + BOOT_DEVICE_OFFSET));
131
132 gd->arch.omap_boot_params.ch_flags =
133 *((u8 *)(rom_params + CH_FLAGS_OFFSET));
134
135 if ((boot_device >= MMC_BOOT_DEVICES_START) &&
136 (boot_device <= MMC_BOOT_DEVICES_END)) {
137 if ((omap_hw_init_context() ==
138 OMAP_INIT_CONTEXT_UBOOT_AFTER_SPL)) {
139 gd->arch.omap_boot_params.omap_bootmode =
140 *((u8 *)(rom_params + BOOT_MODE_OFFSET));
141 } else {
142 dev_desc = *((u32 *)(rom_params + DEV_DESC_PTR_OFFSET));
143 dev_data = *((u32 *)(dev_desc + DEV_DATA_PTR_OFFSET));
144 gd->arch.omap_boot_params.omap_bootmode =
145 *((u32 *)(dev_data + BOOT_MODE_OFFSET));
146 }
147 }
148}
149
119/* 150/*
120 * Routine: s_init 151 * Routine: s_init
121 * Description: Does early system init of watchdog, muxing, andclocks 152 * Description: Does early system init of watchdog, muxing, andclocks
@@ -132,6 +163,14 @@ void __weak srcomp_enable(void)
132 */ 163 */
133void s_init(void) 164void s_init(void)
134{ 165{
166 /*
167 * Save the boot parameters passed from romcode.
168 * We cannot delay the saving further than this,
169 * to prevent overwrites.
170 */
171#ifdef CONFIG_SPL_BUILD
172 save_omap_boot_params();
173#endif
135 init_omap_revision(); 174 init_omap_revision();
136 hw_data_init(); 175 hw_data_init();
137 176
@@ -156,7 +195,6 @@ void s_init(void)
156 195
157 /* For regular u-boot sdram_init() is called from dram_init() */ 196 /* For regular u-boot sdram_init() is called from dram_init() */
158 sdram_init(); 197 sdram_init();
159 init_boot_params();
160#endif 198#endif
161} 199}
162 200
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 37ac0daa70..7611d0a18b 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -24,6 +24,10 @@
24#ifndef __ASM_GBL_DATA_H 24#ifndef __ASM_GBL_DATA_H
25#define __ASM_GBL_DATA_H 25#define __ASM_GBL_DATA_H
26 26
27#ifdef CONFIG_OMAP
28#include <asm/omap_boot.h>
29#endif
30
27/* Architecture-specific global data */ 31/* Architecture-specific global data */
28struct arch_global_data { 32struct arch_global_data {
29#if defined(CONFIG_FSL_ESDHC) 33#if defined(CONFIG_FSL_ESDHC)
@@ -51,6 +55,10 @@ struct arch_global_data {
51 unsigned long tlb_addr; 55 unsigned long tlb_addr;
52 unsigned long tlb_size; 56 unsigned long tlb_size;
53#endif 57#endif
58
59#ifdef CONFIG_OMAP
60 struct omap_boot_parameters omap_boot_params;
61#endif
54}; 62};
55 63
56#include <asm-generic/global_data.h> 64#include <asm-generic/global_data.h>
diff --git a/arch/arm/include/asm/omap_boot.h b/arch/arm/include/asm/omap_boot.h
index 87a95302fa..a803965ac5 100644
--- a/arch/arm/include/asm/omap_boot.h
+++ b/arch/arm/include/asm/omap_boot.h
@@ -45,5 +45,6 @@ struct omap_boot_parameters {
45 unsigned char omap_bootdevice; 45 unsigned char omap_bootdevice;
46 unsigned char reset_reason; 46 unsigned char reset_reason;
47 unsigned char ch_flags; 47 unsigned char ch_flags;
48 unsigned long omap_bootmode;
48}; 49};
49#endif 50#endif
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 837b69fdab..eebc9c7cbf 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -597,5 +597,7 @@ static inline u32 omap_revision(void)
597#define OMAP_SRAM_SCRATCH_DPLLS_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x18) 597#define OMAP_SRAM_SCRATCH_DPLLS_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x18)
598#define OMAP_SRAM_SCRATCH_VCORES_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x1C) 598#define OMAP_SRAM_SCRATCH_VCORES_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x1C)
599#define OMAP_SRAM_SCRATCH_SYS_CTRL (SRAM_SCRATCH_SPACE_ADDR + 0x20) 599#define OMAP_SRAM_SCRATCH_SYS_CTRL (SRAM_SCRATCH_SPACE_ADDR + 0x20)
600#define OMAP_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x24) 600#define OMAP_SRAM_SCRATCH_BOOT_PARAMS (SRAM_SCRATCH_SPACE_ADDR + 0x24)
601#define OMAP5_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x28)
602
601#endif /* _OMAP_COMMON_H_ */ 603#endif /* _OMAP_COMMON_H_ */