This patch adds support for TI's recently announced
AM35x family of devices.

It implements function is_family() to differentiate
between OMAP34x/OMAP35x and AM35x device families at
runtime.

  [1] http://www.ti.com/sitara
  [2] http://www.ti.com/arm
  [3] 
http://tiexpressdsp.com/index.php?title=Applications_Processors_Crossreference
  [4] http://marc.info/?l=linux-omap&m=125615009412281&w=2

Signed-off-by: Sanjeev Premi <pr...@ti.com>
---
 cpu/arm_cortexa8/omap3/sys_info.c      |   42 ++++++++++++++++++++++++++++----
 include/asm-arm/arch-omap3/omap3.h     |   14 ++++++++++
 include/asm-arm/arch-omap3/sys_proto.h |    1 +
 3 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/cpu/arm_cortexa8/omap3/sys_info.c 
b/cpu/arm_cortexa8/omap3/sys_info.c
index 449262a..6206e17 100644
--- a/cpu/arm_cortexa8/omap3/sys_info.c
+++ b/cpu/arm_cortexa8/omap3/sys_info.c
@@ -41,16 +41,19 @@ static char *rev_s[CPU_3XX_MAX_REV] = {
                                "3.0",
                                "3.1"};
 
-static u8 cpu_revision;
+static u16 cpu_family;
+static u16 cpu_id;
+static u8  cpu_revision;
 
 /**
  * Identify the silicon
  *
- * Currently, it identifies the cpu revision.
+ * Currently, it identifies the cpu family and silicon revision.
  */
 void identify_cpu (void)
 {
        u32 cpuid = 0;
+       u16 hawkeye;
        struct ctrl_id *id_base;
 
        /*
@@ -59,6 +62,7 @@ void identify_cpu (void)
         */
        __asm__ __volatile__("mrc p15, 0, %0, c0, c0, 0":"=r"(cpuid));
        if ((cpuid & 0xf) == 0x0) {
+               cpu_family = CPU_OMAP34XX;
                cpu_revision = CPU_3XX_ES10;
        } else {
                /* Decode the IDs on > ES1.0 */
@@ -66,11 +70,26 @@ void identify_cpu (void)
 
                cpuid = readl(&id_base->idcode);
 
+               hawkeye  = (cpuid >> HAWKEYE_SHIFT) & 0xffff;
                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;
+               switch (hawkeye) {
+               case HAWKEYE_OMAP34XX:
+                       cpu_family = CPU_OMAP34XX;
+
+                       /* Some early ES2.0 seem to report ID 0, fix this */
+                       if(cpu_revision == 0)
+                               cpu_revision = CPU_3XX_ES20;
+                       break;
+
+               case HAWKEYE_AM35XX:
+                       cpu_family = CPU_AM35XX;
+                       break;
+
+               default:
+                       cpu_family = CPU_OMAP34XX;
+                       break;
+               }
        }
 }
 
@@ -89,6 +108,19 @@ int arch_cpu_init (void)
        return 0;
 }
 
+/**
+ * Check if cpu belongs to specific family
+ *
+ * Returns 1 if true, 0 if false.
+ */
+u8 is_cpu_family(u16 family)
+{
+       if (cpu_family == family)
+               return 1;
+
+       return 0;
+}
+
 /*****************************************************************
  * dieid_num_r(void) - read and set die ID
  *****************************************************************/
diff --git a/include/asm-arm/arch-omap3/omap3.h 
b/include/asm-arm/arch-omap3/omap3.h
index 12815f6..86df1f2 100644
--- a/include/asm-arm/arch-omap3/omap3.h
+++ b/include/asm-arm/arch-omap3/omap3.h
@@ -183,4 +183,18 @@ struct gpio {
 #define WIDTH_8BIT             0x0000
 #define WIDTH_16BIT            0x1000  /* bit pos for 16 bit in gpmc */
 
+/*
+ * Hawkeye values
+ */
+#define HAWKEYE_OMAP34XX       0xb7ae
+#define HAWKEYE_AM35XX         0xb868
+
+#define HAWKEYE_SHIFT          12
+
+/*
+ * Define CPU families
+ */
+#define CPU_OMAP34XX           0x3400  /* OMAP34xx/OMAP35 devices */
+#define CPU_AM35XX             0x3500  /* AM35xx devices          */
+
 #endif
diff --git a/include/asm-arm/arch-omap3/sys_proto.h 
b/include/asm-arm/arch-omap3/sys_proto.h
index 9ddd272..0b6e48b 100644
--- a/include/asm-arm/arch-omap3/sys_proto.h
+++ b/include/asm-arm/arch-omap3/sys_proto.h
@@ -41,6 +41,7 @@ void watchdog_init(void);
 void set_muxconf_regs(void);
 
 void identify_cpu(void);
+u8 is_cpu_family(u16);
 u8 get_cpu_rev(void);
 u32 get_mem_type(void);
 u32 get_sysboot_value(void);
-- 
1.6.2.2

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to