From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (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 21DF423DE; Sat, 11 May 2024 09:35:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715420149; cv=none; b=b108DHF/pPv48HxqOl/3soRaO9pBQA8xJGpQYJAhyVpIdLBwEYWRnl1YIwaq5kNCKFvo2pxLnmzBlKj8D9xVxbx2TgMHHtNoXecGbaPqZsm/aNX2afZ6fKLR2uKjiUEYuXF25QW7OaaY0ad6cIkCJXZGbkaRW7/4kjBzWIAaAE4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715420149; c=relaxed/simple; bh=BvPFoaXVuMlkHotikPNEYLmheM+9prSGu6IcaitWVlg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rr6WT0WGxKZ6wImxCLZS2uTOmkJ9x48IQy7MsiDtTz0gzAMeROAIVnyj4rKMTU5mWFgtDIL2t98SvuCSkGKbZhXCKwYEX4whCPXYLuYs1eYxkCjdnj0ldsnhZv3699hmUT9UwjJK5FXOlEnZ7iAzemYs7dfqRG1U/bbZnP4xbQI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=eyDG7Bbq; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="eyDG7Bbq" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YK/ds1gkbnMTSGHHRHJlklAGEyLYiT7Eu+ltFawe6hE=; b=eyDG7BbqqDxe9AkQN/XMfyHOzz KNLcZKB1QNtnR0SCFSjDMU76UzEsr7qwCdAhtkWAizMuflzRxYRs5zJmXGCp30gGhld+fe2969eYm CJq5tfamK3JwiCaduVHJUGMENwMl2J7v6vTNj5qS1JdHyyzUa6wgDlI8v2cH2JG+sIXmoZLi0M4Un RZ/j8ZpPrv5WeQ0hhHMb+kbckVs5Zmq5X1L+E7SUjsezICJib+4vTg6a7BDO8HY0PjZKazaxN+VoX +/qUYvjXPhfttGAVonRDpjmZxyffZP8gkJAqqCBICUuHeQK6B57/Z3pFO4hLKiew8X0Jnp0cV3m3O eoaxdlDw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:38330) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s5j8Q-0008JX-0Q; Sat, 11 May 2024 10:35:18 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1s5j8L-0004AO-Dl; Sat, 11 May 2024 10:35:13 +0100 Date: Sat, 11 May 2024 10:35:13 +0100 From: "Russell King (Oracle)" To: Andrew Lunn Cc: Daniel Golle , Christian Marangi , Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , William Zhang , Anand Gore , Kursad Oney , Florian Fainelli , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , Broadcom internal kernel review list , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Jacek Anaszewski , =?iso-8859-1?Q?Fern=E1ndez?= Rojas , Sven Schwermer , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Subject: Re: [net-next PATCH v10 3/5] net: phy: add support for PHY LEDs polarity modes Message-ID: References: <20240125203702.4552-1-ansuelsmth@gmail.com> <20240125203702.4552-4-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: devicetree@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: Sender: Russell King (Oracle) On Sat, May 11, 2024 at 01:58:13AM +0200, Andrew Lunn wrote: > > Wanting to make use of this I noticed that polarity settings are only > > applied once in of_phy_led(), which is not sufficient for my use-case: > > > > I'm writing a LED driver for Aquantia PHYs and those PHYs reset the > > polarity mode every time a PHY reset is triggered. What sort of reset? There are hard resets that set the registers back to default, and soft resets that don't. I think you are referring to a hard reset, but please be clear. > > I ended up writing the patch below, but I'm not sure if phy_init_hw > > should take care of this or if the polarity modes should be stored in > > memory allocated by the PHY driver and re-applied by the driver after > > reset (eg. in .config_init). Kinda depends on taste and on how common > > this behavior is in practise, so I thought the best is to reach out to > > discuss. > > There was a similar discussion recently about WoL settings getting > lost. The conclusion about that was the PHY should keep track of WoL > setting. So i would say the same applies there. Please store it in a > local priv structure. Agreed. If it turns out that it's something that many PHYs need to do, that would be the tiem to move it into the core phylib code. If it only affects a minority of drivers, then it's something drivers should do. The reasoning here is: if its only a problem for a small amount of PHY drivers, then we don't need to penalise everyone with additional overhead. If it's the majority of drivers, then it makes sense to remove this burden from drivers. Also note that this is one of the reasons I don't particularly like the kernel's approach to PHY hardware resets - if a platform firmware decides to describe the PHy hardware reset to the kernel, then we end up with the hardware reset being used at various points which will clear all the registers back to the reset defaults including clearing WoL settings and the like. That's fine for AN state which will get reloaded, but other state does not, so describing the hardware reset can make things much more complicated and introduce differing behaviours compared to platforms that don't describe it. A lot of platforms choose not to describe the PHY hardware reset, but some people see that there's a way to describe it, so they do whether or not there's a reason for the kernel to be manipulating that reset signal. What I'm saying is there's several issues here that all interact... -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!