From: Sanjeev Premi <premi@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] omap3: Identify the CPU in arch_cpu_init()
Date: Tue, 15 Dec 2009 18:48:25 +0530 [thread overview]
Message-ID: <1260883106-4588-2-git-send-email-premi@ti.com> (raw)
In-Reply-To: <1260883106-4588-1-git-send-email-premi@ti.com>
The function get_cpu_rev() is called multiple times
during execution resulting in probe into the IDCODE
register to extract the revision information.
This patch does the following:
- Moves the steps to identify static cpu information
into arch_cpu_init().
- Updates configs for all omap3 boards to define
CONFIG_ARCH_CPU_INIT.
- Updates get_cpu_rev() to return value calculated in
arch_cpu_init().
- Since revision isn't expected to be longer than 8bits,
get_cpu_rev() return a u8 value instead of u32.
Signed-off-by: Sanjeev Premi <premi@ti.com>
---
cpu/arm_cortexa8/omap3/sys_info.c | 60 +++++++++++++++++++------------
include/asm-arm/arch-omap3/sys_proto.h | 2 +-
include/configs/omap3_beagle.h | 2 +
include/configs/omap3_evm.h | 2 +
include/configs/omap3_overo.h | 2 +
include/configs/omap3_pandora.h | 2 +
include/configs/omap3_zoom1.h | 2 +
include/configs/omap3_zoom2.h | 2 +
8 files changed, 50 insertions(+), 24 deletions(-)
diff --git a/cpu/arm_cortexa8/omap3/sys_info.c b/cpu/arm_cortexa8/omap3/sys_info.c
index 31b2003..40866ae 100644
--- a/cpu/arm_cortexa8/omap3/sys_info.c
+++ b/cpu/arm_cortexa8/omap3/sys_info.c
@@ -41,6 +41,41 @@ static char *rev_s[CPU_3XX_MAX_REV] = {
"3.0",
"3.1"};
+static u8 cpu_revision;
+
+/**
+ * Perform architecture specific initialization.
+ *
+ * Currently, it identifies the cpu revision.
+ */
+int arch_cpu_init (void)
+{
+ u32 cpuid = 0;
+ struct ctrl_id *id_base;
+
+ /*
+ * On ES1.0 the IDCODE register is not exposed on L4
+ * so using CPU ID to differentiate between ES1.0 and > ES1.0.
+ */
+ __asm__ __volatile__("mrc p15, 0, %0, c0, c0, 0":"=r"(cpuid));
+ if ((cpuid & 0xf) == 0x0) {
+ cpu_revision = CPU_3XX_ES10;
+ } else {
+ /* Decode the IDs on > ES1.0 */
+ id_base = (struct ctrl_id *) OMAP34XX_ID_L4_IO_BASE;
+
+ cpuid = readl(&id_base->idcode);
+
+ cpu_revision = (cpuid >> CPU_3XX_ID_SHIFT) & 0xf;
+
+ /* Some early ES2.0 seem to report rev 0, fix this */
+ if(cpu_revision == 0)
+ cpu_revision = CPU_3XX_ES20;
+ }
+
+ return 0;
+}
+
/*****************************************************************
* dieid_num_r(void) - read and set die ID
*****************************************************************/
@@ -78,30 +113,9 @@ u32 get_cpu_type(void)
/******************************************
* get_cpu_rev(void) - extract version info
******************************************/
-u32 get_cpu_rev(void)
+u8 get_cpu_rev(void)
{
- u32 cpuid = 0;
- struct ctrl_id *id_base;
-
- /*
- * On ES1.0 the IDCODE register is not exposed on L4
- * so using CPU ID to differentiate between ES1.0 and > ES1.0.
- */
- __asm__ __volatile__("mrc p15, 0, %0, c0, c0, 0":"=r"(cpuid));
- if ((cpuid & 0xf) == 0x0)
- return CPU_3XX_ES10;
- else {
- /* Decode the IDs on > ES1.0 */
- id_base = (struct ctrl_id *) OMAP34XX_ID_L4_IO_BASE;
-
- cpuid = (readl(&id_base->idcode) >> CPU_3XX_ID_SHIFT) & 0xf;
-
- /* Some early ES2.0 seem to report ID 0, fix this */
- if(cpuid == 0)
- cpuid = CPU_3XX_ES20;
-
- return cpuid;
- }
+ return cpu_revision;
}
/****************************************************
diff --git a/include/asm-arm/arch-omap3/sys_proto.h b/include/asm-arm/arch-omap3/sys_proto.h
index 34bd515..1c99c45 100644
--- a/include/asm-arm/arch-omap3/sys_proto.h
+++ b/include/asm-arm/arch-omap3/sys_proto.h
@@ -40,7 +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);
-u32 get_cpu_rev(void);
+u8 get_cpu_rev(void);
u32 get_mem_type(void);
u32 get_sysboot_value(void);
u32 is_gpmc_muxed(void);
diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index 19a5ec9..640562c 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -28,6 +28,8 @@
#ifndef __CONFIG_H
#define __CONFIG_H
+#define CONFIG_ARCH_CPU_INIT 1
+
/*
* High Level Configuration Options
*/
diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
index a5514ae..0e85393 100644
--- a/include/configs/omap3_evm.h
+++ b/include/configs/omap3_evm.h
@@ -33,6 +33,8 @@
#ifndef __CONFIG_H
#define __CONFIG_H
+#define CONFIG_ARCH_CPU_INIT 1
+
/*
* High Level Configuration Options
*/
diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
index ffb515d..4ff06a3 100644
--- a/include/configs/omap3_overo.h
+++ b/include/configs/omap3_overo.h
@@ -20,6 +20,8 @@
#ifndef __CONFIG_H
#define __CONFIG_H
+#define CONFIG_ARCH_CPU_INIT 1
+
/*
* High Level Configuration Options
*/
diff --git a/include/configs/omap3_pandora.h b/include/configs/omap3_pandora.h
index 6f21af3..fee592f 100644
--- a/include/configs/omap3_pandora.h
+++ b/include/configs/omap3_pandora.h
@@ -23,6 +23,8 @@
#ifndef __CONFIG_H
#define __CONFIG_H
+#define CONFIG_ARCH_CPU_INIT 1
+
/*
* High Level Configuration Options
*/
diff --git a/include/configs/omap3_zoom1.h b/include/configs/omap3_zoom1.h
index da4b677..8866cda 100644
--- a/include/configs/omap3_zoom1.h
+++ b/include/configs/omap3_zoom1.h
@@ -29,6 +29,8 @@
#ifndef __CONFIG_H
#define __CONFIG_H
+#define CONFIG_ARCH_CPU_INIT 1
+
/*
* High Level Configuration Options
*/
diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h
index 32cd6fd..5381aa9 100644
--- a/include/configs/omap3_zoom2.h
+++ b/include/configs/omap3_zoom2.h
@@ -30,6 +30,8 @@
#ifndef __CONFIG_H
#define __CONFIG_H
+#define CONFIG_ARCH_CPU_INIT 1
+
/*
* High Level Configuration Options
*/
--
1.6.2.2
next prev 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 ` Sanjeev Premi [this message]
2009-12-15 13:18 ` [U-Boot] [PATCH 2/2] omap3: Identify cpu in s_init() Sanjeev Premi
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-2-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