net: phy: split devices_in_package
We have two competing requirements for the devices_in_package field. We want to use it as a bit array indicating which MMDs are present, but we also want to know if the Clause 22 registers are present. Since "devices in package" is a term used in the 802.3 specification, keep this as the as-specified values read from the PHY, and introduce a new member "mmds_present" to indicate which MMDs are actually present in the PHY, derived from the "devices in package" value. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
5ba33cf483
commit
320ed3bf90
@@ -1638,11 +1638,11 @@ static int phylink_phy_read(struct phylink *pl, unsigned int phy_id,
|
||||
case MII_BMSR:
|
||||
case MII_PHYSID1:
|
||||
case MII_PHYSID2:
|
||||
devad = __ffs(phydev->c45_ids.devices_in_package);
|
||||
devad = __ffs(phydev->c45_ids.mmds_present);
|
||||
break;
|
||||
case MII_ADVERTISE:
|
||||
case MII_LPA:
|
||||
if (!(phydev->c45_ids.devices_in_package & MDIO_DEVS_AN))
|
||||
if (!(phydev->c45_ids.mmds_present & MDIO_DEVS_AN))
|
||||
return -EINVAL;
|
||||
devad = MDIO_MMD_AN;
|
||||
if (reg == MII_ADVERTISE)
|
||||
@@ -1678,11 +1678,11 @@ static int phylink_phy_write(struct phylink *pl, unsigned int phy_id,
|
||||
case MII_BMSR:
|
||||
case MII_PHYSID1:
|
||||
case MII_PHYSID2:
|
||||
devad = __ffs(phydev->c45_ids.devices_in_package);
|
||||
devad = __ffs(phydev->c45_ids.mmds_present);
|
||||
break;
|
||||
case MII_ADVERTISE:
|
||||
case MII_LPA:
|
||||
if (!(phydev->c45_ids.devices_in_package & MDIO_DEVS_AN))
|
||||
if (!(phydev->c45_ids.mmds_present & MDIO_DEVS_AN))
|
||||
return -EINVAL;
|
||||
devad = MDIO_MMD_AN;
|
||||
if (reg == MII_ADVERTISE)
|
||||
|
Reference in New Issue
Block a user