Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2834380pxb; Mon, 1 Nov 2021 02:50:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9PtvggUPWbg841nKZyPZ7BNt9dwXPgwcTbJLIXVBasEWsR2g/l5vfpMdjCMxsB6zl09z7 X-Received: by 2002:a92:cb01:: with SMTP id s1mr18597803ilo.41.1635760206546; Mon, 01 Nov 2021 02:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635760206; cv=none; d=google.com; s=arc-20160816; b=czodS8wOFjsBGqmWkLIUlbI4JdQgwlDddQP0RvbqGJinnynvp6xtgq/iLG8PzA0iO0 yvW6+JX8Wsio+8lH66MpbGRmsBrTz7I7OxosCkXtrbxjVisFkcjVjyqiZggITIaYm23r ORoZIAqS5MO43rYht9S5TzezL/8rGsAaJ5x4/wRTkCJNLUmZqr5LN0C+9ImaJsoxmrRa J8kzYvMquk8w/VKtx/XJ0wF9TeUBm5fm7fZnQu2vlg1wvBhmtMhS/44NEXyGLptXs+FR Iy5WD+RA9Pl6KA0Tx9I3tfXb/ch/RA7vj9JrdDxuN706arc+Qt7FtMqlVpTEbVSxdNy/ Knig== 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=awNAHh5Pu9kQ+qNJ9/FpeKxXqwzC7ci6GnBboiXDepCbdMFOmM52sNAfUT9eSfwKqi j+MlRMb18RQoHvzheBYA5QsqffS0xcSntO9gOYXaQQTz/N338qS5dufX6nFwAFf4emc8 Pbs8ntfle7+CfqQWH8mPAxTr2E1+kr3INv96FzvR1/ui2MdMi8CjE7awd5IGjn5sxf/R POb6qlphihPJ2ryC8R1zFh3cfa1pDhdxPz36mWGo8qUz8RseCj030rgg7R/Oy+Pht5P/ 4PvAifnXsedI63FjYOrIeIa3F4UxaunGK+wWarSzD4oCiriOXW3GCmJI9dA5Jr5NssIJ tAeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xdBF89mC; 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 ay5si21059379jab.64.2021.11.01.02.49.55; Mon, 01 Nov 2021 02:50:06 -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=xdBF89mC; 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 S233180AbhKAJub (ORCPT + 99 others); Mon, 1 Nov 2021 05:50:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:51088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234562AbhKAJrK (ORCPT ); Mon, 1 Nov 2021 05:47:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 75E3D613E8; Mon, 1 Nov 2021 09:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635759035; bh=NWtY/yBNxkcnnGKSfGyzyg6bWegWiIGZz37uhmBi0/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xdBF89mC24CtwD7hCW865/DEjMsJZfAkl++wDUI0O+67+H7dmpA7wImosi+P8XCP6 3uhhxL9l0xG2hKNdv75af22UhFdb94vdK9X372Xeg8VY9Rrc1kc6qhfJtJLU+gmp5I qONg+aCF1KjniI+FS+8FrZccOeIF79jLoSAeKh2Y= 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.14 087/125] net: nxp: lpc_eth.c: avoid hang when bringing interface down Date: Mon, 1 Nov 2021 10:17:40 +0100 Message-Id: <20211101082549.663553273@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082533.618411490@linuxfoundation.org> References: <20211101082533.618411490@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;