kernel: copy kernel 4.19 code to 5.4
[openwrt/openwrt.git] / target / linux / generic / pending-5.4 / 180-net-phy-at803x-add-support-for-AT8032.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Subject: net: phy: at803x: add support for AT8032
3
4 Like AT8030, this PHY needs the GPIO reset workaround
5
6 Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 ---
8
9 --- a/drivers/net/phy/at803x.c
10 +++ b/drivers/net/phy/at803x.c
11 @@ -62,8 +62,10 @@
12
13 #define ATH8030_PHY_ID 0x004dd076
14 #define ATH8031_PHY_ID 0x004dd074
15 +#define ATH8032_PHY_ID 0x004dd023
16 #define ATH8035_PHY_ID 0x004dd072
17 #define AT803X_PHY_ID_MASK 0xffffffef
18 +#define AT8032_PHY_ID_MASK 0xffffffff
19
20 MODULE_DESCRIPTION("Atheros 803x PHY driver");
21 MODULE_AUTHOR("Matus Ujhelyi");
22 @@ -308,7 +310,7 @@ static void at803x_link_change_notify(st
23 struct at803x_priv *priv = phydev->priv;
24
25 /*
26 - * Conduct a hardware reset for AT8030 every time a link loss is
27 + * Conduct a hardware reset for AT8030/2 every time a link loss is
28 * signalled. This is necessary to circumvent a hardware bug that
29 * occurs when the cable is unplugged while TX packets are pending
30 * in the FIFO. In such cases, the FIFO enters an error mode it
31 @@ -414,6 +416,24 @@ static struct phy_driver at803x_driver[]
32 .aneg_done = at803x_aneg_done,
33 .ack_interrupt = &at803x_ack_interrupt,
34 .config_intr = &at803x_config_intr,
35 +}, {
36 + /* ATHEROS 8032 */
37 + .phy_id = ATH8032_PHY_ID,
38 + .name = "Atheros 8032 ethernet",
39 + .phy_id_mask = AT8032_PHY_ID_MASK,
40 + .probe = at803x_probe,
41 + .config_init = at803x_config_init,
42 + .link_change_notify = at803x_link_change_notify,
43 + .set_wol = at803x_set_wol,
44 + .get_wol = at803x_get_wol,
45 + .suspend = at803x_suspend,
46 + .resume = at803x_resume,
47 + .features = PHY_BASIC_FEATURES,
48 + .flags = PHY_HAS_INTERRUPT,
49 + .config_aneg = genphy_config_aneg,
50 + .read_status = genphy_read_status,
51 + .ack_interrupt = at803x_ack_interrupt,
52 + .config_intr = at803x_config_intr,
53 } };
54
55 module_phy_driver(at803x_driver);
56 @@ -421,6 +441,7 @@ module_phy_driver(at803x_driver);
57 static struct mdio_device_id __maybe_unused atheros_tbl[] = {
58 { ATH8030_PHY_ID, AT803X_PHY_ID_MASK },
59 { ATH8031_PHY_ID, AT803X_PHY_ID_MASK },
60 + { ATH8032_PHY_ID, AT8032_PHY_ID_MASK },
61 { ATH8035_PHY_ID, AT803X_PHY_ID_MASK },
62 { }
63 };