kernel: backport phylink changes from mainline Linux
[openwrt/staging/pepe2k.git] / target / linux / generic / backport-6.1 / 715-10-v6.4-net-dpaa2-mac-use-Autoneg-bit-rather-than-an_enabled.patch
1 From 99d0f3a1095f4c938b1665025c29411edafe8a01 Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Tue, 21 Mar 2023 15:58:44 +0000
4 Subject: [PATCH] net: dpaa2-mac: use Autoneg bit rather than an_enabled
5
6 The Autoneg bit in the advertising bitmap and state->an_enabled are
7 always identical. Thus, we will be removing state->an_enabled.
8
9 Use the Autoneg bit in the advertising bitmap to indicate whether
10 autonegotiation should be used, rather than using the an_enabled
11 member which will be going away. This means we use the same condition
12 as phylink_mii_c22_pcs_config().
13
14 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
15 Reviewed-by: Simon Horman <simon.horman@corigine.com>
16 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
17 ---
18 drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 3 ++-
19 1 file changed, 2 insertions(+), 1 deletion(-)
20
21 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
22 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
23 @@ -158,7 +158,8 @@ static void dpaa2_mac_config(struct phyl
24 struct dpmac_link_state *dpmac_state = &mac->state;
25 int err;
26
27 - if (state->an_enabled)
28 + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
29 + state->advertising))
30 dpmac_state->options |= DPMAC_LINK_OPT_AUTONEG;
31 else
32 dpmac_state->options &= ~DPMAC_LINK_OPT_AUTONEG;