aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2018-11-10 23:43:34 +0100
committerDavid S. Miller <davem@davemloft.net>2018-11-11 10:10:01 -0800
commitc0ec3c2736774c69bf5c641aea7712132c0f0eba (patch)
tree882122cf62a93a87d94036062c5fc5dcd4a7a606 /include
parentnet: ethernet: Convert phydev advertize and supported from u32 to link mode (diff)
downloadlinux-dev-c0ec3c2736774c69bf5c641aea7712132c0f0eba.tar.xz
linux-dev-c0ec3c2736774c69bf5c641aea7712132c0f0eba.zip
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mii.h36
-rw-r--r--include/linux/phy.h3
2 files changed, 37 insertions, 2 deletions
diff --git a/include/linux/mii.h b/include/linux/mii.h
index aaa458bbef2a..e7112e878bb0 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -288,6 +288,25 @@ static inline u32 mii_stat1000_to_ethtool_lpa_t(u32 lpa)
}
/**
+ * 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
*
@@ -385,6 +404,23 @@ static inline void mii_adv_to_linkmode_adv_t(unsigned long *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
*
diff --git a/include/linux/phy.h b/include/linux/phy.h
index cbc66ac3b560..8f927246acdb 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -414,8 +414,7 @@ struct phy_device {
/* See ethtool.h for more info */
__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
-
- u32 lp_advertising;
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
/* Energy efficient ethernet modes which should be prohibited */
u32 eee_broken_modes;