diff options
author | Ben Gardiner <bengardiner@nanometrics.ca> | 2010-09-23 09:58:43 -0400 |
---|---|---|
committer | Ben Warren <biggerbadderben@gmail.com> | 2010-10-11 23:07:17 -0700 |
commit | 7b37a27e14975f32528552deed453b56a4149818 (patch) | |
tree | 97b76f279c64ac3be9b186060e4aab0e969fcc53 /board/davinci/da8xxevm | |
parent | 042272a6f2fce3bf610a84cbfde3676b53c0d8dd (diff) | |
download | u-boot-imx-7b37a27e14975f32528552deed453b56a4149818.zip u-boot-imx-7b37a27e14975f32528552deed453b56a4149818.tar.gz u-boot-imx-7b37a27e14975f32528552deed453b56a4149818.tar.bz2 |
davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
This patch proposes to migrate the davinci_emac driver to using the
eth_device->write_hwaddr function pointer as suggested by Ben Warren.
All the davinci boards had the behaviour, prior to this patch, of
sync'ing the environment variable enetaddr with the MAC address read
from non-volatile storage on boot -- when the two locations disagreed,
the environment variable value took precendence. This patch keeps the
same behaviour but lets eth_initialize take care of it.
This patch refactors davinci_emac setup in the boards so that the MAC
address is read from non-volatile storage into the environment variable
and then the environment variable value is use in eth_intialize. The
only exception is the direct call to davinci_eth_set_mac_addr made by
the da830evm board init which was changed into an assignment of the
enetaddr field.
Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Tested-by: Nick Thompson <nick.thompson@ge.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'board/davinci/da8xxevm')
-rw-r--r-- | board/davinci/da8xxevm/da830evm.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c index 6baa860..8a9f988 100644 --- a/board/davinci/da8xxevm/da830evm.c +++ b/board/davinci/da8xxevm/da830evm.c @@ -196,19 +196,17 @@ int board_eth_init(bd_t *bis) { u_int8_t mac_addr[6]; u_int8_t switch_start_cmd[2] = { 0x01, 0x23 }; + struct eth_device *dev; /* Read Ethernet MAC address from EEPROM */ if (dvevm_read_mac_address(mac_addr)) /* set address env if not already set */ - dv_configure_mac_address(mac_addr); + davinci_sync_env_enetaddr(mac_addr); /* read the address back from env */ if (!eth_getenv_enetaddr("ethaddr", mac_addr)) return -1; - /* provide the resulting addr to the driver */ - davinci_eth_set_mac_addr(mac_addr); - /* enable the Ethernet switch in the 3 port PHY */ if (i2c_write(PHY_SW_I2C_ADDR, 0, 0, switch_start_cmd, sizeof(switch_start_cmd))) { @@ -222,6 +220,12 @@ int board_eth_init(bd_t *bis) return -1; } + dev = eth_get_dev(); + + /* provide the resulting addr to the driver */ + memcpy(dev->enetaddr, mac_addr, 6); + dev->write_hwaddr(dev); + return 0; } #endif /* CONFIG_DRIVER_TI_EMAC */ |