Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2377688rdb; Mon, 12 Feb 2024 02:56:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUnpUAQymCJqYoFc23LZpIdZQO2ZArVT/R5Z95qDwqv+Z3j4rWFsp416fuVORUeUPeTpohTbSFbo84qoyNAiXRi3ZjoDRkPF/EN9itGiA== X-Google-Smtp-Source: AGHT+IFeC4gTYCo7uOPJQZW8hpu/j5j0iL0+urkskEyJOKlBOBXp9slBTQqH2a0779GjWTciTHHF X-Received: by 2002:a05:6e02:5c3:b0:363:c9cd:e8e3 with SMTP id l3-20020a056e0205c300b00363c9cde8e3mr6643302ils.27.1707735368505; Mon, 12 Feb 2024 02:56:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707735368; cv=pass; d=google.com; s=arc-20160816; b=sIu2sx+Ssed3qNG+LdZuqCt6dGtRdlul9Onx/QGxnkG9FupmcDjs5AdwZHVcYrEOKP vyHbMzQPcFZx7ADdk40DjCmpU22V5sMePHDw0U0HZKkNDsJd+BCvDtmj8FgGNI6Yu+3h Chbf6rjLQoRbPl4QzMLSu+tp6pF2H8oSJLlg1y7f8rmJnzFkKGkgBJaM3XZjxMyn1ZbS 5jkVOyvhOQL3Zl8ZWDYpAXcyhTVeZm/0zguOxhTC/FgyJCljoIiqxzMjOr/QDSX9LjC4 dB48owfpsZnJctQs+R4QVSJiaAB+LJ+tGKJqW8KWlbdNWRvqW9mumenCUx/Sgd0/rg5E XZcg== 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=GhobAyZGdz4dl3G4taG4LG6tDU6OBDJDUGTy8v8B9/o=; b=ZuBt3fY/NRDA8QYZvYzhQVl623PfA53HFSPRazmYtKeVfnCYA9ZO45ECDz6aDFAawo VqHRWCqk/kE47YftQqRtW/+epgi3fnScaYfxdgcL/PAyue6QrRHhPZPlXP1REV6KS2GY cs+T0SADm9wL4tvVpaS2gQZJtV2e6uy3STfkPIJ7hxFgBJF4lJFHIaIHgolGVx37CetC mRDG2bxLCpoN7IbosSH06+xu0s8bH2AOduRBDld2E8K6jFDv6MWcAnZpyMUIBuIYTtm+ AYVgOP7ZGGwxj7jq/0gION/CYUNYHG6PB/cVv3S8NLORQNYynI8ix+2hCsrrgj8gXVzW 0JWQ==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61378-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXNVeYScYBdGmyxUmuNJ9JXxq6102OkQGqgnpDcwieNNlmeqWnBOY3P8JoDUdpl2/zuu9FDQuDjP34B9YfLTBW8gOEIWw6sTxQItuI5QA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id cm12-20020a056a020a0c00b005d5d32bf0cbsi73731pgb.463.2024.02.12.02.56.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 02:56:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61378-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=actia.se); spf=pass (google.com: domain of linux-kernel+bounces-61378-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61378-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3C24C281499 for ; Mon, 12 Feb 2024 10:54:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE5703B799; Mon, 12 Feb 2024 10:50:44 +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 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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(): md= io_bus_phy_resume+0x0/0xc8 returns -110 Microchip LAN87xx T1 5b040000.ethernet-1:04: PM: failed to resume: erro= r -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/ethern= et/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 *d= ev) napi_enable(&fep->napi); phy_init_hw(ndev->phydev); phy_start(ndev->phydev); + } else { + fec_restart(ndev); } rtnl_unlock(); =20 --=20 2.43.0