[U-Boot] [PATCH 2/2] omap3: Identify cpu in s_init()

Sanjeev Premi premi at ti.com
Tue Dec 15 14:18:26 CET 2009


When s_init() is called, the silicon version hasn't yet
been identified. This would lead to incorrect index in
the DPLL table.

This patch ensures that silicon is identified as first
step in s_init().

When called from s_init(), the globals updated in the
function identify_cpu() lie in 'relocated' address
space.

So, identify_cpu() is called again in arch_cpu_init().

Signed-off-by: Sanjeev Premi <premi at ti.com>
---
 cpu/arm_cortexa8/omap3/board.c         |    2 ++
 cpu/arm_cortexa8/omap3/sys_info.c      |   17 +++++++++++++++--
 include/asm-arm/arch-omap3/sys_proto.h |    1 +
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/cpu/arm_cortexa8/omap3/board.c b/cpu/arm_cortexa8/omap3/board.c
index 2aa69b3..2f27cb9 100644
--- a/cpu/arm_cortexa8/omap3/board.c
+++ b/cpu/arm_cortexa8/omap3/board.c
@@ -193,6 +193,8 @@ void s_init(void)
 {
 	int in_sdram = is_running_in_sdram();
 
+	identify_cpu();
+
 	watchdog_init();
 
 	try_unlock_memory();
diff --git a/cpu/arm_cortexa8/omap3/sys_info.c b/cpu/arm_cortexa8/omap3/sys_info.c
index 40866ae..449262a 100644
--- a/cpu/arm_cortexa8/omap3/sys_info.c
+++ b/cpu/arm_cortexa8/omap3/sys_info.c
@@ -44,11 +44,11 @@ static char *rev_s[CPU_3XX_MAX_REV] = {
 static u8 cpu_revision;
 
 /**
- * Perform architecture specific initialization.
+ * Identify the silicon
  *
  * Currently, it identifies the cpu revision.
  */
-int arch_cpu_init (void)
+void identify_cpu (void)
 {
 	u32 cpuid = 0;
 	struct ctrl_id *id_base;
@@ -72,6 +72,19 @@ int arch_cpu_init (void)
 		if(cpu_revision == 0)
 			cpu_revision = CPU_3XX_ES20;
 	}
+}
+
+/**
+ * Perform architecture specific initialization
+ */
+int arch_cpu_init (void)
+{
+	/*
+	 * The identification done in s_init is 'lost' due to
+	 * relocation. The variable contents are not same.
+	 * Function identify_cpu() is called again.
+	 */
+	identify_cpu();
 
 	return 0;
 }
diff --git a/include/asm-arm/arch-omap3/sys_proto.h b/include/asm-arm/arch-omap3/sys_proto.h
index 1c99c45..9ddd272 100644
--- a/include/asm-arm/arch-omap3/sys_proto.h
+++ b/include/asm-arm/arch-omap3/sys_proto.h
@@ -40,6 +40,7 @@ void enable_gpmc_cs_config(const u32 *gpmc_config, struct gpmc_cs *cs, u32 base,
 void watchdog_init(void);
 void set_muxconf_regs(void);
 
+void identify_cpu(void);
 u8 get_cpu_rev(void);
 u32 get_mem_type(void);
 u32 get_sysboot_value(void);
-- 
1.6.2.2



More information about the U-Boot mailing list