Patchwork [U-Boot] omap3evm: Move function to identify board revision

login
register
mail settings
Submitter Sanjeev Premi
Date Oct. 19, 2010, 1:06 p.m.
Message ID <1287493608-13323-1-git-send-email-premi@ti.com>
Download mbox | patch
Permalink /patch/71884/
State Superseded
Delegated to: Sandeep Paulraj
Headers show

Comments

Sanjeev Premi - Oct. 19, 2010, 1:06 p.m.
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.

Moved the function and added detailed comment to set
the context.

Signed-off-by: Sanjeev Premi <premi@ti.com>
---
 board/ti/evm/evm.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
Sanjeev Premi - Oct. 19, 2010, 4:38 p.m.
> -----Original Message-----
> From: Premi, Sanjeev 
> Sent: Tuesday, October 19, 2010 6:37 PM
> To: u-boot@lists.denx.de
> Cc: Premi, Sanjeev
> Subject: [PATCH] omap3evm: Move function 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.
> 
> Moved the function and added detailed comment to set
> the context.
> 
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> ---
>  board/ti/evm/evm.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
> index 73330db..6163b12 100644
> --- a/board/ti/evm/evm.c
> +++ b/board/ti/evm/evm.c
> @@ -109,6 +109,12 @@ int misc_init_r(void)
>  
>  #if defined(CONFIG_CMD_NET)
>  	setup_net_chip();
> +
> +	/*
> +	 * Board revision can be ascertained only by identifying
> +	 * the Ethernet chipset.
> +	 */
> +	omap3_evm_get_revision();
>  #endif

[sp] While reviewing the code, I realized a "latent" bug that
     can hit us when CONFIG_CMD_NET is not defined.

     omap3_evm_get_revision() never gets called - value of
     omap3_evm_version is never set. So, value returned by
     get_omap3_evm_rev() depends upon compiler used.

     Please disregard this patch. I will submit a cleaned-up
     patch with takes care of this "latent" bug as well.

~sanjeev

>  
>  	dieid_num_r();
> @@ -163,9 +169,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)
> -- 
> 1.7.2.2
> 
>

Patch

diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index 73330db..6163b12 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -109,6 +109,12 @@  int misc_init_r(void)
 
 #if defined(CONFIG_CMD_NET)
 	setup_net_chip();
+
+	/*
+	 * Board revision can be ascertained only by identifying
+	 * the Ethernet chipset.
+	 */
+	omap3_evm_get_revision();
 #endif
 
 	dieid_num_r();
@@ -163,9 +169,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)