]> git.hungrycats.org Git - linux/commitdiff
net: stmmac: start phylink instance before stmmac_hw_setup()
authorFugang Duan <fugang.duan@nxp.com>
Mon, 7 Dec 2020 10:51:38 +0000 (18:51 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Dec 2020 12:28:16 +0000 (13:28 +0100)
[ Upstream commit 36d18b5664ef617ccf4da266291d2f2342fab89d ]

Start phylink instance and resume back the PHY to supply
RX clock to MAC before MAC layer initialization by calling
.stmmac_hw_setup(), since DMA reset depends on the RX clock,
otherwise DMA reset cost maximum timeout value then finally
timeout.

Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic")
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index aa51d16965fe5bf7281c1bdc6e8965706fdd4181..5e94488991acc6f64012adeaa230e9b5774e5564 100644 (file)
@@ -5170,6 +5170,14 @@ int stmmac_resume(struct device *dev)
                        return ret;
        }
 
+       if (!device_may_wakeup(priv->device) || !priv->plat->pmt) {
+               rtnl_lock();
+               phylink_start(priv->phylink);
+               /* We may have called phylink_speed_down before */
+               phylink_speed_up(priv->phylink);
+               rtnl_unlock();
+       }
+
        rtnl_lock();
        mutex_lock(&priv->lock);
 
@@ -5188,14 +5196,6 @@ int stmmac_resume(struct device *dev)
        mutex_unlock(&priv->lock);
        rtnl_unlock();
 
-       if (!device_may_wakeup(priv->device) || !priv->plat->pmt) {
-               rtnl_lock();
-               phylink_start(priv->phylink);
-               /* We may have called phylink_speed_down before */
-               phylink_speed_up(priv->phylink);
-               rtnl_unlock();
-       }
-
        phylink_mac_change(priv->phylink, true);
 
        netif_device_attach(ndev);