
On Monday 18 January 2010 01:15:43 Ben Warren wrote:
Vipin KUMAR wrote:
This patch adds the support to read and write mac id from i2c memory. For reading: if (env contains ethaddr) pick env ethaddr else pick ethaddr from i2c memory For writing: chip_config ethaddr XX:XX:XX:XX:XX:XX writes the mac id in i2c memory
--- a/board/spear/common/spr_misc.c +++ b/board/spear/common/spr_misc.c @@ -67,6 +67,12 @@ int dram_init(void)
int misc_init_r(void) { +#if defined(CONFIG_CMD_NET)
- uchar mac_id[6];
- if (!eth_getenv_enetaddr("ethaddr", mac_id) && !i2c_read_mac(mac_id))
eth_setenv_enetaddr("ethaddr", mac_id);
It's really not a good idea to programatically set an environment variable like this. Also, there's already a well-defined and documented protocol for how MAC addresses should be read and the precedence between EEPROM storage and environment storage. Please find a way to fit into that model. Since you don't have network support yet, I have no idea which network controller you're using, and recommend waiting until this is really needed.
he's doing it the way doc/README.enetaddr suggests ... -mike