mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Johannes Stezenbach <js@sig21.net>
To: "Eric Bénard" <eric@eukrea.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/3] miidev: fix 1G wrong detection
Date: Fri, 7 Sep 2012 11:28:33 +0200	[thread overview]
Message-ID: <20120907092833.GA13549@sig21.net> (raw)
In-Reply-To: <20120907110218.143c45ab@eb-e6520>

Hi,

On Fri, Sep 07, 2012 at 11:02:18AM +0200, Eric Bénard wrote:
> Le Fri, 7 Sep 2012 10:52:16 +0200,
> Johannes Stezenbach <js@sig21.net> a écrit :
> > On Thu, Sep 06, 2012 at 09:39:31PM +0200, Eric Bénard wrote:
> > > since 99e72c8bbdbdc690025a5868d831f1fe79ad56fc on an i.MX51 based board,
> > > I get : "phy0: Link is up - 1000/Full". It seems miidev tries to probe
> > > the PHY to early and gets 0x3ffff which leads to the wrong capabilities
> > > setting.
> > 
> > Hm, MII registers are only 16bit, why does your mii_read()
> > implementation return 0x3ffff?
> > 
> in fec_imx it returns the 32 bit register. I though we could mask it to
> only return the data but that wouldn't solve the problem as the tests
> in miidev would fail because the data is 0xFFFF.

Well, the check for the PHY ID registers was added for a purpose:
It allows barebox to print a useful error message if it can't talk
to the PHY, which is *much* better than letting you guess why
you ethernet doesn't work.  You could change the check to ">= 0xffff"
but it looks strange.  IMHO it would be better to mask the invalid
bits in your mii_read().

> > Also, what exactly do you mean by "too early"?  Your code
> > shouldn't call mii_register() before the MDIO clock is stable.
> > 
> fec_imx.c does that.

But why is it too early?  What do you need to wait for?
Maybe something in eth_device.open() enables MDIO?

Maybe it is actually better to defer PHY probing until
eth_device.open() is called, to save a few milliseconds during
boot from flash when ethernet isn't used.  But I have a board which can
have different PHY (e.g. 100Mbit or 1Gbit), and where one
of them doesn't answer to address 0, so I need to probe the address.
Then I would need to defer the mii_register() also
until eth_device.open()?


Thanks,
Johannes

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

  reply	other threads:[~2012-09-07  9:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06 19:39 [PATCH 1/3] fec: restart autoneg at open instead of init Eric Bénard
2012-09-06 19:39 ` [PATCH 2/3] i.MX51: unbreak FEC iomux Eric Bénard
2012-09-07  8:30   ` Sascha Hauer
2012-09-06 19:39 ` [PATCH 3/3] miidev: fix 1G wrong detection Eric Bénard
2012-09-06 21:52   ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-07  6:44   ` Sascha Hauer
2012-09-07  7:28     ` Eric Bénard
2012-09-07  8:23       ` Sascha Hauer
2012-09-07  7:43     ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-07  8:52   ` Johannes Stezenbach
2012-09-07  9:02     ` Eric Bénard
2012-09-07  9:28       ` Johannes Stezenbach [this message]
2012-09-07  9:32         ` Eric Bénard
2012-09-14  7:03   ` Sascha Hauer
2012-09-07  6:57 ` [PATCH 1/3] fec: restart autoneg at open instead of init Sascha Hauer
2012-09-07  7:30   ` Eric Bénard
2012-09-07  7:47     ` Sascha Hauer
2012-09-07  7:51       ` Eric Bénard

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=20120907092833.GA13549@sig21.net \
    --to=js@sig21.net \
    --cc=barebox@lists.infradead.org \
    --cc=eric@eukrea.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