[PATCH 1/6] omap3: Add macros to extract hawkeye and version

Sanjeev Premi premi at ti.com
Thu Dec 30 08:49:53 EST 2010


This patch adds macros to extract the hawkeye
and version number from IDCODE value.

Updated function get_cpu_rev() to use new macro.

Signed-off-by: Sanjeev Premi <premi at ti.com>
---
 arch/arm/mach-omap/include/mach/omap3-silicon.h |   16 ++++++++--------
 arch/arm/mach-omap/omap3_generic.c              |   12 ++++++------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap/include/mach/omap3-silicon.h b/arch/arm/mach-omap/include/mach/omap3-silicon.h
index 62e612b..0e6a45f 100644
--- a/arch/arm/mach-omap/include/mach/omap3-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap3-silicon.h
@@ -116,17 +116,17 @@
 #define OMAP_TAP_BASE		(OMAP_L4_WKUP_BASE + 0xA000)
 #define IDCODE_REG		(OMAP_TAP_BASE + 0x204)
 
-/************ Generic Chip specific Definitions **********/
-/**
- * CHIP			F number	HAWKEYE (hex)
- * OMAP3430 ES1.0	F771609		B6D6
- * OMAP3430 ES2.0	F771609A	B7AE
- */
+/** Masks to extract information from ID code register */
+#define IDCODE_HAWKEYE_MASK	0x0FFFF000
+#define IDCODE_VERSION_MASK	0xF0000000
+
+ #define get_hawkeye(v)		(((v) & IDCODE_HAWKEYE_MASK) >> 12)
+ #define get_version(v)		(((v) & IDCODE_VERSION_MASK) >> 28)
+
 #define HAWKEYE_ES1		0x0B6D6000
 #define HAWKEYE_ES2		0x0B7AE000
 #define HAWKEYE_ES2_1		0x1B7AE000
-#define HAWKEYE_MASK		0x0FFFF000
-#define VERSION_MASK		0xF0000000
+
 #define DEVICE_MASK		((0x1 << 8)|(0x1 << 9)|(0x1 << 10))
 
 #define OMAP_SDRC_CS0		0x80000000
diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index f780794..a079f38 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -82,13 +82,13 @@ u32 get_cpu_type(void)
 u32 get_cpu_rev(void)
 {
 	u32 idcode_val;
+	u32 version;
+
 	idcode_val = readl(IDCODE_REG);
-	if ((idcode_val & (HAWKEYE_MASK | VERSION_MASK)) == HAWKEYE_ES2_1)
-		return CPU_ES2P1;
-	if ((idcode_val & HAWKEYE_MASK) == HAWKEYE_ES2)
-		return CPU_ES2;
-	/* unsupported! */
-	return CPU_ES1;
+
+	version = get_version(idcode_val);
+
+	return version;
 }
 
 /**
-- 
1.7.2.2




More information about the barebox mailing list