mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Johannes Stezenbach <js@sig21.net>
To: Roberto Nibali <rnibali@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/6] miidev: actually probe the PHY
Date: Mon, 18 Jun 2012 21:39:28 +0200	[thread overview]
Message-ID: <20120618193928.GB4166@sig21.net> (raw)
In-Reply-To: <CAONxwYPRvOL0FL1PfuQ7MjCr+vY7g6OnR_m8v38y+71EvsHmhw@mail.gmail.com>

Hi,

On Mon, Jun 18, 2012 at 08:27:08PM +0200, Roberto Nibali wrote:
> On Mon, Jun 18, 2012 at 4:47 PM, Johannes Stezenbach <js@sig21.net> wrote:
> 
> > Check if the PHY is really accessible (e.g. the
> > PHY address is correct) during probe.
> >
> > Signed-off-by: Johannes Stezenbach <js@sig21.net>
> > ---
> >  drivers/net/miidev.c |   12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
> > index 272234e..3545889 100644
> > --- a/drivers/net/miidev.c
> > +++ b/drivers/net/miidev.c
> > @@ -225,6 +225,14 @@ static struct file_operations miidev_ops = {
> >  static int miidev_probe(struct device_d *dev)
> >  {
> >        struct mii_device *mdev = dev->priv;
> > +       int val;
> > +
> > +       val = mii_read(mdev, mdev->address, MII_PHYSID1);
> > +       if (val < 0 || val == 0xffff)
> > +               goto err_out;
> > +       val = mii_read(mdev, mdev->address, MII_PHYSID2);
> > +       if (val < 0 || val == 0xffff)
> > +               goto err_out;
> >
> >
> Suppose this has no influence on drivers/net/fec_imx.c:fec_set_hwaddr()
> returning -1?

Well, the MAC address goes to the MAC not the PHY... so it
shouldn't have any adverse effect on that.

Besides checking that the PHY address is correct this also
catches cases where the PHY is broken or not soldered correctly,
or when the MDIO clock divisor is wrong etc. 
Can save time in trouble shooting.


Johannes

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

  reply	other threads:[~2012-06-18 19:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-18 14:47 [PATCH 0/6] misc ethernet fixes and new driver Johannes Stezenbach
2012-06-18 14:47 ` [PATCH 1/6] miidev: fix auto negotiation Johannes Stezenbach
2012-06-18 17:52   ` Roberto Nibali
2012-06-18 19:26     ` Johannes Stezenbach
2012-06-18 14:47 ` [PATCH 2/6] miidev: actually probe the PHY Johannes Stezenbach
2012-06-18 18:27   ` Roberto Nibali
2012-06-18 19:39     ` Johannes Stezenbach [this message]
2012-06-18 14:47 ` [PATCH 3/6] miidev: add support for 1000Mbit Johannes Stezenbach
2012-06-18 14:47 ` [PATCH 4/6] miidev: consistent md and mw on phy regs Johannes Stezenbach
2012-06-20  6:49   ` Sascha Hauer
2012-06-18 14:47 ` [PATCH 5/6] eth: eth MAC addresses are six bytes Johannes Stezenbach
2012-06-18 14:48 ` [PATCH 6/6] drivers/net: add designware driver Johannes Stezenbach
2012-06-20  7:13   ` Sascha Hauer
2012-06-20  8:11     ` Johannes Stezenbach
2012-06-20  8:41       ` Sascha Hauer
2012-06-20  7:15 ` [PATCH 0/6] misc ethernet fixes and new driver Sascha Hauer

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=20120618193928.GB4166@sig21.net \
    --to=js@sig21.net \
    --cc=barebox@lists.infradead.org \
    --cc=rnibali@gmail.com \
    /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