aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSRICHARAN R2013-04-23 19:41:24 -0500
committerTom Rini2013-05-10 07:25:56 -0500
commit4a0eb75752167bef51993307a10677295cef315b (patch)
treee1bb753ed7ebfe79ba34c373a2164e42faaa4cdd
parentfda06812a068f916f64d9d1b3d1730e8213195b3 (diff)
downloadu-boot-4a0eb75752167bef51993307a10677295cef315b.tar.gz
u-boot-4a0eb75752167bef51993307a10677295cef315b.tar.xz
u-boot-4a0eb75752167bef51993307a10677295cef315b.zip
ARM: OMAP: Cleanup boot parameters usage
The boot parameters are read from individual variables assigned for each of them. This been corrected and now they are stored as a part of the global data 'gd' structure. So read them from 'gd' instead. Signed-off-by: Sricharan R <r.sricharan@ti.com> [trini: Add igep0033 hunk] Signed-off-by: Tom Rini <trini@ti.com>
-rw-r--r--arch/arm/cpu/armv7/lowlevel_init.S8
-rw-r--r--arch/arm/cpu/armv7/omap-common/boot-common.c31
-rw-r--r--arch/arm/cpu/armv7/omap-common/lowlevel_init.S50
-rw-r--r--arch/arm/include/asm/arch-omap4/sys_proto.h11
-rw-r--r--arch/arm/include/asm/arch-omap5/sys_proto.h12
-rw-r--r--arch/arm/include/asm/omap_common.h3
-rw-r--r--common/spl/spl.c10
-rw-r--r--include/configs/am335x_evm.h1
-rw-r--r--include/configs/igep0033.h1
-rw-r--r--include/configs/pcm051.h1
-rw-r--r--include/configs/ti814x_evm.h1
-rw-r--r--include/spl.h1
12 files changed, 39 insertions, 91 deletions
diff --git a/arch/arm/cpu/armv7/lowlevel_init.S b/arch/arm/cpu/armv7/lowlevel_init.S
index 0d45528e99..0a15aa4671 100644
--- a/arch/arm/cpu/armv7/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/lowlevel_init.S
@@ -37,7 +37,13 @@ ENTRY(lowlevel_init)
37 */ 37 */
38 ldr sp, =CONFIG_SYS_INIT_SP_ADDR 38 ldr sp, =CONFIG_SYS_INIT_SP_ADDR
39 bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ 39 bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
40 40#ifdef CONFIG_SPL_BUILD
41 ldr r8, =gdata
42#else
43 sub sp, #GD_SIZE
44 bic sp, sp, #7
45 mov r8, sp
46#endif
41 /* 47 /*
42 * Save the old lr(passed in ip) and the current lr to stack 48 * Save the old lr(passed in ip) and the current lr to stack
43 */ 49 */
diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c
index 24cbe2da05..bff7e9c82a 100644
--- a/arch/arm/cpu/armv7/omap-common/boot-common.c
+++ b/arch/arm/cpu/armv7/omap-common/boot-common.c
@@ -23,31 +23,17 @@
23#include <asm/arch/mmc_host_def.h> 23#include <asm/arch/mmc_host_def.h>
24#include <asm/arch/sys_proto.h> 24#include <asm/arch/sys_proto.h>
25 25
26/* 26DECLARE_GLOBAL_DATA_PTR;
27 * This is used to verify if the configuration header
28 * was executed by rom code prior to control of transfer
29 * to the bootloader. SPL is responsible for saving and
30 * passing the boot_params pointer to the u-boot.
31 */
32struct omap_boot_parameters boot_params __attribute__ ((section(".data")));
33 27
34#ifdef CONFIG_SPL_BUILD 28#ifdef CONFIG_SPL_BUILD
35/*
36 * We use static variables because global data is not ready yet.
37 * Initialized data is available in SPL right from the beginning.
38 * We would not typically need to save these parameters in regular
39 * U-Boot. This is needed only in SPL at the moment.
40 */
41u32 omap_bootmode = MMCSD_MODE_FAT;
42
43u32 spl_boot_device(void) 29u32 spl_boot_device(void)
44{ 30{
45 return (u32) (boot_params.omap_bootdevice); 31 return (u32) (gd->arch.omap_boot_params.omap_bootdevice);
46} 32}
47 33
48u32 spl_boot_mode(void) 34u32 spl_boot_mode(void)
49{ 35{
50 return omap_bootmode; 36 return gd->arch.omap_boot_params.omap_bootmode;
51} 37}
52 38
53void spl_board_init(void) 39void spl_board_init(void)
@@ -73,4 +59,15 @@ int board_mmc_init(bd_t *bis)
73 } 59 }
74 return 0; 60 return 0;
75} 61}
62
63void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
64{
65 typedef void __noreturn (*image_entry_noargs_t)(u32 *);
66 image_entry_noargs_t image_entry =
67 (image_entry_noargs_t) spl_image->entry_point;
68
69 debug("image entry point: 0x%X\n", spl_image->entry_point);
70 /* Pass the saved boot_params from rom code */
71 image_entry((u32 *)&gd->arch.omap_boot_params);
72}
76#endif 73#endif
diff --git a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
index 90b3c8aea4..c4895369bf 100644
--- a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
@@ -28,59 +28,13 @@
28 28
29#include <config.h> 29#include <config.h>
30#include <asm/arch/omap.h> 30#include <asm/arch/omap.h>
31#include <asm/omap_common.h>
31#include <asm/arch/spl.h> 32#include <asm/arch/spl.h>
32#include <linux/linkage.h> 33#include <linux/linkage.h>
33 34
34ENTRY(save_boot_params) 35ENTRY(save_boot_params)
35 /* 36 ldr r1, =OMAP_SRAM_SCRATCH_BOOT_PARAMS
36 * See if the rom code passed pointer is valid:
37 * It is not valid if it is not in non-secure SRAM
38 * This may happen if you are booting with the help of
39 * debugger
40 */
41 ldr r2, =NON_SECURE_SRAM_START
42 cmp r2, r0
43 bgt 1f
44 ldr r2, =NON_SECURE_SRAM_END
45 cmp r2, r0
46 blt 1f
47
48 /*
49 * store the boot params passed from rom code or saved
50 * and passed by SPL
51 */
52 cmp r0, #0
53 beq 1f
54 ldr r1, =boot_params
55 str r0, [r1] 37 str r0, [r1]
56#ifdef CONFIG_SPL_BUILD
57 /* Store the boot device in spl_boot_device */
58 ldrb r2, [r0, #BOOT_DEVICE_OFFSET] @ r1 <- value of boot device
59 and r2, #BOOT_DEVICE_MASK
60 ldr r3, =boot_params
61 strb r2, [r3, #BOOT_DEVICE_OFFSET] @ spl_boot_device <- r1
62
63 /*
64 * boot mode is only valid for device that can be raw or FAT booted.
65 * in other cases it may be fatal to look. While platforms differ
66 * in the values used for each MMC slot, they are contiguous.
67 */
68 cmp r2, #MMC_BOOT_DEVICES_START
69 blt 2f
70 cmp r2, #MMC_BOOT_DEVICES_END
71 bgt 2f
72 /* Store the boot mode (raw/FAT) in omap_bootmode */
73 ldr r2, [r0, #DEV_DESC_PTR_OFFSET] @ get the device descriptor ptr
74 ldr r2, [r2, #DEV_DATA_PTR_OFFSET] @ get the pDeviceData ptr
75 ldr r2, [r2, #BOOT_MODE_OFFSET] @ get the boot mode
76 ldr r3, =omap_bootmode
77 str r2, [r3]
78#endif
792:
80 ldrb r2, [r0, #CH_FLAGS_OFFSET]
81 ldr r3, =boot_params
82 strb r2, [r3, #CH_FLAGS_OFFSET]
831:
84 bx lr 38 bx lr
85ENDPROC(save_boot_params) 39ENDPROC(save_boot_params)
86 40
diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h b/arch/arm/include/asm/arch-omap4/sys_proto.h
index ac9c1f83ed..039a1f2604 100644
--- a/arch/arm/include/asm/arch-omap4/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h
@@ -27,6 +27,8 @@
27#include <asm/omap_common.h> 27#include <asm/omap_common.h>
28#include <asm/arch/mux_omap4.h> 28#include <asm/arch/mux_omap4.h>
29 29
30DECLARE_GLOBAL_DATA_PTR;
31
30struct omap_sysinfo { 32struct omap_sysinfo {
31 char *board_string; 33 char *board_string;
32}; 34};
@@ -59,13 +61,6 @@ int omap_vc_bypass_send_value(u8 sa, u8 reg_addr, u8 reg_data);
59u32 warm_reset(void); 61u32 warm_reset(void);
60void force_emif_self_refresh(void); 62void force_emif_self_refresh(void);
61void setup_warmreset_time(void); 63void setup_warmreset_time(void);
62/*
63 * This is used to verify if the configuration header
64 * was executed by Romcode prior to control of transfer
65 * to the bootloader. SPL is responsible for saving and
66 * passing this to the u-boot.
67 */
68extern struct omap_boot_parameters boot_params;
69 64
70static inline u32 running_from_sdram(void) 65static inline u32 running_from_sdram(void)
71{ 66{
@@ -85,7 +80,7 @@ static inline u8 uboot_loaded_by_spl(void)
85 * variable by both SPL and u-boot.Check out for CHSETTINGS, which is a 80 * variable by both SPL and u-boot.Check out for CHSETTINGS, which is a
86 * mandatory section if CH is present. 81 * mandatory section if CH is present.
87 */ 82 */
88 if ((boot_params.ch_flags) & (CH_FLAGS_CHSETTINGS)) 83 if ((gd->arch.omap_boot_params.ch_flags) & (CH_FLAGS_CHSETTINGS))
89 return 0; 84 return 0;
90 else 85 else
91 return running_from_sdram(); 86 return running_from_sdram();
diff --git a/arch/arm/include/asm/arch-omap5/sys_proto.h b/arch/arm/include/asm/arch-omap5/sys_proto.h
index 393c8bfdb7..b79161d79a 100644
--- a/arch/arm/include/asm/arch-omap5/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap5/sys_proto.h
@@ -27,6 +27,8 @@
27#include <asm/omap_common.h> 27#include <asm/omap_common.h>
28#include <asm/arch/clocks.h> 28#include <asm/arch/clocks.h>
29 29
30DECLARE_GLOBAL_DATA_PTR;
31
30struct pad_conf_entry { 32struct pad_conf_entry {
31 u32 offset; 33 u32 offset;
32 u32 val; 34 u32 val;
@@ -66,14 +68,6 @@ void get_ioregs(const struct ctrl_ioregs **regs);
66void srcomp_enable(void); 68void srcomp_enable(void);
67void setup_warmreset_time(void); 69void setup_warmreset_time(void);
68 70
69/*
70 * This is used to verify if the configuration header
71 * was executed by Romcode prior to control of transfer
72 * to the bootloader. SPL is responsible for saving and
73 * passing this to the u-boot.
74 */
75extern struct omap_boot_parameters boot_params;
76
77static inline u32 running_from_sdram(void) 71static inline u32 running_from_sdram(void)
78{ 72{
79 u32 pc; 73 u32 pc;
@@ -92,7 +86,7 @@ static inline u8 uboot_loaded_by_spl(void)
92 * variable by both SPL and u-boot.Check out for CHSETTINGS, which is a 86 * variable by both SPL and u-boot.Check out for CHSETTINGS, which is a
93 * mandatory section if CH is present. 87 * mandatory section if CH is present.
94 */ 88 */
95 if ((boot_params.ch_flags) & (CH_FLAGS_CHSETTINGS)) 89 if ((gd->arch.omap_boot_params.ch_flags) & (CH_FLAGS_CHSETTINGS))
96 return 0; 90 return 0;
97 else 91 else
98 return running_from_sdram(); 92 return running_from_sdram();
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index eebc9c7cbf..ee7b188d3a 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -25,6 +25,8 @@
25#ifndef _OMAP_COMMON_H_ 25#ifndef _OMAP_COMMON_H_
26#define _OMAP_COMMON_H_ 26#define _OMAP_COMMON_H_
27 27
28#ifndef __ASSEMBLY__
29
28#include <common.h> 30#include <common.h>
29 31
30#define NUM_SYS_CLKS 8 32#define NUM_SYS_CLKS 8
@@ -558,6 +560,7 @@ static inline u32 omap_revision(void)
558 extern u32 *const omap_si_rev; 560 extern u32 *const omap_si_rev;
559 return *omap_si_rev; 561 return *omap_si_rev;
560} 562}
563#endif
561 564
562/* 565/*
563 * silicon revisions. 566 * silicon revisions.
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 6715e0d203..e6aa89bdd0 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -125,17 +125,13 @@ void spl_parse_image_header(const struct image_header *header)
125 125
126__weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) 126__weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
127{ 127{
128 typedef void __noreturn (*image_entry_noargs_t)(u32 *); 128 typedef void __noreturn (*image_entry_noargs_t)(void);
129
129 image_entry_noargs_t image_entry = 130 image_entry_noargs_t image_entry =
130 (image_entry_noargs_t) spl_image->entry_point; 131 (image_entry_noargs_t) spl_image->entry_point;
131 132
132 debug("image entry point: 0x%X\n", spl_image->entry_point); 133 debug("image entry point: 0x%X\n", spl_image->entry_point);
133 /* Pass the saved boot_params from rom code */ 134 image_entry();
134#if defined(CONFIG_VIRTIO) || defined(CONFIG_ZEBU)
135 image_entry = (image_entry_noargs_t)0x80100000;
136#endif
137 u32 boot_params_ptr_addr = (u32)&boot_params_ptr;
138 image_entry((u32 *)boot_params_ptr_addr);
139} 135}
140 136
141#ifdef CONFIG_SPL_RAM_DEVICE 137#ifdef CONFIG_SPL_RAM_DEVICE
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 5739422c4c..941054d70a 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -17,6 +17,7 @@
17#define __CONFIG_AM335X_EVM_H 17#define __CONFIG_AM335X_EVM_H
18 18
19#define CONFIG_AM33XX 19#define CONFIG_AM33XX
20#define CONFIG_OMAP
20 21
21#include <asm/arch/omap.h> 22#include <asm/arch/omap.h>
22 23
diff --git a/include/configs/igep0033.h b/include/configs/igep0033.h
index 50eafdf60b..14063a83e6 100644
--- a/include/configs/igep0033.h
+++ b/include/configs/igep0033.h
@@ -15,6 +15,7 @@
15#define __CONFIG_IGEP0033_H 15#define __CONFIG_IGEP0033_H
16 16
17#define CONFIG_AM33XX 17#define CONFIG_AM33XX
18#define CONFIG_OMAP
18 19
19#include <asm/arch/omap.h> 20#include <asm/arch/omap.h>
20 21
diff --git a/include/configs/pcm051.h b/include/configs/pcm051.h
index 2e3f08b5b6..cc8d317199 100644
--- a/include/configs/pcm051.h
+++ b/include/configs/pcm051.h
@@ -20,6 +20,7 @@
20#define __CONFIG_PCM051_H 20#define __CONFIG_PCM051_H
21 21
22#define CONFIG_AM33XX 22#define CONFIG_AM33XX
23#define CONFIG_OMAP
23 24
24#include <asm/arch/omap.h> 25#include <asm/arch/omap.h>
25 26
diff --git a/include/configs/ti814x_evm.h b/include/configs/ti814x_evm.h
index e646bd7235..6c423df372 100644
--- a/include/configs/ti814x_evm.h
+++ b/include/configs/ti814x_evm.h
@@ -19,6 +19,7 @@
19#define CONFIG_TI81XX 19#define CONFIG_TI81XX
20#define CONFIG_TI814X 20#define CONFIG_TI814X
21#define CONFIG_SYS_NO_FLASH 21#define CONFIG_SYS_NO_FLASH
22#define CONFIG_OMAP
22 23
23#include <asm/arch/omap.h> 24#include <asm/arch/omap.h>
24 25
diff --git a/include/spl.h b/include/spl.h
index b40be8039c..4bc1dd13bb 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -44,7 +44,6 @@ struct spl_image_info {
44#define SPL_COPY_PAYLOAD_ONLY 1 44#define SPL_COPY_PAYLOAD_ONLY 1
45 45
46extern struct spl_image_info spl_image; 46extern struct spl_image_info spl_image;
47extern u32 *boot_params_ptr;
48 47
49/* SPL common functions */ 48/* SPL common functions */
50void preloader_console_init(void); 49void preloader_console_init(void);