linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: Mark Brown <broonie@kernel.org>,
	davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, alexis.lothore@bootlin.com,
	thomas.petazzoni@bootlin.com, Andrew Lunn <andrew@lunn.ch>,
	Jakub Kicinski <kuba@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Jose Abreu <joabreu@synopsys.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>
Subject: Re: [PATCH net-next v3 4/4] net: stmmac: dwmac-sogfpga: use the lynx pcs driver
Date: Fri, 26 May 2023 10:52:17 +0200	[thread overview]
Message-ID: <ZHBzQaWi5oskThI2@corigine.com> (raw)
In-Reply-To: <20230526074252.480200-5-maxime.chevallier@bootlin.com>

On Fri, May 26, 2023 at 09:42:52AM +0200, Maxime Chevallier wrote:
> dwmac_socfpga re-implements support for the TSE PCS, which is identical
> to the already existing TSE PCS, which in turn is the same as the Lynx
> PCS. Drop the existing TSE re-implemenation and use the Lynx PCS
> instead, relying on the regmap-mdio driver to translate MDIO accesses
> into mmio accesses.
> 
> Instead of extending xpcs, allow using a generic phylink_pcs, populated
> by lynx_pcs_create(), and use .mac_select_pcs() to return the relevant
> PCS to be used.
> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
> V2->V3 : No changes
> V1->V2 : No changes
> 
>  drivers/net/ethernet/stmicro/stmmac/Kconfig   |   1 +
>  drivers/net/ethernet/stmicro/stmmac/Makefile  |   2 +-
>  .../ethernet/stmicro/stmmac/altr_tse_pcs.c    | 257 ------------------
>  .../ethernet/stmicro/stmmac/altr_tse_pcs.h    |  29 --
>  drivers/net/ethernet/stmicro/stmmac/common.h  |   1 +
>  .../ethernet/stmicro/stmmac/dwmac-socfpga.c   |  90 ++++--
>  .../net/ethernet/stmicro/stmmac/stmmac_main.c |  12 +-
>  7 files changed, 76 insertions(+), 316 deletions(-)

Another nice diffstat :)

...

> @@ -443,6 +454,35 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_dvr_remove;
>  
> +	memset(&pcs_regmap_cfg, 0, sizeof(pcs_regmap_cfg));
> +	pcs_regmap_cfg.reg_bits = 16;
> +	pcs_regmap_cfg.val_bits = 16;
> +	pcs_regmap_cfg.reg_shift = REGMAP_UPSHIFT(1);
> +
> +	/* Create a regmap for the PCS so that it can be used by the PCS driver,
> +	 * if we have such a PCS
> +	 */
> +	if (dwmac->tse_pcs_base) {

nit: perhaps the scope of pcs_regmap and pcs_bus could be reduced to
     this block.

> +		pcs_regmap = devm_regmap_init_mmio(&pdev->dev, dwmac->tse_pcs_base,
> +						   &pcs_regmap_cfg);
> +		if (IS_ERR(pcs_regmap)) {
> +			ret = PTR_ERR(pcs_regmap);
> +			goto err_dvr_remove;
> +		}
> +
> +		mrc.regmap = pcs_regmap;
> +
> +		snprintf(mrc.name, MII_BUS_ID_SIZE, "%s-pcs-mii", ndev->name);
> +		pcs_bus = devm_mdio_regmap_register(&pdev->dev, &mrc);
> +		if (IS_ERR(pcs_bus)) {
> +			ret = PTR_ERR(pcs_bus);
> +			goto err_dvr_remove;
> +		}
> +
> +		dwmac->pcs_mdiodev = mdio_device_create(pcs_bus, 0);
> +		stpriv->hw->phylink_pcs = lynx_pcs_create(dwmac->pcs_mdiodev);
> +	}
> +
>  	return 0;
>  
>  err_dvr_remove:

...

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2023-05-26  8:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26  7:42 [PATCH net-next v3 0/4] net: add a regmap-based mdio driver and drop TSE PCS Maxime Chevallier
2023-05-26  7:42 ` [PATCH net-next v3 1/4] net: mdio: Introduce a regmap-based mdio driver Maxime Chevallier
2023-05-26 10:21   ` Vladimir Oltean
2023-05-26 16:59     ` Maxime Chevallier
2023-05-26  7:42 ` [PATCH net-next v3 2/4] net: ethernet: altera-tse: Convert to mdio-regmap and use PCS Lynx Maxime Chevallier
2023-05-26  8:39   ` Simon Horman
2023-05-26  9:05     ` Russell King (Oracle)
2023-05-26 10:42       ` Russell King (Oracle)
2023-05-26 17:03     ` Maxime Chevallier
2023-05-26  7:42 ` [PATCH net-next v3 3/4] net: pcs: Drop the TSE PCS driver Maxime Chevallier
2023-05-26  8:43   ` Simon Horman
2023-05-26 17:07     ` Maxime Chevallier
2023-05-26  7:42 ` [PATCH net-next v3 4/4] net: stmmac: dwmac-sogfpga: use the lynx pcs driver Maxime Chevallier
2023-05-26  8:52   ` Simon Horman [this message]

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=ZHBzQaWi5oskThI2@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=alexis.lothore@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vladimir.oltean@nxp.com \
    /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).