* [U-Boot] [PATCH 1/5] ARM: OMAP: Make omap_boot_parameters common across socs
2013-04-15 15:08 [U-Boot] [PATCH 0/5] ARM: OMAP: Cleanup save_boot_params function Sricharan R
@ 2013-04-15 15:08 ` Sricharan R
2013-04-15 15:08 ` [U-Boot] [PATCH 2/5] ARM: OMAP4/5: Make OMAPx_SRAM_SCRATCH_ defines common Sricharan R
` (3 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Sricharan R @ 2013-04-15 15:08 UTC (permalink / raw)
To: u-boot
omap_boot_parameters is same and defined for each
soc. So move this to a common place to reuse it
across socs.
Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
arch/arm/include/asm/arch-am33xx/omap.h | 25 ----------------
arch/arm/include/asm/arch-omap4/omap.h | 24 ---------------
arch/arm/include/asm/arch-omap5/omap.h | 23 ---------------
arch/arm/include/asm/omap_boot.h | 49 +++++++++++++++++++++++++++++++
4 files changed, 49 insertions(+), 72 deletions(-)
create mode 100644 arch/arm/include/asm/omap_boot.h
diff --git a/arch/arm/include/asm/arch-am33xx/omap.h b/arch/arm/include/asm/arch-am33xx/omap.h
index d28f9a8..7e3bb9c 100644
--- a/arch/arm/include/asm/arch-am33xx/omap.h
+++ b/arch/arm/include/asm/arch-am33xx/omap.h
@@ -35,29 +35,4 @@
#define NON_SECURE_SRAM_START 0x40300000
#define NON_SECURE_SRAM_END 0x40320000
#endif
-
-/* ROM code defines */
-/* Boot device */
-#define BOOT_DEVICE_MASK 0xFF
-#define BOOT_DEVICE_OFFSET 0x8
-#define DEV_DESC_PTR_OFFSET 0x4
-#define DEV_DATA_PTR_OFFSET 0x18
-#define BOOT_MODE_OFFSET 0x8
-#define RESET_REASON_OFFSET 0x9
-#define CH_FLAGS_OFFSET 0xA
-
-#define CH_FLAGS_CHSETTINGS (0x1 << 0)
-#define CH_FLAGS_CHRAM (0x1 << 1)
-#define CH_FLAGS_CHFLASH (0x1 << 2)
-#define CH_FLAGS_CHMMCSD (0x1 << 3)
-
-#ifndef __ASSEMBLY__
-struct omap_boot_parameters {
- char *boot_message;
- unsigned int mem_boot_descriptor;
- unsigned char omap_bootdevice;
- unsigned char reset_reason;
- unsigned char ch_flags;
-};
-#endif
#endif
diff --git a/arch/arm/include/asm/arch-omap4/omap.h b/arch/arm/include/asm/arch-omap4/omap.h
index 5f321fe..555d0f6 100644
--- a/arch/arm/include/asm/arch-omap4/omap.h
+++ b/arch/arm/include/asm/arch-omap4/omap.h
@@ -156,28 +156,4 @@ struct s32ktimer {
#define OMAP4_SRAM_SCRATCH_SYS_CTRL (SRAM_SCRATCH_SPACE_ADDR + 0x20)
#define OMAP4_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x24)
-/* ROM code defines */
-/* Boot device */
-#define BOOT_DEVICE_MASK 0xFF
-#define BOOT_DEVICE_OFFSET 0x8
-#define DEV_DESC_PTR_OFFSET 0x4
-#define DEV_DATA_PTR_OFFSET 0x18
-#define BOOT_MODE_OFFSET 0x8
-#define RESET_REASON_OFFSET 0x9
-#define CH_FLAGS_OFFSET 0xA
-
-#define CH_FLAGS_CHSETTINGS (0x1 << 0)
-#define CH_FLAGS_CHRAM (0x1 << 1)
-#define CH_FLAGS_CHFLASH (0x1 << 2)
-#define CH_FLAGS_CHMMCSD (0x1 << 3)
-
-#ifndef __ASSEMBLY__
-struct omap_boot_parameters {
- char *boot_message;
- unsigned int mem_boot_descriptor;
- unsigned char omap_bootdevice;
- unsigned char reset_reason;
- unsigned char ch_flags;
-};
-#endif
#endif
diff --git a/arch/arm/include/asm/arch-omap5/omap.h b/arch/arm/include/asm/arch-omap5/omap.h
index b632635..a06a300 100644
--- a/arch/arm/include/asm/arch-omap5/omap.h
+++ b/arch/arm/include/asm/arch-omap5/omap.h
@@ -215,21 +215,6 @@ struct s32ktimer {
#define OMAP4460_ES1_0 0x44600100
#define OMAP4460_ES1_1 0x44600110
-/* ROM code defines */
-/* Boot device */
-#define BOOT_DEVICE_MASK 0xFF
-#define BOOT_DEVICE_OFFSET 0x8
-#define DEV_DESC_PTR_OFFSET 0x4
-#define DEV_DATA_PTR_OFFSET 0x18
-#define BOOT_MODE_OFFSET 0x8
-#define RESET_REASON_OFFSET 0x9
-#define CH_FLAGS_OFFSET 0xA
-
-#define CH_FLAGS_CHSETTINGS (0x1 << 0)
-#define CH_FLAGS_CHRAM (0x1 << 1)
-#define CH_FLAGS_CHFLASH (0x1 << 2)
-#define CH_FLAGS_CHMMCSD (0x1 << 3)
-
/* CONTROL_SRCOMP_XXX_SIDE */
#define OVERRIDE_XS_SHIFT 30
#define OVERRIDE_XS_MASK (1 << 30)
@@ -250,14 +235,6 @@ struct srcomp_params {
s8 multiply_factor;
};
-struct omap_boot_parameters {
- char *boot_message;
- unsigned int mem_boot_descriptor;
- unsigned char omap_bootdevice;
- unsigned char reset_reason;
- unsigned char ch_flags;
-};
-
struct ctrl_ioregs {
u32 ctrl_ddrch;
u32 ctrl_lpddr2ch;
diff --git a/arch/arm/include/asm/omap_boot.h b/arch/arm/include/asm/omap_boot.h
new file mode 100644
index 0000000..87a9530
--- /dev/null
+++ b/arch/arm/include/asm/omap_boot.h
@@ -0,0 +1,49 @@
+/*
+ * (C) Copyright 2013
+ * Texas Instruments, <www.ti.com>
+ *
+ * Sricharan R <r.sricharan@ti.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/* ROM code defines */
+/* Boot device */
+#define BOOT_DEVICE_MASK 0xFF
+#define BOOT_DEVICE_OFFSET 0x8
+#define DEV_DESC_PTR_OFFSET 0x4
+#define DEV_DATA_PTR_OFFSET 0x18
+#define BOOT_MODE_OFFSET 0x8
+#define RESET_REASON_OFFSET 0x9
+#define CH_FLAGS_OFFSET 0xA
+
+#define CH_FLAGS_CHSETTINGS (0x1 << 0)
+#define CH_FLAGS_CHRAM (0x1 << 1)
+#define CH_FLAGS_CHFLASH (0x1 << 2)
+#define CH_FLAGS_CHMMCSD (0x1 << 3)
+
+#ifndef __ASSEMBLY__
+struct omap_boot_parameters {
+ char *boot_message;
+ unsigned int mem_boot_descriptor;
+ unsigned char omap_bootdevice;
+ unsigned char reset_reason;
+ unsigned char ch_flags;
+};
+#endif
--
1.7.9.5
^ permalink raw reply related [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 2/5] ARM: OMAP4/5: Make OMAPx_SRAM_SCRATCH_ defines common
2013-04-15 15:08 [U-Boot] [PATCH 0/5] ARM: OMAP: Cleanup save_boot_params function Sricharan R
2013-04-15 15:08 ` [U-Boot] [PATCH 1/5] ARM: OMAP: Make omap_boot_parameters common across socs Sricharan R
@ 2013-04-15 15:08 ` Sricharan R
2013-04-15 15:08 ` [U-Boot] [PATCH 3/5] ARM: OMAP: Correct save_boot_params and replace with 'C' function Sricharan R
` (2 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Sricharan R @ 2013-04-15 15:08 UTC (permalink / raw)
To: u-boot
These defines are same across OMAP4/5. So move them to
omap_common.h. This is required for the patches that
follow.
Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
arch/arm/cpu/armv7/omap4/emif.c | 6 +++---
arch/arm/cpu/armv7/omap4/hw_data.c | 2 +-
arch/arm/cpu/armv7/omap4/hwinit.c | 3 ++-
arch/arm/cpu/armv7/omap5/emif.c | 6 +++---
arch/arm/cpu/armv7/omap5/hw_data.c | 2 +-
arch/arm/cpu/armv7/omap5/hwinit.c | 3 ++-
arch/arm/include/asm/arch-omap4/omap.h | 13 -------------
arch/arm/include/asm/arch-omap5/omap.h | 14 --------------
arch/arm/include/asm/omap_common.h | 14 ++++++++++++++
9 files changed, 26 insertions(+), 37 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap4/emif.c b/arch/arm/cpu/armv7/omap4/emif.c
index ca4823d..81da9c9 100644
--- a/arch/arm/cpu/armv7/omap4/emif.c
+++ b/arch/arm/cpu/armv7/omap4/emif.c
@@ -31,9 +31,9 @@
#include <asm/utils.h>
#ifndef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
-u32 *const T_num = (u32 *)OMAP4_SRAM_SCRATCH_EMIF_T_NUM;
-u32 *const T_den = (u32 *)OMAP4_SRAM_SCRATCH_EMIF_T_DEN;
-u32 *const emif_sizes = (u32 *)OMAP4_SRAM_SCRATCH_EMIF_SIZE;
+u32 *const T_num = (u32 *)OMAP_SRAM_SCRATCH_EMIF_T_NUM;
+u32 *const T_den = (u32 *)OMAP_SRAM_SCRATCH_EMIF_T_DEN;
+u32 *const emif_sizes = (u32 *)OMAP_SRAM_SCRATCH_EMIF_SIZE;
#endif
#ifdef CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS
diff --git a/arch/arm/cpu/armv7/omap4/hw_data.c b/arch/arm/cpu/armv7/omap4/hw_data.c
index 7551b98..ab1d487 100644
--- a/arch/arm/cpu/armv7/omap4/hw_data.c
+++ b/arch/arm/cpu/armv7/omap4/hw_data.c
@@ -40,7 +40,7 @@ struct dplls const **dplls_data =
struct vcores_data const **omap_vcores =
(struct vcores_data const **) OMAP_SRAM_SCRATCH_VCORES_PTR;
struct omap_sys_ctrl_regs const **ctrl =
- (struct omap_sys_ctrl_regs const **)OMAP4_SRAM_SCRATCH_SYS_CTRL;
+ (struct omap_sys_ctrl_regs const **)OMAP_SRAM_SCRATCH_SYS_CTRL;
/*
* The M & N values in the following tables are created using the
diff --git a/arch/arm/cpu/armv7/omap4/hwinit.c b/arch/arm/cpu/armv7/omap4/hwinit.c
index 2db517b..81f5a48 100644
--- a/arch/arm/cpu/armv7/omap4/hwinit.c
+++ b/arch/arm/cpu/armv7/omap4/hwinit.c
@@ -34,10 +34,11 @@
#include <asm/sizes.h>
#include <asm/emif.h>
#include <asm/arch/gpio.h>
+#include <asm/omap_common.h>
DECLARE_GLOBAL_DATA_PTR;
-u32 *const omap_si_rev = (u32 *)OMAP4_SRAM_SCRATCH_OMAP4_REV;
+u32 *const omap_si_rev = (u32 *)OMAP_SRAM_SCRATCH_OMAP_REV;
static const struct gpio_bank gpio_bank_44xx[6] = {
{ (void *)OMAP44XX_GPIO1_BASE, METHOD_GPIO_24XX },
diff --git a/arch/arm/cpu/armv7/omap5/emif.c b/arch/arm/cpu/armv7/omap5/emif.c
index 8019ffe..e7176d4 100644
--- a/arch/arm/cpu/armv7/omap5/emif.c
+++ b/arch/arm/cpu/armv7/omap5/emif.c
@@ -32,9 +32,9 @@
#ifndef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
#define print_timing_reg(reg) debug(#reg" - 0x%08x\n", (reg))
-static u32 *const T_num = (u32 *)OMAP5_SRAM_SCRATCH_EMIF_T_NUM;
-static u32 *const T_den = (u32 *)OMAP5_SRAM_SCRATCH_EMIF_T_DEN;
-static u32 *const emif_sizes = (u32 *)OMAP5_SRAM_SCRATCH_EMIF_SIZE;
+static u32 *const T_num = (u32 *)OMAP_SRAM_SCRATCH_EMIF_T_NUM;
+static u32 *const T_den = (u32 *)OMAP_SRAM_SCRATCH_EMIF_T_DEN;
+static u32 *const emif_sizes = (u32 *)OMAP_SRAM_SCRATCH_EMIF_SIZE;
#endif
#ifdef CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS
diff --git a/arch/arm/cpu/armv7/omap5/hw_data.c b/arch/arm/cpu/armv7/omap5/hw_data.c
index ced274e..e29803d 100644
--- a/arch/arm/cpu/armv7/omap5/hw_data.c
+++ b/arch/arm/cpu/armv7/omap5/hw_data.c
@@ -41,7 +41,7 @@ struct dplls const **dplls_data =
struct vcores_data const **omap_vcores =
(struct vcores_data const **) OMAP_SRAM_SCRATCH_VCORES_PTR;
struct omap_sys_ctrl_regs const **ctrl =
- (struct omap_sys_ctrl_regs const **)OMAP5_SRAM_SCRATCH_SYS_CTRL;
+ (struct omap_sys_ctrl_regs const **)OMAP_SRAM_SCRATCH_SYS_CTRL;
/* OPP HIGH FREQUENCY for ES2.0 */
static const struct dpll_params mpu_dpll_params_1_5ghz[NUM_SYS_CLKS] = {
diff --git a/arch/arm/cpu/armv7/omap5/hwinit.c b/arch/arm/cpu/armv7/omap5/hwinit.c
index 2f4b247..e93f403 100644
--- a/arch/arm/cpu/armv7/omap5/hwinit.c
+++ b/arch/arm/cpu/armv7/omap5/hwinit.c
@@ -37,10 +37,11 @@
#include <asm/utils.h>
#include <asm/arch/gpio.h>
#include <asm/emif.h>
+#include <asm/omap_common.h>
DECLARE_GLOBAL_DATA_PTR;
-u32 *const omap_si_rev = (u32 *)OMAP5_SRAM_SCRATCH_OMAP5_REV;
+u32 *const omap_si_rev = (u32 *)OMAP_SRAM_SCRATCH_OMAP_REV;
static struct gpio_bank gpio_bank_54xx[6] = {
{ (void *)OMAP54XX_GPIO1_BASE, METHOD_GPIO_24XX },
diff --git a/arch/arm/include/asm/arch-omap4/omap.h b/arch/arm/include/asm/arch-omap4/omap.h
index 555d0f6..e9a6ffe 100644
--- a/arch/arm/include/asm/arch-omap4/omap.h
+++ b/arch/arm/include/asm/arch-omap4/omap.h
@@ -143,17 +143,4 @@ struct s32ktimer {
#define NON_SECURE_SRAM_END 0x4030E000 /* Not inclusive */
/* base address for indirect vectors (internal boot mode) */
#define SRAM_ROM_VECT_BASE 0x4030D000
-/* Temporary SRAM stack used while low level init is done */
-#define SRAM_SCRATCH_SPACE_ADDR NON_SECURE_SRAM_START
-/* SRAM scratch space entries */
-#define OMAP4_SRAM_SCRATCH_OMAP4_REV SRAM_SCRATCH_SPACE_ADDR
-#define OMAP4_SRAM_SCRATCH_EMIF_SIZE (SRAM_SCRATCH_SPACE_ADDR + 0x4)
-#define OMAP4_SRAM_SCRATCH_EMIF_T_NUM (SRAM_SCRATCH_SPACE_ADDR + 0xC)
-#define OMAP4_SRAM_SCRATCH_EMIF_T_DEN (SRAM_SCRATCH_SPACE_ADDR + 0x10)
-#define OMAP_SRAM_SCRATCH_PRCM_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x14)
-#define OMAP_SRAM_SCRATCH_DPLLS_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x18)
-#define OMAP_SRAM_SCRATCH_VCORES_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x1C)
-#define OMAP4_SRAM_SCRATCH_SYS_CTRL (SRAM_SCRATCH_SPACE_ADDR + 0x20)
-#define OMAP4_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x24)
-
#endif
diff --git a/arch/arm/include/asm/arch-omap5/omap.h b/arch/arm/include/asm/arch-omap5/omap.h
index a06a300..4f43a90 100644
--- a/arch/arm/include/asm/arch-omap5/omap.h
+++ b/arch/arm/include/asm/arch-omap5/omap.h
@@ -191,20 +191,6 @@ struct s32ktimer {
/* base address for indirect vectors (internal boot mode) */
#define SRAM_ROM_VECT_BASE 0x4031F000
-#define SRAM_SCRATCH_SPACE_ADDR NON_SECURE_SRAM_START
-/*
- * SRAM scratch space entries
- */
-#define OMAP5_SRAM_SCRATCH_OMAP5_REV SRAM_SCRATCH_SPACE_ADDR
-#define OMAP5_SRAM_SCRATCH_EMIF_SIZE (SRAM_SCRATCH_SPACE_ADDR + 0x4)
-#define OMAP5_SRAM_SCRATCH_EMIF_T_NUM (SRAM_SCRATCH_SPACE_ADDR + 0xC)
-#define OMAP5_SRAM_SCRATCH_EMIF_T_DEN (SRAM_SCRATCH_SPACE_ADDR + 0x10)
-#define OMAP_SRAM_SCRATCH_PRCM_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x14)
-#define OMAP_SRAM_SCRATCH_DPLLS_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x18)
-#define OMAP_SRAM_SCRATCH_VCORES_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x1C)
-#define OMAP5_SRAM_SCRATCH_SYS_CTRL (SRAM_SCRATCH_SPACE_ADDR + 0x20)
-#define OMAP5_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x24)
-
/* Silicon revisions */
#define OMAP4430_SILICON_ID_INVALID 0xFFFFFFFF
#define OMAP4430_ES1_0 0x44300100
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 091ddb5..6b70dbb 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -583,4 +583,18 @@ static inline u32 omap_revision(void)
/* DRA7XX */
#define DRA752_ES1_0 0x07520100
+
+/*
+ * SRAM scratch space entries
+ */
+#define SRAM_SCRATCH_SPACE_ADDR NON_SECURE_SRAM_START
+#define OMAP_SRAM_SCRATCH_OMAP_REV SRAM_SCRATCH_SPACE_ADDR
+#define OMAP_SRAM_SCRATCH_EMIF_SIZE (SRAM_SCRATCH_SPACE_ADDR + 0x4)
+#define OMAP_SRAM_SCRATCH_EMIF_T_NUM (SRAM_SCRATCH_SPACE_ADDR + 0xC)
+#define OMAP_SRAM_SCRATCH_EMIF_T_DEN (SRAM_SCRATCH_SPACE_ADDR + 0x10)
+#define OMAP_SRAM_SCRATCH_PRCM_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x14)
+#define OMAP_SRAM_SCRATCH_DPLLS_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x18)
+#define OMAP_SRAM_SCRATCH_VCORES_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x1C)
+#define OMAP_SRAM_SCRATCH_SYS_CTRL (SRAM_SCRATCH_SPACE_ADDR + 0x20)
+#define OMAP_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x24)
#endif /* _OMAP_COMMON_H_ */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 3/5] ARM: OMAP: Correct save_boot_params and replace with 'C' function
2013-04-15 15:08 [U-Boot] [PATCH 0/5] ARM: OMAP: Cleanup save_boot_params function Sricharan R
2013-04-15 15:08 ` [U-Boot] [PATCH 1/5] ARM: OMAP: Make omap_boot_parameters common across socs Sricharan R
2013-04-15 15:08 ` [U-Boot] [PATCH 2/5] ARM: OMAP4/5: Make OMAPx_SRAM_SCRATCH_ defines common Sricharan R
@ 2013-04-15 15:08 ` Sricharan R
2013-04-15 15:28 ` Tom Rini
2013-04-15 16:22 ` Michael Cashwell
2013-04-15 15:08 ` [U-Boot] [PATCH 4/5] ARM: OMAP: Cleanup boot parameters usage Sricharan R
2013-04-15 15:08 ` [U-Boot] [PATCH 5/5] ARM: OMAP: Add arch_cpu_init function Sricharan R
4 siblings, 2 replies; 14+ messages in thread
From: Sricharan R @ 2013-04-15 15:08 UTC (permalink / raw)
To: u-boot
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>
---
There is a checkpatch warning because of multiple
assignments. The code looks readable this way.
arch/arm/cpu/armv7/omap-common/hwinit-common.c | 50 +++++++++++++++++++++---
arch/arm/include/asm/global_data.h | 8 ++++
arch/arm/include/asm/omap_boot.h | 1 +
arch/arm/include/asm/omap_common.h | 4 +-
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 70d16a8..602e76e 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)
}
#ifdef CONFIG_SPL_BUILD
-static void init_boot_params(void)
-{
- boot_params_ptr = (u32 *) &boot_params;
-}
-
void spl_display_print(void)
{
omap_rev_string();
@@ -116,6 +111,42 @@ 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 >= BOOT_DEVICE_XIP) &&
+ (boot_device <= BOOT_DEVICE_MMC2)) {
+ if (!(omap_hw_init_context() ==
+ OMAP_INIT_CONTEXT_UBOOT_AFTER_SPL)) {
+ 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));
+ } else {
+ gd->arch.omap_boot_params.omap_bootmode =
+ *((u8 *)(rom_params + BOOT_MODE_OFFSET));
+ }
+ }
+}
+
/*
* Routine: s_init
* Description: Does early system init of watchdog, muxing, andclocks
@@ -132,6 +163,14 @@ void __weak srcomp_enable(void)
*/
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
init_omap_revision();
hw_data_init();
@@ -156,7 +195,6 @@ void s_init(void)
/* For regular u-boot sdram_init() is called from dram_init() */
sdram_init();
- init_boot_params();
#endif
}
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 37ac0da..7611d0a 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -24,6 +24,10 @@
#ifndef __ASM_GBL_DATA_H
#define __ASM_GBL_DATA_H
+#ifdef CONFIG_OMAP
+#include <asm/omap_boot.h>
+#endif
+
/* Architecture-specific global data */
struct arch_global_data {
#if defined(CONFIG_FSL_ESDHC)
@@ -51,6 +55,10 @@ struct arch_global_data {
unsigned long tlb_addr;
unsigned long tlb_size;
#endif
+
+#ifdef CONFIG_OMAP
+ struct omap_boot_parameters omap_boot_params;
+#endif
};
#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 87a9530..a803965 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 {
unsigned char omap_bootdevice;
unsigned char reset_reason;
unsigned char ch_flags;
+ unsigned long omap_bootmode;
};
#endif
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 6b70dbb..6b73d86 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -596,5 +596,7 @@ static inline u32 omap_revision(void)
#define OMAP_SRAM_SCRATCH_DPLLS_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x18)
#define OMAP_SRAM_SCRATCH_VCORES_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x1C)
#define OMAP_SRAM_SCRATCH_SYS_CTRL (SRAM_SCRATCH_SPACE_ADDR + 0x20)
-#define OMAP_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x24)
+#define OMAP_SRAM_SCRATCH_BOOT_PARAMS (SRAM_SCRATCH_SPACE_ADDR + 0x24)
+#define OMAP5_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x28)
+
#endif /* _OMAP_COMMON_H_ */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 3/5] ARM: OMAP: Correct save_boot_params and replace with 'C' function
2013-04-15 15:08 ` [U-Boot] [PATCH 3/5] ARM: OMAP: Correct save_boot_params and replace with 'C' function Sricharan R
@ 2013-04-15 15:28 ` Tom Rini
2013-04-15 15:33 ` Sricharan R
2013-04-15 16:22 ` Michael Cashwell
1 sibling, 1 reply; 14+ messages in thread
From: Tom Rini @ 2013-04-15 15:28 UTC (permalink / raw)
To: u-boot
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 04/15/2013 11:08 AM, Sricharan R wrote:
> 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> --- There is a
> checkpatch warning because of multiple assignments. The code looks
> readable this way.
>
What/where?
[snip]
> + if ((boot_device >= BOOT_DEVICE_XIP) && + (boot_device <=
> BOOT_DEVICE_MMC2)) {
This will need to be rebased to use MMC_BOOT_DEVICES_START/END and I
know you didn't test from eMMC on omap5_uevm then.
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRbByPAAoJENk4IS6UOR1W9tgQAIO3+Ejnxgy+oqo10SieOsw0
n4dgRvYwppNgpaR4RND5ldjHnYAdr7g3TPOZ8X0tPuw/VwgvpaSkMfAtxzKF3S8m
QjVlPj2+XCTHI9fbg3Wz3kiHRTBYjlBnQ4o3fbnL+h7Sunci8a0HGrLzmfPfz6eA
SR/jLFNtBCQNfh3p7ZikH4pnTCcf/kTfHWkGjIImt5/2Viv8XoQnbwFyTeJS9upZ
s3BPlST+Az7p/D6qFTGR70fmq55H/cIF8iW6KxmD8I8Ezwa2S+hj6FIJ+NmRtEw8
6SOzGw61hGV4y60NelfbRA4KR8GqiFpbb6NtX+bBhX6Vu8DGJpsU/PE1jngA9xSt
RCWqUVxP3LOGCxgI3brZe26kCgHkI8hGx/tDK2e9LF9MspkujL7TVxOTWMEARdZ/
XdJVGljTjovfbIVdWwt0NMASs9aY9gm3lbFtWfST9uZ8esEI1xRc9i19s1aGUf3k
ND87nLgsf6xW1hbJbC+f5+UdUkBizu3+MSCAivNcsc8Haqubm/Ue1s+e7Bh3rkzA
3fo4HfYGqJnAcZiD6EtXhtObOSCEIl3tHOpHkl2kf29G5H8SbPTosXuEZvNESjzx
PSNqyn9jSJHUPQLmPxRhi9ltfm4forZgYyBqQjHMUOBhhMZGdlrqaCSwTdxmwN2L
z62KZtWwP9g5Ac64fWJ+
=8BS/
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 3/5] ARM: OMAP: Correct save_boot_params and replace with 'C' function
2013-04-15 15:28 ` Tom Rini
@ 2013-04-15 15:33 ` Sricharan R
0 siblings, 0 replies; 14+ messages in thread
From: Sricharan R @ 2013-04-15 15:33 UTC (permalink / raw)
To: u-boot
On Monday 15 April 2013 08:58 PM, Tom Rini wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 04/15/2013 11:08 AM, Sricharan R wrote:
>> 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> --- There is a
>> checkpatch warning because of multiple assignments. The code looks
>> readable this way.
>>
>
> What/where?
>
In the below line pf the patch.
gd->arch.omap_boot_params.omap_bootdevice = boot_device =
> [snip]
>> + if ((boot_device >= BOOT_DEVICE_XIP) && + (boot_device <=
>> BOOT_DEVICE_MMC2)) {
>
> This will need to be rebased to use MMC_BOOT_DEVICES_START/END and I
> know you didn't test from eMMC on omap5_uevm then.
>
Yes, i was aware of this. Infact i saw before this series that
emmc was broken and your patch was fixing that. When i started this
series, your patch was not merged then. I can rebase on V2.
Regards,
Sricharan
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 3/5] ARM: OMAP: Correct save_boot_params and replace with 'C' function
2013-04-15 15:08 ` [U-Boot] [PATCH 3/5] ARM: OMAP: Correct save_boot_params and replace with 'C' function Sricharan R
2013-04-15 15:28 ` Tom Rini
@ 2013-04-15 16:22 ` Michael Cashwell
2013-04-16 4:04 ` Sricharan R
1 sibling, 1 reply; 14+ messages in thread
From: Michael Cashwell @ 2013-04-15 16:22 UTC (permalink / raw)
To: u-boot
Hi Sricharan,
I very much like how you've structured this. A vast improvement!
I haven't yet tried to apply the whole series but have one quick comment. In the new function:
static void save_omap_boot_params(void)
{
...
if (!(omap_hw_init_context() ==
OMAP_INIT_CONTEXT_UBOOT_AFTER_SPL)) {
...
} else {
...
}
wouldn't it be clearer to drop the boolean negation "!" and exchange the if/else bodies?
Best regards,
-Michael Cashwell
^ permalink raw reply [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 3/5] ARM: OMAP: Correct save_boot_params and replace with 'C' function
2013-04-15 16:22 ` Michael Cashwell
@ 2013-04-16 4:04 ` Sricharan R
0 siblings, 0 replies; 14+ messages in thread
From: Sricharan R @ 2013-04-16 4:04 UTC (permalink / raw)
To: u-boot
On Monday 15 April 2013 09:52 PM, Michael Cashwell wrote:
> Hi Sricharan,
>
> I very much like how you've structured this. A vast improvement!
>
> I haven't yet tried to apply the whole series but have one quick comment. In the new function:
>
> static void save_omap_boot_params(void)
> {
> ...
> if (!(omap_hw_init_context() ==
> OMAP_INIT_CONTEXT_UBOOT_AFTER_SPL)) {
> ...
> } else {
> ...
> }
>
> wouldn't it be clearer to drop the boolean negation "!" and exchange the if/else bodies?
>
hmm, will do and add a comment as well.
Regards,
Sricharan
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 4/5] ARM: OMAP: Cleanup boot parameters usage
2013-04-15 15:08 [U-Boot] [PATCH 0/5] ARM: OMAP: Cleanup save_boot_params function Sricharan R
` (2 preceding siblings ...)
2013-04-15 15:08 ` [U-Boot] [PATCH 3/5] ARM: OMAP: Correct save_boot_params and replace with 'C' function Sricharan R
@ 2013-04-15 15:08 ` Sricharan R
2013-04-15 15:35 ` Tom Rini
2013-04-15 15:08 ` [U-Boot] [PATCH 5/5] ARM: OMAP: Add arch_cpu_init function Sricharan R
4 siblings, 1 reply; 14+ messages in thread
From: Sricharan R @ 2013-04-15 15:08 UTC (permalink / raw)
To: u-boot
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>
---
arch/arm/cpu/armv7/lowlevel_init.S | 8 ++++-
arch/arm/cpu/armv7/omap-common/boot-common.c | 20 ++---------
arch/arm/cpu/armv7/omap-common/lowlevel_init.S | 46 ++----------------------
arch/arm/include/asm/arch-omap4/sys_proto.h | 11 ++----
arch/arm/include/asm/arch-omap5/sys_proto.h | 12 ++-----
arch/arm/include/asm/omap_common.h | 3 ++
common/spl/spl.c | 12 ++++---
include/configs/am335x_evm.h | 1 +
include/configs/pcm051.h | 1 +
include/configs/ti814x_evm.h | 1 +
include/spl.h | 1 -
11 files changed, 32 insertions(+), 84 deletions(-)
diff --git a/arch/arm/cpu/armv7/lowlevel_init.S b/arch/arm/cpu/armv7/lowlevel_init.S
index 0d45528..0a15aa4 100644
--- a/arch/arm/cpu/armv7/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/lowlevel_init.S
@@ -37,7 +37,13 @@ ENTRY(lowlevel_init)
*/
ldr sp, =CONFIG_SYS_INIT_SP_ADDR
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
-
+#ifdef CONFIG_SPL_BUILD
+ ldr r8, =gdata
+#else
+ sub sp, #GD_SIZE
+ bic sp, sp, #7
+ mov r8, sp
+#endif
/*
* Save the old lr(passed in ip) and the current lr to stack
*/
diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c
index 24cbe2d..6561957 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 @@
#include <asm/arch/mmc_host_def.h>
#include <asm/arch/sys_proto.h>
-/*
- * This is used to verify if the configuration header
- * was executed by rom code prior to control of transfer
- * to the bootloader. SPL is responsible for saving and
- * passing the boot_params pointer to the u-boot.
- */
-struct omap_boot_parameters boot_params __attribute__ ((section(".data")));
+DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_SPL_BUILD
-/*
- * We use static variables because global data is not ready yet.
- * Initialized data is available in SPL right from the beginning.
- * We would not typically need to save these parameters in regular
- * U-Boot. This is needed only in SPL at the moment.
- */
-u32 omap_bootmode = MMCSD_MODE_FAT;
-
u32 spl_boot_device(void)
{
- return (u32) (boot_params.omap_bootdevice);
+ return (u32) (gd->arch.omap_boot_params.omap_bootdevice);
}
u32 spl_boot_mode(void)
{
- return omap_bootmode;
+ return gd->arch.omap_boot_params.omap_bootmode;
}
void spl_board_init(void)
diff --git a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
index b933fe8..c489536 100644
--- a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
@@ -28,55 +28,13 @@
#include <config.h>
#include <asm/arch/omap.h>
+#include <asm/omap_common.h>
#include <asm/arch/spl.h>
#include <linux/linkage.h>
ENTRY(save_boot_params)
- /*
- * See if the rom code passed pointer is valid:
- * It is not valid if it is not in non-secure SRAM
- * This may happen if you are booting with the help of
- * debugger
- */
- ldr r2, =NON_SECURE_SRAM_START
- cmp r2, r0
- bgt 1f
- ldr r2, =NON_SECURE_SRAM_END
- cmp r2, r0
- blt 1f
-
- /*
- * store the boot params passed from rom code or saved
- * and passed by SPL
- */
- cmp r0, #0
- beq 1f
- ldr r1, =boot_params
+ ldr r1, =OMAP_SRAM_SCRATCH_BOOT_PARAMS
str r0, [r1]
-#ifdef CONFIG_SPL_BUILD
- /* Store the boot device in spl_boot_device */
- ldrb r2, [r0, #BOOT_DEVICE_OFFSET] @ r1 <- value of boot device
- and r2, #BOOT_DEVICE_MASK
- ldr r3, =boot_params
- strb r2, [r3, #BOOT_DEVICE_OFFSET] @ spl_boot_device <- r1
-
- /* boot mode is passed only for devices that can raw/fat mode */
- cmp r2, #BOOT_DEVICE_XIP
- blt 2f
- cmp r2, #BOOT_DEVICE_MMC2
- bgt 2f
- /* Store the boot mode (raw/FAT) in omap_bootmode */
- ldr r2, [r0, #DEV_DESC_PTR_OFFSET] @ get the device descriptor ptr
- ldr r2, [r2, #DEV_DATA_PTR_OFFSET] @ get the pDeviceData ptr
- ldr r2, [r2, #BOOT_MODE_OFFSET] @ get the boot mode
- ldr r3, =omap_bootmode
- str r2, [r3]
-#endif
-2:
- ldrb r2, [r0, #CH_FLAGS_OFFSET]
- ldr r3, =boot_params
- strb r2, [r3, #CH_FLAGS_OFFSET]
-1:
bx lr
ENDPROC(save_boot_params)
diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h b/arch/arm/include/asm/arch-omap4/sys_proto.h
index d5f1868..841388a 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 @@
#include <asm/omap_common.h>
#include <asm/arch/mux_omap4.h>
+DECLARE_GLOBAL_DATA_PTR;
+
struct omap_sysinfo {
char *board_string;
};
@@ -58,13 +60,6 @@ void omap_vc_init(u16 speed_khz);
int omap_vc_bypass_send_value(u8 sa, u8 reg_addr, u8 reg_data);
u32 warm_reset(void);
void force_emif_self_refresh(void);
-/*
- * This is used to verify if the configuration header
- * was executed by Romcode prior to control of transfer
- * to the bootloader. SPL is responsible for saving and
- * passing this to the u-boot.
- */
-extern struct omap_boot_parameters boot_params;
static inline u32 running_from_sdram(void)
{
@@ -84,7 +79,7 @@ static inline u8 uboot_loaded_by_spl(void)
* variable by both SPL and u-boot.Check out for CHSETTINGS, which is a
* mandatory section if CH is present.
*/
- if ((boot_params.ch_flags) & (CH_FLAGS_CHSETTINGS))
+ if ((gd->arch.omap_boot_params.ch_flags) & (CH_FLAGS_CHSETTINGS))
return 0;
else
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 e66ab44..1099ec3 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 @@
#include <asm/omap_common.h>
#include <asm/arch/clocks.h>
+DECLARE_GLOBAL_DATA_PTR;
+
struct pad_conf_entry {
u32 offset;
u32 val;
@@ -65,14 +67,6 @@ void force_emif_self_refresh(void);
void get_ioregs(const struct ctrl_ioregs **regs);
void srcomp_enable(void);
-/*
- * This is used to verify if the configuration header
- * was executed by Romcode prior to control of transfer
- * to the bootloader. SPL is responsible for saving and
- * passing this to the u-boot.
- */
-extern struct omap_boot_parameters boot_params;
-
static inline u32 running_from_sdram(void)
{
u32 pc;
@@ -91,7 +85,7 @@ static inline u8 uboot_loaded_by_spl(void)
* variable by both SPL and u-boot.Check out for CHSETTINGS, which is a
* mandatory section if CH is present.
*/
- if ((boot_params.ch_flags) & (CH_FLAGS_CHSETTINGS))
+ if ((gd->arch.omap_boot_params.ch_flags) & (CH_FLAGS_CHSETTINGS))
return 0;
else
return running_from_sdram();
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 6b73d86..9db4b1b 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -25,6 +25,8 @@
#ifndef _OMAP_COMMON_H_
#define _OMAP_COMMON_H_
+#ifndef __ASSEMBLY__
+
#include <common.h>
#define NUM_SYS_CLKS 8
@@ -557,6 +559,7 @@ static inline u32 omap_revision(void)
extern u32 *const omap_si_rev;
return *omap_si_rev;
}
+#endif
/*
* silicon revisions.
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 6715e0d..4a7ce42 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -125,17 +125,21 @@ void spl_parse_image_header(const struct image_header *header)
__weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
{
+#ifdef CONFIG_OMAP
typedef void __noreturn (*image_entry_noargs_t)(u32 *);
+#else
+ typedef void __noreturn (*image_entry_noargs_t)(void);
+#endif
image_entry_noargs_t image_entry =
(image_entry_noargs_t) spl_image->entry_point;
debug("image entry point: 0x%X\n", spl_image->entry_point);
/* Pass the saved boot_params from rom code */
-#if defined(CONFIG_VIRTIO) || defined(CONFIG_ZEBU)
- image_entry = (image_entry_noargs_t)0x80100000;
+#ifdef CONFIG_OMAP
+ image_entry((u32 *)&gd->arch.omap_boot_params);
+#else
+ image_entry();
#endif
- u32 boot_params_ptr_addr = (u32)&boot_params_ptr;
- image_entry((u32 *)boot_params_ptr_addr);
}
#ifdef CONFIG_SPL_RAM_DEVICE
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index b7c443c..976f4d1 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -17,6 +17,7 @@
#define __CONFIG_AM335X_EVM_H
#define CONFIG_AM33XX
+#define CONFIG_OMAP
#include <asm/arch/omap.h>
diff --git a/include/configs/pcm051.h b/include/configs/pcm051.h
index d0ea74e..5e5fab1 100644
--- a/include/configs/pcm051.h
+++ b/include/configs/pcm051.h
@@ -20,6 +20,7 @@
#define __CONFIG_PCM051_H
#define CONFIG_AM33XX
+#define CONFIG_OMAP
#include <asm/arch/omap.h>
diff --git a/include/configs/ti814x_evm.h b/include/configs/ti814x_evm.h
index 16547e3..68a7307 100644
--- a/include/configs/ti814x_evm.h
+++ b/include/configs/ti814x_evm.h
@@ -19,6 +19,7 @@
#define CONFIG_TI81XX
#define CONFIG_TI814X
#define CONFIG_SYS_NO_FLASH
+#define CONFIG_OMAP
#include <asm/arch/omap.h>
diff --git a/include/spl.h b/include/spl.h
index b40be80..4bc1dd1 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -44,7 +44,6 @@ struct spl_image_info {
#define SPL_COPY_PAYLOAD_ONLY 1
extern struct spl_image_info spl_image;
-extern u32 *boot_params_ptr;
/* SPL common functions */
void preloader_console_init(void);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 4/5] ARM: OMAP: Cleanup boot parameters usage
2013-04-15 15:08 ` [U-Boot] [PATCH 4/5] ARM: OMAP: Cleanup boot parameters usage Sricharan R
@ 2013-04-15 15:35 ` Tom Rini
2013-04-15 15:39 ` Sricharan R
0 siblings, 1 reply; 14+ messages in thread
From: Tom Rini @ 2013-04-15 15:35 UTC (permalink / raw)
To: u-boot
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 04/15/2013 11:08 AM, Sricharan R wrote:
> 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> ---
> arch/arm/cpu/armv7/lowlevel_init.S | 8 ++++-
> arch/arm/cpu/armv7/omap-common/boot-common.c | 20 ++---------
> arch/arm/cpu/armv7/omap-common/lowlevel_init.S | 46
> ++----------------------
> arch/arm/include/asm/arch-omap4/sys_proto.h | 11 ++----
> arch/arm/include/asm/arch-omap5/sys_proto.h | 12 ++-----
> arch/arm/include/asm/omap_common.h | 3 ++
> common/spl/spl.c | 12 ++++---
> include/configs/am335x_evm.h | 1 +
> include/configs/pcm051.h | 1 +
> include/configs/ti814x_evm.h | 1 +
> include/spl.h | 1 - 11 files
> changed, 32 insertions(+), 84 deletions(-)
I can live with adding CONFIG_OMAP to the am335/ti81* parts.
[snip]
> diff --git a/common/spl/spl.c b/common/spl/spl.c index
> 6715e0d..4a7ce42 100644 --- a/common/spl/spl.c +++
> b/common/spl/spl.c @@ -125,17 +125,21 @@ void
> spl_parse_image_header(const struct image_header *header)
>
> __weak void __noreturn jump_to_image_no_args(struct spl_image_info
> *spl_image) { +#ifdef CONFIG_OMAP typedef void __noreturn
> (*image_entry_noargs_t)(u32 *); +#else + typedef void __noreturn
> (*image_entry_noargs_t)(void); +#endif image_entry_noargs_t
> image_entry = (image_entry_noargs_t) spl_image->entry_point;
>
> debug("image entry point: 0x%X\n", spl_image->entry_point); /*
> Pass the saved boot_params from rom code */ -#if
> defined(CONFIG_VIRTIO) || defined(CONFIG_ZEBU) - image_entry =
> (image_entry_noargs_t)0x80100000; +#ifdef CONFIG_OMAP +
> image_entry((u32 *)&gd->arch.omap_boot_params); +#else +
> image_entry(); #endif - u32 boot_params_ptr_addr =
> (u32)&boot_params_ptr; - image_entry((u32 *)boot_params_ptr_addr);
> }
We must correct jump_to_image_no_args to really be, in the default
case here just image_entry() and have omap-common override the weak
function with one that passes along our params, and comment what's
going on.
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRbB4/AAoJENk4IS6UOR1WeWgP/3YpBeHa7RCjfc1ZfHjHSX4T
RlULN42HhNG/pka7S/bTo83whcVLDYz3WXYLWDYO6YVCnpaU1dfV2SuXeKjJIA9M
rfB/q2pIc6Wnjcfzrazdh7LS1A/0iV3qe4AUBgkaVJdQX+q5WwJoHVjzp1WH7aOH
/iXUR9pnhPnv8Uc+DJwtoT9fnDH5TkeMeSkVKe2mJEYPbSiKhmPHfKDvwbX7VfPl
IAD6ifda7rApH4QTWFyFj+9MsfW/XkdILmg4JaGQU5Gp6DwVC2cmNS47br5d9WeV
dsY+vA8Fezw+/HT5Jq7HBAmhy+gu7x7gpnYs5IzOSlWS+32W6HWoPzo/CHcnCaGt
1ltB44KevYu5FCrBA4KlJsoMx9JR1yJukOv3ezEFe2G9PBPyylLwTJ0tkVJb0b2H
fJO2fPCWbOHzvIy5nIFFY0sE9YsnKu8PAxqPFYaJGeUWQL87kRo9E0ep72HUv/Ia
rrOD6KWgp6cHi1qrFqbnVctWbDKBjBCyd3kc1nhGSmZTSTUkd/9Z6ie3i+wOyYsO
yBtG9S6riJDcECcE8nOxXRfW973aqxkH7ybNn5ekbYdP8iHq+UgFx8rfhf73gaen
c07fmIZJxz7i0KXNTsjHGycDMq7UqsihrdX47C9kcrcFqxEWAcZc8kXBlM1Kura2
EX40u9fhgitYG8EG4GGo
=5qv1
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 4/5] ARM: OMAP: Cleanup boot parameters usage
2013-04-15 15:35 ` Tom Rini
@ 2013-04-15 15:39 ` Sricharan R
2013-04-15 15:43 ` Tom Rini
0 siblings, 1 reply; 14+ messages in thread
From: Sricharan R @ 2013-04-15 15:39 UTC (permalink / raw)
To: u-boot
On Monday 15 April 2013 09:05 PM, Tom Rini wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 04/15/2013 11:08 AM, Sricharan R wrote:
>> 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> ---
>> arch/arm/cpu/armv7/lowlevel_init.S | 8 ++++-
>> arch/arm/cpu/armv7/omap-common/boot-common.c | 20 ++---------
>> arch/arm/cpu/armv7/omap-common/lowlevel_init.S | 46
>> ++----------------------
>> arch/arm/include/asm/arch-omap4/sys_proto.h | 11 ++----
>> arch/arm/include/asm/arch-omap5/sys_proto.h | 12 ++-----
>> arch/arm/include/asm/omap_common.h | 3 ++
>> common/spl/spl.c | 12 ++++---
>> include/configs/am335x_evm.h | 1 +
>> include/configs/pcm051.h | 1 +
>> include/configs/ti814x_evm.h | 1 +
>> include/spl.h | 1 - 11 files
>> changed, 32 insertions(+), 84 deletions(-)
>
> I can live with adding CONFIG_OMAP to the am335/ti81* parts.
Thanks. I was suspicious about this.
BTW, does am335/ti81 devices get the bootparams from romcode
in the same as OMAP ?
Also are there any am335 boards with XIP where i can test this ?
>
> [snip]
>> diff --git a/common/spl/spl.c b/common/spl/spl.c index
>> 6715e0d..4a7ce42 100644 --- a/common/spl/spl.c +++
>> b/common/spl/spl.c @@ -125,17 +125,21 @@ void
>> spl_parse_image_header(const struct image_header *header)
>>
>> __weak void __noreturn jump_to_image_no_args(struct spl_image_info
>> *spl_image) { +#ifdef CONFIG_OMAP typedef void __noreturn
>> (*image_entry_noargs_t)(u32 *); +#else + typedef void __noreturn
>> (*image_entry_noargs_t)(void); +#endif image_entry_noargs_t
>> image_entry = (image_entry_noargs_t) spl_image->entry_point;
>>
>> debug("image entry point: 0x%X\n", spl_image->entry_point); /*
>> Pass the saved boot_params from rom code */ -#if
>> defined(CONFIG_VIRTIO) || defined(CONFIG_ZEBU) - image_entry =
>> (image_entry_noargs_t)0x80100000; +#ifdef CONFIG_OMAP +
>> image_entry((u32 *)&gd->arch.omap_boot_params); +#else +
>> image_entry(); #endif - u32 boot_params_ptr_addr =
>> (u32)&boot_params_ptr; - image_entry((u32 *)boot_params_ptr_addr);
>> }
>
> We must correct jump_to_image_no_args to really be, in the default
> case here just image_entry() and have omap-common override the weak
> function with one that passes along our params, and comment what's
> going on.
>
ok, that looks cleaner. This change in V2.
Regards,
Sricharan
^ permalink raw reply [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 4/5] ARM: OMAP: Cleanup boot parameters usage
2013-04-15 15:39 ` Sricharan R
@ 2013-04-15 15:43 ` Tom Rini
2013-04-16 4:00 ` Sricharan R
0 siblings, 1 reply; 14+ messages in thread
From: Tom Rini @ 2013-04-15 15:43 UTC (permalink / raw)
To: u-boot
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 04/15/2013 11:39 AM, Sricharan R wrote:
> On Monday 15 April 2013 09:05 PM, Tom Rini wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>
>> On 04/15/2013 11:08 AM, Sricharan R wrote:
>>> 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> ---
>>> arch/arm/cpu/armv7/lowlevel_init.S | 8 ++++-
>>> arch/arm/cpu/armv7/omap-common/boot-common.c | 20
>>> ++--------- arch/arm/cpu/armv7/omap-common/lowlevel_init.S |
>>> 46 ++----------------------
>>> arch/arm/include/asm/arch-omap4/sys_proto.h | 11 ++----
>>> arch/arm/include/asm/arch-omap5/sys_proto.h | 12 ++-----
>>> arch/arm/include/asm/omap_common.h | 3 ++
>>> common/spl/spl.c | 12 ++++---
>>> include/configs/am335x_evm.h | 1 +
>>> include/configs/pcm051.h | 1 +
>>> include/configs/ti814x_evm.h | 1 +
>>> include/spl.h | 1 - 11
>>> files changed, 32 insertions(+), 84 deletions(-)
>>
>> I can live with adding CONFIG_OMAP to the am335/ti81* parts.
> Thanks. I was suspicious about this.
>
> BTW, does am335/ti81 devices get the bootparams from romcode in the
> same as OMAP ?
Yes, that's some common code we all share now.
> Also are there any am335 boards with XIP where i can test this ?
am335x can have NOR, and there is a NOR cape for beaglebone, but we
don't have everything for that in mainline just yet. Once that gets
closer I will check it out.
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRbCAxAAoJENk4IS6UOR1WYV8P/11BbdwmzsnP7kp1vfuBtPeW
cU4A0unTnX6WiIOtEUsOW7i0Mk8QFDsm6KknkCvkOw51Vs+cYTiYeB0hjEmKH129
DEEGGWkhoaupmRtPmmNGzZaCDGbBsWOMexwzCS6L5ozsYWov+FIJtsLVMNR7EV83
8f1O5TA6EtTjmJ31AjvkFTOyTej0p+I167+edLsCzeMCQyuVj/aKWoH2HCHWhkhb
fq/CYExXiW9uhxWKinvECuOk9Yjw9scQWfM21GQQL1GK9zMNv/hZ+SoLptX67twZ
SiQboUdVAz/VhvHC/CvsNjW3lGOVrV1YwAFlhYHrjboA7aAm7H8zQRNbF55r95bc
bjA6bBe8xIWqmeu6tWQRP9zej8V7NWKaGMhFHSqSIE9svCG/x7gUnFal2z3+0hCa
xaxUiJgAAFGmEQNaw9HJ3sLogc18pOLABUSCVmtNlpRh7qTpK7a4qs2bx8gT+FIS
H3GIQRya952wXFipjxnzdKzr4zPmTGtIwzR9PSYSiY0V5w5jsnZ2BBb0YAZNWy4E
SmdwmYb27g3sVNTZzE5UIwv2NM/EY1IpJAca2vCR2n52ibJqraOTqPHMAdya4BX1
I5UD5HiCsX4jokfF+eBl3JllYgj/JoqSQCLS/zpFu+qll1tZHEMIYkhKNU4nDPjg
Su8NIwR0hmJvuOEqtEsz
=U9OR
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 4/5] ARM: OMAP: Cleanup boot parameters usage
2013-04-15 15:43 ` Tom Rini
@ 2013-04-16 4:00 ` Sricharan R
0 siblings, 0 replies; 14+ messages in thread
From: Sricharan R @ 2013-04-16 4:00 UTC (permalink / raw)
To: u-boot
On Monday 15 April 2013 09:13 PM, Tom Rini wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 04/15/2013 11:39 AM, Sricharan R wrote:
>> On Monday 15 April 2013 09:05 PM, Tom Rini wrote:
>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>>
>>> On 04/15/2013 11:08 AM, Sricharan R wrote:
>>>> 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> ---
>>>> arch/arm/cpu/armv7/lowlevel_init.S | 8 ++++-
>>>> arch/arm/cpu/armv7/omap-common/boot-common.c | 20
>>>> ++--------- arch/arm/cpu/armv7/omap-common/lowlevel_init.S |
>>>> 46 ++----------------------
>>>> arch/arm/include/asm/arch-omap4/sys_proto.h | 11 ++----
>>>> arch/arm/include/asm/arch-omap5/sys_proto.h | 12 ++-----
>>>> arch/arm/include/asm/omap_common.h | 3 ++
>>>> common/spl/spl.c | 12 ++++---
>>>> include/configs/am335x_evm.h | 1 +
>>>> include/configs/pcm051.h | 1 +
>>>> include/configs/ti814x_evm.h | 1 +
>>>> include/spl.h | 1 - 11
>>>> files changed, 32 insertions(+), 84 deletions(-)
>>>
>>> I can live with adding CONFIG_OMAP to the am335/ti81* parts.
>> Thanks. I was suspicious about this.
>>
>> BTW, does am335/ti81 devices get the bootparams from romcode in the
>> same as OMAP ?
>
> Yes, that's some common code we all share now.
>
>> Also are there any am335 boards with XIP where i can test this ?
>
> am335x can have NOR, and there is a NOR cape for beaglebone, but we
> don't have everything for that in mainline just yet. Once that gets
> closer I will check it out.
>
Ok, thanks for that.
Regards,
Sricharan
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 5/5] ARM: OMAP: Add arch_cpu_init function
2013-04-15 15:08 [U-Boot] [PATCH 0/5] ARM: OMAP: Cleanup save_boot_params function Sricharan R
` (3 preceding siblings ...)
2013-04-15 15:08 ` [U-Boot] [PATCH 4/5] ARM: OMAP: Cleanup boot parameters usage Sricharan R
@ 2013-04-15 15:08 ` Sricharan R
4 siblings, 0 replies; 14+ messages in thread
From: Sricharan R @ 2013-04-15 15:08 UTC (permalink / raw)
To: u-boot
The boot parameters passed from SPL to UBOOT
must be saved as a part of uboot's gd data
as early as possible, before we will inadvertently
overwrite it. So adding a arch_cpu_init for the required
Socs to save it.
Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
arch/arm/cpu/armv7/omap-common/hwinit-common.c | 11 +++++++++++
include/configs/am335x_evm.h | 3 +++
include/configs/omap4_common.h | 4 ++++
include/configs/omap5_common.h | 4 ++++
include/configs/pcm051.h | 3 +++
include/configs/ti814x_evm.h | 3 +++
6 files changed, 28 insertions(+)
diff --git a/arch/arm/cpu/armv7/omap-common/hwinit-common.c b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
index 602e76e..c82208c 100644
--- a/arch/arm/cpu/armv7/omap-common/hwinit-common.c
+++ b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
@@ -147,6 +147,17 @@ static void save_omap_boot_params(void)
}
}
+#ifdef CONFIG_ARCH_CPU_INIT
+/*
+ * SOC specific cpu init
+ */
+int arch_cpu_init(void)
+{
+ save_omap_boot_params();
+ return 0;
+}
+#endif /* CONFIG_ARCH_CPU_INIT */
+
/*
* Routine: s_init
* Description: Does early system init of watchdog, muxing, andclocks
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 976f4d1..f207f66 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -256,6 +256,9 @@
#define CONFIG_SYS_BAUDRATE_TABLE { 110, 300, 600, 1200, 2400, \
4800, 9600, 14400, 19200, 28800, 38400, 56000, 57600, 115200 }
+/* CPU */
+#define CONFIG_ARCH_CPU_INIT
+
#define CONFIG_ENV_OVERWRITE 1
#define CONFIG_SYS_CONSOLE_INFO_QUIET
diff --git a/include/configs/omap4_common.h b/include/configs/omap4_common.h
index 6ae6a0f..7b7cc99 100644
--- a/include/configs/omap4_common.h
+++ b/include/configs/omap4_common.h
@@ -87,6 +87,10 @@
#define CONFIG_BAUDRATE 115200
#define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\
115200}
+
+/* CPU */
+#define CONFIG_ARCH_CPU_INIT
+
/* I2C */
#define CONFIG_HARD_I2C 1
#define CONFIG_SYS_I2C_SPEED 100000
diff --git a/include/configs/omap5_common.h b/include/configs/omap5_common.h
index af97564..28a74ae 100644
--- a/include/configs/omap5_common.h
+++ b/include/configs/omap5_common.h
@@ -87,6 +87,10 @@
#define CONFIG_BAUDRATE 115200
#define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\
115200}
+
+/* CPU */
+#define CONFIG_ARCH_CPU_INIT
+
/* I2C */
#define CONFIG_HARD_I2C
#define CONFIG_SYS_I2C_SPEED 100000
diff --git a/include/configs/pcm051.h b/include/configs/pcm051.h
index 5e5fab1..9614f70 100644
--- a/include/configs/pcm051.h
+++ b/include/configs/pcm051.h
@@ -195,6 +195,9 @@
#define CONFIG_SYS_BAUDRATE_TABLE { 110, 300, 600, 1200, 2400, \
4800, 9600, 14400, 19200, 28800, 38400, 56000, 57600, 115200 }
+/* CPU */
+#define CONFIG_ARCH_CPU_INIT
+
#define CONFIG_ENV_OVERWRITE
#define CONFIG_SYS_CONSOLE_INFO_QUIET
diff --git a/include/configs/ti814x_evm.h b/include/configs/ti814x_evm.h
index 68a7307..8ba1e1b 100644
--- a/include/configs/ti814x_evm.h
+++ b/include/configs/ti814x_evm.h
@@ -163,6 +163,9 @@
#define CONFIG_BAUDRATE 115200
+/* CPU */
+#define CONFIG_ARCH_CPU_INIT
+
#define CONFIG_ENV_OVERWRITE
#define CONFIG_CONS_INDEX 1
#define CONFIG_SYS_CONSOLE_INFO_QUIET
--
1.7.9.5
^ permalink raw reply related [flat|nested] 14+ messages in thread