diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-02-11 18:38:38 -0500 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-03-20 22:39:10 +0100 |
commit | b6b4625d175019e387e5b0f65a17322a78f6bb90 (patch) | |
tree | b2ce2171c2fc2138f4a7d2f93a03e17559fd5b0a /board/netstal/common/nm_bsp.c | |
parent | 06a0c4381a65ed500c816a05b9ae7b207c3b1d4b (diff) | |
download | u-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/netstal/common/nm_bsp.c')
-rw-r--r-- | board/netstal/common/nm_bsp.c | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/board/netstal/common/nm_bsp.c b/board/netstal/common/nm_bsp.c index e38b706..237f4ed 100644 --- a/board/netstal/common/nm_bsp.c +++ b/board/netstal/common/nm_bsp.c @@ -83,40 +83,20 @@ void set_params_for_sw_install(int install_requested, char *board_name ) void common_misc_init_r(void) { - char *s = getenv(DEFAULT_ETH_ADDR); - char *e; - int i; - u32 serial = get_serial_number(); IPaddr_t ipaddr; char *ipstring; + uchar ethaddr[6]; - for (i = 0; i < 6; ++i) { - gd->bd->bi_enetaddr[i] = s ? simple_strtoul(s, &e, 16) : 0; - if (s) - s = (*e) ? e + 1 : e; - } - - if (gd->bd->bi_enetaddr[3] == 0 && - gd->bd->bi_enetaddr[4] == 0 && - gd->bd->bi_enetaddr[5] == 0) { - char ethaddr[22]; - + if (!eth_getenv_enetaddr(DEFAULT_ETH_ADDR, ethaddr)) { /* Must be in sync with CONFIG_ETHADDR */ - gd->bd->bi_enetaddr[0] = 0x00; - gd->bd->bi_enetaddr[1] = 0x60; - gd->bd->bi_enetaddr[2] = 0x13; - gd->bd->bi_enetaddr[3] = (serial >> 16) & 0xff; - gd->bd->bi_enetaddr[4] = (serial >> 8) & 0xff; - gd->bd->bi_enetaddr[5] = hcu_get_slot(); - sprintf(ethaddr, "%02X:%02X:%02X:%02X:%02X:%02X%c", - gd->bd->bi_enetaddr[0], gd->bd->bi_enetaddr[1], - gd->bd->bi_enetaddr[2], gd->bd->bi_enetaddr[3], - gd->bd->bi_enetaddr[4], - gd->bd->bi_enetaddr[5], - 0) ; - printf("%s: Setting eth %s serial 0x%x\n", __FUNCTION__, - ethaddr, serial); - setenv(DEFAULT_ETH_ADDR, ethaddr); + u32 serial = get_serial_number(); + ethaddr[0] = 0x00; + ethaddr[1] = 0x60; + ethaddr[2] = 0x13; + ethaddr[3] = (serial >> 16) & 0xff; + ethaddr[4] = (serial >> 8) & 0xff; + ethaddr[5] = hcu_get_slot(); + eth_setenv_enetaddr(DEFAULT_ETH_ADDR, ethaddr); } /* IP-Adress update */ |