mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/1] phy: if the link partner just ack us wait the end of the autoneg
@ 2012-11-14 21:03 Jean-Christophe PLAGNIOL-VILLARD
  2012-11-14 21:04 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-15  8:01 ` Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-14 21:03 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/net/phy/phy.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 43738c2..daa657f 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -578,6 +578,18 @@ int genphy_read_status(struct phy_device *phydev)
 		if (lpa < 0)
 			return lpa;
 
+		if (lpa & LPA_LPACK) {
+			int ret;
+
+			ret = phy_aneg_done(phydev);
+			if (ret)
+				return ret;
+
+			lpa = phy_read(phydev, MII_LPA);
+			if (lpa < 0)
+				return lpa;
+		}
+
 		adv = phy_read(phydev, MII_ADVERTISE);
 
 		if (adv < 0)
-- 
1.7.10.4


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] phy: if the link partner just ack us wait the end of the autoneg
  2012-11-14 21:03 [PATCH 1/1] phy: if the link partner just ack us wait the end of the autoneg Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-14 21:04 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-15  8:01 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-14 21:04 UTC (permalink / raw)
  To: barebox

On 22:03 Wed 14 Nov     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
this will detect that the phy was jsut notified that the link is up

Best Regards,
J.
>  drivers/net/phy/phy.c |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 43738c2..daa657f 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -578,6 +578,18 @@ int genphy_read_status(struct phy_device *phydev)
>  		if (lpa < 0)
>  			return lpa;
>  
> +		if (lpa & LPA_LPACK) {
> +			int ret;
> +
> +			ret = phy_aneg_done(phydev);
> +			if (ret)
> +				return ret;
> +
> +			lpa = phy_read(phydev, MII_LPA);
> +			if (lpa < 0)
> +				return lpa;
> +		}
> +
>  		adv = phy_read(phydev, MII_ADVERTISE);
>  
>  		if (adv < 0)
> -- 
> 1.7.10.4
> 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] phy: if the link partner just ack us wait the end of the autoneg
  2012-11-14 21:03 [PATCH 1/1] phy: if the link partner just ack us wait the end of the autoneg Jean-Christophe PLAGNIOL-VILLARD
  2012-11-14 21:04 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-15  8:01 ` Sascha Hauer
  2012-11-15  9:29   ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2012-11-15  8:01 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Wed, Nov 14, 2012 at 10:03:19PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  drivers/net/phy/phy.c |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 43738c2..daa657f 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -578,6 +578,18 @@ int genphy_read_status(struct phy_device *phydev)
>  		if (lpa < 0)
>  			return lpa;
>  
> +		if (lpa & LPA_LPACK) {
> +			int ret;
> +
> +			ret = phy_aneg_done(phydev);
> +			if (ret)
> +				return ret;
> +
> +			lpa = phy_read(phydev, MII_LPA);
> +			if (lpa < 0)
> +				return lpa;
> +		}
> +

Still does not work:

barebox@Freescale i.MX53 LOCO:/ while [ ${done} != 0 ]; do dhcp;
done=$?; msleep 500; done
genphy_read_status MII_LPA 0x0001
dhcp failed: Network is down
dhcp: Network is down
dhcp failed: Network is down
dhcp: Network is down
dhcp failed: Network is down
dhcp: Network is down
dhcp failed: Network is down
dhcp: Network is down
dhcp failed: Network is down
dhcp: Network is down
dhcp failed: Network is down
dhcp: Network is down
dhcp failed: Network is down
dhcp: Network is down
dhcp failed: Network is down
dhcp: Network is down
dhcp failed: Network is down
dhcp: Network is down
dhcp failed: Network is down
dhcp: Network is down
genphy_read_status MII_LPA 0x45e1
100Mbps full duplex link detected
DHCP client bound to address 192.168.24.118


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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] phy: if the link partner just ack us wait the end of the autoneg
  2012-11-15  8:01 ` Sascha Hauer
@ 2012-11-15  9:29   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-15  9:29 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 09:01 Thu 15 Nov     , Sascha Hauer wrote:
> On Wed, Nov 14, 2012 at 10:03:19PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  drivers/net/phy/phy.c |   12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> > index 43738c2..daa657f 100644
> > --- a/drivers/net/phy/phy.c
> > +++ b/drivers/net/phy/phy.c
> > @@ -578,6 +578,18 @@ int genphy_read_status(struct phy_device *phydev)
> >  		if (lpa < 0)
> >  			return lpa;
> >  
> > +		if (lpa & LPA_LPACK) {
> > +			int ret;
> > +
> > +			ret = phy_aneg_done(phydev);
> > +			if (ret)
> > +				return ret;
> > +
> > +			lpa = phy_read(phydev, MII_LPA);
> > +			if (lpa < 0)
> > +				return lpa;
> > +		}
> > +
> 
> Still does not work:
> 
> barebox@Freescale i.MX53 LOCO:/ while [ ${done} != 0 ]; do dhcp;
> done=$?; msleep 500; done
> genphy_read_status MII_LPA 0x0001
> dhcp failed: Network is down
> dhcp: Network is down
> dhcp failed: Network is down
> dhcp: Network is down
> dhcp failed: Network is down
> dhcp: Network is down
> dhcp failed: Network is down
> dhcp: Network is down
> dhcp failed: Network is down
> dhcp: Network is down
> dhcp failed: Network is down
> dhcp: Network is down
> dhcp failed: Network is down
> dhcp: Network is down
> dhcp failed: Network is down
> dhcp: Network is down
> dhcp failed: Network is down
> dhcp: Network is down
> dhcp failed: Network is down
> dhcp: Network is down
> genphy_read_status MII_LPA 0x45e1
> 100Mbps full duplex link detected
> DHCP client bound to address 192.168.24.118
this is a bug on LAN8720 which may cause this


Make sure the EDPWRDOWN bit is NOT set. Setting this bit on
LAN8710/LAN8720 PHY causes the PHY to misbehave, likely due
to a bug on the chip.

When the system is powered on with the network cable being
disconnected all the way until after ifconfig ethX up is
ssued for the LAN port with this PHY, connecting the cable
afterwards does not cause LINK change detection, while the
expected behavior is the Link UP being detected.

Best Regards,
J. 
> -- 
> 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 |

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-11-15  9:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-14 21:03 [PATCH 1/1] phy: if the link partner just ack us wait the end of the autoneg Jean-Christophe PLAGNIOL-VILLARD
2012-11-14 21:04 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-15  8:01 ` Sascha Hauer
2012-11-15  9:29   ` Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox