On Mon, Apr 11, 2011 at 09:23:56AM +0200, Franck JULLIEN wrote: > 2011/4/11 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@xxxxxxxxxxxx> > > > On 20:21 Sun 10 Apr , Franck JULLIEN wrote: > > > 2011/4/10 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@xxxxxxxxxxxx> > > > > > > > > index 0000000..2687377 > > > > > --- /dev/null > > > > > + > > > > > +static int tse_get_ethaddr(struct eth_device *edev, > > unsigned > > > char *m) > > > > > +{ > > > > > + /* There is no eeprom */ > > > > so return the content of the register no? > > > > > > > > Well, the register is reseted to 0 when the MAC starts so there > > is > > > no > > > > Ethernet address > > > > to get. > > > > > > > except this function is supposed to return the mac address of the > > device > > > at > > > any time so after a set of it it will not be true any more > > > > > > If I implement the function I get a "eth@eth0: got MAC address from > > > EEPROM: 00:00:00:00:00:00" at startup. > > > That why I returned -1 as what I could find int at91_ether.c...... > > > Or, I could find something to return -1 as long as the MAC address > > hasn't > > > been set. > > > > > I known this issue I re-write recently the at91_ether and the same on macb > > will post the patch soon > > > > It's fine the uperlayer will see that it's not a valid mac so this will > > generate a random one > > cf net/net.c IIRC > > > > > For me, it's a bit annoying to get this message at startup. > > Don't you really think I could have a flag in the private structure to check > if an address has been set and then return -1 or the address in the > tse_get_ethaddr function ? How about the following: diff --git a/net/eth.c b/net/eth.c index 0251e59..c5b346c 100644 --- a/net/eth.c +++ b/net/eth.c @@ -167,8 +167,10 @@ int eth_register(struct eth_device *edev) if (edev->get_ethaddr(edev, ethaddr) == 0) { ethaddr_to_string(ethaddr, ethaddr_str); - dev_info(dev, "got MAC address from EEPROM: %s\n", ethaddr_str); - dev_set_param(dev, "ethaddr", ethaddr_str); + if (is_valid_ether_addr(ethaddr)) { + dev_info(dev, "got MAC address from EEPROM: %s\n", ethaddr_str); + dev_set_param(dev, "ethaddr", ethaddr_str); + } } if (!eth_current) { Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox