Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2816223pxb; Mon, 1 Nov 2021 02:22:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEcl63FwmA3vlEdKSGFnNET/yo00I0YGg07wdBh8kGPbCaCK8SFMaOlu8kvdtAEdKlb/Nw X-Received: by 2002:a05:6e02:1b8a:: with SMTP id h10mr19032108ili.219.1635758575673; Mon, 01 Nov 2021 02:22:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635758575; cv=none; d=google.com; s=arc-20160816; b=mDJjLdBhXKm6LeHZhWN2qALvf8nkFvD/2Yvx7tAbSMMy4lkz08OnGsmyzOy65gm6nq uawzaTc/3dKvcoAdt09k+lfjILVq8caSKyn/KGO1sozNHwLh5n6DcnZaclGdTBiahNyh Y0g8GoERwrwTcso4U2lGvRyA1q4RpqYXj2Waok7ZlG9CNQ1IGAGjgcFyaageIq6UdODc FdGDjPaJxIoCQ9/9Ls+vzIlFHz/nCJ8C2OzmVMqtQkMfJXsxu1yEpMALS+QyEjbT0gaL eH/LPBSbfLv91j1v7D6RNm5bg9Cbs0+GeC0UbS//2/iUaHgVPO0BPBS8BHz5D0czVnur hLbg== 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=SsHB9LpwEaVmJttAwr9KI2YkriGGs24TLHeWaPMVJ/k=; b=nTvyQeJ+a6EVQfLXLMZiSnRPhBtZmcm8FyTPkpiPFMdDByWvKKedqzPUu3gjvEWkJP SMSILo9dF6WyB8paJWjOl+ijPG12W1I5vjk80VfHrhsvehG4mLo7mNMUU3L/qcjZpRJs DLeeX6Ce8diP1Moaz6zJ0KtQuuR3qsHoMCemLYQBOdg7oJkwuxUVqd85lURx3npdNmp2 ZUQFSYrtWiaecdg0Pd6yxjli9xm2bGcdZNXDMzgCBiZBigvKbfJb+fGNYGVT71KTdDQg 9lg+hXcBJmvruBWSdZuves0/XHtCJoP4FS9ani3KzA536lSaCCoXtwMm4e4/G6mcB3hz Iecg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ct8h/4pr"; 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 n1si22544695ili.170.2021.11.01.02.22.43; Mon, 01 Nov 2021 02:22:55 -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="ct8h/4pr"; 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 S232488AbhKAJXa (ORCPT + 99 others); Mon, 1 Nov 2021 05:23:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:58178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232252AbhKAJWg (ORCPT ); Mon, 1 Nov 2021 05:22:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D26E461166; Mon, 1 Nov 2021 09:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635758376; bh=shtjU+p2NCu2mu9HUq7unFtiM+hkby71sUG0AJ6qYpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ct8h/4prY56oQ95WTI5ph1Man+y6wuEoGcUxFg8L8JxaqiP9p2cGPB+YQjhu16fW8 UHynueLqCwrZMU0T3W9foxYCUzVM0avY+ZvhkCih1d+yjKKUfuQqetkC3xpumUXz8q GuhfPgnJlI1xId+dIE9bTcyPFZ+uaUAY3Sg0mdok= 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 4.9 18/20] net: nxp: lpc_eth.c: avoid hang when bringing interface down Date: Mon, 1 Nov 2021 10:17:27 +0100 Message-Id: <20211101082447.960614660@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082444.133899096@linuxfoundation.org> References: <20211101082444.133899096@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 @@ -1039,9 +1039,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); @@ -1049,6 +1046,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;