diff options
| author | Florian Fainelli <f.fainelli@gmail.com> | 2016-11-13 20:50:35 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-11-14 16:39:15 -0500 |
| commit | c51e424dc79e1428afc4d697cdb6a07f7af70cbf (patch) | |
| tree | 134649e585c87c481cb11cce69461befdef732eb | |
| parent | 5bf35ddfee052d44f39ebaa395d87101c8918405 (diff) | |
net: stmmac: Fix lack of link transition for fixed PHYs
Commit 52f95bbfcf72 ("stmmac: fix adjust link call in case of a switch
is attached") added some logic to avoid polling the fixed PHY and
therefore invoking the adjust_link callback more than once, since this
is a fixed PHY and link events won't be generated.
This works fine the first time, because we start with phydev->irq =
PHY_POLL, so we call adjust_link, then we set phydev->irq =
PHY_IGNORE_INTERRUPT and we stop polling the PHY.
Now, if we called ndo_close(), which calls both phy_stop() and does an
explicit netif_carrier_off(), we end up with a link down. Upon calling
ndo_open() again, despite starting the PHY state machine, we have
PHY_IGNORE_INTERRUPT set, and we generate no link event at all, so the
link is permanently down.
Fixes: 52f95bbfcf72 ("stmmac: fix adjust link call in case of a switch is attached")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 48e71fad4210..e2c94ec4edd0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
| @@ -880,6 +880,13 @@ static int stmmac_init_phy(struct net_device *dev) | |||
| 880 | return -ENODEV; | 880 | return -ENODEV; |
| 881 | } | 881 | } |
| 882 | 882 | ||
| 883 | /* stmmac_adjust_link will change this to PHY_IGNORE_INTERRUPT to avoid | ||
| 884 | * subsequent PHY polling, make sure we force a link transition if | ||
| 885 | * we have a UP/DOWN/UP transition | ||
| 886 | */ | ||
| 887 | if (phydev->is_pseudo_fixed_link) | ||
| 888 | phydev->irq = PHY_POLL; | ||
| 889 | |||
| 883 | pr_debug("stmmac_init_phy: %s: attached to PHY (UID 0x%x)" | 890 | pr_debug("stmmac_init_phy: %s: attached to PHY (UID 0x%x)" |
| 884 | " Link = %d\n", dev->name, phydev->phy_id, phydev->link); | 891 | " Link = %d\n", dev->name, phydev->phy_id, phydev->link); |
| 885 | 892 | ||
