public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sanjeev Premi <premi@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] AM35x: Introduce support for AM35x processors
Date: Wed, 16 Dec 2009 00:07:43 +0530	[thread overview]
Message-ID: <1260902266-26009-2-git-send-email-premi@ti.com> (raw)
In-Reply-To: <1260902266-26009-1-git-send-email-premi@ti.com>

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 <premi@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

  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 ` Sanjeev Premi [this message]
2009-12-15 18:37 ` [U-Boot] [PATCH 2/4] OMAP3, AM35x: Detect exact CPU in arch_cpu_init() Sanjeev Premi
2009-12-16 22:11   ` 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-2-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