[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZHBzQaWi5oskThI2@corigine.com>
Date: Fri, 26 May 2023 10:52:17 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Maxime Chevallier <maxime.chevallier@...tlin.com>
Cc: Mark Brown <broonie@...nel.org>, davem@...emloft.net,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
alexis.lothore@...tlin.com, thomas.petazzoni@...tlin.com,
Andrew Lunn <andrew@...n.ch>, Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Vladimir Oltean <vladimir.oltean@....com>,
Ioana Ciornei <ioana.ciornei@....com>,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Jose Abreu <joabreu@...opsys.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Giuseppe Cavallaro <peppe.cavallaro@...com>
Subject: Re: [PATCH net-next v3 4/4] net: stmmac: dwmac-sogfpga: use the lynx
pcs driver
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@...tlin.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:
...
Powered by blists - more mailing lists