Commit 4a0eb75752167bef51993307a10677295cef315b

Authored by SRICHARAN R
Committed by Tom Rini
1 parent fda06812a0

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>

Showing 12 changed files with 39 additions and 91 deletions Side-by-side Diff

arch/arm/cpu/armv7/lowlevel_init.S
... ... @@ -37,7 +37,13 @@
37 37 */
38 38 ldr sp, =CONFIG_SYS_INIT_SP_ADDR
39 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 48 * Save the old lr(passed in ip) and the current lr to stack
43 49 */
arch/arm/cpu/armv7/omap-common/boot-common.c
... ... @@ -23,31 +23,17 @@
23 23 #include <asm/arch/mmc_host_def.h>
24 24 #include <asm/arch/sys_proto.h>
25 25  
26   -/*
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   - */
32   -struct omap_boot_parameters boot_params __attribute__ ((section(".data")));
  26 +DECLARE_GLOBAL_DATA_PTR;
33 27  
34 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   - */
41   -u32 omap_bootmode = MMCSD_MODE_FAT;
42   -
43 29 u32 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  
48 34 u32 spl_boot_mode(void)
49 35 {
50   - return omap_bootmode;
  36 + return gd->arch.omap_boot_params.omap_bootmode;
51 37 }
52 38  
53 39 void spl_board_init(void)
... ... @@ -72,6 +58,17 @@
72 58 break;
73 59 }
74 60 return 0;
  61 +}
  62 +
  63 +void __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);
75 72 }
76 73 #endif
arch/arm/cpu/armv7/omap-common/lowlevel_init.S
... ... @@ -28,59 +28,13 @@
28 28  
29 29 #include <config.h>
30 30 #include <asm/arch/omap.h>
  31 +#include <asm/omap_common.h>
31 32 #include <asm/arch/spl.h>
32 33 #include <linux/linkage.h>
33 34  
34 35 ENTRY(save_boot_params)
35   - /*
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
  36 + ldr r1, =OMAP_SRAM_SCRATCH_BOOT_PARAMS
55 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
79   -2:
80   - ldrb r2, [r0, #CH_FLAGS_OFFSET]
81   - ldr r3, =boot_params
82   - strb r2, [r3, #CH_FLAGS_OFFSET]
83   -1:
84 38 bx lr
85 39 ENDPROC(save_boot_params)
86 40  
arch/arm/include/asm/arch-omap4/sys_proto.h
... ... @@ -27,6 +27,8 @@
27 27 #include <asm/omap_common.h>
28 28 #include <asm/arch/mux_omap4.h>
29 29  
  30 +DECLARE_GLOBAL_DATA_PTR;
  31 +
30 32 struct omap_sysinfo {
31 33 char *board_string;
32 34 };
... ... @@ -59,13 +61,6 @@
59 61 u32 warm_reset(void);
60 62 void force_emif_self_refresh(void);
61 63 void 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   - */
68   -extern struct omap_boot_parameters boot_params;
69 64  
70 65 static inline u32 running_from_sdram(void)
71 66 {
... ... @@ -85,7 +80,7 @@
85 80 * variable by both SPL and u-boot.Check out for CHSETTINGS, which is a
86 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 84 return 0;
90 85 else
91 86 return running_from_sdram();
arch/arm/include/asm/arch-omap5/sys_proto.h
... ... @@ -27,6 +27,8 @@
27 27 #include <asm/omap_common.h>
28 28 #include <asm/arch/clocks.h>
29 29  
  30 +DECLARE_GLOBAL_DATA_PTR;
  31 +
30 32 struct pad_conf_entry {
31 33 u32 offset;
32 34 u32 val;
... ... @@ -66,14 +68,6 @@
66 68 void srcomp_enable(void);
67 69 void 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   - */
75   -extern struct omap_boot_parameters boot_params;
76   -
77 71 static inline u32 running_from_sdram(void)
78 72 {
79 73 u32 pc;
... ... @@ -92,7 +86,7 @@
92 86 * variable by both SPL and u-boot.Check out for CHSETTINGS, which is a
93 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 90 return 0;
97 91 else
98 92 return running_from_sdram();
arch/arm/include/asm/omap_common.h
... ... @@ -25,6 +25,8 @@
25 25 #ifndef _OMAP_COMMON_H_
26 26 #define _OMAP_COMMON_H_
27 27  
  28 +#ifndef __ASSEMBLY__
  29 +
28 30 #include <common.h>
29 31  
30 32 #define NUM_SYS_CLKS 8
... ... @@ -558,6 +560,7 @@
558 560 extern u32 *const omap_si_rev;
559 561 return *omap_si_rev;
560 562 }
  563 +#endif
561 564  
562 565 /*
563 566 * silicon revisions.
... ... @@ -125,17 +125,13 @@
125 125  
126 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 130 image_entry_noargs_t image_entry =
130 131 (image_entry_noargs_t) spl_image->entry_point;
131 132  
132 133 debug("image entry point: 0x%X\n", spl_image->entry_point);
133   - /* Pass the saved boot_params from rom code */
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);
  134 + image_entry();
139 135 }
140 136  
141 137 #ifdef CONFIG_SPL_RAM_DEVICE
include/configs/am335x_evm.h
... ... @@ -17,6 +17,7 @@
17 17 #define __CONFIG_AM335X_EVM_H
18 18  
19 19 #define CONFIG_AM33XX
  20 +#define CONFIG_OMAP
20 21  
21 22 #include <asm/arch/omap.h>
22 23  
include/configs/igep0033.h
... ... @@ -15,6 +15,7 @@
15 15 #define __CONFIG_IGEP0033_H
16 16  
17 17 #define CONFIG_AM33XX
  18 +#define CONFIG_OMAP
18 19  
19 20 #include <asm/arch/omap.h>
20 21  
include/configs/pcm051.h
... ... @@ -20,6 +20,7 @@
20 20 #define __CONFIG_PCM051_H
21 21  
22 22 #define CONFIG_AM33XX
  23 +#define CONFIG_OMAP
23 24  
24 25 #include <asm/arch/omap.h>
25 26  
include/configs/ti814x_evm.h
... ... @@ -19,6 +19,7 @@
19 19 #define CONFIG_TI81XX
20 20 #define CONFIG_TI814X
21 21 #define CONFIG_SYS_NO_FLASH
  22 +#define CONFIG_OMAP
22 23  
23 24 #include <asm/arch/omap.h>
24 25  
... ... @@ -44,7 +44,6 @@
44 44 #define SPL_COPY_PAYLOAD_ONLY 1
45 45  
46 46 extern struct spl_image_info spl_image;
47   -extern u32 *boot_params_ptr;
48 47  
49 48 /* SPL common functions */
50 49 void preloader_console_init(void);