]> git.sur5r.net Git - u-boot/commitdiff
am33xx/omap: Move save_omap_boot_params to omap-common/boot-common.c
authorTom Rini <trini@ti.com>
Fri, 31 May 2013 16:31:59 +0000 (12:31 -0400)
committerTom Rini <trini@ti.com>
Wed, 5 Jun 2013 12:46:49 +0000 (08:46 -0400)
We need to call the save_omap_boot_params function on am33xx/ti81xx and
other newer TI SoCs, so move the function to boot-common.  Only OMAP4+
has the omap_hw_init_context function so add ifdefs to not call it on
am33xx/ti81xx.  Call save_omap_boot_params from s_init on am33xx/ti81xx
boards.

Reviewed-by: R Sricharan <r.sricharan@ti.com>
Signed-off-by: Tom Rini <trini@ti.com>
arch/arm/cpu/armv7/omap-common/boot-common.c
arch/arm/cpu/armv7/omap-common/hwinit-common.c
arch/arm/include/asm/arch-am33xx/sys_proto.h
arch/arm/include/asm/arch-omap4/sys_proto.h
arch/arm/include/asm/arch-omap5/sys_proto.h
board/isee/igep0033/board.c
board/phytec/pcm051/board.c
board/ti/am335x/board.c
board/ti/ti814x/evm.c

index bff7e9c82a1ef0be65d6b9bd0f52cca312bcfc74..76ae1b675fec9de008832b7d9f46c6b6f86cd0f5 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
+void save_omap_boot_params(void)
+{
+       u32 rom_params = *((u32 *)OMAP_SRAM_SCRATCH_BOOT_PARAMS);
+       u8 boot_device;
+       u32 dev_desc, dev_data;
+
+       if ((rom_params <  NON_SECURE_SRAM_START) ||
+           (rom_params > NON_SECURE_SRAM_END))
+               return;
+
+       /*
+        * rom_params can be type casted to omap_boot_parameters and
+        * used. But it not correct to assume that romcode structure
+        * encoding would be same as u-boot. So use the defined offsets.
+        */
+       gd->arch.omap_boot_params.omap_bootdevice = boot_device =
+                                  *((u8 *)(rom_params + BOOT_DEVICE_OFFSET));
+
+       gd->arch.omap_boot_params.ch_flags =
+                               *((u8 *)(rom_params + CH_FLAGS_OFFSET));
+
+       if ((boot_device >= MMC_BOOT_DEVICES_START) &&
+           (boot_device <= MMC_BOOT_DEVICES_END)) {
+#if !defined(CONFIG_AM33XX) && !defined(CONFIG_TI81XX)
+               if ((omap_hw_init_context() ==
+                                     OMAP_INIT_CONTEXT_UBOOT_AFTER_SPL)) {
+                       gd->arch.omap_boot_params.omap_bootmode =
+                       *((u8 *)(rom_params + BOOT_MODE_OFFSET));
+               } else
+#endif
+               {
+                       dev_desc = *((u32 *)(rom_params + DEV_DESC_PTR_OFFSET));
+                       dev_data = *((u32 *)(dev_desc + DEV_DATA_PTR_OFFSET));
+                       gd->arch.omap_boot_params.omap_bootmode =
+                                       *((u32 *)(dev_data + BOOT_MODE_OFFSET));
+               }
+       }
+}
+
 #ifdef CONFIG_SPL_BUILD
 u32 spl_boot_device(void)
 {
index e61464171068cdb6feecf49d16a66764a3af65c5..0776d5c6e8a717de4fac944eb36161a6503ec677 100644 (file)
@@ -111,42 +111,6 @@ void __weak srcomp_enable(void)
 {
 }
 
-static void save_omap_boot_params(void)
-{
-       u32 rom_params = *((u32 *)OMAP_SRAM_SCRATCH_BOOT_PARAMS);
-       u8 boot_device;
-       u32 dev_desc, dev_data;
-
-       if ((rom_params <  NON_SECURE_SRAM_START) ||
-           (rom_params > NON_SECURE_SRAM_END))
-               return;
-
-       /*
-        * rom_params can be type casted to omap_boot_parameters and
-        * used. But it not correct to assume that romcode structure
-        * encoding would be same as u-boot. So use the defined offsets.
-        */
-       gd->arch.omap_boot_params.omap_bootdevice = boot_device =
-                                  *((u8 *)(rom_params + BOOT_DEVICE_OFFSET));
-
-       gd->arch.omap_boot_params.ch_flags =
-                               *((u8 *)(rom_params + CH_FLAGS_OFFSET));
-
-       if ((boot_device >= MMC_BOOT_DEVICES_START) &&
-           (boot_device <= MMC_BOOT_DEVICES_END)) {
-               if ((omap_hw_init_context() ==
-                                     OMAP_INIT_CONTEXT_UBOOT_AFTER_SPL)) {
-                       gd->arch.omap_boot_params.omap_bootmode =
-                       *((u8 *)(rom_params + BOOT_MODE_OFFSET));
-               } else {
-                       dev_desc = *((u32 *)(rom_params + DEV_DESC_PTR_OFFSET));
-                       dev_data = *((u32 *)(dev_desc + DEV_DATA_PTR_OFFSET));
-                       gd->arch.omap_boot_params.omap_bootmode =
-                                       *((u32 *)(dev_data + BOOT_MODE_OFFSET));
-               }
-       }
-}
-
 #ifdef CONFIG_ARCH_CPU_INIT
 /*
  * SOC specific cpu init
index c913b5f318451c561eee7a2e9475fc50c4143c81..fedc674031d2d3321cabc02754d456106cc1bb91 100644 (file)
@@ -30,6 +30,7 @@ int print_cpuinfo(void);
 
 extern struct ctrl_stat *cstat;
 u32 get_device_type(void);
+void save_omap_boot_params(void);
 void setup_clocks_for_console(void);
 void ddr_pll_config(unsigned int ddrpll_M);
 
index 039a1f2604f84794c535e767f432e1a65c7de387..ef85594bd2594ae08cd00b277df5c0acec5ef9cb 100644 (file)
@@ -54,6 +54,7 @@ void cancel_out(u32 *num, u32 *den, u32 den_limit);
 void sdram_init(void);
 u32 omap_sdram_size(void);
 u32 cortex_rev(void);
+void save_omap_boot_params(void);
 void init_omap_revision(void);
 void do_io_settings(void);
 void omap_vc_init(u16 speed_khz);
index b79161d79abd710e3d324ec0326be0347e096f41..4d99db9b7dd5f4ca5e8acfe3a384b128b8b17bc1 100644 (file)
@@ -58,6 +58,7 @@ void cancel_out(u32 *num, u32 *den, u32 den_limit);
 void sdram_init(void);
 u32 omap_sdram_size(void);
 u32 cortex_rev(void);
+void save_omap_boot_params(void);
 void init_omap_revision(void);
 void do_io_settings(void);
 void omap_vc_init(u16 speed_khz);
index d315516fea42df8d12243453aefcebaa35f5185d..826ceadd81d1139a1354b9613bbff8c1acac2e71 100644 (file)
@@ -105,6 +105,15 @@ static struct emif_regs ddr3_emif_reg_data = {
  */
 void s_init(void)
 {
+       /*
+        * Save the boot parameters passed from romcode.
+        * We cannot delay the saving further than this,
+        * to prevent overwrites.
+        */
+#ifdef CONFIG_SPL_BUILD
+       save_omap_boot_params();
+#endif
+
        /* WDT1 is already running when the bootloader gets control
         * Disable it to avoid "random" resets
         */
index 43d7b6e15ac87c0173618048f7febb6092266c04..93c611dfc6e65c5a4e68047cc2b3dd60df4d808e 100644 (file)
@@ -114,6 +114,15 @@ static struct emif_regs ddr3_emif_reg_data = {
  */
 void s_init(void)
 {
+       /*
+        * Save the boot parameters passed from romcode.
+        * We cannot delay the saving further than this,
+        * to prevent overwrites.
+        */
+#ifdef CONFIG_SPL_BUILD
+       save_omap_boot_params();
+#endif
+
        /*
         * WDT1 is already running when the bootloader gets control
         * Disable it to avoid "random" resets
index b371376bc72c0f6d0b5c6118057065a6cd1679e4..ebddf0c7ca3275034583a3ac0db483575cfe4d39 100644 (file)
@@ -304,6 +304,15 @@ static struct emif_regs ddr3_evm_emif_reg_data = {
  */
 void s_init(void)
 {
+       /*
+        * Save the boot parameters passed from romcode.
+        * We cannot delay the saving further than this,
+        * to prevent overwrites.
+        */
+#ifdef CONFIG_SPL_BUILD
+       save_omap_boot_params();
+#endif
+
        /* WDT1 is already running when the bootloader gets control
         * Disable it to avoid "random" resets
         */
index 7adb52405c13ab41391b97ab5ce612bffe5b96c3..4759b167a46ab2f51d55c0b92fa41e599627c2bd 100644 (file)
@@ -149,6 +149,15 @@ static const struct ddr_data evm_ddr2_data = {
 void s_init(void)
 {
 #ifdef CONFIG_SPL_BUILD
+       /*
+        * Save the boot parameters passed from romcode.
+        * We cannot delay the saving further than this,
+        * to prevent overwrites.
+        */
+#ifdef CONFIG_SPL_BUILD
+       save_omap_boot_params();
+#endif
+
        /* WDT1 is already running when the bootloader gets control
         * Disable it to avoid "random" resets
         */