Commit c1164bb1 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller

net: phy: check PMAPMD link status only in genphy_c45_read_link

The current code reports a link as up if all devices (except a few
blacklisted ones) report the link as up. This breaks Aquantia AQCS109
for lower speeds because on this PHY the PCS link status reflects a
10G link only. For Marvell there's a similar issue, therefore PHYXS
device isn't checked.

There may be more PHYs where depending on the mode the link status
of only selected devices is relevant.

For now it seems to be sufficient to check the link status of the
PMAPMD device only. Leave the loop in the code to be prepared in
case we have to add functionality to check more than one device,
depending on the mode.

Successfully tested on a board with an AQCS109.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 87e0616e
...@@ -215,17 +215,10 @@ EXPORT_SYMBOL_GPL(genphy_c45_aneg_done); ...@@ -215,17 +215,10 @@ EXPORT_SYMBOL_GPL(genphy_c45_aneg_done);
*/ */
int genphy_c45_read_link(struct phy_device *phydev) int genphy_c45_read_link(struct phy_device *phydev)
{ {
u32 mmd_mask = phydev->c45_ids.devices_in_package; u32 mmd_mask = MDIO_DEVS_PMAPMD;
int val, devad; int val, devad;
bool link = true; bool link = true;
/* The vendor devads and C22EXT do not report link status. Avoid the
* PHYXS instance as its status may depend on the MAC being
* appropriately configured for the negotiated speed.
*/
mmd_mask &= ~(MDIO_DEVS_VEND1 | MDIO_DEVS_VEND2 | MDIO_DEVS_C22EXT |
MDIO_DEVS_PHYXS);
while (mmd_mask && link) { while (mmd_mask && link) {
devad = __ffs(mmd_mask); devad = __ffs(mmd_mask);
mmd_mask &= ~BIT(devad); mmd_mask &= ~BIT(devad);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment