v1.5 branch refresh based upon upstream master @ c8677ca89e53e3be7988d54280fce166cc894a7e
[librecmc/librecmc.git] / target / linux / generic / pending-4.14 / 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,6 +62,7 @@
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  
19 @@ -256,7 +257,8 @@ static int at803x_probe(struct phy_devic
20         if (!priv)
21                 return -ENOMEM;
22  
23 -       if (phydev->drv->phy_id != ATH8030_PHY_ID)
24 +       if (phydev->drv->phy_id != ATH8030_PHY_ID &&
25 +           phydev->drv->phy_id != ATH8032_PHY_ID)
26                 goto does_not_require_reset_workaround;
27  
28         gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
29 @@ -332,7 +334,7 @@ static void at803x_link_change_notify(st
30         struct at803x_priv *priv = phydev->priv;
31  
32         /*
33 -        * Conduct a hardware reset for AT8030 every time a link loss is
34 +        * Conduct a hardware reset for AT8030/2 every time a link loss is
35          * signalled. This is necessary to circumvent a hardware bug that
36          * occurs when the cable is unplugged while TX packets are pending
37          * in the FIFO. In such cases, the FIFO enters an error mode it
38 @@ -444,6 +446,24 @@ static struct phy_driver at803x_driver[]
39         .aneg_done              = at803x_aneg_done,
40         .ack_interrupt          = &at803x_ack_interrupt,
41         .config_intr            = &at803x_config_intr,
42 +}, {
43 +       /* ATHEROS 8032 */
44 +       .phy_id                 = ATH8032_PHY_ID,
45 +       .name                   = "Atheros 8032 ethernet",
46 +       .phy_id_mask            = 0xffffffef,
47 +       .probe                  = at803x_probe,
48 +       .config_init            = at803x_config_init,
49 +       .link_change_notify     = at803x_link_change_notify,
50 +       .set_wol                = at803x_set_wol,
51 +       .get_wol                = at803x_get_wol,
52 +       .suspend                = at803x_suspend,
53 +       .resume                 = at803x_resume,
54 +       .features               = PHY_BASIC_FEATURES,
55 +       .flags                  = PHY_HAS_INTERRUPT,
56 +       .config_aneg            = genphy_config_aneg,
57 +       .read_status            = genphy_read_status,
58 +       .ack_interrupt          = at803x_ack_interrupt,
59 +       .config_intr            = at803x_config_intr,
60  } };
61  
62  module_phy_driver(at803x_driver);
63 @@ -451,6 +471,7 @@ module_phy_driver(at803x_driver);
64  static struct mdio_device_id __maybe_unused atheros_tbl[] = {
65         { ATH8030_PHY_ID, AT803X_PHY_ID_MASK },
66         { ATH8031_PHY_ID, AT803X_PHY_ID_MASK },
67 +       { ATH8032_PHY_ID, AT803X_PHY_ID_MASK },
68         { ATH8035_PHY_ID, AT803X_PHY_ID_MASK },
69         { }
70  };