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 3D5122DF6E6; Thu, 16 Oct 2025 14:59: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=1760626787; cv=none; b=PfjbTPeHu0TOBFglvG3Zlu/TKVga6O1x3z24GtW+nJM+v/WYqeOe40wmNq7wwnxTgIjD3eQfE3aMMc22lKDUY5+ikMtp6qZ5nQIPlUTeJ0zzR2H8fmmGIVl9ptQZP/oZjmt8vXqAdk3Lam1cd/+gvHnJxQfLj6aW+cclhqEryZk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760626787; c=relaxed/simple; bh=ywlLgvA+bBZEIWtQo0kwXN2Wp8Uht1l9bbFfQZxMiwM=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=H7wVTIE8JPghO0CDG1rrt3xNxzjroE8E82XKHCoEL1Ruimm7+CkXBbfxHT35ZgCB2xIKitt5j2QTM1JQ9AD9AEh9uJmKoS6dKqgSHwfewBi5HlktW3cYDJB9A4e4LIYTPkVnFlwMu5eohuMcgKps2dSLfcGdFcqDhZQih2kjBmI= 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=BKPV3HuR; 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="BKPV3HuR" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=MwUEqOLFxWpUzct285C2ApYhavg8AhF7TZo9DSyOqQ4=; b=BKPV3HuRNlEliX0LVe28KRVYhx RjiIUUwxKVARp6XLMajHZ9D/XCISc6HL6n8nSYzRkrMrHdh9nNCncGmMsTQkQ2ufXP9zaBnuPwHVr ddsAw/wtZBSDiEMRBFlI0zMRqUxI1k2t/aQeEoN8KVwF17ciNQ52+OIfAYxlTl8Mn8Z7yW651dZkG 4ajxPjuuiv4Sna0kpb69FG+zDGs5HPSlxl1BN++UcRK2F1E+VTPtczWf0KiD4nsJJb7dTkHCHNJSR 77ENqOFL2GTxUwwbXE225UalfjVdw+jcXZzypP/nHerYovmVyf6UPL9rHB/sTbJQQE54rjLTI4Q7I l5486IxA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:50476 helo=rmk-PC.armlinux.org.uk) 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 1v9P76-000000006SR-36Mx; Thu, 16 Oct 2025 15:37:56 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1v9P6x-0000000AomL-3OKd; Thu, 16 Oct 2025 15:37:47 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Abhishek Chauhan , Alexandre Torgue , Alexis Lothore , Andrew Lunn , Boon Khai Ng , Daniel Machon , "David S. Miller" , Drew Fustini , Emil Renner Berthing , Eric Dumazet , Faizal Rahim , Furong Xu <0x1207@gmail.com>, Inochi Amaoto , 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, Matthew Gerlach , Maxime Chevallier , Maxime Coquelin , Michal Swiatkowski , 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 net-next v2 13/14] net: stmmac: provide PCS initialisation hook Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Thu, 16 Oct 2025 15:37:47 +0100 dwmac cores provide a feature bit to indicate when the PCS block is present, but features are only read after the core's setup() function has been called, meaning we can't decide whether to initialise the integrated PCS in the setup function. Provide a new MAC core hook for PCS initialisation, which will be called after the feature registers have been read. Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/hwif.h | 4 ++++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 7796f5f3c96f..82cfb6bec334 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -313,6 +313,8 @@ enum stmmac_lpi_mode { /* Helpers to program the MAC core */ struct stmmac_ops { + /* Initialise any PCS instances */ + int (*pcs_init)(struct stmmac_priv *priv); /* MAC core initialization */ void (*core_init)(struct mac_device_info *hw, struct net_device *dev); /* Update MAC capabilities */ @@ -413,6 +415,8 @@ struct stmmac_ops { u32 pclass); }; +#define stmmac_mac_pcs_init(__priv) \ + stmmac_do_callback(__priv, mac, pcs_init, __priv) #define stmmac_core_init(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, core_init, __args) #define stmmac_mac_update_caps(__priv) \ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index c3633baf5180..35cd881b3496 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7238,6 +7238,13 @@ static int stmmac_hw_init(struct stmmac_priv *priv) "Enable RX Mitigation via HW Watchdog Timer\n"); } + /* Unimplemented PCS init (as indicated by stmmac_do_callback() + * perversely returning -EINVAL) is non-fatal. + */ + ret = stmmac_mac_pcs_init(priv); + if (ret != -EINVAL) + return ret; + return 0; } -- 2.47.3