Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: phy: c45: add a separate function to read BASE-T1 abilities

Add a separate function to read the BASE-T1 abilities. Some PHYs do not
indicate the availability of the extended BASE-T1 ability register, so
this function must be called separately.

Signed-off-by: Stefan Eichenberger <eichest@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Stefan Eichenberger and committed by
Paolo Abeni
eba2e4c2 25108a83

+32 -13
+31 -13
drivers/net/phy/phy-c45.c
··· 882 882 } 883 883 884 884 /** 885 + * genphy_c45_pma_baset1_read_abilities - read supported baset1 link modes from PMA 886 + * @phydev: target phy_device struct 887 + * 888 + * Read the supported link modes from the extended BASE-T1 ability register 889 + */ 890 + int genphy_c45_pma_baset1_read_abilities(struct phy_device *phydev) 891 + { 892 + int val; 893 + 894 + val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1); 895 + if (val < 0) 896 + return val; 897 + 898 + linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT, 899 + phydev->supported, 900 + val & MDIO_PMA_PMD_BT1_B10L_ABLE); 901 + 902 + val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_T1_STAT); 903 + if (val < 0) 904 + return val; 905 + 906 + linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, 907 + phydev->supported, 908 + val & MDIO_AN_STAT1_ABLE); 909 + 910 + return 0; 911 + } 912 + EXPORT_SYMBOL_GPL(genphy_c45_pma_baset1_read_abilities); 913 + 914 + /** 885 915 * genphy_c45_pma_read_abilities - read supported link modes from PMA 886 916 * @phydev: target phy_device struct 887 917 * ··· 1007 977 } 1008 978 1009 979 if (val & MDIO_PMA_EXTABLE_BT1) { 1010 - val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1); 980 + val = genphy_c45_pma_baset1_read_abilities(phydev); 1011 981 if (val < 0) 1012 982 return val; 1013 - 1014 - linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT, 1015 - phydev->supported, 1016 - val & MDIO_PMA_PMD_BT1_B10L_ABLE); 1017 - 1018 - val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_T1_STAT); 1019 - if (val < 0) 1020 - return val; 1021 - 1022 - linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, 1023 - phydev->supported, 1024 - val & MDIO_AN_STAT1_ABLE); 1025 983 } 1026 984 } 1027 985
+1
include/linux/phy.h
··· 1826 1826 int genphy_c45_an_disable_aneg(struct phy_device *phydev); 1827 1827 int genphy_c45_read_mdix(struct phy_device *phydev); 1828 1828 int genphy_c45_pma_read_abilities(struct phy_device *phydev); 1829 + int genphy_c45_pma_baset1_read_abilities(struct phy_device *phydev); 1829 1830 int genphy_c45_read_eee_abilities(struct phy_device *phydev); 1830 1831 int genphy_c45_pma_baset1_read_master_slave(struct phy_device *phydev); 1831 1832 int genphy_c45_read_status(struct phy_device *phydev);