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 E9B26C3064D for ; Fri, 28 Jun 2024 14:54:52 +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: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-Owner; bh=81FpBswvqTN/+g4RZ2JQLI94RMcUtnvBgT5CRymvy00=; b=a0t3GuJvI8yOSRj9BCYO3P6HCV 8NH/ErfvbsW0SCvvloHAzCdM30FEPZXL0qRFKS9fWoVUhGA9rYWtT3mf4CphHXplg0E0MWh+BoZDb JqsvX2ioxcalVn/KsEcrg3zQAJIXK/1hMGn9YfB77JpUw1WZ5BEiEcWrqgkTot3BJhxfaFuvMx4j4 rI1OfNjSTHrWgyu7GDZo3r0WWhwI3L0X+92JplIW2fP23FbwlzrJOOT7gULz2j9Ros65uM8OknmBV EB8bv3hXvtvJUxdQNBayiyL3/ufy/oFqM7IY/OxVGflxV4Eb2rM0iOUFvvtMFB3828VQqIBygLlp+ bSaM6SKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNCzp-0000000E6PR-1F8B; Fri, 28 Jun 2024 14:54:41 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNCzf-0000000E6Nz-2Jdj for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 14:54:33 +0000 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=81FpBswvqTN/+g4RZ2JQLI94RMcUtnvBgT5CRymvy00=; b=MGYf7KdnGuXY1WWsPiwRchgkQh ckcHUlfg+yk3eL6vt4Rsvd5uI2k0bL8Gqkt4+p+vMHVp00sZytVvFCe/KhlzOuFFz+S3gA8u4PI0V Eis+uEXgk0ESe02/721q9JveAWDX8ObVdhiaYOybrkobYbcLZ5wOdPYMILvu86VguhJexRV9y7cgE JcraytzqsYeMIg3qNTsJrXZh/myRdCnjN7oomiwToTd7E9OvA89qlR18GbJJFKEn5S7S67riVx8h/ Im3BJ63YZhjxDDDNe6niBS5eMb5L4LPud3nqarCn6r18jtYaZ4eKaM4pZ5vk0zNF9xewkVqaxwo11 uESa2Vuw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35642) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sNCzM-0006mN-02; Fri, 28 Jun 2024 15:54:12 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1sNCzN-0006ah-A6; Fri, 28 Jun 2024 15:54:13 +0100 Date: Fri, 28 Jun 2024 15:54:13 +0100 From: "Russell King (Oracle)" To: Serge Semin Cc: Andrew Halaney , Vinod Koul , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexei Starovoitov , Jesper Dangaard Brouer , John Fastabend , Daniel Borkmann , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, bpf@vger.kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC net-next v2 10/17] net: stmmac: Introduce internal PCS offset-based CSR access Message-ID: References: <20240624132802.14238-2-fancer.lancer@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240624132802.14238-2-fancer.lancer@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240628_075431_618520_6DB7B577 X-CRM114-Status: GOOD ( 14.49 ) 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 On Mon, Jun 24, 2024 at 04:26:27PM +0300, Serge Semin wrote: > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > index 80eb72bc6311..d0bcebe87ee8 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > @@ -633,7 +633,7 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos) > RGMII_CONFIG2_RGMII_CLK_SEL_CFG, > RGMII_IO_MACRO_CONFIG2); > ethqos_set_serdes_speed(ethqos, SPEED_2500); > - stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 0, 0, 0); > + stmmac_pcs_ctrl_ane(priv, priv->pcsaddr, 0, 0, 0); > break; > case SPEED_1000: > val &= ~ETHQOS_MAC_CTRL_PORT_SEL; > @@ -641,12 +641,12 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos) > RGMII_CONFIG2_RGMII_CLK_SEL_CFG, > RGMII_IO_MACRO_CONFIG2); > ethqos_set_serdes_speed(ethqos, SPEED_1000); > - stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0); > + stmmac_pcs_ctrl_ane(priv, priv->pcsaddr, 1, 0, 0); > break; > case SPEED_100: > val |= ETHQOS_MAC_CTRL_PORT_SEL | ETHQOS_MAC_CTRL_SPEED_MODE; > ethqos_set_serdes_speed(ethqos, SPEED_1000); > - stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0); > + stmmac_pcs_ctrl_ane(priv, priv->pcsaddr, 1, 0, 0); > break; > case SPEED_10: > val |= ETHQOS_MAC_CTRL_PORT_SEL; > @@ -656,7 +656,7 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos) > SGMII_10M_RX_CLK_DVDR), > RGMII_IO_MACRO_CONFIG); > ethqos_set_serdes_speed(ethqos, SPEED_1000); > - stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0); > + stmmac_pcs_ctrl_ane(priv, priv->pcsaddr, 1, 0, 0); > break; > } > I think a better preparatory patch (given what you do in future patches) would be to change all of these to: ethqos_pcs_set_inband(priv, {false | true}); which would be: static void ethqos_pcs_set_inband(struct stmmac_priv *priv, bool enable) { stmmac_pcs_ctrl_ane(priv, priv->ioaddr, enable, 0, 0); } which then means this patch becomes a single line, and your subsequent patch just has to replace stmmac_pcs_ctrl_ane() with its open-coded equivalent. > diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c > index 84fd57b76fad..3666893acb69 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c > +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c > @@ -6,6 +6,7 @@ > > #include "common.h" > #include "stmmac.h" > +#include "stmmac_pcs.h" > #include "stmmac_ptp.h" > #include "stmmac_est.h" > > @@ -116,6 +117,7 @@ static const struct stmmac_hwif_entry { > const void *tc; > const void *mmc; > const void *est; > + const void *pcs; I'm not a fan of void pointers. common.h includes linux/phylink.h, which will define struct phylink_pcs_ops, so there is no reason not to declare this as: const struct phylink_pcs_ops *pcs; -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!