All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] net: mii: check phy advertising register when geting link status
@ 2016-08-22 13:03 Dongpo Li
  2016-08-22 16:46 ` Joe Hershberger
  2016-08-23  2:28 ` [U-Boot] " Joe Hershberger
  0 siblings, 2 replies; 3+ messages in thread
From: Dongpo Li @ 2016-08-22 13:03 UTC (permalink / raw)
  To: u-boot

When phy autoneg on, the link speed and duplex should be
determined by phy advertising register and
phy link partner ability register.
Check phy advertising register when geting phy link speed and
duplex if autoneg on.

Signed-off-by: Dongpo Li <lidongpo@hisilicon.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
---
 common/miiphyutil.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 08aa854..d8ebb38 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -380,7 +380,7 @@ int miiphy_reset(const char *devname, unsigned char addr)
  */
 int miiphy_speed(const char *devname, unsigned char addr)
 {
-	u16 bmcr, anlpar;
+	u16 bmcr, anlpar, adv;
 
 #if defined(CONFIG_PHY_GIGE)
 	u16 btsr;
@@ -417,7 +417,12 @@ int miiphy_speed(const char *devname, unsigned char addr)
 			printf("PHY AN speed");
 			goto miiphy_read_failed;
 		}
-		return (anlpar & LPA_100) ? _100BASET : _10BASET;
+
+		if (miiphy_read(devname, addr, MII_ADVERTISE, &adv)) {
+			puts("PHY AN adv speed");
+			goto miiphy_read_failed;
+		}
+		return ((anlpar & adv) & LPA_100) ? _100BASET : _10BASET;
 	}
 	/* Get speed from basic control settings. */
 	return (bmcr & BMCR_SPEED100) ? _100BASET : _10BASET;
@@ -433,7 +438,7 @@ miiphy_read_failed:
  */
 int miiphy_duplex(const char *devname, unsigned char addr)
 {
-	u16 bmcr, anlpar;
+	u16 bmcr, anlpar, adv;
 
 #if defined(CONFIG_PHY_GIGE)
 	u16 btsr;
@@ -475,7 +480,12 @@ int miiphy_duplex(const char *devname, unsigned char addr)
 			puts("PHY AN duplex");
 			goto miiphy_read_failed;
 		}
-		return (anlpar & (LPA_10FULL | LPA_100FULL)) ?
+
+		if (miiphy_read(devname, addr, MII_ADVERTISE, &adv)) {
+			puts("PHY AN adv duplex");
+			goto miiphy_read_failed;
+		}
+		return ((anlpar & adv) & (LPA_10FULL | LPA_100FULL)) ?
 		    FULL : HALF;
 	}
 	/* Get speed from basic control settings. */
-- 
2.8.2

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

* [U-Boot] [PATCH] net: mii: check phy advertising register when geting link status
  2016-08-22 13:03 [U-Boot] [PATCH] net: mii: check phy advertising register when geting link status Dongpo Li
@ 2016-08-22 16:46 ` Joe Hershberger
  2016-08-23  2:28 ` [U-Boot] " Joe Hershberger
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Hershberger @ 2016-08-22 16:46 UTC (permalink / raw)
  To: u-boot

On Mon, Aug 22, 2016 at 8:03 AM, Dongpo Li <lidongpo@hisilicon.com> wrote:
> When phy autoneg on, the link speed and duplex should be
> determined by phy advertising register and
> phy link partner ability register.
> Check phy advertising register when geting phy link speed and
> duplex if autoneg on.
>
> Signed-off-by: Dongpo Li <lidongpo@hisilicon.com>
> Cc: Joe Hershberger <joe.hershberger@ni.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

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

* [U-Boot] net: mii: check phy advertising register when geting link status
  2016-08-22 13:03 [U-Boot] [PATCH] net: mii: check phy advertising register when geting link status Dongpo Li
  2016-08-22 16:46 ` Joe Hershberger
@ 2016-08-23  2:28 ` Joe Hershberger
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Hershberger @ 2016-08-23  2:28 UTC (permalink / raw)
  To: u-boot

Hi Dongpo,

https://patchwork.ozlabs.org/patch/661450/ was applied to u-boot-net.git.

Thanks!
-Joe

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

end of thread, other threads:[~2016-08-23  2:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-22 13:03 [U-Boot] [PATCH] net: mii: check phy advertising register when geting link status Dongpo Li
2016-08-22 16:46 ` Joe Hershberger
2016-08-23  2:28 ` [U-Boot] " Joe Hershberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.