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

net: phy: teranetics: Utilize generic functions

Update teranetics_aneg_done() to use genphy_c45_aneg_done() instead of
duplicating that code, and switch to gen10g_* functions where
appropriate instead of maintaining identical copies doing nothing.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

authored by

Florian Fainelli and committed by
David S. Miller
aebc78a4 e8a714e0

+5 -27
+5 -27
drivers/net/phy/teranetics.c
··· 34 34 MDIO_PHYXS_LNSTAT_SYNC3 | \ 35 35 MDIO_PHYXS_LNSTAT_ALIGN) 36 36 37 - static int teranetics_config_init(struct phy_device *phydev) 38 - { 39 - phydev->supported = SUPPORTED_10000baseT_Full; 40 - phydev->advertising = SUPPORTED_10000baseT_Full; 41 - 42 - return 0; 43 - } 44 - 45 - static int teranetics_soft_reset(struct phy_device *phydev) 46 - { 47 - return 0; 48 - } 49 - 50 37 static int teranetics_aneg_done(struct phy_device *phydev) 51 38 { 52 - int reg; 53 - 54 39 /* auto negotiation state can only be checked when using copper 55 40 * port, if using fiber port, just lie it's done. 56 41 */ 57 - if (!phy_read_mmd(phydev, MDIO_MMD_VEND1, 93)) { 58 - reg = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1); 59 - return (reg < 0) ? reg : (reg & BMSR_ANEGCOMPLETE); 60 - } 42 + if (!phy_read_mmd(phydev, MDIO_MMD_VEND1, 93)) 43 + return genphy_c45_aneg_done(phydev); 61 44 62 45 return 1; 63 - } 64 - 65 - static int teranetics_config_aneg(struct phy_device *phydev) 66 - { 67 - return 0; 68 46 } 69 47 70 48 static int teranetics_read_status(struct phy_device *phydev) ··· 80 102 .phy_id = PHY_ID_TN2020, 81 103 .phy_id_mask = 0xffffffff, 82 104 .name = "Teranetics TN2020", 83 - .soft_reset = teranetics_soft_reset, 105 + .soft_reset = gen10g_no_soft_reset, 84 106 .aneg_done = teranetics_aneg_done, 85 - .config_init = teranetics_config_init, 86 - .config_aneg = teranetics_config_aneg, 107 + .config_init = gen10g_config_init, 108 + .config_aneg = gen10g_config_aneg, 87 109 .read_status = teranetics_read_status, 88 110 .match_phy_device = teranetics_match_phy_device, 89 111 },