From: Sanjeev Premi <premi@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] OMAP3, AM35x: Detect exact CPU in arch_cpu_init()
Date: Wed, 16 Dec 2009 00:07:44 +0530 [thread overview]
Message-ID: <1260902266-26009-3-git-send-email-premi@ti.com> (raw)
In-Reply-To: <1260902266-26009-1-git-send-email-premi@ti.com>
This patch identifies exact cpu in function arch_cpu_init().
It does the following:
- It consolidates all related #defines into omap3.h.
- Prefixes CTRL_ to #defines used in comparison against
contents of Control Status Register returned by the
function get_cpu_type().
- Adds new #defines to identify exact CPU id.
Signed-off-by: Sanjeev Premi <premi@ti.com>
---
cpu/arm_cortexa8/omap3/sys_info.c | 55 ++++++++++++++++++++++++++++++++++-
include/asm-arm/arch-omap3/cpu.h | 6 ----
include/asm-arm/arch-omap3/omap3.h | 26 +++++++++++++++-
3 files changed, 77 insertions(+), 10 deletions(-)
diff --git a/cpu/arm_cortexa8/omap3/sys_info.c b/cpu/arm_cortexa8/omap3/sys_info.c
index 6206e17..3544d26 100644
--- a/cpu/arm_cortexa8/omap3/sys_info.c
+++ b/cpu/arm_cortexa8/omap3/sys_info.c
@@ -45,14 +45,17 @@ static u16 cpu_family;
static u16 cpu_id;
static u8 cpu_revision;
+static u32 get_cpu_type(void);
+
/**
* Identify the silicon
*
- * Currently, it identifies the cpu family and silicon revision.
+ * It identifies the cpu family, exact cpu and silicon revision.
*/
void identify_cpu (void)
{
u32 cpuid = 0;
+ u32 cputype;
u16 hawkeye;
struct ctrl_id *id_base;
@@ -73,6 +76,9 @@ void identify_cpu (void)
hawkeye = (cpuid >> HAWKEYE_SHIFT) & 0xffff;
cpu_revision = (cpuid >> CPU_3XX_ID_SHIFT) & 0xf;
+ /*
+ * Identify cpu family and revision
+ */
switch (hawkeye) {
case HAWKEYE_OMAP34XX:
cpu_family = CPU_OMAP34XX;
@@ -90,6 +96,51 @@ void identify_cpu (void)
cpu_family = CPU_OMAP34XX;
break;
}
+
+ cputype = get_cpu_type();
+ switch (cpu_family)
+ {
+ case CPU_OMAP34XX:
+ switch (cputype) {
+ case CTRL_OMAP3503:
+ cpu_id = OMAP3503;
+ break;
+ case CTRL_OMAP3515:
+ cpu_id = OMAP3515;
+ break;
+ case CTRL_OMAP3525:
+ cpu_id = OMAP3525;
+ break;
+ case CTRL_OMAP3530:
+ cpu_id = OMAP3430; /* Same as OMAP3530 */
+ break;
+ default:
+ cpu_id = OMAP3430;
+ break;
+ }
+ break;
+
+ case CPU_AM35XX:
+ switch (cputype) {
+ case CTRL_AM3505:
+ cpu_id = AM3505;
+ break;
+ case CTRL_AM3517:
+ cpu_id = AM3517;
+ break;
+ default:
+ cpu_id = AM3505;
+ break;
+ }
+ break;
+
+ default:
+ /*
+ * Fall back to most common device
+ */
+ cpu_id = OMAP3430;
+ break;
+ }
}
}
@@ -150,7 +201,7 @@ void dieid_num_r(void)
/******************************************
* get_cpu_type(void) - extract cpu info
******************************************/
-u32 get_cpu_type(void)
+static u32 get_cpu_type(void)
{
return readl(&ctrl_base->ctrl_omap_stat);
}
diff --git a/include/asm-arm/arch-omap3/cpu.h b/include/asm-arm/arch-omap3/cpu.h
index 8ab2e39..088a342 100644
--- a/include/asm-arm/arch-omap3/cpu.h
+++ b/include/asm-arm/arch-omap3/cpu.h
@@ -60,12 +60,6 @@ struct ctrl {
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL_STRICT_NAMES */
-/* cpu type */
-#define OMAP3503 0x5c00
-#define OMAP3515 0x1c00
-#define OMAP3525 0x4c00
-#define OMAP3530 0x0c00
-
#ifndef __KERNEL_STRICT_NAMES
#ifndef __ASSEMBLY__
struct ctrl_id {
diff --git a/include/asm-arm/arch-omap3/omap3.h b/include/asm-arm/arch-omap3/omap3.h
index 86df1f2..af23e5d 100644
--- a/include/asm-arm/arch-omap3/omap3.h
+++ b/include/asm-arm/arch-omap3/omap3.h
@@ -161,8 +161,6 @@ struct gpio {
#define DDR_133 133 /* most combo, some mem d-boards */
#define DDR_165 165 /* future parts */
-#define CPU_3430 0x3430
-
/*
* 343x real hardware:
* ES1 = rev 0
@@ -197,4 +195,28 @@ struct gpio {
#define CPU_OMAP34XX 0x3400 /* OMAP34xx/OMAP35 devices */
#define CPU_AM35XX 0x3500 /* AM35xx devices */
+/*
+ * Define CPUs
+ */
+#define OMAP3430 0x3430
+
+#define OMAP3503 0x3503
+#define OMAP3515 0x3515
+#define OMAP3525 0x3525
+#define OMAP3530 0x3530
+
+#define AM3505 0x3505
+#define AM3517 0x3517
+
+/*
+ * Control status register values corresponding to cpu variants
+ */
+#define CTRL_OMAP3503 0x5c00
+#define CTRL_OMAP3515 0x1c00
+#define CTRL_OMAP3525 0x4c00
+#define CTRL_OMAP3530 0x0c00
+
+#define CTRL_AM3505 0x5c00
+#define CTRL_AM3517 0x1c00
+
#endif
--
1.6.2.2
next prev parent reply other threads:[~2009-12-15 18:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-15 18:37 [U-Boot] [PATCH 0/4] AM35x: Initial support for the processor Sanjeev Premi
2009-12-15 18:37 ` [U-Boot] [PATCH 1/4] AM35x: Introduce support for AM35x processors Sanjeev Premi
2009-12-15 18:37 ` Sanjeev Premi [this message]
2009-12-16 22:11 ` [U-Boot] [PATCH 2/4] OMAP3, AM35x: Detect exact CPU in arch_cpu_init() Wolfgang Denk
2009-12-15 18:37 ` [U-Boot] [PATCH 3/4] OMAP3, AM35x: Update function print_cpuinfo() Sanjeev Premi
2009-12-16 22:13 ` Wolfgang Denk
2009-12-15 18:37 ` [U-Boot] [PATCH 4/4] OMAP3, AM35x: Update the checks for CPU revision Sanjeev Premi
2009-12-15 20:01 ` [U-Boot] [PATCH 0/4] AM35x: Initial support for the processor Tom
2009-12-16 8:45 ` Hiremath, Vaibhav
2010-01-07 14:56 ` Premi, Sanjeev
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=1260902266-26009-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