summaryrefslogtreecommitdiff
path: root/board/sixnet/sixnet.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-02-11 18:38:38 -0500
committerWolfgang Denk <wd@denx.de>2009-03-20 22:39:10 +0100
commitb6b4625d175019e387e5b0f65a17322a78f6bb90 (patch)
treeb2ce2171c2fc2138f4a7d2f93a03e17559fd5b0a /board/sixnet/sixnet.c
parent06a0c4381a65ed500c816a05b9ae7b207c3b1d4b (diff)
downloadu-boot-imx-b6b4625d175019e387e5b0f65a17322a78f6bb90.zip
u-boot-imx-b6b4625d175019e387e5b0f65a17322a78f6bb90.tar.gz
u-boot-imx-b6b4625d175019e387e5b0f65a17322a78f6bb90.tar.bz2
boards: get mac address from environment
The boards that get converted here to use the environment for the mac address rather than global data: debris mgcoge mgsuvd muas3001 netstal pn62 sixnet vcma9 xilinx (the ones that use xilinx_enet) Signed-off-by: Mike Frysinger <vapier@gentoo.org> CC: Ben Warren <biggerbadderben@gmail.com> CC: Sangmoon Kim <dogoil@etinsys.com> CC: Heiko Schocher <hs@denx.de> CC: David Mueller <d.mueller@elsoft.ch> CC: Niklaus Giger <niklaus.giger@netstal.com> CC: Wolfgang Grandegger <wg@denx.de> CC: Dave Ellis <DGE@sixnetio.com> CC: Ricardo Ribalda <ricardo.ribalda@uam.es>
Diffstat (limited to 'board/sixnet/sixnet.c')
-rw-r--r--board/sixnet/sixnet.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/board/sixnet/sixnet.c b/board/sixnet/sixnet.c
index 3ed581e..4fcd84b 100644
--- a/board/sixnet/sixnet.c
+++ b/board/sixnet/sixnet.c
@@ -264,6 +264,7 @@ int misc_init_r (void)
char* e;
int reg;
bd_t *bd = gd->bd;
+ uchar enetaddr[6];
memctl->memc_or2 = NVRAM_OR_PRELIM;
memctl->memc_br2 = NVRAM_BR_VALUE;
@@ -315,13 +316,9 @@ int misc_init_r (void)
* is present it gets a unique address, otherwise it
* shares the FEC address.
*/
- s = getenv("eth1addr");
- if (s == NULL)
- s = getenv("ethaddr");
- for (reg=0; reg<6; ++reg) {
- bd->bi_enet1addr[reg] = s ? simple_strtoul(s, &e, 16) : 0;
- if (s)
- s = (*e) ? e+1 : e;
+ if (!eth_getenv_enetaddr("eth1addr", enetaddr)) {
+ eth_getenv_enetaddr("ethaddr", enetaddr);
+ eth_setenv_enetaddr("eth1addr", enetaddr);
}
return (0);