diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2019-02-17 04:28:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-02-17 13:26:34 -0500 |
commit | 744e458aebf8dc7f33eee9af61aeb0145de921a6 (patch) | |
tree | 61fd4d25736f07fc48fabf92302d3b07980008ea | |
parent | 885e63195980ab25abc67336f0c44d4cb4e6e72b (diff) |
net: phy: add helper linkmode_adv_to_mii_10gbt_adv_t
Add a helper linkmode_adv_to_mii_10gbt_adv_t(), similar to
linkmode_adv_to_mii_adv_t.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/mdio.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/mdio.h b/include/linux/mdio.h index bfa7114167d7..dd46828b4c47 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h | |||
@@ -261,6 +261,31 @@ static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv) | |||
261 | return reg; | 261 | return reg; |
262 | } | 262 | } |
263 | 263 | ||
264 | /** | ||
265 | * linkmode_adv_to_mii_10gbt_adv_t | ||
266 | * @advertising: the linkmode advertisement settings | ||
267 | * | ||
268 | * A small helper function that translates linkmode advertisement | ||
269 | * settings to phy autonegotiation advertisements for the C45 | ||
270 | * 10GBASE-T AN CONTROL (7.32) register. | ||
271 | */ | ||
272 | static inline u32 linkmode_adv_to_mii_10gbt_adv_t(unsigned long *advertising) | ||
273 | { | ||
274 | u32 result = 0; | ||
275 | |||
276 | if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, | ||
277 | advertising)) | ||
278 | result |= MDIO_AN_10GBT_CTRL_ADV2_5G; | ||
279 | if (linkmode_test_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, | ||
280 | advertising)) | ||
281 | result |= MDIO_AN_10GBT_CTRL_ADV5G; | ||
282 | if (linkmode_test_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, | ||
283 | advertising)) | ||
284 | result |= MDIO_AN_10GBT_CTRL_ADV10G; | ||
285 | |||
286 | return result; | ||
287 | } | ||
288 | |||
264 | int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum); | 289 | int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum); |
265 | int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val); | 290 | int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val); |
266 | 291 | ||