First git repo commit for the libreCMC project
[librecmc/librecmc.git] / target / linux / generic / patches-4.4 / 739-net-phy-at803x-add-support-for-AT8032.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Wed, 30 Nov 2016 11:31:03 +0100
3 Subject: [PATCH] net: phy: at803x: add support for AT8032
4
5 Like AT8030, this PHY needs the GPIO reset workaround
6
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 ---
9
10 --- a/drivers/net/phy/at803x.c
11 +++ b/drivers/net/phy/at803x.c
12 @@ -55,6 +55,7 @@
13  #define AT803X_PHY_ID_MASK                     0xffffffef
14  #define ATH8030_PHY_ID                         0x004dd076
15  #define ATH8031_PHY_ID                         0x004dd074
16 +#define ATH8032_PHY_ID                         0x004dd023
17  #define ATH8035_PHY_ID                         0x004dd072
18  
19  MODULE_DESCRIPTION("Atheros 803x PHY driver");
20 @@ -250,7 +251,8 @@ static int at803x_probe(struct phy_devic
21         if (!priv)
22                 return -ENOMEM;
23  
24 -       if (phydev->drv->phy_id != ATH8030_PHY_ID)
25 +       if (phydev->drv->phy_id != ATH8030_PHY_ID &&
26 +           phydev->drv->phy_id != ATH8032_PHY_ID)
27                 goto does_not_require_reset_workaround;
28  
29         gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
30 @@ -478,6 +480,27 @@ static struct phy_driver at803x_driver[]
31         .driver                 = {
32                 .owner = THIS_MODULE,
33         },
34 +}, {
35 +       /* ATHEROS 8032 */
36 +       .phy_id                 = ATH8032_PHY_ID,
37 +       .name                   = "Atheros 8032 ethernet",
38 +       .phy_id_mask            = AT803X_PHY_ID_MASK,
39 +       .probe                  = at803x_probe,
40 +       .config_init            = at803x_config_init,
41 +       .link_change_notify     = at803x_link_change_notify,
42 +       .set_wol                = at803x_set_wol,
43 +       .get_wol                = at803x_get_wol,
44 +       .suspend                = at803x_suspend,
45 +       .resume                 = at803x_resume,
46 +       .features               = PHY_GBIT_FEATURES,
47 +       .flags                  = PHY_HAS_INTERRUPT,
48 +       .config_aneg            = genphy_config_aneg,
49 +       .read_status            = genphy_read_status,
50 +       .ack_interrupt          = &at803x_ack_interrupt,
51 +       .config_intr            = &at803x_config_intr,
52 +       .driver                 = {
53 +               .owner = THIS_MODULE,
54 +       },
55  } };
56  
57  module_phy_driver(at803x_driver);
58 @@ -485,6 +508,7 @@ module_phy_driver(at803x_driver);
59  static struct mdio_device_id __maybe_unused atheros_tbl[] = {
60         { ATH8030_PHY_ID, AT803X_PHY_ID_MASK },
61         { ATH8031_PHY_ID, AT803X_PHY_ID_MASK },
62 +       { ATH8032_PHY_ID, AT803X_PHY_ID_MASK },
63         { ATH8035_PHY_ID, AT803X_PHY_ID_MASK },
64         { }
65  };