Skip to content
Snippets Groups Projects
Commit 0dcfb0fc authored by Wolfgang Denk's avatar Wolfgang Denk
Browse files

Revert "phylib: remove a couple of redundant code lines"


This reverts commit 041c5422.

The lines removed by this commit weren't redundant. The logic is (and
probably should be better commented):

Find the intersection of the advertised capabilities of both sides of
the link (lpa).
From that intersection, find the highest capability we can run at
(that will be the negotiated link).

Now imagine that the intersection (lpa) is (LPA_100HALF | LPA_10FULL).

The code will now set phydev->speed to 100, and phydev->duplex to 1,
but this link does not support 100FULL.

Kudos to Andy Fleming <afleming@gmail.com> for binging this to
attention and for the explanation.

Signed-off-by: default avatarWolfgang Denk <wd@denx.de>
parent ff4dea03
No related branches found
No related tags found
No related merge requests found
...@@ -318,10 +318,13 @@ static int genphy_parse_link(struct phy_device *phydev) ...@@ -318,10 +318,13 @@ static int genphy_parse_link(struct phy_device *phydev)
lpa = phy_read(phydev, MDIO_DEVAD_NONE, MII_ADVERTISE); lpa = phy_read(phydev, MDIO_DEVAD_NONE, MII_ADVERTISE);
lpa &= phy_read(phydev, MDIO_DEVAD_NONE, MII_LPA); lpa &= phy_read(phydev, MDIO_DEVAD_NONE, MII_LPA);
if (lpa & (LPA_100FULL | LPA_100HALF)) if (lpa & (LPA_100FULL | LPA_100HALF)) {
phydev->speed = SPEED_100; phydev->speed = SPEED_100;
if (lpa & (LPA_100FULL | LPA_10FULL)) if (lpa & LPA_100FULL)
phydev->duplex = DUPLEX_FULL;
} else if (lpa & LPA_10FULL)
phydev->duplex = DUPLEX_FULL; phydev->duplex = DUPLEX_FULL;
} else { } else {
u32 bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR); u32 bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment