public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sanjeev Premi <premi@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] omap3: Identify cpu in s_init()
Date: Tue, 15 Dec 2009 18:48:26 +0530	[thread overview]
Message-ID: <1260883106-4588-3-git-send-email-premi@ti.com> (raw)
In-Reply-To: <1260883106-4588-1-git-send-email-premi@ti.com>

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@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

  parent reply	other threads:[~2009-12-15 13:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-15 13:18 [U-Boot] [PATCH 0/2] omap3: Optimize detection of cpu revision Sanjeev Premi
2009-12-15 13:18 ` [U-Boot] [PATCH 1/2] omap3: Identify the CPU in arch_cpu_init() Sanjeev Premi
2009-12-15 13:18 ` Sanjeev Premi [this message]
2009-12-15 17:14 ` [U-Boot] [PATCH 0/2] omap3: Optimize detection of cpu revision Tom
2009-12-15 18:44   ` Premi, Sanjeev
2009-12-16 22:15     ` Wolfgang Denk
2010-01-07 14:56 ` Premi, Sanjeev
2010-01-07 15:32   ` Paulraj, Sandeep
2010-01-08 10:41     ` Premi, Sanjeev
2010-01-11 17:15     ` Premi, Sanjeev
2010-01-12 13:44       ` Tom
2010-01-17 21:32       ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1260883106-4588-3-git-send-email-premi@ti.com \
    --to=premi@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox