diff mbox

[U-Boot] net: phy: Use 'autoneg' flag from phydev

Message ID 1453490216-15156-1-git-send-email-amessier.tyco@gmail.com
State Accepted
Commit 1f9e672c792404744006658047c5866c74bc1ab1
Delegated to: Joe Hershberger
Headers show

Commit Message

amessier.tyco@gmail.com Jan. 22, 2016, 7:16 p.m. UTC
From: Alexandre Messier <amessier@tycoint.com>

Use the 'autoneg' flag available in phydev when checking if
autoneg is in use.

The previous implementation was checking directly in the PHY
if autoneg was supported. Some PHYs will report that autoneg
is supported, even when it is disabled. Thus it is not possible
to use that bit to determine if autoneg is currently in use or
not.

Signed-off-by: Alexandre Messier <amessier@tycoint.com>
---
 drivers/net/phy/phy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Joe Hershberger Jan. 22, 2016, 7:26 p.m. UTC | #1
On Fri, Jan 22, 2016 at 1:16 PM,  <amessier.tyco@gmail.com> wrote:
> From: Alexandre Messier <amessier@tycoint.com>
>
> Use the 'autoneg' flag available in phydev when checking if
> autoneg is in use.
>
> The previous implementation was checking directly in the PHY
> if autoneg was supported. Some PHYs will report that autoneg
> is supported, even when it is disabled. Thus it is not possible
> to use that bit to determine if autoneg is currently in use or
> not.
>
> Signed-off-by: Alexandre Messier <amessier@tycoint.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe Hershberger Jan. 29, 2016, 9:27 p.m. UTC | #2
Hi amessier.tyco@gmail.com,

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

Thanks!
-Joe
diff mbox

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 1d8eed5..10a7b30 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -223,7 +223,8 @@  int genphy_update_link(struct phy_device *phydev)
 	if (phydev->link && mii_reg & BMSR_LSTATUS)
 		return 0;
 
-	if ((mii_reg & BMSR_ANEGCAPABLE) && !(mii_reg & BMSR_ANEGCOMPLETE)) {
+	if ((phydev->autoneg == AUTONEG_ENABLE) &&
+	    !(mii_reg & BMSR_ANEGCOMPLETE)) {
 		int i = 0;
 
 		printf("%s Waiting for PHY auto negotiation to complete",
@@ -279,7 +280,7 @@  int genphy_parse_link(struct phy_device *phydev)
 	int mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);
 
 	/* We're using autonegotiation */
-	if (phydev->supported & SUPPORTED_Autoneg) {
+	if (phydev->autoneg == AUTONEG_ENABLE) {
 		u32 lpa = 0;
 		int gblpa = 0;
 		u32 estatus = 0;