]>
Commit | Line | Data |
---|---|---|
5c38cac1 GKH |
1 | From foo@baz Fri Nov 18 11:35:46 CET 2016 |
2 | From: Florian Fainelli <f.fainelli@gmail.com> | |
3 | Date: Sun, 13 Nov 2016 17:50:35 -0800 | |
4 | Subject: net: stmmac: Fix lack of link transition for fixed PHYs | |
5 | ||
6 | From: Florian Fainelli <f.fainelli@gmail.com> | |
7 | ||
8 | ||
9 | [ Upstream commit c51e424dc79e1428afc4d697cdb6a07f7af70cbf ] | |
10 | ||
11 | Commit 52f95bbfcf72 ("stmmac: fix adjust link call in case of a switch | |
12 | is attached") added some logic to avoid polling the fixed PHY and | |
13 | therefore invoking the adjust_link callback more than once, since this | |
14 | is a fixed PHY and link events won't be generated. | |
15 | ||
16 | This works fine the first time, because we start with phydev->irq = | |
17 | PHY_POLL, so we call adjust_link, then we set phydev->irq = | |
18 | PHY_IGNORE_INTERRUPT and we stop polling the PHY. | |
19 | ||
20 | Now, if we called ndo_close(), which calls both phy_stop() and does an | |
21 | explicit netif_carrier_off(), we end up with a link down. Upon calling | |
22 | ndo_open() again, despite starting the PHY state machine, we have | |
23 | PHY_IGNORE_INTERRUPT set, and we generate no link event at all, so the | |
24 | link is permanently down. | |
25 | ||
26 | Fixes: 52f95bbfcf72 ("stmmac: fix adjust link call in case of a switch is attached") | |
27 | Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> | |
28 | Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> | |
29 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
30 | Signed-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 |