kernel: backport phylink changes from mainline Linux
[openwrt/staging/stintel.git] / target / linux / generic / backport-6.1 / 715-25-v6.5-net-phylink-convert-phylink_mii_c22_pcs_config-to-ne.patch
1 From cdb08aa0473730315dbc088d5394e59622314034 Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 16 Jun 2023 13:06:27 +0100
4 Subject: [PATCH 1/2] net: phylink: convert phylink_mii_c22_pcs_config() to
5 neg_mode
6
7 Use phylink_pcs_neg_mode() for phylink_mii_c22_pcs_config(). This
8 results in no functional change.
9
10 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
11 Link: https://lore.kernel.org/r/E1qA8Dj-00EaFG-Mt@rmk-PC.armlinux.org.uk
12 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 ---
14 drivers/net/phy/phylink.c | 9 ++++-----
15 1 file changed, 4 insertions(+), 5 deletions(-)
16
17 --- a/drivers/net/phy/phylink.c
18 +++ b/drivers/net/phy/phylink.c
19 @@ -3558,6 +3558,7 @@ int phylink_mii_c22_pcs_config(struct md
20 phy_interface_t interface,
21 const unsigned long *advertising)
22 {
23 + unsigned int neg_mode;
24 bool changed = 0;
25 u16 bmcr;
26 int ret, adv;
27 @@ -3571,15 +3572,13 @@ int phylink_mii_c22_pcs_config(struct md
28 changed = ret;
29 }
30
31 - /* Ensure ISOLATE bit is disabled */
32 - if (mode == MLO_AN_INBAND &&
33 - (interface == PHY_INTERFACE_MODE_SGMII ||
34 - interface == PHY_INTERFACE_MODE_QSGMII ||
35 - linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, advertising)))
36 + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising);
37 + if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED)
38 bmcr = BMCR_ANENABLE;
39 else
40 bmcr = 0;
41
42 + /* Configure the inband state. Ensure ISOLATE bit is disabled */
43 ret = mdiodev_modify(pcs, MII_BMCR, BMCR_ANENABLE | BMCR_ISOLATE, bmcr);
44 if (ret < 0)
45 return ret;