Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2827476pxb; Mon, 1 Nov 2021 02:39:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsmYgQ/fpGeyHyx9sIhQz5q2RWqqLAD5ujrTC2cuNby1d1ECkc20uHE/1ewKlNDvMuZd5r X-Received: by 2002:a5e:890b:: with SMTP id k11mr20247664ioj.71.1635759560869; Mon, 01 Nov 2021 02:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635759560; cv=none; d=google.com; s=arc-20160816; b=OQMMijKepVShqzvh3iVWO+YGxilxTfEhTUhzr6lDVxukQx+W6rhDBYwPvs0Urtk6N8 9MJN40Kr1k0Ub8itsPEGEFSTMyBPKAapuZkiiV11A/GthqDzeMIIFVTtLJqo5WFDeyLr VP9D8QnvKAWssCzyFmtLXT8rJ5K93LPoej2sNPRxWfaAWG2tCgki0qiB2TbqX9LXrVBg rtZ/ym27RlG3qIdh1UPFen4OEkL7tbQUscCdIKKmMseHFTx01mg2oW8Nh8K6evuUrYi/ GhwtkSDAMJpBDzAwc4Ei/7/6Rqdpubf6bACr2DRFLqtDNNXDsv3Mc19ZA8q6wChOJnkx ka9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ySnkoccpNRhdOIovMd7sLBksRQDOTiCnhakq405Mksc=; b=b9RHK48vuacemwpbq00Z82pTpoezsSejEqNm3OWd6sANvpPcmS8cQaTUw/IYppvjMJ 4IbJlYj3E2IUN6/Z14V60AveuXACAdcxilL4GkgAmdiqs4Bk7O7wRlvMfsQE8gyFiMe5 vaIwmqK2RYze5iX61SHdRb1EMQH4PH82Mbbiwmxf636BRXo2uLdIexeuMeMSshooRMZ5 okSjIATsJJxanOL+Sx7yE9b5OHZsc54L/wZDnBtc+inGGwfO5KENvTrXpz/jM2GYraJ/ 2qZRMRlNg6SmSH/KOO6VeaIz5dPVsP01aCVvbIuqrB8tVvwvsxtKxamLM+VFVtMmaKz5 9nSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S4yyVAfK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o3si21051618jat.84.2021.11.01.02.39.09; Mon, 01 Nov 2021 02:39:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S4yyVAfK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233452AbhKAJjr (ORCPT + 99 others); Mon, 1 Nov 2021 05:39:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:43530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233629AbhKAJho (ORCPT ); Mon, 1 Nov 2021 05:37:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5218461352; Mon, 1 Nov 2021 09:26:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635758788; bh=NWtY/yBNxkcnnGKSfGyzyg6bWegWiIGZz37uhmBi0/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S4yyVAfK6qGGWexuRjf7jtOQUe2Mxq4Q2Rkhts1bs99cVlNSHETTN53TPl87QB7Gs BdrMJvx4igyLWwRNU3ranuYFMDeNNCBxIeIxZnHQmBEOx5G9TlSaMwGMpQs6i4AG8M zz9jI4TByH3t5THqAMYG8mDttQUarFrsbl1eoSvs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trevor Woerner , Vladimir Zapolskiy , "David S. Miller" Subject: [PATCH 5.10 59/77] net: nxp: lpc_eth.c: avoid hang when bringing interface down Date: Mon, 1 Nov 2021 10:17:47 +0100 Message-Id: <20211101082524.058311014@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082511.254155853@linuxfoundation.org> References: <20211101082511.254155853@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trevor Woerner 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: b7370112f519 ("lpc32xx: Added ethernet driver") Signed-off-by: Trevor Woerner Acked-by: Vladimir Zapolskiy Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/nxp/lpc_eth.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c @@ -1015,9 +1015,6 @@ static int lpc_eth_close(struct net_devi 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_devi 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;