Skip to contentSkip to conversation

omap3evm: Add board revision function

PATCH New Ajay Kumar Gupta 2 participants 3 messages Nov 13, 2009 – Nov 20, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 omap3evm: Add board revision function

Hi Vaibhav/Sanjeev,

Please review this which I plan to submit today.

It almost same as submited on lo.

Regards,
Ajay

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

---
Created against denx's u-boot master branch.

 board/ti/evm/evm.c |   29 +++++++++++++++++++++++++++++
 board/ti/evm/evm.h |   14 ++++++++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)
board/ti/evm/evm.c +29 -0
index 0718a08..6eacc00 100644
@@ -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.
@@ -45,6 +72,8 @@ int board_init(void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
 
+	omap3_evm_get_revision();
+
 	gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
 	/* board id for Linux */
 	gd->bd->bi_arch_number = MACH_TYPE_OMAP3EVM;
board/ti/evm/evm.h +14 -0
index 37da29d..e2581f6 100644
@@ -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);
 
 /*
Signature · 1 line
1.6.2.4
#1 lore raw

PATCH 1/1 omap3evm: Add board revision function

Somehow the local patch got sent to the list.
Apologies for it.

Please find the correct patch attached.

Regards,
Ajay

Quoted 104 lines

-----Original Message-----
From: Gupta, Ajay Kumar
Sent: Friday, November 13, 2009 3:24 PM
To: u-boot at lists.denx.de
Cc: Gupta, Ajay Kumar; Hiremath, Vaibhav; Premi, Sanjeev
Subject: [PATCH] omap3evm: Add board revision function

Hi Vaibhav/Sanjeev,

Please review this which I plan to submit today.

It almost same as submited on lo.

Regards,
Ajay

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

---
Created against denx's u-boot master branch.

 board/ti/evm/evm.c |   29 +++++++++++++++++++++++++++++
 board/ti/evm/evm.h |   14 ++++++++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)
board/ti/evm/evm.c +29 -0
index 0718a08..6eacc00 100644
@@ -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.
@@ -45,6 +72,8 @@ int board_init(void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
 
+	omap3_evm_get_revision();
+
 	gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
 	/* board id for Linux */
 	gd->bd->bi_arch_number = MACH_TYPE_OMAP3EVM;
board/ti/evm/evm.h +14 -1
index 37da29d..e2581f6 100644
@@ -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);
 
 /*
--
Quoted 1 line

1.6.2.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-omap3evm-Add-board-revision-function.patch
Type: application/octet-stream
Size: 2366 bytes
Desc: 0001-omap3evm-Add-board-revision-function.patch
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091113/cbe34ba3/attachment.obj

#2 lore raw

PATCH 1/1 omap3evm: Add board revision function

Hi,

Quoted 7 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Gupta, Ajay Kumar
Sent: Friday, November 13, 2009 3:31 PM
To: u-boot at lists.denx.de
Cc: Hiremath, Vaibhav
Subject: Re: [U-Boot] [PATCH] omap3evm: Add board revision function

<snip...>

Quoted 9 lines

board/ti/evm/evm.c int board_init(void) · line 76

Quoted 9 lines

/*
* Routine: board_init
* Description: Early hardware init.

board/ti/evm/evm.c +2 -0
@@ -45,6 +72,8 @@ int board_init(void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
 
+	omap3_evm_get_revision();
+

This must be called after setup_net_chip() else ethernet id Read statement wouldn't work.

I will resubmit this patch.

Regards,
ajay

Quoted 30 lines
Quoted 30 lines
board/ti/evm/evm.c +0 -0
 	gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
 	/* board id for Linux */
 	gd->bd->bi_arch_number = MACH_TYPE_OMAP3EVM;
board/ti/evm/evm.h +14 -1
index 37da29d..e2581f6 100644
@@ -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