kernel: bump to 4.4.36
[openwrt/openwrt.git] / target / linux / generic / patches-4.4 / 738-net-phy-at803x-only-the-AT8030-needs-a-hardware-rese.patch
1 From: Timur Tabi <timur@codeaurora.org>
2 Date: Tue, 26 Apr 2016 12:44:18 -0500
3 Subject: [PATCH] net: phy: at803x: only the AT8030 needs a hardware reset on
4 link change
5
6 Commit 13a56b44 ("at803x: Add support for hardware reset") added a
7 work-around for a hardware bug on the AT8030. However, the work-around
8 was being called for all 803x PHYs, even those that don't need it.
9 Function at803x_link_change_notify() checks to make sure that it only
10 resets the PHY on the 8030, but it makes more sense to not call that
11 function at all if it isn't needed.
12
13 Signed-off-by: Timur Tabi <timur@codeaurora.org>
14 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
15 Signed-off-by: David S. Miller <davem@davemloft.net>
16 ---
17
18 --- a/drivers/net/phy/at803x.c
19 +++ b/drivers/net/phy/at803x.c
20 @@ -374,27 +374,25 @@ static void at803x_link_change_notify(st
21 * in the FIFO. In such cases, the FIFO enters an error mode it
22 * cannot recover from by software.
23 */
24 - if (phydev->drv->phy_id == ATH8030_PHY_ID) {
25 - if (phydev->state == PHY_NOLINK) {
26 - if (priv->gpiod_reset && !priv->phy_reset) {
27 - struct at803x_context context;
28 -
29 - at803x_context_save(phydev, &context);
30 -
31 - gpiod_set_value(priv->gpiod_reset, 1);
32 - msleep(1);
33 - gpiod_set_value(priv->gpiod_reset, 0);
34 - msleep(1);
35 -
36 - at803x_context_restore(phydev, &context);
37 -
38 - dev_dbg(&phydev->dev, "%s(): phy was reset\n",
39 - __func__);
40 - priv->phy_reset = true;
41 - }
42 - } else {
43 - priv->phy_reset = false;
44 + if (phydev->state == PHY_NOLINK) {
45 + if (priv->gpiod_reset && !priv->phy_reset) {
46 + struct at803x_context context;
47 +
48 + at803x_context_save(phydev, &context);
49 +
50 + gpiod_set_value(priv->gpiod_reset, 1);
51 + msleep(1);
52 + gpiod_set_value(priv->gpiod_reset, 0);
53 + msleep(1);
54 +
55 + at803x_context_restore(phydev, &context);
56 +
57 + dev_dbg(&phydev->dev, "%s(): phy was reset\n",
58 + __func__);
59 + priv->phy_reset = true;
60 }
61 + } else {
62 + priv->phy_reset = false;
63 }
64 if (pdata && pdata->fixup_rgmii_tx_delay &&
65 phydev->speed != priv->prev_speed) {
66 @@ -426,7 +424,6 @@ static struct phy_driver at803x_driver[]
67 .phy_id_mask = AT803X_PHY_ID_MASK,
68 .probe = at803x_probe,
69 .config_init = at803x_config_init,
70 - .link_change_notify = at803x_link_change_notify,
71 .set_wol = at803x_set_wol,
72 .get_wol = at803x_get_wol,
73 .suspend = at803x_suspend,
74 @@ -468,7 +465,6 @@ static struct phy_driver at803x_driver[]
75 .phy_id_mask = AT803X_PHY_ID_MASK,
76 .probe = at803x_probe,
77 .config_init = at803x_config_init,
78 - .link_change_notify = at803x_link_change_notify,
79 .set_wol = at803x_set_wol,
80 .get_wol = at803x_get_wol,
81 .suspend = at803x_suspend,