From patchwork Mon Feb 12 10:50:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ernberg X-Patchwork-Id: 199652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2352344dyd; Mon, 12 Feb 2024 02:54:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWYjCodhQvJ8rz4T7a+HKlRR2mQ8LdG00KGIk/TATEYPtgzZGtcKSq4u567/F4L0+0NVG16VGdFIdPS2ZGAfShKPuBNNA== X-Google-Smtp-Source: AGHT+IH3BrwWB5Kik6gEuY4NypLvYX4TY4MO1aKu3BSo1hm9o6rlapbZXEFmKpzeOE2RDQqsoYCp X-Received: by 2002:a05:620a:22b3:b0:785:a232:6fee with SMTP id p19-20020a05620a22b300b00785a2326feemr6407353qkh.5.1707735287549; Mon, 12 Feb 2024 02:54:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707735287; cv=pass; d=google.com; s=arc-20160816; b=sNB9VKZTKTNBWk+AfYVHsMOCOpi5iMU6AKxhWybTB1JxEhy/KzRtyRL96Qh+N0ls4M HAbsGIAGlkbnauEv0k1EcnMdBMaMolIF/ADAlYYo8+I8yMRAKoIAWvkOgBTjhFXD50q+ BYMWnlzrGwh6K8JsyVFbbHgN/HEODbKEfZhvKFLQbsf+lUcBW0q1zLgRxE4+OCVkYeeE fdvCGjX2bI2f63HWBo6Sk6RYArH9AFkk5m0IqNJpQeZN+7ouW4yeSGYXc/YslgL0szXL H8A9bB+6WNas16DsRZVw5s6oZdUyaCKCAi5LgQnfOB7Qds+B/iLGE3KZKR+Az0aYcfF+ SocA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:content-language:accept-language :message-id:date:thread-index:thread-topic:subject:cc:to:from; bh=ue40+uXcK96E+BN9uq7MxDzd4qLrWwlnPR9KwRIvg9k=; fh=vF2//gAxCmksV+J80LiE5zxrPdkrXKmv/M5QooEXewM=; b=et1YU220dl6ZeuF1WgMpcYciwBF15CrHNoUx0DOIHiCb0zbUVDT23orxvrVt+sCQwk 661cMq19JZAsBgqETN1kyaISZFxv9HhhQxm50CgeIIHX+Dq3FPsam9rdjHbS5ytNsjFh MHf5r5px+KxjfyWG2wwTXc9MkdX29H6DC6nuURX1hrl2NlhrGrRxZEas7Dckyt9M0Rpg 2zKwCIM70GZCK2NmWny4Uwua/UIRlFMH0SzCFILcdhUx4bnSsnCiWrc7fi7hoIR6K58T hREJ2L9cMtCWXJ4wH8NnpsmES2FTgf03DqQu3u/n8zArdWeiZjJFp3FpWBAByubaMoxm mM3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=actia.se); spf=pass (google.com: domain of linux-kernel+bounces-61378-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61378-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCUq6br9lqUJcCoNYZ5DrP3c9Pq4G7cXbolu1oaLE4pggzlP9tco8r6kJtsgJlweyEgr+IH0PWBS9EfK4I7MzotaQWqdvA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f14-20020a05620a20ce00b00785ca459548si4381612qka.113.2024.02.12.02.54.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 02:54:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61378-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=actia.se); spf=pass (google.com: domain of linux-kernel+bounces-61378-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61378-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 53E621C2354C for ; Mon, 12 Feb 2024 10:54:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E53063BB36; Mon, 12 Feb 2024 10:50:45 +0000 (UTC) Received: from mail.actia.se (mail.actia.se [212.181.117.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D2B03B1AC; Mon, 12 Feb 2024 10:50:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.181.117.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707735044; cv=none; b=PfqNI8iAE+GK9Ag84U0TkYcC+ha4E6ib+631URnszKkwtQuohVxNaLBd4N5r2GO80nTVnbjJer9qdProfkS8n6sBYPNusZm4Jdqcco4Nwj5uDs4videK/Kb1iknD33zxQtFaP641VKagHswAoJJPpguC0ehIocH7Dz1vnLRi7Vc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707735044; c=relaxed/simple; bh=DslaFWZZuV/SwGQuQpMrEYo+M/OcOIqoqJTfsY93H9U=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=ORr5cz/Zey7vRqygcj/cbdB4SKMdcKMSZKn5xALxGbomL+oI5YLKtf+VokOxmTdFkxIfdo0PzSNL/WrmEvQG8pm4aIiGZVYSAQ5P/Lw7bb7LAhOTbNWyNbw34x+JI4p9wpnGx9kOBK9+AqkTHB7OKnm11ZYJa/dr7RY3YWs7B0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=actia.se; spf=pass smtp.mailfrom=actia.se; arc=none smtp.client-ip=212.181.117.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=actia.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=actia.se Received: from S036ANL.actianordic.se (10.12.31.117) by S036ANL.actianordic.se (10.12.31.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 12 Feb 2024 11:50:30 +0100 Received: from S036ANL.actianordic.se ([fe80::e13e:1feb:4ea6:ec69]) by S036ANL.actianordic.se ([fe80::e13e:1feb:4ea6:ec69%4]) with mapi id 15.01.2507.035; Mon, 12 Feb 2024 11:50:30 +0100 From: John Ernberg To: Wei Fang CC: Shenwei Wang , Clark Wang , NXP Linux Team , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , John Ernberg Subject: [PATCH net-next] net: fec: Always call fec_restart() in resume path Thread-Topic: [PATCH net-next] net: fec: Always call fec_restart() in resume path Thread-Index: AQHaXaFLRIYd45z3UU+7Sl3MRdVj/Q== Date: Mon, 12 Feb 2024 10:50:30 +0000 Message-ID: <20240212105010.2258421-1-john.ernberg@actia.se> Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.43.0 x-esetresult: clean, is OK x-esetid: 37303A2958D72955617D6A Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790690236883214671 X-GMAIL-MSGID: 1790690236883214671 When trying to resume from suspend the following can be observed: fec 5b040000.ethernet eth0: MDIO read timeout Microchip LAN87xx T1 5b040000.ethernet-1:04: PM: dpm_run_callback(): mdio_bus_phy_resume+0x0/0xc8 returns -110 Microchip LAN87xx T1 5b040000.ethernet-1:04: PM: failed to resume: error -110 This is because the MAC is left powered down after resuming from suspend. The MAC is brought up in both probe and open, so leaving it off in resume from suspend is an imbalance. This imbalance combined with a LAN8700R that is permanently powered results in unusuable networking if the board would happen to suspend before the link is brought up, and the only way to get out of it would be a full power cycle. NOTE: With this change the PHY ends up taking different resume paths when the link has never been up compared to once the link has been up. Currently the resume process is identical and just happens at different times, so this *should* not have any unforseen consequences. Signed-off-by: John Ernberg --- Tested on 6.1 kernel and forward ported. I discovered this when we upgraded from 5.10 to 6.1, but the resume path in the FEC driver has had this imbalance since at least 2009. This is also why I target the -next tree, I can't identify a proper commit to blame with a Fixes. Let me know if this should be the net tree anyway. drivers/net/ethernet/freescale/fec_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 42bdc01a304e..e6804c068d6b 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -4706,6 +4706,8 @@ static int __maybe_unused fec_resume(struct device *dev) napi_enable(&fep->napi); phy_init_hw(ndev->phydev); phy_start(ndev->phydev); + } else { + fec_restart(ndev); } rtnl_unlock();