diff options
author | Ben Warren <biggerbadderben@gmail.com> | 2010-04-26 11:11:46 -0700 |
---|---|---|
committer | Ben Warren <biggerbadderben@gmail.com> | 2010-05-03 14:52:49 -0700 |
commit | ecee9324d73555e744593f3e0d387bec4c566f55 (patch) | |
tree | e0ddc06decbe33b90c867d1751272e933f5e01ec /net/eth.c | |
parent | c960b13ed22d9ea570957379f9f7f2f37d87ef08 (diff) | |
download | u-boot-imx-ecee9324d73555e744593f3e0d387bec4c566f55.zip u-boot-imx-ecee9324d73555e744593f3e0d387bec4c566f55.tar.gz u-boot-imx-ecee9324d73555e744593f3e0d387bec4c566f55.tar.bz2 |
Program net device MAC addresses after initializing
Add a new function to the eth_device struct for programming a network
controller's hardware address.
After all network devices have been initialized and the proper MAC address
for each has been determined, make a device driver call to program the
address into the device. Only device instances with valid unicast addresses
will be programmed.
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Acked-by: Detlev Zundel <dzu@denx.de>
Tested-by: Prafulla Wadaskar <prafulla@marvell.com>
Tested-by: Heiko Schocher <hs@denx.de>
Tested-by: Thomas Chou <thomas@wytron.com.tw>
Diffstat (limited to 'net/eth.c')
-rw-r--r-- | net/eth.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -60,6 +60,14 @@ int eth_getenv_enetaddr_by_index(int index, uchar *enetaddr) return eth_getenv_enetaddr(enetvar, enetaddr); } +static int eth_mac_skip(int index) +{ + char enetvar[15]; + char *skip_state; + sprintf(enetvar, index ? "eth%dmacskip" : "ethmacskip", index); + return ((skip_state = getenv(enetvar)) != NULL); +} + #ifdef CONFIG_NET_MULTI /* @@ -242,6 +250,11 @@ int eth_initialize(bd_t *bis) memcpy(dev->enetaddr, env_enetaddr, 6); } + if (dev->write_hwaddr && + !eth_mac_skip(eth_number) && + is_valid_ether_addr(dev->enetaddr)) { + dev->write_hwaddr(dev); + } eth_number++; dev = dev->next; |