
Hello stefano,
Stefano Babic wrote:
Heiko Schocher wrote:
Hi Heiko,
Signed-off-by: Heiko Schocher hs@denx.de
drivers/net/fec_mxc.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 5af9cdb..b5245ec 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -749,11 +749,18 @@ static int fec_probe(bd_t *bd)
eth_register(edev);
- if (fec_get_hwaddr(edev, ethaddr) == 0) {
printf("got MAC address from EEPROM: %pM\n", ethaddr);
memcpy(edev->enetaddr, ethaddr, 6);
fec_set_hwaddr(edev);
if (!eth_getenv_enetaddr("ethaddr", ethaddr)) {
/* "ethaddr" is not set in the environment */
if (fec_get_hwaddr(edev, ethaddr) == 0) {
printf("got MAC address from EEPROM: %pM\n", ethaddr);
eth_setenv_enetaddr("ethaddr", ethaddr);
} else {
printf ("no MAC found\n");
return -1;
}
}
memcpy(edev->enetaddr, ethaddr, 6);
fec_set_hwaddr(edev);
return 0;
}
As I understood Ben's comment on my last patch, the driver must not touch any environment variable, that is it must not call any getenv/setenv function.
See http://www.mail-archive.com/u-boot@lists.denx.de/msg28329.html
Huh, didn;t see your patch ... sorry!
Hmm.. but if u-boot didn;t use this interface, linux never get the mac address stored in ethaddr ... so, if using in u-boot network, linux see/uses the mac address from environment, if not using network in u-boot, linux uses the mac address stored in eeprom ...
and if no valid mac address is in eeprom, linux has no valid mac address, if u-boot don;t uses the interface ...
If I look in the code drivers/net/fec_mxc.c fec_get_hwaddr():
if defined CONFIG_MX51 this function _always_ returns -1, so if not using this interface, on MX51 based plattforms, the mac address is never initialized ...
How works this on such plattforms?
bye Heiko