Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b75fa48e authored by Trevor Woerner's avatar Trevor Woerner Committed by Greg Kroah-Hartman
Browse files

net: nxp: lpc_eth.c: avoid hang when bringing interface down



commit ace19b992436a257d9a793672e57abc28fe83e2e 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: b7370112 ("lpc32xx: Added ethernet driver")
Signed-off-by: default avatarTrevor Woerner <twoerner@gmail.com>
Acked-by: default avatarVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 84a9eb9a
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1037,9 +1037,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);
@@ -1047,6 +1044,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;