Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2018063rdd; Thu, 11 Jan 2024 17:31:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqS/DSLHHebaSxdaD1z3mLqJtJlwMN5JHp9dpydey/7PzAgNXW9OHVBHTcP3JfJopTJV/V X-Received: by 2002:a05:620a:b82:b0:783:33d7:68ce with SMTP id k2-20020a05620a0b8200b0078333d768cemr740530qkh.128.1705023065539; Thu, 11 Jan 2024 17:31:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705023065; cv=none; d=google.com; s=arc-20160816; b=NtAPUc7q9xLDl0qVhMXS+1VAYcDZRbbhXkoTGenuTD0oZL2woYw3mZyC2YVPCs6xCM 7F1/upa/MEn0Av7eZrhDjP4Vs0ygKjrdPvOfTLHZmyWE7CalzRWr4v87m3j7pSdI7Gom RbyC6A9Eneh2h06U7rv017HAkT08svf761CYmHIKbSeSuhXMVdxJkJolsrEd3gtTKgSA ntxreZSJvF9YZCbEuMcsaMKyXDfgff7vhvs9I3FpbXAT6EP+pnMQ+rflxfVkVNrRXohr cHCkkX2uJx2ouGuXRxKKxWzAwIJPMBxFr/y2FS3+yId4Zvnas7ZLt+TR1PvVzdqliJgN OHqw== 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:dkim-signature; bh=EX4KvwsG+Ty7/y7ISF6vqjYHJpX/a8k4tDTQ2hUTWdw=; fh=yJd4YJCI0joMRw/IEfcQkX//lKKP4Ob9dAzwGVCWel4=; b=wDEvrDsmjpZy1bQEGIcbmqeYQvE8X8ARrCdy0sJT7EeDC2/5OoIB16CM/B4q2znNu6 UnG5YcqttaaOu4nv1NGN8O1/y1XhYeXbX2gIabT2Gtpea5fjJy0LHVttDhJlL58bWygm xbWMWWFVnyzZ8b36JgT9rNV6dKhxvJDZKhzoWfZtw0phg24vnXw3iXJ/CMRLiqex857Y lSDQ9o5lwBtOuucxI1p1K7zUx1MntX2jnpy3l4XzztKyGDvQjJohLsMt6IwS0KnhHb3V FHpw2673qsIeTIGblvQqOm8297YkHviFbcTtSQp6W5vI45Pj0W4PgwgJ6XIyfRamMSHA 3I4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=NBn7PWKs; spf=pass (google.com: domain of linux-kernel+bounces-24210-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24210-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h14-20020a05620a21ce00b0078328d5a82esi2059093qka.753.2024.01.11.17.31.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 17:31:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24210-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=@lunn.ch header.s=20171124 header.b=NBn7PWKs; spf=pass (google.com: domain of linux-kernel+bounces-24210-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24210-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch 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 499101C248B8 for ; Fri, 12 Jan 2024 01:31:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3754D1118; Fri, 12 Jan 2024 01:30:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="NBn7PWKs" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 48B1BEBD; Fri, 12 Jan 2024 01:30:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=EX4KvwsG+Ty7/y7ISF6vqjYHJpX/a8k4tDTQ2hUTWdw=; b=NBn7PWKsKBsAaLI5werka/g57w egxhrciZSc0a4Z/nYxJpaXzXThfAcJOuW76lFXJXWaRKC8USchZYLei6mnqSmLiirStlsWh3+8ADU QfGvqQNU4xpc+gFr9sBB/QlOSTevfDLycR4KAfcKFcUTaZnVhR8H/tBNnvL2mzyVMZJ8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rO6NS-0052Yy-K5; Fri, 12 Jan 2024 02:30:30 +0100 Date: Fri, 12 Jan 2024 02:30:30 +0100 From: Andrew Lunn To: claudiu beznea Cc: "Russell King (Oracle)" , 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: <65d22ad5-4db2-4e7d-b314-7cd3cd387335@lunn.ch> References: <20240105085242.1471050-1-claudiu.beznea.uj@bp.renesas.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: On Wed, Jan 10, 2024 at 03:20:19PM +0200, claudiu beznea wrote: > Hi, Andrew, Russell, > > On 05.01.2024 16:36, 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. > > It's not clear to me if you both agree with this fix. Could you please let > me know? Hi Claudiu I think this is a valid workaround for the broken hardware. Reviewed-by: Andrew Lunn There might be further discussion about if suspend and resume are being done at the correct time, but i think that is orthogonal. Andrew