Skip to contentSkip to conversation

omap3evm: Fix mechanism to identify board revision

PATCH New Sanjeev Premi 2 participants 2 messages Oct 20, 2010 – Nov 3, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 omap3evm: Fix mechanism to identify board revision

Function omap3_evm_get_revision() - to identify the board revision was called at end of setup_net_chip().

Board revision can be ascertained only by identifying the Ethernet chipset - but combining setup operations with revision detection isn't a good idea. So, moved the function after call to setup_net_chip().

Function setup_net_chip() should be ideally be called only when CONFIG_CMD_NET is defined. But this leaves the board revision "undetected". This patch allows static definition of revision or default fallback to the latest revision.

---
 board/ti/evm/evm.c          |   22 +++++++++++++++++++---
 board/ti/evm/evm.h          |    2 ++
 include/configs/omap3_evm.h |    5 +++++
 3 files changed, 26 insertions(+), 3 deletions(-)
board/ti/evm/evm.c +19 -3
index 73330db..09d14f7 100644
@@ -46,6 +46,11 @@ u8 get_omap3_evm_rev(void)
 
 static void omap3_evm_get_revision(void)
 {
+#if defined(CONFIG_CMD_NET)
+	/*
+	 * Board revision can be ascertained only by identifying
+	 * the Ethernet chipset.
+	 */
 	unsigned int smsc_id;
 
 	/* Ethernet PHY ID is stored at ID_REV register */
@@ -62,6 +67,19 @@ static void omap3_evm_get_revision(void)
 	default:
 		omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
        }
+#else
+#if defined(CONFIG_STATIC_BOARD_REV)
+	/*
+	 * Look for static defintion of the board revision
+	 */
+	omap3_evm_version = CONFIG_STATIC_BOARD_REV;
+#else
+	/*
+	 * Fallback to the default above.
+	 */
+	omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
+#endif
+#endif	/* CONFIG_CMD_NET */
 }
 
 #ifdef CONFIG_USB_OMAP3
@@ -110,6 +128,7 @@ int misc_init_r(void)
 #if defined(CONFIG_CMD_NET)
 	setup_net_chip();
 #endif
+	omap3_evm_get_revision();
 
 	dieid_num_r();
 
@@ -163,9 +182,6 @@ 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)
board/ti/evm/evm.h +2 -0
index e2581f6..a76deb8 100644
@@ -47,7 +47,9 @@ enum {
 
 u8 get_omap3_evm_rev(void);
 
+#if defined(CONFIG_CMD_NET)
 static void setup_net_chip(void);
+#endif
 
 /*
  * IEN  - Input Enable
include/configs/omap3_evm.h +5 -0
index cd38698..271c985 100644
@@ -351,6 +351,11 @@ extern unsigned int boot_flash_type;
 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
 #define CONFIG_SYS_INIT_SP_ADDR		(LOW_LEVEL_SRAM_STACK - CONFIG_SYS_GBL_DATA_SIZE)
 
+/*
+ * Define the board revision statically
+ */
+/* #define CONFIG_STATIC_BOARD_REV	OMAP3EVM_BOARD_GEN_2 */
+
 /*----------------------------------------------------------------------------
  * SMSC9115 Ethernet from SMSC9118 family
  *----------------------------------------------------------------------------
Signature · 1 line
1.7.2.2
#1 lore raw

PATCH 1/1 omap3evm: Fix mechanism to identify board revision

Quoted 7 lines

-----Original Message-----
From: Premi, Sanjeev
Sent: Wednesday, October 20, 2010 4:21 PM
To: u-boot at lists.denx.de
Cc: Premi, Sanjeev
Subject: [PATCH] omap3evm: Fix mechanism to identify board revision

[snip]

Sandeep,

Pinging for status...

~sanjeev