ath25: switch default kernel to 5.15
[openwrt/openwrt.git] / target / linux / generic / backport-5.10 / 729-v5.14-net-phy-at803x-mask-1000-Base-X-link-mode.patch
1 From b856150c8098f12996ee81c3ab2a65adbaeeb3ec Mon Sep 17 00:00:00 2001
2 From: David Bauer <mail@david-bauer.net>
3 Date: Sun, 27 Jun 2021 12:16:07 +0200
4 Subject: [PATCH] net: phy: at803x: mask 1000 Base-X link mode
5
6 AR8031/AR8033 have different status registers for copper
7 and fiber operation. However, the extended status register
8 is the same for both operation modes.
9
10 As a result of that, ESTATUS_1000_XFULL is set to 1 even when
11 operating in copper TP mode.
12
13 Remove this mode from the supported link modes, as this driver
14 currently only supports copper operation.
15
16 Signed-off-by: David Bauer <mail@david-bauer.net>
17 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
19 ---
20 drivers/net/phy/at803x.c | 30 +++++++++++++++++++++++++++++-
21 1 file changed, 29 insertions(+), 1 deletion(-)
22
23 --- a/drivers/net/phy/at803x.c
24 +++ b/drivers/net/phy/at803x.c
25 @@ -583,6 +583,34 @@ static void at803x_remove(struct phy_dev
26 regulator_disable(priv->vddio);
27 }
28
29 +static int at803x_get_features(struct phy_device *phydev)
30 +{
31 + int err;
32 +
33 + err = genphy_read_abilities(phydev);
34 + if (err)
35 + return err;
36 +
37 + if (!at803x_match_phy_id(phydev, ATH8031_PHY_ID))
38 + return 0;
39 +
40 + /* AR8031/AR8033 have different status registers
41 + * for copper and fiber operation. However, the
42 + * extended status register is the same for both
43 + * operation modes.
44 + *
45 + * As a result of that, ESTATUS_1000_XFULL is set
46 + * to 1 even when operating in copper TP mode.
47 + *
48 + * Remove this mode from the supported link modes,
49 + * as this driver currently only supports copper
50 + * operation.
51 + */
52 + linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
53 + phydev->supported);
54 + return 0;
55 +}
56 +
57 static int at803x_clk_out_config(struct phy_device *phydev)
58 {
59 struct at803x_priv *priv = phydev->priv;
60 @@ -1156,7 +1184,7 @@ static struct phy_driver at803x_driver[]
61 .resume = at803x_resume,
62 .read_page = at803x_read_page,
63 .write_page = at803x_write_page,
64 - /* PHY_GBIT_FEATURES */
65 + .get_features = at803x_get_features,
66 .read_status = at803x_read_status,
67 .aneg_done = at803x_aneg_done,
68 .ack_interrupt = &at803x_ack_interrupt,