]> git.sur5r.net Git - u-boot/commitdiff
OMAP4/5: device: Add support to get the device type.
authorSRICHARAN R <r.sricharan@ti.com>
Mon, 12 Mar 2012 02:25:43 +0000 (02:25 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Tue, 15 May 2012 06:31:24 +0000 (08:31 +0200)
Add support to identify the device as GP/EMU/HS.

Signed-off-by: R Sricharan <r.sricharan@ti.com>
arch/arm/cpu/armv7/omap-common/hwinit-common.c
arch/arm/include/asm/arch-omap4/omap.h
arch/arm/include/asm/arch-omap5/omap.h

index ab46bff5af7ab32b62e9fbb243e0896737c2a1aa..10e766980554a568f46665c6eea32090c1272ce1 100644 (file)
@@ -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;
 }
 
 /*
index 5fd692fe1364a0f2700cadbd7d98a93441c1b8e1..3a39787298b9456473af61176d9c8f7289bd899b 100644 (file)
@@ -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 */
index 7e17c76166274a5a62cd1a3618558f74c9a5c928..27253929699e5cf8f37bfa300495c156a2faa43b 100644 (file)
@@ -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 */