public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ajay Kumar Gupta <ajay.gupta@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/4 v2] omap3evm: Add board revision function
Date: Wed,  9 Jun 2010 16:15:33 +0530	[thread overview]
Message-ID: <1276080334-930-3-git-send-email-ajay.gupta@ti.com> (raw)
In-Reply-To: <1276080334-930-2-git-send-email-ajay.gupta@ti.com>

Added function to differentiate between the OMAP3EVM revisions. The
chip-id of the ethernet PHY is being used for this purpose.

Rev A to D : 0x01150000
Rev >= E   : 0x92200000

CC: Remy Bohmer <linux@bohmer.net>
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Sanjeev Premi <premi@ti.com>
Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
---
Changes from v1:
	- Fixed the signed-off-by: mail ids

 board/ti/evm/evm.c |   30 ++++++++++++++++++++++++++++++
 board/ti/evm/evm.h |   14 ++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index 0718a08..fcc1803 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -37,6 +37,33 @@
 #include <asm/mach-types.h>
 #include "evm.h"
 
+static u8 omap3_evm_version;
+
+u8 get_omap3_evm_rev(void)
+{
+	return omap3_evm_version;
+}
+
+static void omap3_evm_get_revision(void)
+{
+	unsigned int smsc_id;
+
+	/* Ethernet PHY ID is stored at ID_REV register */
+	smsc_id = readl(CONFIG_SMC911X_BASE + 0x50) & 0xFFFF0000;
+	printf("Read back SMSC id 0x%x\n", smsc_id);
+
+	switch (smsc_id) {
+	/* SMSC9115 chipset */
+	case 0x01150000:
+		omap3_evm_version = OMAP3EVM_BOARD_GEN_1;
+		break;
+	/* SMSC 9220 chipset */
+	case 0x92200000:
+	default:
+		omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
+       }
+}
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
@@ -121,6 +148,9 @@ static void setup_net_chip(void)
 	writel(GPIO0, &gpio3_base->cleardataout);
 	udelay(1);
 	writel(GPIO0, &gpio3_base->setdataout);
+
+	/* determine omap3evm revision */
+	omap3_evm_get_revision();
 }
 
 int board_eth_init(bd_t *bis)
diff --git a/board/ti/evm/evm.h b/board/ti/evm/evm.h
index 37da29d..e2581f6 100644
--- a/board/ti/evm/evm.h
+++ b/board/ti/evm/evm.h
@@ -33,6 +33,20 @@ const omap3_sysinfo sysinfo = {
 #endif
 };
 
+/*
+ * OMAP35x EVM revision
+ * Run time detection of EVM revision is done by reading Ethernet
+ * PHY ID -
+ *      GEN_1   = 0x01150000
+ *      GEN_2   = 0x92200000
+ */
+enum {
+	OMAP3EVM_BOARD_GEN_1 = 0,	/* EVM Rev between  A - D */
+	OMAP3EVM_BOARD_GEN_2,		/* EVM Rev >= Rev E */
+};
+
+u8 get_omap3_evm_rev(void);
+
 static void setup_net_chip(void);
 
 /*
-- 
1.6.2.4

  reply	other threads:[~2010-06-09 10:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09 10:45 [U-Boot] [PATCH 1/4 v2] musb: Use name based initialization for musb_config Ajay Kumar Gupta
2010-06-09 10:45 ` [U-Boot] [PATCH 2/4 v2] musb: Add Phy programming for using external Vbus Ajay Kumar Gupta
2010-06-09 10:45   ` Ajay Kumar Gupta [this message]
2010-06-09 10:45     ` [U-Boot] [PATCH 4/4] musb: Program extvbus for OMAP3EVM Rev >= E Ajay Kumar Gupta
2010-06-09 23:05   ` [U-Boot] [PATCH 2/4 v2] musb: Add Phy programming for using external Vbus Mike Frysinger
2010-06-10  5:46     ` Gupta, Ajay Kumar

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=1276080334-930-3-git-send-email-ajay.gupta@ti.com \
    --to=ajay.gupta@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