]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.8.10/net-stmmac-fix-lack-of-link-transition-for-fixed-phys.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.8.10 / net-stmmac-fix-lack-of-link-transition-for-fixed-phys.patch
CommitLineData
5c38cac1
GKH
1From foo@baz Fri Nov 18 11:35:46 CET 2016
2From: Florian Fainelli <f.fainelli@gmail.com>
3Date: Sun, 13 Nov 2016 17:50:35 -0800
4Subject: net: stmmac: Fix lack of link transition for fixed PHYs
5
6From: Florian Fainelli <f.fainelli@gmail.com>
7
8
9[ Upstream commit c51e424dc79e1428afc4d697cdb6a07f7af70cbf ]
10
11Commit 52f95bbfcf72 ("stmmac: fix adjust link call in case of a switch
12is attached") added some logic to avoid polling the fixed PHY and
13therefore invoking the adjust_link callback more than once, since this
14is a fixed PHY and link events won't be generated.
15
16This works fine the first time, because we start with phydev->irq =
17PHY_POLL, so we call adjust_link, then we set phydev->irq =
18PHY_IGNORE_INTERRUPT and we stop polling the PHY.
19
20Now, if we called ndo_close(), which calls both phy_stop() and does an
21explicit netif_carrier_off(), we end up with a link down. Upon calling
22ndo_open() again, despite starting the PHY state machine, we have
23PHY_IGNORE_INTERRUPT set, and we generate no link event at all, so the
24link is permanently down.
25
26Fixes: 52f95bbfcf72 ("stmmac: fix adjust link call in case of a switch is attached")
27Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
28Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
29Signed-off-by: David S. Miller <davem@davemloft.net>
30Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
31---
32 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 +++++++
33 1 file changed, 7 insertions(+)
34
35--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
36+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
37@@ -871,6 +871,13 @@ static int stmmac_init_phy(struct net_de
38 return -ENODEV;
39 }
40
41+ /* stmmac_adjust_link will change this to PHY_IGNORE_INTERRUPT to avoid
42+ * subsequent PHY polling, make sure we force a link transition if
43+ * we have a UP/DOWN/UP transition
44+ */
45+ if (phydev->is_pseudo_fixed_link)
46+ phydev->irq = PHY_POLL;
47+
48 pr_debug("stmmac_init_phy: %s: attached to PHY (UID 0x%x)"
49 " Link = %d\n", dev->name, phydev->phy_id, phydev->link);
50