[PATCH 3/3] miidev: fix 1G wrong detection

Sascha Hauer s.hauer at pengutronix.de
Fri Sep 7 04:23:57 EDT 2012


On Fri, Sep 07, 2012 at 09:28:30AM +0200, Eric Bénard wrote:
> Le Fri, 7 Sep 2012 08:44:19 +0200,
> Sascha Hauer <s.hauer at pengutronix.de> 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.
> > > 
> > > Signed-off-by: Eric Bénard <eric at eukrea.com>
> > > ---
> > >  drivers/net/miidev.c |   33 +++++++++------------------------
> > >  1 files changed, 9 insertions(+), 24 deletions(-)
> > > 
> > > diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
> > > index 75b53e3..e0f9d67 100644
> > > --- a/drivers/net/miidev.c
> > > +++ b/drivers/net/miidev.c
> > > @@ -131,6 +131,14 @@ int miidev_get_status(struct mii_device *mdev)
> > >  
> > >  	status = ret & BMSR_LSTATUS ? MIIDEV_STATUS_IS_UP : 0;
> > >  
> > > +	if (ret & BMSR_ESTATEN) {
> > > +		ret = mii_read(mdev, mdev->address, MII_ESTATUS);
> > > +		if (ret < 0)
> > > +			goto err_out;
> > > +		if (ret & (ESTATUS_1000_TFULL | ESTATUS_1000_THALF))
> > > +			mdev->capabilities = MIIDEV_CAPABLE_1000M;
> > > +	}
> > > +
> > >  	ret = mii_read(mdev, mdev->address, MII_BMCR);
> > >  	if (ret < 0)
> > >  		goto err_out;
> > > @@ -239,27 +247,8 @@ static struct file_operations miidev_ops = {
> > >  static int miidev_probe(struct device_d *dev)
> > >  {
> > >  	struct mii_device *mdev = dev->priv;
> > > -	int val;
> > > -	int caps = 0;
> > >  
> > > -	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;
> > 
> > Is the above necessary? This was present before the patch which made the
> > regression.
> > 
> well there is no interest as we don't check the value read (and in the
> present case I also get 0x3ffff here).

Ah, I see. I thought the above lines were there for longer, but they
were introduced right before the commit adding 1000mbit support.

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 |



More information about the barebox mailing list