aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-02-17 10:27:00 -0800
committerDavid S. Miller <davem@davemloft.net>2019-02-17 10:27:00 -0800
commit9e8ccd895704d61baebdefc164e524fb038d9697 (patch)
tree27ed80285ee6e8fbc0cbee4277be5a4ae6e7293d /include
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next (diff)
parentnet: phy: marvell10g: check for newly set aneg (diff)
downloadlinux-9e8ccd895704d61baebdefc164e524fb038d9697.tar.gz
linux-9e8ccd895704d61baebdefc164e524fb038d9697.zip
Merge branch 'net-phy-add-and-use-genphy_c45_an_config_an'
Heiner Kallweit says: ==================== net: phy: add and use genphy_c45_an_config_an This series adds genphy_c45_an_config_an() and uses it in the marvell10g diver. In addition patch 4 aligns the aneg configuration with what is done in genphy_config_aneg(). v2: - in patch 2 changed function name to genphy_c45_an_config_aneg - in patch 3 add a comment regarding 1000BaseT vendor registers v3: - rebase patch 3 ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mdio.h25
-rw-r--r--include/linux/phy.h1
2 files changed, 26 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)
return reg;
}
+/**
+ * linkmode_adv_to_mii_10gbt_adv_t
+ * @advertising: the linkmode advertisement settings
+ *
+ * A small helper function that translates linkmode advertisement
+ * settings to phy autonegotiation advertisements for the C45
+ * 10GBASE-T AN CONTROL (7.32) register.
+ */
+static inline u32 linkmode_adv_to_mii_10gbt_adv_t(unsigned long *advertising)
+{
+ u32 result = 0;
+
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
+ advertising))
+ result |= MDIO_AN_10GBT_CTRL_ADV2_5G;
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
+ advertising))
+ result |= MDIO_AN_10GBT_CTRL_ADV5G;
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT,
+ advertising))
+ result |= MDIO_AN_10GBT_CTRL_ADV10G;
+
+ return result;
+}
+
int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index bf1070c2a53b..3db507e68191 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1101,6 +1101,7 @@ int genphy_c45_read_link(struct phy_device *phydev);
int genphy_c45_read_lpa(struct phy_device *phydev);
int genphy_c45_read_pma(struct phy_device *phydev);
int genphy_c45_pma_setup_forced(struct phy_device *phydev);
+int genphy_c45_an_config_aneg(struct phy_device *phydev);
int genphy_c45_an_disable_aneg(struct phy_device *phydev);
int genphy_c45_read_mdix(struct phy_device *phydev);
int genphy_c45_pma_read_abilities(struct phy_device *phydev);