]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: nxp: lpc_eth.c: avoid hang when bringing interface down
authorTrevor Woerner <twoerner@gmail.com>
Sun, 24 Oct 2021 17:50:02 +0000 (13:50 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 25 Oct 2021 14:40:27 +0000 (15:40 +0100)
A hard hang is observed whenever the ethernet interface is brought
down. If the PHY is stopped before the LPC core block is reset,
the SoC will hang. Comparing lpc_eth_close() and lpc_eth_open() I
re-arranged the ordering of the functions calls in lpc_eth_close() to
reset the hardware before stopping the PHY.
Fixes: b7370112f519 ("lpc32xx: Added ethernet driver")
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/nxp/lpc_eth.c

index d29fe562b3decbac43b8454b6a52982c2a864ee0..c910fa2f40a4bc710d63a5411b8a9c679c0b05a4 100644 (file)
@@ -1015,9 +1015,6 @@ static int lpc_eth_close(struct net_device *ndev)
        napi_disable(&pldat->napi);
        netif_stop_queue(ndev);
 
-       if (ndev->phydev)
-               phy_stop(ndev->phydev);
-
        spin_lock_irqsave(&pldat->lock, flags);
        __lpc_eth_reset(pldat);
        netif_carrier_off(ndev);
@@ -1025,6 +1022,8 @@ static int lpc_eth_close(struct net_device *ndev)
        writel(0, LPC_ENET_MAC2(pldat->net_base));
        spin_unlock_irqrestore(&pldat->lock, flags);
 
+       if (ndev->phydev)
+               phy_stop(ndev->phydev);
        clk_disable_unprepare(pldat->clk);
 
        return 0;