net: phy: Convert u32 phydev->lp_advertising to linkmode
Convert phy drivers to report the link partner advertised modes using a linkmode bitmap. This allows them to report the higher speeds which don't fit in a u32. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
3c1bcc8614
commit
c0ec3c2736
@@ -287,6 +287,25 @@ static inline u32 mii_stat1000_to_ethtool_lpa_t(u32 lpa)
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* mii_stat1000_to_linkmode_lpa_t
|
||||
* @advertising: target the linkmode advertisement settings
|
||||
* @adv: value of the MII_STAT1000 register
|
||||
*
|
||||
* A small helper function that translates MII_STAT1000 bits, when in
|
||||
* 1000Base-T mode, to linkmode advertisement settings.
|
||||
*/
|
||||
static inline void mii_stat1000_to_linkmode_lpa_t(unsigned long *advertising,
|
||||
u32 lpa)
|
||||
{
|
||||
if (lpa & LPA_1000HALF)
|
||||
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
|
||||
advertising);
|
||||
if (lpa & LPA_1000FULL)
|
||||
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
|
||||
advertising);
|
||||
}
|
||||
|
||||
/**
|
||||
* ethtool_adv_to_mii_adv_x
|
||||
* @ethadv: the ethtool advertisement settings
|
||||
@@ -384,6 +403,23 @@ static inline void mii_adv_to_linkmode_adv_t(unsigned long *advertising,
|
||||
linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, advertising);
|
||||
}
|
||||
|
||||
/**
|
||||
* mii_lpa_to_linkmode_lpa_t
|
||||
* @adv: value of the MII_LPA register
|
||||
*
|
||||
* A small helper function that translates MII_LPA bits, when in
|
||||
* 1000Base-T mode, to linkmode LP advertisement settings.
|
||||
*/
|
||||
static inline void mii_lpa_to_linkmode_lpa_t(unsigned long *lp_advertising,
|
||||
u32 lpa)
|
||||
{
|
||||
if (lpa & LPA_LPACK)
|
||||
linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
|
||||
lp_advertising);
|
||||
|
||||
mii_adv_to_linkmode_adv_t(lp_advertising, lpa);
|
||||
}
|
||||
|
||||
/**
|
||||
* linkmode_adv_to_lcl_adv_t
|
||||
* @advertising:pointer to linkmode advertising
|
||||
|
Reference in New Issue
Block a user