[U-Boot] [PATCH 10/17] OMAP4/5: device: Add support to get the device type.

R Sricharan r.sricharan at ti.com
Fri Feb 17 13:05:26 CET 2012


Add support to identify the device as GP/EMU/HS.

Signed-off-by: R Sricharan <r.sricharan at ti.com>
---
 arch/arm/cpu/armv7/omap-common/hwinit-common.c |    6 +++++-
 arch/arm/include/asm/arch-omap4/omap.h         |    4 ++++
 arch/arm/include/asm/arch-omap5/omap.h         |    4 ++++
 3 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/hwinit-common.c b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
index ab46bff..10e7669 100644
--- a/arch/arm/cpu/armv7/omap-common/hwinit-common.c
+++ b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
@@ -217,7 +217,11 @@ int arch_cpu_init(void)
  */
 u32 get_device_type(void)
 {
-	return 0;
+	struct omap_sys_ctrl_regs *ctrl =
+		      (struct omap_sys_ctrl_regs *) SYSCTRL_GENERAL_CORE_BASE;
+
+	return (readl(&ctrl->control_status) &
+				      (DEVICE_TYPE_MASK)) >> DEVICE_TYPE_SHIFT;
 }
 
 /*
diff --git a/arch/arm/include/asm/arch-omap4/omap.h b/arch/arm/include/asm/arch-omap4/omap.h
index 5fd692f..3a39787 100644
--- a/arch/arm/include/asm/arch-omap4/omap.h
+++ b/arch/arm/include/asm/arch-omap4/omap.h
@@ -139,6 +139,10 @@ struct s32ktimer {
 	unsigned int s32k_cr;	/* 0x10 */
 };
 
+#define DEVICE_TYPE_SHIFT (0x8)
+#define DEVICE_TYPE_MASK (0x7 << DEVICE_TYPE_SHIFT)
+#define DEVICE_GP 0x3
+
 struct omap_sys_ctrl_regs {
 	unsigned int pad1[129];
 	unsigned int control_id_code;			/* 0x4A002204 */
diff --git a/arch/arm/include/asm/arch-omap5/omap.h b/arch/arm/include/asm/arch-omap5/omap.h
index 7e17c76..2725392 100644
--- a/arch/arm/include/asm/arch-omap5/omap.h
+++ b/arch/arm/include/asm/arch-omap5/omap.h
@@ -136,6 +136,10 @@ struct s32ktimer {
 	unsigned int s32k_cr;	/* 0x10 */
 };
 
+#define DEVICE_TYPE_SHIFT 0x6
+#define DEVICE_TYPE_MASK (0x7 << DEVICE_TYPE_SHIFT)
+#define DEVICE_GP 0x3
+
 struct omap_sys_ctrl_regs {
 	u32 pad0[77]; /* 0x4A002000 */
 	u32 control_status; /* 0x4A002134 */
-- 
1.7.1



More information about the U-Boot mailing list