netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Serge Semin <fancer.lancer@gmail.com>
Cc: Andrew Halaney <ahalaney@redhat.com>,
	Vinod Koul <vkoul@kernel.org>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	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
Date: Fri, 28 Jun 2024 15:54:13 +0100	[thread overview]
Message-ID: <Zn7OlQ4aoO2vZTrj@shell.armlinux.org.uk> (raw)
In-Reply-To: <20240624132802.14238-2-fancer.lancer@gmail.com>

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!

  reply	other threads:[~2024-06-28 14:54 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31 11:25 [PATCH RFC v2 0/8] net: stmmac: convert stmmac "pcs" to phylink Russell King (Oracle)
2024-05-31 11:26 ` [PATCH RFC net-next v2 1/8] net: stmmac: add infrastructure for hwifs to provide PCS Russell King (Oracle)
2024-06-05 19:57   ` Andrew Halaney
2024-06-10  9:16     ` Russell King (Oracle)
2024-05-31 11:26 ` [PATCH RFC net-next v2 2/8] net: stmmac: provide core phylink PCS infrastructure Russell King (Oracle)
2024-05-31 11:26 ` [PATCH RFC net-next v2 3/8] net: stmmac: dwmac1000: convert sgmii/rgmii "pcs" to phylink Russell King (Oracle)
2024-06-05 20:05   ` Andrew Halaney
2024-06-05 21:59     ` Andrew Halaney
2024-06-10  9:24       ` Russell King (Oracle)
2024-06-10  9:19     ` Russell King (Oracle)
2024-06-11 12:25       ` Serge Semin
2024-06-12 22:04         ` Russell King (Oracle)
2024-06-13 21:14           ` Serge Semin
2024-06-18 10:26             ` Serge Semin
2024-06-24  1:32               ` Serge Semin
2024-06-24 13:40                 ` Serge Semin
2024-05-31 11:26 ` [PATCH RFC net-next v2 4/8] net: stmmac: dwmac1000: move PCS interrupt control Russell King (Oracle)
2024-05-31 11:26 ` [PATCH RFC net-next v2 5/8] net: stmmac: dwmac4: convert sgmii/rgmii "pcs" to phylink Russell King (Oracle)
2024-06-05 22:35   ` Andrew Halaney
2024-06-11 18:22     ` Abhishek Chauhan (ABC)
2024-05-31 11:26 ` [PATCH RFC net-next v2 6/8] net: stmmac: dwmac4: move PCS interrupt control Russell King (Oracle)
2024-05-31 11:26 ` [PATCH RFC net-next v2 7/8] net: stmmac: remove obsolete pcs methods and associated code Russell King (Oracle)
2024-06-05 22:09   ` Andrew Halaney
2024-05-31 11:26 ` [PATCH RFC net-next v2 8/8] net: stmmac: Activate Inband/PCS flag based on the selected iface Russell King
2024-06-03 21:39 ` [PATCH RFC v2 0/8] net: stmmac: convert stmmac "pcs" to phylink Andrew Halaney
2024-06-24 13:26 ` [PATCH RFC net-next v2 09/17] net: stmmac: Introduce mac_device_info::priv pointer Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 10/17] net: stmmac: Introduce internal PCS offset-based CSR access Serge Semin
2024-06-28 14:54   ` Russell King (Oracle) [this message]
2024-07-03 18:03     ` Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 11/17] net: stmmac: Introduce internal PCS config register getter Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 12/17] net: stmmac: Introduce internal PCS IRQ enable/disable methods Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 13/17] net: stmmac: Move internal PCS ANE-control method to dwmac-qcom-ethqos.c Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 14/17] net: stmmac: Move internal PCS PHYLINK ops to stmmac_pcs.c Serge Semin
2024-06-28 15:07   ` Russell King (Oracle)
2024-07-03 19:08     ` Serge Semin
2024-07-03 20:07       ` Russell King (Oracle)
2024-07-04 19:56         ` Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 15/17] net: stmmac: Move internal PCS ISR " Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 16/17] net: stmmac: Move internal PCS init method " Serge Semin
2024-06-28 14:36   ` Russell King (Oracle)
2024-07-04 12:55     ` Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 17/17] net: stmmac: pcs: Drop the _SHIFT macros Serge Semin
2024-06-28 14:42   ` Russell King (Oracle)
2024-07-04 13:19     ` Serge Semin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zn7OlQ4aoO2vZTrj@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=ahalaney@redhat.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fancer.lancer@gmail.com \
    --cc=hawk@kernel.org \
    --cc=joabreu@synopsys.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).