Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp224195rdb; Fri, 5 Jan 2024 07:53:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVd7z/iAhcYmWKuamP9bpB5K/YaP1hyjC/GFNNeBnIYCAl1N+h0xL+J6slpKoTUByN/+5V X-Received: by 2002:a0d:f2c4:0:b0:5ec:f5cb:fcac with SMTP id b187-20020a0df2c4000000b005ecf5cbfcacmr2085824ywf.69.1704470021931; Fri, 05 Jan 2024 07:53:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470021; cv=none; d=google.com; s=arc-20160816; b=Pa5ye6H62tG7IwMWVr7d1KRnYcoRL5fB1YbMq7WcutW+g6I4NvPHHCDwcYT5GLkYM1 HkEbLuurz9J8UKLE+ZocFNij4Xhc/FQI1AtuNlLjZqGJc6Y2BkzGaWbeWF64Uw0TXjUW u/o/GntKHRTCHzrq+Ao0p5CSBw/Zr+lewl7YI5Y64y4WpVScM2zml5saFBMYQJ8b2x/D /9sHVrCjrCGgKKBwQExTNZjPo+d8n7F4wGLjCwLTRBx8KqsluJfaAzcucaM3A2DOKEN4 f0rQumdcAbB/Qz1BKjhk82r0cJc8n5lTECEraikGBBL1Es0JHO42GXb2jo1d9fJhGqCP clUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=2g80y/5MAB47CRr2+a6WSVdW/+13sNXPjnzgr6k2OQw=; fh=auro3qlkM7zOuWz0vByuVcBmhkufKtq7v5bcRCJUcBk=; b=wJtzYeYGMUoJUQKTBxghK5PYbApcvEIg3HyPRQqddj6Kn1AUaCQQoIRlLQgA8rXsWK dfkrFZmu0EHahMHHC4XPSjfy3Vz9fHI3Hp3xmkEKCRZwstous4B+z7sM9YcfbQU8XSxd yLUref47EBlEGaDiBKcMRLgihFyt6ak3RKeny8Ztr6dS/tJzeddt9cPxLdmVU+wzd9I1 ntdVkd8hUAOk8C8G6BDCBeK6CMn7ggbIHgKyrWrjTSkapcW/LEFg6HbqDD9tn6eQeLwo BkeMRVQV8WLKdBjeFpgY5JlqpbxDs85UxxMnoA5JiZ0y/5LmNK738PjuMhBJ+UmUUsIs BulA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=EgTCbj7n; spf=pass (google.com: domain of linux-kernel+bounces-18015-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18015-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x12-20020a0c8e8c000000b0067f34487d8bsi1980613qvb.467.2024.01.05.07.53.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 07:53:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18015-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=EgTCbj7n; spf=pass (google.com: domain of linux-kernel+bounces-18015-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18015-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com 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 AC1AF1C23181 for ; Fri, 5 Jan 2024 15:53:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A05032E826; Fri, 5 Jan 2024 15:53:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="EgTCbj7n" X-Original-To: linux-kernel@vger.kernel.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 954232E634; Fri, 5 Jan 2024 15:53:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 8D2A61C0003; Fri, 5 Jan 2024 15:53:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1704470006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2g80y/5MAB47CRr2+a6WSVdW/+13sNXPjnzgr6k2OQw=; b=EgTCbj7n3pDZeCmRS8rzp6gpHWce/IvZbRd5r6tCGGYSNrGwZBgsWkC3l/IreGV6fNhJmV IpuLzJi0p8sITMce+O3dEE2lGSk1cwsr2nD3UDWjF6qp5EytRban2Mcn6EaWzGICTUyCo2 symVy7+qUi5+9SBBokGLwZY0OjX4e5A/9pDZHFBZnnIbZsjjvF2fqVE0vlXgLY306A7UI3 G5tfLwcvTgKrf6DETSwHokVmOqLOpjeuTJ1AngYaJiTQOvb2Nldowyk+/xLAxXFP8ARnRo D4zQZavWUGGk59kbSvcoL6m6KcwVgGcAvPIDNSiio587SP6MMR3b31zQkhxeow== Date: Fri, 5 Jan 2024 16:53:23 +0100 From: Maxime Chevallier To: Andrew Lunn Cc: "Russell King (Oracle)" , Claudiu , hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, yuiko.oshino@microchip.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: Re: [PATCH net] net: phy: micrel: populate .soft_reset for KSZ9131 Message-ID: <20240105165323.1105ecaf@device-28.home> In-Reply-To: References: <20240105085242.1471050-1-claudiu.beznea.uj@bp.renesas.com> Organization: Bootlin X-Mailer: Claws Mail 4.2.0 (GTK 3.24.39; x86_64-redhat-linux-gnu) 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-Transfer-Encoding: 7bit X-GND-Sasl: maxime.chevallier@bootlin.com On Fri, 5 Jan 2024 15:36:29 +0100 Andrew Lunn wrote: > On Fri, Jan 05, 2024 at 09:43:22AM +0000, Russell King (Oracle) wrote: > > On Fri, Jan 05, 2024 at 10:52:42AM +0200, Claudiu wrote: > > > The order of PHY-related operations in ravb_open() is as follows: > > > ravb_open() -> > > > ravb_phy_start() -> > > > ravb_phy_init() -> > > > of_phy_connect() -> > > > phy_connect_direct() -> > > > phy_attach_direct() -> > > > phy_init_hw() -> > > > phydev->drv->soft_reset() > > > phydev->drv->config_init() > > > phydev->drv->config_intr() > > > phy_resume() > > > kszphy_resume() > > > > > > The order of PHY-related operations in ravb_close is as follows: > > > ravb_close() -> > > > phy_stop() -> > > > phy_suspend() -> > > > kszphy_suspend() -> > > > genphy_suspend() > > > // set BMCR_PDOWN bit in MII_BMCR > > > > Andrew, > > > > This looks wrong to me - shouldn't we be resuming the PHY before > > attempting to configure it? > > Hummm. The opposite of phy_stop() is phy_start(). So it would be the > logical order to perform the resume as the first action of > phy_start(), not phy_attach_direct(). > > In phy_connect_direct(), we don't need the PHY to be operational > yet. That happens with phy_start(). > > The standard says: > > 22.2.4.1.5 Power down > > The PHY may be placed in a low-power consumption state by setting > bit 0.11 to a logic one. Clearing bit 0.11 to zero allows normal > operation. The specific behavior of a PHY in the power-down state is > implementation specific. While in the power-down state, the PHY > shall respond to management transactions. > > So i would say this PHY is broken, its not responding to all > management transactions. So in that respect, Claudiu fix is correct. > > But i also somewhat agree with you, this looks wrong, but in a > different way to how you see it. However, moving the phy_resume() to > phy_start() seems a bit risky. So i'm not sure we should actually do > that. Looking at other PHYs similar to it like the 9031, the .soft_reset() was added to fix some similar issues : Issue : https://lore.kernel.org/netdev/a63ca542-db96-40ed-201d-59c609f565ce@gmail.com/ Fix : https://lore.kernel.org/netdev/6d3b1dce-7633-51a1-0556-97cd03304c2c@gmail.com/ We couldn't get a proper explanation back then. Could it be that they suffer from the same problem, but that it was more clearly documented for the 9131 ? Maxime