From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5AF85CAC5B5 for ; Sun, 28 Sep 2025 09:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: 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:In-Reply-To:References:List-Owner; bh=CrsZJsDm1lLjC1J6W9qU2UxrU3wiJPo7+vrG1pU08b4=; b=18sVs0l+fntPrdSSt1EIrFl3C2 RqoL5gteGXB9tJtbQtFgzSq3itUnVVp5KSN8aJLofv0qNIBi431ZhPhqfLe1Ibv1JoFQenTFL1sGN Fj18JnzDPA3Pg9rGOyWl5IMhIE5Cyf8l2MWdvlxwRyPuvgwQa8DDPaJyE2w9JVMGxd0LeXtv71c7O E+os2LKbNXUHwv35D3VBNdFdJi1g4E9iX3VgbpPzLzRn7/iPQXuxo2rHFdDnh6TOr9OqtoU0ZDrfj lOW5L+9rVy+V5y4ToLzyKaFh/H09zqxUUnM756wDWINGWe8KH2ULcIe5uX7KFuTvznSgyIaTuHKwp QuNTNYfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v2nUN-0000000EZuA-1Pp5; Sun, 28 Sep 2025 09:14:39 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v2nUK-0000000EZtk-0UVo for linux-arm-kernel@lists.infradead.org; Sun, 28 Sep 2025 09:14:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:Content-Type:MIME-Version: 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:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=CrsZJsDm1lLjC1J6W9qU2UxrU3wiJPo7+vrG1pU08b4=; b=zrt8GaeNXA1mzxe+JXJUFRNsGP Zwe7g1PJwjsMH+3npMSE5FDxLi5P+QAIzYgXTa1giz9iR52ywg0fsSP0N4YRdAPQpdoX3S8jnyA4W 59XdMxbTxgj45OU5cP7MW8BUpPr7fQjmLxB5EKQ9eJro8jVeN6+Tp88yaAaRIo1a/kUXSMb/vAOvj lbnGlkDvlkC3a5+BbJWmh9CJDEPyD1qmgOSbpPgYEfduuxO87xRPwlRpgRwE5fqwMJie8ru1kZsts lwJxz3QG72kyrV4o0Kz94Xm/WDQ9YQ+hiGBK+qhiWCgZBrJpeXSHmmQJK3pgO9u7cS6x3UW3sCKdP wlKfXFZg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:48448) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1v2nTq-000000005Dn-2yGp; Sun, 28 Sep 2025 10:14:06 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1v2nTf-000000002ST-1rVo; Sun, 28 Sep 2025 10:13:55 +0100 Date: Sun, 28 Sep 2025 10:13:55 +0100 From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Abhishek Chauhan , Alexandre Torgue , Alexis Lothore , Andrew Lunn , Boon Khai Ng , Choong Yong Liang , Daniel Machon , "David S. Miller" , Eric Dumazet , Faizal Rahim , Furong Xu <0x1207@gmail.com>, Huacai Chen , Jacob Keller , Jakub Kicinski , "Jan Petrous (OSS)" , Jisheng Zhang , Kees Cook , Kunihiko Hayashi , Lad Prabhakar , Ley Foon Tan , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Mateusz Polchlopek , Maxime Chevallier , Maxime Coquelin , netdev@vger.kernel.org, Oleksij Rempel , Paolo Abeni , Rohan G Thomas , Shenwei Wang , Simon Horman , Song Yoong Siang , Swathi K S , Tiezhu Yang , Vinod Koul , Vladimir Oltean , Vladimir Oltean , Yu-Chun Lin Subject: [PATCH RFC net-next v2 0/19] net: stmmac: experimental PCS conversion Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250928_021436_328092_4C282AE3 X-CRM114-Status: GOOD ( 23.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This series is radical - it takes the brave step of ripping out much of the existing PCS support code and throwing it all away. I have discussed the introduction of the STMMAC_FLAG_HAS_INTEGRATED_PCS flag with Bartosz Golaszewski, and the conclusion I came to is that this is to workaround the breakage that I've been going on about concerning the phylink conversion for the last five or six years. The problem is that the stmmac PCS code manipulates the netif carrier state, which confuses phylink. There is a way of testing this out on the Jetson Xavier NX platform as the "PCS" code paths can be exercised while in RGMII mode - because RGMII also has in-band status and the status register is shared with SGMII. Testing this out confirms my long held theory: the interrupt handler manipulates the netif carrier state before phylink gets a look-in, which means that the mac_link_up() and mac_link_down() methods are never called, resulting in the device being non-functional. Moreover, on dwmac4 cores, ethtool reports incorrect information - despite having a full-duplex link, ethtool reports that it is half-dupex. Thus, this code is completely broken - anyone using it will not have a functional platform, and thus it doesn't deserve to live any longer, especially as it's a thorn in phylink. Rip all this out, leaving just the bare bones initialisation in place. However, this is not the last of what's broken. We have this hw->ps integer which is really not descriptive, and the DT property from which it comes from does little to help understand what's going on. Putting all the clues together: - early configuration of the GMAC configuration register for the speed. - setting the SGMII rate adapter layer to take its speed from the GMAC configuration register. Lastly, setting the transmit enable (TE) bit, which is a typo that puts the nail in the coffin of this code. It should be the transmit configuration (TC) bit. Given that when the link comes up, phylink will call mac_link_up() which will overwrite the speed in the GMAC configuration register, the only part of this that is functional is changing where the SGMII rate adapter layer gets its speed from, which is a boolean. >From what I've found so far, everyone who sets the snps,ps-speed property which configures this mode also configures a fixed link, so the pre-configuration is unnecessary - the link will come up anyway. So, this series rips that out the preconfiguration as well, and replaces hw->ps with a boolean hw->reverse_sgmii_enable flag. We then move the sole PCS configuration into a phylink_pcs instance, which configures the PCS control register in the same way as is done during the probe function. Thus, we end up with much easier and simpler conversion to phylink PCS than previous attempts. Even so, this still results in inband mode always being enabled at the moment in the new .pcs_config() method to reflect what the probe function was doing. The next stage will be to change that to allow phylink to correctly configure the PCS. This needs fixing to allow platform glue maintainers who are currently blocked to progress. Please note, however, that this has not been tested with any SGMII platform. I've tried to get as many people into the Cc list with get_maintainers, I hope that's sufficient to get enough eyeballs on this. v2: numerous changes, too many to have kept track of, sorry. As one can see, the series has more than doubled in size. Some are not up to mainline submission quality, but I've included them as they give the full picture. b4 may be able to do a better job at identifying the differences between the two series than I could ever do. drivers/net/ethernet/stmicro/stmmac/Makefile | 2 +- drivers/net/ethernet/stmicro/stmmac/common.h | 11 ++- .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 6 +- drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 7 +- .../net/ethernet/stmicro/stmmac/dwmac1000_core.c | 101 ++++++++------------ drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 3 - drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 105 ++++++++------------- .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 39 ++++---- drivers/net/ethernet/stmicro/stmmac/hwif.c | 2 + drivers/net/ethernet/stmicro/stmmac/hwif.h | 12 ++- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 4 + .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 68 +------------ drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c | 3 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 65 ++++++------- drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c | 88 +++++++++++++++++ drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h | 29 +++++- include/linux/stmmac.h | 1 - 17 files changed, 269 insertions(+), 277 deletions(-) -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!