diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-02-11 19:09:54 -0500 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-03-20 22:39:11 +0100 |
commit | 03f3d8d3b39cf85c0ce7ca903b436701e8aa610b (patch) | |
tree | 290db467d9217ac53a4e6f799a3f7547a3da48a4 /drivers/net/smc911x.c | |
parent | c527ce92511cbf723c2ca77bee1cf9ecf83dac81 (diff) | |
download | u-boot-imx-03f3d8d3b39cf85c0ce7ca903b436701e8aa610b.zip u-boot-imx-03f3d8d3b39cf85c0ce7ca903b436701e8aa610b.tar.gz u-boot-imx-03f3d8d3b39cf85c0ce7ca903b436701e8aa610b.tar.bz2 |
lan91c96/smc91111/smc911x: get mac address from environment
The environment is the canonical storage location of the mac address, so
we're killing off the global data location and moving everything to
querying the env directly.
Also, do not bother checking the EEPROM if the env is setup. This
simplifies the code greatly.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Wolfgang Dnek <wd@denx.de>
CC: Ben Warren <biggerbadderben@gmail.com>
CC: Rolf Offermanns <rof@sysgo.de>
CC: Erik Stahlman <erik@vt.edu>
CC: Daris A Nevil <dnevil@snmc.com>
CC: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net/smc911x.c')
-rw-r--r-- | drivers/net/smc911x.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 1ded8f0..30f2dc2 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -39,15 +39,10 @@ void pkt_data_push(u32 addr, u32 val) \ static int smx911x_handle_mac_address(bd_t *bd) { unsigned long addrh, addrl; - unsigned char *m = bd->bi_enetaddr; + uchar m[6]; /* if the environment has a valid mac address then use it */ - if ((m[0] | m[1] | m[2] | m[3] | m[4] | m[5])) { - addrl = m[0] | m[1] << 8 | m[2] << 16 | m[3] << 24; - addrh = m[4] | m[5] << 8; - smc911x_set_mac_csr(ADDRH, addrh); - smc911x_set_mac_csr(ADDRL, addrl); - } else { + if (!eth_getenv_enetaddr("ethaddr", m)) { /* if not, try to get one from the eeprom */ addrh = smc911x_get_mac_csr(ADDRH); addrl = smc911x_get_mac_csr(ADDRL); @@ -65,10 +60,11 @@ static int smx911x_handle_mac_address(bd_t *bd) "and no eeprom found\n"); return -1; } + + eth_setenv_enetaddr("ethaddr", m); } - printf(DRIVERNAME ": MAC %02x:%02x:%02x:%02x:%02x:%02x\n", - m[0], m[1], m[2], m[3], m[4], m[5]); + printf(DRIVERNAME ": MAC %pM\n", m); return 0; } |