mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Franck JULLIEN <franck.jullien@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox <barebox@lists.infradead.org>
Subject: Re: [PATCH] [v2] Nios2: Add Altera TSE MAC driver
Date: Mon, 11 Apr 2011 09:52:09 +0200	[thread overview]
Message-ID: <BANLkTikG3ZfCNcNba=qbSBfpq9+1XfS7jQ@mail.gmail.com> (raw)
In-Reply-To: <20110411074750.GF7285@pengutronix.de>


[-- Attachment #1.1: Type: text/plain, Size: 3016 bytes --]

2011/4/11 Sascha Hauer <s.hauer@pengutronix.de>

> On Mon, Apr 11, 2011 at 09:23:56AM +0200, Franck JULLIEN wrote:
> > 2011/4/11 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> >
> > > On 20:21 Sun 10 Apr     , Franck JULLIEN wrote:
> > > >    2011/4/10 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com
> >
> > > >
> > > >      >      > 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
>
>
Sounds good :)


> --
> 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 |
>

[-- Attachment #1.2: Type: text/html, Size: 4340 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2011-04-11  7:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-09 14:08 franck.jullien
2011-04-09 14:08 ` franck.jullien
2011-04-10  4:06   ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-10  7:13     ` Franck JULLIEN
2011-04-10 10:51       ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-10 18:21         ` Franck JULLIEN
2011-04-11  2:37           ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-11  7:23             ` Franck JULLIEN
2011-04-11  7:47               ` Sascha Hauer
2011-04-11  7:52                 ` Franck JULLIEN [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTikG3ZfCNcNba=qbSBfpq9+1XfS7jQ@mail.gmail.com' \
    --to=franck.jullien@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox