1 From b63cc73341e076961d564a74cc3d29b2fd444079 Mon Sep 17 00:00:00 2001
2 From: Heiner Kallweit <hkallweit1@gmail.com>
3 Date: Thu, 8 Feb 2024 07:59:18 +0100
4 Subject: [PATCH] net: phy: realtek: use generic MDIO helpers to simplify the
7 Use generic MDIO helpers to simplify the code.
9 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
10 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
11 Link: https://lore.kernel.org/r/422ae70f-7305-45fd-ab3e-0dd604b9fd6c@gmail.com
12 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
14 drivers/net/phy/realtek.c | 20 +++-----------------
15 1 file changed, 3 insertions(+), 17 deletions(-)
17 --- a/drivers/net/phy/realtek.c
18 +++ b/drivers/net/phy/realtek.c
19 @@ -682,14 +682,7 @@ static int rtl822x_config_aneg(struct ph
22 if (phydev->autoneg == AUTONEG_ENABLE) {
25 - if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
26 - phydev->advertising))
27 - adv |= MDIO_AN_10GBT_CTRL_ADV2_5G;
28 - if (linkmode_test_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
29 - phydev->advertising))
30 - adv |= MDIO_AN_10GBT_CTRL_ADV5G;
31 + u16 adv = linkmode_adv_to_mii_10gbt_adv_t(phydev->advertising);
33 ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12,
34 MDIO_AN_10GBT_CTRL_ADV2_5G |
35 @@ -712,15 +705,8 @@ static int rtl822x_read_status(struct ph
39 - linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT,
40 - phydev->lp_advertising,
41 - lpadv & MDIO_AN_10GBT_STAT_LP10G);
42 - linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
43 - phydev->lp_advertising,
44 - lpadv & MDIO_AN_10GBT_STAT_LP5G);
45 - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
46 - phydev->lp_advertising,
47 - lpadv & MDIO_AN_10GBT_STAT_LP2_5G);
48 + mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising,
52 ret = genphy_read_status(phydev);