kernel: backport ipeth CDC NCM support
[openwrt/openwrt.git] / target / linux / generic / backport-6.1 / 707-v6.8-02-net-phy-at803x-move-disable-WOL-to-specific-at8031-p.patch
1 From 6a3b8c573b5a152a6aa7a0b54c5e18b84c6ba6f5 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Fri, 8 Dec 2023 15:51:49 +0100
4 Subject: [PATCH 02/13] net: phy: at803x: move disable WOL to specific at8031
5 probe
6
7 Move the WOL disable call to specific at8031 probe to make at803x_probe
8 more generic and drop extra check for PHY ID.
9
10 Keep the same previous behaviour by first calling at803x_probe and then
11 disabling WOL.
12
13 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
14 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
15 Signed-off-by: David S. Miller <davem@davemloft.net>
16 ---
17 drivers/net/phy/at803x.c | 27 +++++++++++++++++----------
18 1 file changed, 17 insertions(+), 10 deletions(-)
19
20 --- a/drivers/net/phy/at803x.c
21 +++ b/drivers/net/phy/at803x.c
22 @@ -886,15 +886,6 @@ static int at803x_probe(struct phy_devic
23 priv->is_fiber = true;
24 break;
25 }
26 -
27 - /* Disable WoL in 1588 register which is enabled
28 - * by default
29 - */
30 - ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
31 - AT803X_PHY_MMD3_WOL_CTRL,
32 - AT803X_WOL_EN, 0);
33 - if (ret)
34 - return ret;
35 }
36
37 return 0;
38 @@ -1591,6 +1582,22 @@ static int at803x_cable_test_start(struc
39 return 0;
40 }
41
42 +static int at8031_probe(struct phy_device *phydev)
43 +{
44 + int ret;
45 +
46 + ret = at803x_probe(phydev);
47 + if (ret)
48 + return ret;
49 +
50 + /* Disable WoL in 1588 register which is enabled
51 + * by default
52 + */
53 + return phy_modify_mmd(phydev, MDIO_MMD_PCS,
54 + AT803X_PHY_MMD3_WOL_CTRL,
55 + AT803X_WOL_EN, 0);
56 +}
57 +
58 static int qca83xx_config_init(struct phy_device *phydev)
59 {
60 u8 switch_revision;
61 @@ -2092,7 +2099,7 @@ static struct phy_driver at803x_driver[]
62 PHY_ID_MATCH_EXACT(ATH8031_PHY_ID),
63 .name = "Qualcomm Atheros AR8031/AR8033",
64 .flags = PHY_POLL_CABLE_TEST,
65 - .probe = at803x_probe,
66 + .probe = at8031_probe,
67 .config_init = at803x_config_init,
68 .config_aneg = at803x_config_aneg,
69 .soft_reset = genphy_soft_reset,