Skip to content

Commit

Permalink
net: nxp: lpc_eth.c: avoid hang when bringing interface down
Browse files Browse the repository at this point in the history
commit ace19b9 upstream.

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: b737011 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Trevor Woerner authored and Greg Kroah-Hartman committed Nov 2, 2021
1 parent 06ccfe9 commit d8b6d0b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/net/ethernet/nxp/lpc_eth.c
Original file line number Diff line number Diff line change
@@ -1039,16 +1039,15 @@ 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);
writel(0, LPC_ENET_MAC1(pldat->net_base));
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;

0 comments on commit d8b6d0b

Please sign in to comment.