Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp642492rdd; Tue, 9 Jan 2024 15:29:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsmnJulrklybJB43Nt2X0VnDEEwrBdZSsk/kP93tiFqxjFF3kwbPlpbzdjI7T/GvnUq2gF X-Received: by 2002:a05:6214:2461:b0:67f:bd18:2eba with SMTP id im1-20020a056214246100b0067fbd182ebamr294019qvb.129.1704842942183; Tue, 09 Jan 2024 15:29:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704842942; cv=none; d=google.com; s=arc-20160816; b=gikvJ8I9enpYMDUqIyCORMYSawn02/IiHHd3QQOzsigYNjnS8HMpqhnZ0hSq2g55LK ZScN1cOaZT412DrpgrkUSZPIKGunLLDPFoncshoJLCXGV+nyrEyacALY8S4k6jmdKPO1 wQDO9dnv2+FaxvX815auMv5wbIlcccgERdwsdFnDOIrSEZiAQsuHx3D/zgv3F418NGcg BTpEl9GRhd3GiC5IHy94TmHKb2Pij48OehdjX7colXLom/CFVowQ9M6dD8b4/I1r8PIC IqAjatGZcqZysC5loS1nE3ZBxylCiqhsJAPIXvdZt5MMETGGMVattxtjhnz2LnLmh1Sa MBDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=iYQ9N8nAhODwBI6BsW5f3v57sNhTgK2ofnTJgKsQuVY=; fh=5EZRocUocC3p4IEFuWmPEOwKmylsdzZx252Ui/PqXPs=; b=HhwrmboRzPIL7Qtkm42/ddSXpHK8sH8hPsaflh1bfr0cO4j/11/jkrxWPyXd9vUxZt vqTO9Y68IOWilyvKFciUHX2PozO8TjWiOy+v4MjbXHmUGI87JIH0WhPsds6xiqapD3Go M45g659cKW/I0Fl56ggXs+A3oMMATZu6dNa6LwzNKbM0KyAdLtbpnZkrA0s3wtx1UMMy gnk8x3K8e/GKRNmH4c3gg3bAz8li7YJriejkYeLjzkdQjBkk5mUR6oP65oZVgevT1M6y 33niUqUk1jlbhZfZR7+koY6yd3hyU1uzXz7Zc7hy0cDxCaMVHbLooi0bFF8hfved3yw/ Al3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-21529-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21529-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s1-20020a0ce301000000b0067f955d1353si3177216qvl.566.2024.01.09.15.29.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 15:29:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21529-linux.lists.archive=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; spf=pass (google.com: domain of linux-kernel+bounces-21529-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21529-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DFB8D1C25100 for ; Tue, 9 Jan 2024 23:29:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D6213E486; Tue, 9 Jan 2024 23:28:54 +0000 (UTC) Received: from mail11.truemail.it (mail11.truemail.it [217.194.8.81]) (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 2485912E41; Tue, 9 Jan 2024 23:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dolcini.it Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dolcini.it Received: from francesco-nb (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) by mail11.truemail.it (Postfix) with ESMTPA id 758F92028F; Wed, 10 Jan 2024 00:28:42 +0100 (CET) Date: Wed, 10 Jan 2024 00:28:38 +0100 From: Francesco Dolcini To: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, Francesco Dolcini , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] net: phy: micrel: reset KSZ9x31 when resuming Message-ID: <20240109232838.GA3626@francesco-nb> References: <20240109205223.40219-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240109205223.40219-1-wsa+renesas@sang-engineering.com> - Philippe, email address is no longer valid. On Tue, Jan 09, 2024 at 09:52:22PM +0100, Wolfram Sang wrote: > On a Renesas Ebisu board, the KSZ9031 PHY is stalled after resuming if > the interface has not been brought up before suspending. If it had been > brought up before, phylib ensures that reset is asserted before > suspending. But if it had never been brought up, there is no instance > which could ensure that reset is asserted. And upon resume, the PHY is > in an unknown state without reset being asserted. To bring it back to a > known state, simply reset it when it is about to be resumed. > > This likely also helps another issue [1] where a KSZ9131 can be powered > using regulators. After switching power on again in resume, a reset is > also needed. > > [1] https://patchwork.kernel.org/project/netdevbpf/patch/20211214121638.138784-4-philippe.schenker@toradex.com/ > > Signed-off-by: Wolfram Sang > --- > > This is a different solution to a problem I already tried to solve > here[2]. Back then, I added code to the MAC, but I now believe it should > be solved on PHY level. We never saw the problem with other PHYs. > Looking at [1], it seems that KSZ9x31 is also sensitive to being > powered down without reset being asserted. I know it is not a perfect > proof, but I guess these assumptions are all we have. > > Philippe, Francesco: do you still have access to machines with this > issue? Could you kindly test if so? I have access, however - Philippe is long gone from Toradex and he was the one looking into this topic - we did solve the issue in a different way, e.g. we no longer power-off the phy in suspend Therefore is not straightforward to provide valuable feedback to you now. > > Patch is based on 6.7. Looking forward for comments if this is the > correct layer to tackle the problem. Thanks! > > > [2] https://lore.kernel.org/all/20230321103357.18940-1-wsa+renesas@sang-engineering.com/ > > drivers/net/phy/micrel.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c > index 08e3915001c3..c38d7982c06c 100644 > --- a/drivers/net/phy/micrel.c > +++ b/drivers/net/phy/micrel.c > @@ -1984,6 +1984,14 @@ static int kszphy_resume(struct phy_device *phydev) > return 0; > } > > +static int ksz9x31_resume(struct phy_device *phydev) > +{ > + phy_device_reset(phydev, 1); > + phy_device_reset(phydev, 0); Is something like that fine? Don't we need to reconfigure the ethernet phy completely on resume if we do reset it? kszphy_config_reset() is taking care of something, but I think that the phy being reset on resume is not handled correctly. Francesco