mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/1] phy: phy_update_status wait auto neg done when enabled
Date: Wed, 14 Nov 2012 10:34:58 +0100	[thread overview]
Message-ID: <20121114093458.GH25679@game.jcrosoft.org> (raw)
In-Reply-To: <20121114080528.GF10369@pengutronix.de>

On 09:05 Wed 14 Nov     , Sascha Hauer wrote:
> On Tue, Nov 13, 2012 at 10:14:05PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > if the autoneg was start by the hw wait it to be finished
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  drivers/net/phy/phy.c |   26 ++++++++++++++++++++++++++
> >  1 file changed, 26 insertions(+)
> > 
> > diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> > index 0c2e602..43738c2 100644
> > --- a/drivers/net/phy/phy.c
> > +++ b/drivers/net/phy/phy.c
> > @@ -28,6 +28,25 @@
> >  #define PHY_AN_TIMEOUT	10
> >  
> >  static int genphy_config_init(struct phy_device *phydev);
> > +static int phy_aneg_done(struct phy_device *phydev);
> > +
> > +static int phy_wait_aneg_read_status(struct phy_device *dev, struct phy_driver *drv)
> > +{
> > +	int ret;
> > +
> > +	if (AUTONEG_ENABLE != dev->autoneg)
> > +		return 0;
> > +
> > +	ret = phy_aneg_done(dev);
> > +	if (ret)
> > +		return ret;
> > +
> > +	/*
> > +	 * re-read the status as the aneg may not be finished
> > +	 * when we read it the first time
> > +	 */
> > +	return drv->read_status(dev);
> > +}
> >  
> >  int phy_update_status(struct phy_device *dev)
> >  {
> > @@ -35,11 +54,18 @@ int phy_update_status(struct phy_device *dev)
> >  	struct eth_device *edev = dev->attached_dev;
> >  	int ret;
> >  	int oldspeed = dev->speed, oldduplex = dev->duplex;
> > +	int old_link = dev->link;
> >  
> >  	ret = drv->read_status(dev);
> >  	if (ret)
> >  		return ret;
> >  
> > +	if (dev->link && !old_link) {
> > +		ret = phy_wait_aneg_read_status(dev, drv);
> > +		if (ret)
> > +			return ret;
> > +	}
> 
> This does not help. dev->link is false after reset, so we never get into
> phy_wait_aneg_read_status() which waits for a link.
read_status update the dev->link as we call update_link

if !dev->link means no cable detected

if the phy is reset the link is ready immediately or that means the reset is
not finished and the phy is not stable

this may means the phy need specific init

Best Regards,
J.

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

  reply	other threads:[~2012-11-14  9:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-13 21:14 Jean-Christophe PLAGNIOL-VILLARD
2012-11-14  8:05 ` Sascha Hauer
2012-11-14  9:34   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-11-14 12:04     ` Sascha Hauer
2012-11-14 17:24       ` Jean-Christophe PLAGNIOL-VILLARD

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=20121114093458.GH25679@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.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