From patchwork Wed Oct 20 10:51:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanjeev Premi X-Patchwork-Id: 71896 X-Patchwork-Delegate: s-paulraj@ti.com Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id 62E55136320 for ; Wed, 20 Oct 2010 12:54:38 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id 4D195348C9D1 for ; Wed, 20 Oct 2010 12:54:38 +0200 (CEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.17) for (single-drop); Wed, 20 Oct 2010 12:54:38 +0200 (CEST) Received: from murder ([192.168.8.180]) by backend2 (Cyrus v2.2.12) with LMTPA; Wed, 20 Oct 2010 12:52:05 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend1.mail.m-online.net (Cyrus v2.2.12) with LMTPA; Wed, 20 Oct 2010 12:52:05 +0200 Received: from scanner-2.m-online.net (scanner-2.mail.m-online.net [192.168.8.166]) by mail.m-online.net (Postfix) with ESMTP id 05D1B1C0038F; Wed, 20 Oct 2010 12:52:05 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-3.m-online.net (Postfix) with ESMTP id B5B7046C0A8; Wed, 20 Oct 2010 12:52:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A1FA428229; Wed, 20 Oct 2010 12:51:58 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rqmFthBZB4vl; Wed, 20 Oct 2010 12:51:58 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 50329281C6; Wed, 20 Oct 2010 12:51:52 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 21E64281AF for ; Wed, 20 Oct 2010 12:51:50 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ax1Bbw3S1SUk for ; Wed, 20 Oct 2010 12:51:48 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by theia.denx.de (Postfix) with ESMTPS id 06722281AE for ; Wed, 20 Oct 2010 12:51:46 +0200 (CEST) Received: from dbdp31.itg.ti.com ([172.24.170.98]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id o9KApfsr023330 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 20 Oct 2010 05:51:44 -0500 Received: from psplinux050.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o9KApe8q022959; Wed, 20 Oct 2010 16:21:40 +0530 (IST) From: Sanjeev Premi To: u-boot@lists.denx.de Date: Wed, 20 Oct 2010 16:21:20 +0530 Message-Id: <1287571880-31829-1-git-send-email-premi@ti.com> X-Mailer: git-send-email 1.7.2.2 Subject: [U-Boot] [PATCH] omap3evm: Fix mechanism to identify board revision X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Virus-Scanned: by amavisd-new at m-online.net 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. Signed-off-by: Sanjeev Premi --- 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(-) diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c index 73330db..09d14f7 100644 --- a/board/ti/evm/evm.c +++ b/board/ti/evm/evm.c @@ -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) diff --git a/board/ti/evm/evm.h b/board/ti/evm/evm.h index e2581f6..a76deb8 100644 --- a/board/ti/evm/evm.h +++ b/board/ti/evm/evm.h @@ -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 diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h index cd38698..271c985 100644 --- a/include/configs/omap3_evm.h +++ b/include/configs/omap3_evm.h @@ -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 *----------------------------------------------------------------------------