Skip to content

Commit e06bd5e

Browse files
committed
Merge branch 'followup-fixes-for-the-dwmac-and-altera-lynx-conversion'
Maxime Chevallier says: ==================== Followup fixes for the dwmac and altera lynx conversion Here's yet another version of the cleanup series for the TSE PCS replacement by PCS Lynx. It includes Kconfig fixups, some missing initialisations and a slight rework suggested by Russell for the dwmac cleanup sequence, along with more explicit zeroing of local structures as per MAciej's review. ==================== Link: https://lore.kernel.org/r/20230607135941.407054-1-maxime.chevallier@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 6878eb5 + 06b9ded commit e06bd5e

File tree

5 files changed

+26
-12
lines changed

5 files changed

+26
-12
lines changed

drivers/net/ethernet/altera/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ config ALTERA_TSE
44
depends on HAS_DMA
55
select PHYLIB
66
select PHYLINK
7-
select PCS_ALTERA_TSE
7+
select PCS_LYNX
88
select MDIO_REGMAP
99
select REGMAP_MMIO
1010
help

drivers/net/ethernet/altera/altera_tse_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,8 @@ static int altera_tse_probe(struct platform_device *pdev)
12551255
if (ret)
12561256
goto err_free_netdev;
12571257

1258+
memset(&pcs_regmap_cfg, 0, sizeof(pcs_regmap_cfg));
1259+
memset(&mrc, 0, sizeof(mrc));
12581260
/* SGMII PCS address space. The location can vary depending on how the
12591261
* IP is integrated. We can have a resource dedicated to it at a specific
12601262
* address space, but if it's not the case, we fallback to the mdiophy0
@@ -1286,6 +1288,7 @@ static int altera_tse_probe(struct platform_device *pdev)
12861288
mrc.regmap = pcs_regmap;
12871289
mrc.parent = &pdev->dev;
12881290
mrc.valid_addr = 0x0;
1291+
mrc.autoscan = false;
12891292

12901293
/* Rx IRQ */
12911294
priv->rx_irq = platform_get_irq_byname(pdev, "rx_irq");

drivers/net/ethernet/stmicro/stmmac/common.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <linux/stmmac.h>
1717
#include <linux/phy.h>
1818
#include <linux/pcs/pcs-xpcs.h>
19-
#include <linux/pcs-lynx.h>
2019
#include <linux/module.h>
2120
#if IS_ENABLED(CONFIG_VLAN_8021Q)
2221
#define STMMAC_VLAN_TAG_USED

drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/phy.h>
1212
#include <linux/regmap.h>
1313
#include <linux/mdio/mdio-regmap.h>
14+
#include <linux/pcs-lynx.h>
1415
#include <linux/reset.h>
1516
#include <linux/stmmac.h>
1617

@@ -388,7 +389,6 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
388389
struct net_device *ndev;
389390
struct stmmac_priv *stpriv;
390391
const struct socfpga_dwmac_ops *ops;
391-
struct regmap_config pcs_regmap_cfg;
392392

393393
ops = device_get_match_data(&pdev->dev);
394394
if (!ops) {
@@ -446,19 +446,22 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
446446
if (ret)
447447
goto err_dvr_remove;
448448

449-
memset(&pcs_regmap_cfg, 0, sizeof(pcs_regmap_cfg));
450-
pcs_regmap_cfg.reg_bits = 16;
451-
pcs_regmap_cfg.val_bits = 16;
452-
pcs_regmap_cfg.reg_shift = REGMAP_UPSHIFT(1);
453-
454449
/* Create a regmap for the PCS so that it can be used by the PCS driver,
455450
* if we have such a PCS
456451
*/
457452
if (dwmac->tse_pcs_base) {
453+
struct regmap_config pcs_regmap_cfg;
458454
struct mdio_regmap_config mrc;
459455
struct regmap *pcs_regmap;
460456
struct mii_bus *pcs_bus;
461457

458+
memset(&pcs_regmap_cfg, 0, sizeof(pcs_regmap_cfg));
459+
memset(&mrc, 0, sizeof(mrc));
460+
461+
pcs_regmap_cfg.reg_bits = 16;
462+
pcs_regmap_cfg.val_bits = 16;
463+
pcs_regmap_cfg.reg_shift = REGMAP_UPSHIFT(1);
464+
462465
pcs_regmap = devm_regmap_init_mmio(&pdev->dev, dwmac->tse_pcs_base,
463466
&pcs_regmap_cfg);
464467
if (IS_ERR(pcs_regmap)) {
@@ -469,6 +472,7 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
469472
mrc.regmap = pcs_regmap;
470473
mrc.parent = &pdev->dev;
471474
mrc.valid_addr = 0x0;
475+
mrc.autoscan = false;
472476

473477
snprintf(mrc.name, MII_BUS_ID_SIZE, "%s-pcs-mii", ndev->name);
474478
pcs_bus = devm_mdio_regmap_register(&pdev->dev, &mrc);
@@ -494,6 +498,17 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
494498
return ret;
495499
}
496500

501+
static void socfpga_dwmac_remove(struct platform_device *pdev)
502+
{
503+
struct net_device *ndev = platform_get_drvdata(pdev);
504+
struct stmmac_priv *priv = netdev_priv(ndev);
505+
struct phylink_pcs *pcs = priv->hw->lynx_pcs;
506+
507+
stmmac_pltfr_remove(pdev);
508+
509+
lynx_pcs_destroy(pcs);
510+
}
511+
497512
#ifdef CONFIG_PM_SLEEP
498513
static int socfpga_dwmac_resume(struct device *dev)
499514
{
@@ -565,7 +580,7 @@ MODULE_DEVICE_TABLE(of, socfpga_dwmac_match);
565580

566581
static struct platform_driver socfpga_dwmac_driver = {
567582
.probe = socfpga_dwmac_probe,
568-
.remove_new = stmmac_pltfr_remove,
583+
.remove_new = socfpga_dwmac_remove,
569584
.driver = {
570585
.name = "socfpga-dwmac",
571586
.pm = &socfpga_dwmac_pm_ops,

drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,9 +665,6 @@ int stmmac_mdio_unregister(struct net_device *ndev)
665665
if (priv->hw->xpcs)
666666
xpcs_destroy(priv->hw->xpcs);
667667

668-
if (priv->hw->lynx_pcs)
669-
lynx_pcs_destroy(priv->hw->lynx_pcs);
670-
671668
mdiobus_unregister(priv->mii);
672669
priv->mii->priv = NULL;
673670
mdiobus_free(priv->mii);

0 commit comments

Comments
 (0)