diff mbox

[U-Boot,v2] omap3evm: Set environment variable 'ethaddr'

Message ID 1314979036-4576-1-git-send-email-premi@ti.com
State Accepted
Commit 5e463a243aab3609892143302af4b9694df6acee
Headers show

Commit Message

Sanjeev Premi Sept. 2, 2011, 3:57 p.m. UTC
It is now responsibility of the board specific init
code to set the environment variable corresponding
to the MAC address.

Signed-off-by: Sanjeev Premi <premi@ti.com>
---

   Changes in v2:
   - Ensure that environment variable is set iff
     it wasn't already set earlier.

  Tested on omap3evm at against latest master at:
  bd061a5 : Merge branch 'master' of git://git.denx.de/u-boot-sh

  To build successfully, make this substituion in board/ti/evm/evm.c:
  -#include <asm/arch/gpio.h>
  +#include <asm/omap_gpio.h>
  This problem was addressed in separate RFC. Patches
  will follow shortly. (Substituion is not real fix).

 board/ti/evm/evm.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

Comments

Sanjeev Premi Oct. 25, 2011, 3:45 p.m. UTC | #1
> -----Original Message-----
> From: Premi, Sanjeev 
> Sent: Friday, September 02, 2011 9:27 PM
> To: u-boot@lists.denx.de
> Cc: Premi, Sanjeev
> Subject: [PATCH v2] omap3evm: Set environment variable 'ethaddr'
> 
> It is now responsibility of the board specific init
> code to set the environment variable corresponding
> to the MAC address.
> 
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> ---
> 
>    Changes in v2:
>    - Ensure that environment variable is set iff
>      it wasn't already set earlier.
> 
>   Tested on omap3evm at against latest master at:
>   bd061a5 : Merge branch 'master' of git://git.denx.de/u-boot-sh
> 
>   To build successfully, make this substituion in board/ti/evm/evm.c:
>   -#include <asm/arch/gpio.h>
>   +#include <asm/omap_gpio.h>
>   This problem was addressed in separate RFC. Patches
>   will follow shortly. (Substituion is not real fix).

Sandeep,

Wanted to check the status of this patch.
I believe I have addressed all concerns in v2.

Also, with generic gpio patches merged in, the "substitution" mentioned
above is not necessary.

I just validated this patch on ti/master. It applies cleanly and works
fine.

~sanjeev

> 
>  board/ti/evm/evm.c |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
> index 30c1c57..ae3f713 100644
> --- a/board/ti/evm/evm.c
> +++ b/board/ti/evm/evm.c
> @@ -216,7 +216,22 @@ int board_eth_init(bd_t *bis)
>  {
>  	int rc = 0;
>  #ifdef CONFIG_SMC911X
> +#define STR_ENV_ETHADDR	"ethaddr"
> +
> +	struct eth_device *dev;
> +	uchar eth_addr[6];
> +
>  	rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
> +
> +	if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
> +		dev = eth_get_dev_by_index(0);
> +		if (dev) {
> +			eth_setenv_enetaddr(STR_ENV_ETHADDR, 
> dev->enetaddr);
> +		} else {
> +			printf("omap3evm: Couldn't get eth device\n");
> +			rc = -1;
> +		}
> +	}
>  #endif
>  	return rc;
>  }
> -- 
> 1.7.0.4
> 
>
diff mbox

Patch

diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index 30c1c57..ae3f713 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -216,7 +216,22 @@  int board_eth_init(bd_t *bis)
 {
 	int rc = 0;
 #ifdef CONFIG_SMC911X
+#define STR_ENV_ETHADDR	"ethaddr"
+
+	struct eth_device *dev;
+	uchar eth_addr[6];
+
 	rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
+
+	if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
+		dev = eth_get_dev_by_index(0);
+		if (dev) {
+			eth_setenv_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
+		} else {
+			printf("omap3evm: Couldn't get eth device\n");
+			rc = -1;
+		}
+	}
 #endif
 	return rc;
 }