From patchwork Tue Apr 30 07:29:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Gantois X-Patchwork-Id: 13648427 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 86E34C4345F for ; Tue, 30 Apr 2024 07:32:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kqRGrRuVkgv7lkI2av1nklOAubvP4+gIDHDdmsNAzYo=; b=wCAA4OPZQgF/0w Va3c8UPB4G0aS/ubCv+V4iQOSXT6lNhsCezF8+El1RUTD8HFy6ld6GpLnsIA4VAY65CbyBEaYpftr ExHKPLZ8SgWCAQ01A4ZocIOEIgQhASJdMThwSLj2ynWQie4JEBGb9NDYn3lmJdG7wdlRjcATPp30e 4njR9GWWRORJ2wehjok2r6Tt7voAkJ7+ppazaqEuI12DXtdVyuhuXwkqHpZ7hlmgCdmONXdKBx95t ezJb/bRKtOt3TFu/Ufn28C4tmQQYIdwmqVop1nSat6WStN729UHHhpeW1BlnXLQUwnvvQ+VEIgbRG V4y1fRo2553Ku0JZexIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1hxo-00000005RvZ-3Heg; Tue, 30 Apr 2024 07:31:44 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1hwu-00000005RYj-1l4S for linux-arm-kernel@bombadil.infradead.org; Tue, 30 Apr 2024 07:30:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=k5xJj++e/DBPx9ddAMfQsap+qn6muqbGCvqtygpbwCk=; b=jvbZRE7mnKyxJYMS/UDIZpxE7d PrQoaXcH5aCxUSZc/jmV8BYlWHlT+jKOgJmWy7bU/8KUVNftVl4vuPU8Y5xbHYuVfQy/6++dGTFHX Dp+fCziS9kssZI2ok5YF+kd9Cjn8tCwEugs7B/MxeXp9mCZX8r1YNCR4v4nuq1nwjcYN5aVClSRoi AJfqolBoetzsI1VjSbo+wbHr044d3SWerDiWZV31QYmoyK6o+jHMSUyrXIO34ZZnr0dIq39T95lxY R6WEg/psEZCmPyRewTRJMlw696AtRcDMBs6r0pEqkZpfEQPmGE4CR2/UqNDxiwgWirq4cOo/74XQp TCUZgNaw==; Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1hwf-0000000GqJA-2fzV for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2024 07:30:37 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 77A2C24000D; Tue, 30 Apr 2024 07:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1714462149; 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=k5xJj++e/DBPx9ddAMfQsap+qn6muqbGCvqtygpbwCk=; b=cE/jd3OH5C4sWGElGhuhLznxd5UCD3Vf6u6N1drukFen+XxyVsOikegWQ6dC4laMHLVTor KvXcE47qheuvCv1Z9UE/8+l3WCP5xqjfUDpHBrv+UQlKflGvZPMIIWIpGovomB5+mTW1oz ldjjXkWkYExoWYL2QMZT+xcA01y/lrOHqevDt+SKiRhmPp7gqHIRYJiW9ihiDWdSy28+UO kXsxfhylKYVhyEZlyQ+hFLHZzYGuXHxt9p1QDpUHJRR87rtmkDt+L/UYMGeLjWZD9a5YEf LkT38NHGdZYJsXxidcWSjzz3FraTOGkqXaKvJfqIfhQk3HwXMShdskXYe56x/A== From: Romain Gantois Date: Tue, 30 Apr 2024 09:29:44 +0200 Subject: [PATCH net-next v5 4/7] net: stmmac: introduce pcs_init/pcs_exit stmmac operations MIME-Version: 1.0 Message-Id: <20240430-rzn1-gmac1-v5-4-62f65a84f418@bootlin.com> References: <20240430-rzn1-gmac1-v5-0-62f65a84f418@bootlin.com> In-Reply-To: <20240430-rzn1-gmac1-v5-0-62f65a84f418@bootlin.com> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Russell King , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Serge Semin Cc: Thomas Petazzoni , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, "Russell King (Oracle)" , Maxime Chevallier , Romain Gantois X-Mailer: b4 0.13.0 X-GND-Sasl: romain.gantois@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240430_083034_160381_FE45DB0E X-CRM114-Status: GOOD ( 13.97 ) 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 From: "Russell King (Oracle)" Introduce a mechanism whereby platforms can create their PCS instances prior to the network device being published to userspace, but after some of the core stmmac initialisation has been completed. This means that the data structures that platforms need will be available. Signed-off-by: Russell King (Oracle) Reviewed-by: Maxime Chevallier Co-developed-by: Romain Gantois Signed-off-by: Romain Gantois Reviewed-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++++- include/linux/stmmac.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index af8ad9768da10..1c788caea0cfb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -505,7 +505,10 @@ int stmmac_pcs_setup(struct net_device *ndev) priv = netdev_priv(ndev); mode = priv->plat->phy_interface; - if (priv->plat->mdio_bus_data && priv->plat->mdio_bus_data->has_xpcs) { + if (priv->plat->pcs_init) { + ret = priv->plat->pcs_init(priv); + } else if (priv->plat->mdio_bus_data && + priv->plat->mdio_bus_data->has_xpcs) { /* Try to probe the XPCS by scanning all addresses */ for (addr = 0; addr < PHY_MAX_ADDR; addr++) { xpcs = xpcs_create_mdiodev(priv->mii, addr, mode); @@ -531,6 +534,9 @@ int stmmac_pcs_setup(struct net_device *ndev) void stmmac_pcs_clean(struct stmmac_priv *priv) { + if (priv->plat->pcs_exit) + priv->plat->pcs_exit(priv); + if (!priv->hw->xpcs) return; diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index dfa1828cd756a..4a24a246c617d 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -285,6 +285,8 @@ struct plat_stmmacenet_data { int (*crosststamp)(ktime_t *device, struct system_counterval_t *system, void *ctx); void (*dump_debug_regs)(void *priv); + int (*pcs_init)(struct stmmac_priv *priv); + void (*pcs_exit)(struct stmmac_priv *priv); void *bsp_priv; struct clk *stmmac_clk; struct clk *pclk;