Skip to contentSkip to conversation

net: add a regmap-based mdio driver and drop TSE PCS

PATCH Applied Maxime Chevallier 4 participants 13 messages Jun 1, 2023 – Jun 6, 2023

Subsystems (8)
lore
Share & tools
lore

Maxime Chevallier

author maintainer
#0 lore raw

v4 cover net: add a regmap-based mdio driver and drop TSE PCS

Hello everyone,

This is the V4 of a series that follows-up on the work [1] aiming to drop the altera TSE PCS driver, as it turns out to be a version of the Lynx PCS exposed as a memory-mapped block, instead of living on an MDIO bus.

One step of this removal involved creating a regmap-based mdio driver that translates MDIO accesses into the actual underlying bus that exposes the register. The register layout must of course match the standard MDIO layout, but we can now account for differences in stride with recent work on the regmap subsystem [2].

Sorry for repeating this, but I didn't hear anything on this matter in previous iterations, Mark, Net maintainers, this series depends on the patch e12ff2876493 that was recently merged into the regmap tree [3].

For this series to be usable in net-next, this patch must be applied beforehand. Should Mark create a tag that would then be merged into net-next ? Or should we just wait for the next release to merge this into net-next ?

This series introduces a new MDIO driver, and uses it to convert Altera TSE from the actual TSE PCS driver to Lynx PCS.

Since it turns out dwmac_socfpga also uses a TSE PCS block, port that driver to Lynx as well.

Changes in V4 :
- Use new pcs_lynx_create/destroy helpers added by Russell
- Rework the cleanup sequence to avoid leaking data
- Rework a bit KConfig to properly select dependencies
- Fix a few hiccups with misplaced hunks in 2 commits

Changes in V3 :
- Use a dedicated struct for the mii bus's priv data, to avoid duplicating the whole struct mdio_regmap_config, from which 2 fields only are necessary after init, as suggested by Russell
- Use ~0 instead of ~0UL for the no-scan bitmask, following Simon's review.

Changes in V2 :
- Use phy_mask to avoid unnecessarily scanning the whole mdio bus
- Go one step further and completely disable scanning if users set the .autoscan flag to false, in case the mdiodevice isn't an actual PHY (a PCS for example).

Thanks,

Maxime

[1] : https://lore.kernel.org/all/[email protected]/
[2] : https://lore.kernel.org/all/[email protected]/#t
[3] : https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git/commit/?id=e12ff28764937dd58c8613f16065da60da149048

Maxime Chevallier (4):
net: mdio: Introduce a regmap-based mdio driver
net: ethernet: altera-tse: Convert to mdio-regmap and use PCS Lynx
net: pcs: Drop the TSE PCS driver
net: stmmac: dwmac-sogfpga: use the lynx pcs driver

 MAINTAINERS                                   |  14 +-
 drivers/net/ethernet/altera/Kconfig           |   2 +
 drivers/net/ethernet/altera/altera_tse_main.c |  57 +++-
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |   3 +
 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  |   2 +
 .../ethernet/stmicro/stmmac/dwmac-socfpga.c   |  91 +++++--
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |  12 +-
 .../net/ethernet/stmicro/stmmac/stmmac_mdio.c |   3 +
 drivers/net/mdio/Kconfig                      |  11 +
 drivers/net/mdio/Makefile                     |   1 +
 drivers/net/mdio/mdio-regmap.c                |  93 +++++++
 drivers/net/pcs/Kconfig                       |   6 -
 drivers/net/pcs/Makefile                      |   1 -
 drivers/net/pcs/pcs-altera-tse.c              | 160 -----------
 include/linux/mdio/mdio-regmap.h              |  26 ++
 include/linux/pcs-altera-tse.h                |  17 --
 19 files changed, 271 insertions(+), 516 deletions(-)
 delete mode 100644 drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c
 delete mode 100644 drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h
 create mode 100644 drivers/net/mdio/mdio-regmap.c
 delete mode 100644 drivers/net/pcs/pcs-altera-tse.c
 create mode 100644 include/linux/mdio/mdio-regmap.h
 delete mode 100644 include/linux/pcs-altera-tse.h
Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH v4 1/4 net: mdio: Introduce a regmap-based mdio driver

There exists several examples today of devices that embed an ethernet PHY or PCS directly inside an SoC. In this situation, either the device is controlled through a vendor-specific register set, or sometimes exposes the standard 802.3 registers that are typically accessed over MDIO.

As phylib and phylink are designed to use mdiodevices, this driver allows creating a virtual MDIO bus, that translates mdiodev register accesses to regmap accesses.

The reason we use regmap is because there are at least 3 such devices known today, 2 of them are Altera TSE PCS's, memory-mapped, exposed with a 4-byte stride in stmmac's dwmac-socfpga variant, and a 2-byte stride in altera-tse. The other one (nxp,sja1110-base-tx-mdio) is exposed over SPI.

---
V3->V4 :
- Clarify the KConfig description with the need for REGMAP
- Put the correct #include in the new header, as per Vlad's review
V2->V3 :
- Introduce struct mdio_regmap_priv for priv elements instead of plain reuse of the config struct
- Use ~O instead of ~0UL
V1->V2 :
- Use phy_mask to avoid unnecessary scanning, suggested by Andrew
- Allow entirely disabling scanning, suggested by Vlad

 MAINTAINERS                      |  7 +++
 drivers/net/mdio/Kconfig         | 11 ++++
 drivers/net/mdio/Makefile        |  1 +
 drivers/net/mdio/mdio-regmap.c   | 93 ++++++++++++++++++++++++++++++++
 include/linux/mdio/mdio-regmap.h | 26 +++++++++
 5 files changed, 138 insertions(+)
 create mode 100644 drivers/net/mdio/mdio-regmap.c
 create mode 100644 include/linux/mdio/mdio-regmap.h
MAINTAINERS +7 -0
index c904dba1733b..f68269b39e09 100644
@@ -12835,6 +12835,13 @@ F:	Documentation/devicetree/bindings/net/ieee802154/mcr20a.txt
 F:	drivers/net/ieee802154/mcr20a.c
 F:	drivers/net/ieee802154/mcr20a.h
 
+MDIO REGMAP DRIVER
+M:	Maxime Chevallier <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/net/mdio/mdio-regmap.c
+F:	include/linux/mdio/mdio-regmap.h
+
 MEASUREMENT COMPUTING CIO-DAC IIO DRIVER
 M:	William Breathitt Gray <[email protected]>
 L:	[email protected]
drivers/net/mdio/Kconfig +11 -0
index 9ff2e6f22f3f..4a7a303be2f7 100644
@@ -185,6 +185,17 @@ config MDIO_IPQ8064
 	  This driver supports the MDIO interface found in the network
 	  interface units of the IPQ8064 SoC
 
+config MDIO_REGMAP
+	tristate
+	help
+	  This driver allows using MDIO devices that are not sitting on a
+	  regular MDIO bus, but still exposes the standard 802.3 register
+	  layout. It's regmap-based so that it can be used on integrated,
+	  memory-mapped PHYs, SPI PHYs and so on. A new virtual MDIO bus is
+	  created, and its read/write operations are mapped to the underlying
+	  regmap. Users willing to use this driver must explicitly select
+	  REGMAP.
+
 config MDIO_THUNDER
 	tristate "ThunderX SOCs MDIO buses"
 	depends on 64BIT
drivers/net/mdio/Makefile +1 -0
index 7d4cb4c11e4e..1015f0db4531 100644
@@ -19,6 +19,7 @@ obj-$(CONFIG_MDIO_MOXART)		+= mdio-moxart.o
 obj-$(CONFIG_MDIO_MSCC_MIIM)		+= mdio-mscc-miim.o
 obj-$(CONFIG_MDIO_MVUSB)		+= mdio-mvusb.o
 obj-$(CONFIG_MDIO_OCTEON)		+= mdio-octeon.o
+obj-$(CONFIG_MDIO_REGMAP)		+= mdio-regmap.o
 obj-$(CONFIG_MDIO_SUN4I)		+= mdio-sun4i.o
 obj-$(CONFIG_MDIO_THUNDER)		+= mdio-thunder.o
 obj-$(CONFIG_MDIO_XGENE)		+= mdio-xgene.o
drivers/net/mdio/mdio-regmap.c new file +93 -0

93 lines not on this page · raw message

include/linux/mdio/mdio-regmap.h new file +26 -0
new file mode 100644
index 000000000000..679d9069846b
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Driver for MMIO-Mapped MDIO devices. Some IPs expose internal PHYs or PCS
+ * within the MMIO-mapped area
+ *
+ * Copyright (C) 2023 Maxime Chevallier <[email protected]>
+ */
+#ifndef MDIO_REGMAP_H
+#define MDIO_REGMAP_H
+
+#include <linux/phy.h>
+
+struct device;
+struct regmap;
+
+struct mdio_regmap_config {
+	struct device *parent;
+	struct regmap *regmap;
+	char name[MII_BUS_ID_SIZE];
+	u8 valid_addr;
+	bool autoscan;
+};
+
+struct mii_bus *devm_mdio_regmap_register(struct device *dev,
+					  const struct mdio_regmap_config *config);
+
+#endif
Signature · 1 line
2.40.1
Reviewed-by on v4 1/4
#2 lore raw

Re: [PATCH net-next v4 1/4] net: mdio: Introduce a regmap-based mdio driver

Quoted 10 lines · Maxime Chevallier

There exists several examples today of devices that embed an ethernet PHY or PCS directly inside an SoC. In this situation, either the device is controlled through a vendor-specific register set, or sometimes exposes the standard 802.3 registers that are typically accessed over MDIO.

As phylib and phylink are designed to use mdiodevices, this driver allows creating a virtual MDIO bus, that translates mdiodev register accesses to regmap accesses.

Quoted 7 lines

The reason we use regmap is because there are at least 3 such devices known today, 2 of them are Altera TSE PCS's, memory-mapped, exposed with a 4-byte stride in stmmac's dwmac-socfpga variant, and a 2-byte stride in altera-tse. The other one (nxp,sja1110-base-tx-mdio) is exposed over SPI.

author maintainer
#3 lore raw

PATCH v4 2/4 net: ethernet: altera-tse: Convert to mdio-regmap and use PCS Lynx

In reply to Maxime Chevallier

The newly introduced regmap-based MDIO driver allows for an easy mapping of an mdiodevice onto the memory-mapped TSE PCS, which is actually a Lynx PCS.

Convert Altera TSE to use this PCS instead of the pcs-altera-tse, which is nothing more than a memory-mapped Lynx PCS.

---
V3->V4 :
- Use pcs_lynxcreate()/destroy() introduced by Russell
- Fix the error path
- Add back misplaced KConfig dependencies
V2->V3 : No changes
V1->V2 : No changes

 drivers/net/ethernet/altera/Kconfig           |  2 +
 drivers/net/ethernet/altera/altera_tse_main.c | 57 ++++++++++++++++---
 2 files changed, 50 insertions(+), 9 deletions(-)
drivers/net/ethernet/altera/Kconfig +2 -0
index dd7fd41ccde5..93533ba03429 100644
@@ -5,6 +5,8 @@ config ALTERA_TSE
 	select PHYLIB
 	select PHYLINK
 	select PCS_ALTERA_TSE
+	select MDIO_REGMAP
+	select REGMAP_MMIO
 	help
 	  This driver supports the Altera Triple-Speed (TSE) Ethernet MAC.
 
drivers/net/ethernet/altera/altera_tse_main.c +48 -9

112 lines not on this page · raw message

Signature · 1 line
2.40.1
Reviewed-by on v4 2/4
#4 lore raw

Re: [PATCH net-next v4 2/4] net: ethernet: altera-tse: Convert to mdio-regmap and use PCS Lynx

Quoted 8 lines · Maxime Chevallier

The newly introduced regmap-based MDIO driver allows for an easy mapping of an mdiodevice onto the memory-mapped TSE PCS, which is actually a Lynx PCS.

Convert Altera TSE to use this PCS instead of the pcs-altera-tse, which is nothing more than a memory-mapped Lynx PCS.

author maintainer
#5 lore raw

Re: [PATCH net-next v4 2/4] net: ethernet: altera-tse: Convert to mdio-regmap and use PCS Lynx

In reply to Maxime Chevallier

Hi,

Quoted 8 lines · On Thu, 1 Jun 2023 16:14:52 +0200 Maxime Chevallier…

The newly introduced regmap-based MDIO driver allows for an easy mapping of an mdiodevice onto the memory-mapped TSE PCS, which is actually a Lynx PCS.

Convert Altera TSE to use this PCS instead of the pcs-altera-tse, which is nothing more than a memory-mapped Lynx PCS.

[ ... ]

drivers/net/ethernet/altera/altera_tse_main.c static int altera_tse_probe(struct platform_device *pdev) · line 1263

Quoted 3 lines
drivers/net/ethernet/altera/altera_tse_main.c +1 -2
-	ret = request_and_map(pdev, "pcs", &pcs_res,
-			      &priv->pcs_base);
+	ret = request_and_map(pdev, "pcs", &pcs_res, &priv->pcs_base);

It turns out I'm missing the zeroing of pcs_regmap_cfg, which can trigger errors at probe time. I know this series has been applied, and that I can send a followup fix, but due to the missing regmap patch in the net-next tree, this series will break altera_tse and dwmac_socfpga anyway,as mentionned here (and in the cover):

https://lore.kernel.org/netdev/[email protected]/

Is reverting the way to go then ?

Best regards,

Maxime

author maintainer
#6 lore raw

PATCH v4 3/4 net: pcs: Drop the TSE PCS driver

In reply to Maxime Chevallier

Now that we can easily create a mdio-device that represents a memory-mapped device that exposes an MDIO-like register layout, we don't need the Altera TSE PCS anymore, since we can use the Lynx PCS instead.

---
V3->V4 : Add Simon's Reviewed-by
V2->V3 : No changes
V1->V2 : No changes

 MAINTAINERS                      |   7 --
 drivers/net/pcs/Kconfig          |   6 --
 drivers/net/pcs/Makefile         |   1 -
 drivers/net/pcs/pcs-altera-tse.c | 160 -------------------------------
 include/linux/pcs-altera-tse.h   |  17 ----
 5 files changed, 191 deletions(-)
 delete mode 100644 drivers/net/pcs/pcs-altera-tse.c
 delete mode 100644 include/linux/pcs-altera-tse.h
MAINTAINERS +0 -7
index f68269b39e09..0982384e300f 100644
@@ -909,13 +909,6 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/altera/
 
-ALTERA TSE PCS
-M:	Maxime Chevallier <[email protected]>
-L:	[email protected]
-S:	Supported
-F:	drivers/net/pcs/pcs-altera-tse.c
-F:	include/linux/pcs-altera-tse.h
-
 ALTERA UART/JTAG UART SERIAL DRIVERS
 M:	Tobias Klauser <[email protected]>
 L:	[email protected]
drivers/net/pcs/Kconfig +0 -6
index 7c34fb7cbf7b..87cf308fc6d8 100644
@@ -33,10 +33,4 @@ config PCS_RZN1_MIIC
 	  on RZ/N1 SoCs. This PCS converts MII to RMII/RGMII or can be set in
 	  pass-through mode for MII.
 
-config PCS_ALTERA_TSE
-	tristate
-	help
-	  This module provides helper functions for the Altera Triple Speed
-	  Ethernet SGMII PCS, that can be found on the Intel Socfpga family.
-
 endmenu
drivers/net/pcs/Makefile +0 -1
index 9b9afd6b1c22..ea662a7989b2 100644
@@ -7,4 +7,3 @@ obj-$(CONFIG_PCS_XPCS)		+= pcs_xpcs.o
 obj-$(CONFIG_PCS_LYNX)		+= pcs-lynx.o
 obj-$(CONFIG_PCS_MTK_LYNXI)	+= pcs-mtk-lynxi.o
 obj-$(CONFIG_PCS_RZN1_MIIC)	+= pcs-rzn1-miic.o
-obj-$(CONFIG_PCS_ALTERA_TSE)	+= pcs-altera-tse.o
drivers/net/pcs/pcs-altera-tse.c deleted +0 -160

160 lines not on this page · raw message

include/linux/pcs-altera-tse.h deleted +0 -17
deleted file mode 100644
index 92ab9f08e835..000000000000
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (C) 2022 Bootlin
- *
- * Maxime Chevallier <[email protected]>
- */
-
-#ifndef __LINUX_PCS_ALTERA_TSE_H
-#define __LINUX_PCS_ALTERA_TSE_H
-
-struct phylink_pcs;
-struct net_device;
-
-struct phylink_pcs *alt_tse_pcs_create(struct net_device *ndev,
-				       void __iomem *pcs_base, int reg_width);
-
-#endif /* __LINUX_PCS_ALTERA_TSE_H */
Signature · 1 line
2.40.1
author maintainer
#7 lore raw

PATCH v4 4/4 net: stmmac: dwmac-sogfpga: use the lynx pcs driver

In reply to Maxime Chevallier

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.

Add a lynx_pcs reference in the stmmac's internal structure, and use .mac_select_pcs() to return the relevant PCS to be used.

---
V3->V4 :
- Use pcs_lynx_create/destroy()
- Add a missing cleanup step for this PCS
- rename the new PCS field from phylink_pcs to lynx_pcs, as we need to know which kind of PCS it is to call the proper cleanup helper
- Add missing Kconfig dependencies
V2->V3 : No changes
V1->V2 : No changes

 drivers/net/ethernet/stmicro/stmmac/Kconfig   |   3 +
 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  |   2 +
 .../ethernet/stmicro/stmmac/dwmac-socfpga.c   |  91 +++++--
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |  12 +-
 .../net/ethernet/stmicro/stmmac/stmmac_mdio.c |   3 +
 8 files changed, 83 insertions(+), 316 deletions(-)
 delete mode 100644 drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c
 delete mode 100644 drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h
drivers/net/ethernet/stmicro/stmmac/Kconfig +3 -0
index 5f5a997f21f3..5583f0b055ec 100644
@@ -158,6 +158,9 @@ config DWMAC_SOCFPGA
 	default ARCH_INTEL_SOCFPGA
 	depends on OF && (ARCH_INTEL_SOCFPGA || COMPILE_TEST)
 	select MFD_SYSCON
+	select MDIO_REGMAP
+	select REGMAP_MMIO
+	select PCS_LYNX
 	help
 	  Support for ethernet controller on Altera SOCFPGA
 
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -1
index 8738fdbb4b2d..7dd3d388068b 100644
@@ -35,7 +35,7 @@ obj-$(CONFIG_DWMAC_IMX8)	+= dwmac-imx.o
 obj-$(CONFIG_DWMAC_TEGRA)	+= dwmac-tegra.o
 obj-$(CONFIG_DWMAC_VISCONTI)	+= dwmac-visconti.o
 stmmac-platform-objs:= stmmac_platform.o
-dwmac-altr-socfpga-objs := altr_tse_pcs.o dwmac-socfpga.o
+dwmac-altr-socfpga-objs := dwmac-socfpga.o
 
 obj-$(CONFIG_STMMAC_PCI)	+= stmmac-pci.o
 obj-$(CONFIG_DWMAC_INTEL)	+= dwmac-intel.o
drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c deleted +0 -257

257 lines not on this page · raw message

drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h deleted +0 -29
deleted file mode 100644
index 694ac25ef426..000000000000
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/* Copyright Altera Corporation (C) 2016. All rights reserved.
- *
- * Author: Tien Hock Loh <[email protected]>
- */
-
-#ifndef __TSE_PCS_H__
-#define __TSE_PCS_H__
-
-#include <linux/phy.h>
-#include <linux/timer.h>
-
-#define SGMII_ADAPTER_CTRL_REG		0x00
-#define SGMII_ADAPTER_ENABLE		0x0000
-#define SGMII_ADAPTER_DISABLE		0x0001
-
-struct tse_pcs {
-	struct device *dev;
-	void __iomem *tse_pcs_base;
-	void __iomem *sgmii_adapter_base;
-	struct timer_list aneg_link_timer;
-	int autoneg;
-};
-
-int tse_pcs_init(void __iomem *base, struct tse_pcs *pcs);
-void tse_pcs_fix_mac_speed(struct tse_pcs *pcs, struct phy_device *phy_dev,
-			   unsigned int speed);
-
-#endif /* __TSE_PCS_H__ */
drivers/net/ethernet/stmicro/stmmac/common.h +2 -0
index 4ad692c4116c..52c5ec553276 100644
@@ -16,6 +16,7 @@
 #include <linux/stmmac.h>
 #include <linux/phy.h>
 #include <linux/pcs/pcs-xpcs.h>
+#include <linux/pcs-lynx.h>
 #include <linux/module.h>
 #if IS_ENABLED(CONFIG_VLAN_8021Q)
 #define STMMAC_VLAN_TAG_USED
@@ -519,6 +520,7 @@ struct mac_device_info {
 	const struct stmmac_tc_ops *tc;
 	const struct stmmac_mmc_ops *mmc;
 	struct dw_xpcs *xpcs;
+	struct phylink_pcs *lynx_pcs; /* Lynx external PCS */
 	struct mii_regs mii;	/* MII register Addresses */
 	struct mac_link link;
 	void __iomem *pcsr;     /* vpointer to device CSRs */
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +66 -25

177 lines not on this page · raw message

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +8 -4
index 0fca81507a77..cff76e215f7d 100644
@@ -937,10 +937,13 @@ static struct phylink_pcs *stmmac_mac_select_pcs(struct phylink_config *config,
 {
 	struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
 
-	if (!priv->hw->xpcs)
-		return NULL;
+	if (priv->hw->xpcs)
+		return &priv->hw->xpcs->pcs;
+
+	if (priv->hw->lynx_pcs)
+		return priv->hw->lynx_pcs;
 
-	return &priv->hw->xpcs->pcs;
+	return NULL;
 }
 
 static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
@@ -3813,7 +3816,8 @@ static int __stmmac_open(struct net_device *dev,
 	if (priv->hw->pcs != STMMAC_PCS_TBI &&
 	    priv->hw->pcs != STMMAC_PCS_RTBI &&
 	    (!priv->hw->xpcs ||
-	     xpcs_get_an_mode(priv->hw->xpcs, mode) != DW_AN_C73)) {
+	     xpcs_get_an_mode(priv->hw->xpcs, mode) != DW_AN_C73) &&
+	    !priv->hw->lynx_pcs) {
 		ret = stmmac_init_phy(dev);
 		if (ret) {
 			netdev_err(priv->dev,
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +3 -0
index 3db1cb0fd160..c784a6731f08 100644
@@ -665,6 +665,9 @@ int stmmac_mdio_unregister(struct net_device *ndev)
 	if (priv->hw->xpcs)
 		xpcs_destroy(priv->hw->xpcs);
 
+	if (priv->hw->lynx_pcs)
+		lynx_pcs_destroy(priv->hw->lynx_pcs);
+
 	mdiobus_unregister(priv->mii);
 	priv->mii->priv = NULL;
 	mdiobus_free(priv->mii);
Signature · 1 line
2.40.1
Reviewed-by on v4 4/4
#8 lore raw

Re: [PATCH net-next v4 4/4] net: stmmac: dwmac-sogfpga: use the lynx pcs driver

Quoted 10 lines · Maxime Chevallier

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.

Add a lynx_pcs reference in the stmmac's internal structure, and use .mac_select_pcs() to return the relevant PCS to be used.

#9 lore raw
In reply to Maxime Chevallier
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 6 lines · On Thu, 1 Jun 2023 16:14:50 +0200 you wrote:

Hello everyone,

This is the V4 of a series that follows-up on the work [1] aiming to drop the altera TSE PCS driver, as it turns out to be a version of the Lynx PCS exposed as a memory-mapped block, instead of living on an MDIO bus.

Quoted 7 lines

One step of this removal involved creating a regmap-based mdio driver that translates MDIO accesses into the actual underlying bus that exposes the register. The register layout must of course match the standard MDIO layout, but we can now account for differences in stride with recent work on the regmap subsystem [2].

[...]

Here is the summary with links:
- [net-next,v4,1/4] net: mdio: Introduce a regmap-based mdio driver

    https://git.kernel.org/netdev/net-next/c/642af0f92cbe
  - [net-next,v4,2/4] net: ethernet: altera-tse: Convert to mdio-regmap and use PCS Lynx
    https://git.kernel.org/netdev/net-next/c/db48abbaa18e
  - [net-next,v4,3/4] net: pcs: Drop the TSE PCS driver
    https://git.kernel.org/netdev/net-next/c/196eec4062b0
  - [net-next,v4,4/4] net: stmmac: dwmac-sogfpga: use the lynx pcs driver
    https://git.kernel.org/netdev/net-next/c/5d1f3fe7d2d5

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
author maintainer
#10 lore raw

Dear Maintainers,

Thanks for applying the patch, however as mentionned (maybe not stressed enough in the cover) this series depends on a patch that went through the regmap tree :

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git/commit/?id=e12ff28764937dd58c8613f16065da60da149048

How can we proceed on that matter ?

Thanks,

Maxime

Quoted 33 lines · On Mon, 05 Jun 2023 10:30:24 +0000 [email protected] wrote:

Hello:

This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 7 lines · On Thu, 1 Jun 2023 16:14:50 +0200 you wrote:

Hello everyone,

This is the V4 of a series that follows-up on the work [1] aiming to drop the altera TSE PCS driver, as it turns out to be a version of the Lynx PCS exposed as a memory-mapped block, instead of living on an MDIO bus.

Quoted 7 lines

One step of this removal involved creating a regmap-based mdio driver that translates MDIO accesses into the actual underlying bus that exposes the register. The register layout must of course match the standard MDIO layout, but we can now account for differences in stride with recent work on the regmap subsystem [2].

[...]

Here is the summary with links:
- [net-next,v4,1/4] net: mdio: Introduce a regmap-based mdio driver

    https://git.kernel.org/netdev/net-next/c/642af0f92cbe

- [net-next,v4,2/4] net: ethernet: altera-tse: Convert to
mdio-regmap and use PCS Lynx
https://git.kernel.org/netdev/net-next/c/db48abbaa18e
- [net-next,v4,3/4] net: pcs: Drop the TSE PCS driver

    https://git.kernel.org/netdev/net-next/c/196eec4062b0

- [net-next,v4,4/4] net: stmmac: dwmac-sogfpga: use the lynx pcs
driver https://git.kernel.org/netdev/net-next/c/5d1f3fe7d2d5

You are awesome, thank you!

maintainer
#11 lore raw
Quoted 8 lines · On Mon, 5 Jun 2023 14:20:39 +0200 Maxime Chevallier wrote:

Thanks for applying the patch, however as mentionned (maybe not stressed enough in the cover) this series depends on a patch that went through the regmap tree :

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git/commit/?id=e12ff28764937dd58c8613f16065da60da149048

How can we proceed on that matter ?

I don't see a great solution, Mark already applied the change and so did Dave. Don't think we can put them on stable branches now..

Only altera and stmmac-sogfpga are going to break? Maybe we're close enough to the merge window to put our heads in the sand and wait?

author maintainer
#12 lore raw

Hello Jakub,

Quoted 8 lines · On Mon, 5 Jun 2023 11:46:26 -0700 Jakub Kicinski <[email protected]> wrote:
Quoted 7 lines · On Mon, 5 Jun 2023 14:20:39 +0200 Maxime Chevallier wrote:

Thanks for applying the patch, however as mentionned (maybe not stressed enough in the cover) this series depends on a patch that went through the regmap tree :

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git/commit/?id=e12ff28764937dd58c8613f16065da60da149048

Quoted 8 lines
Quoted 1 line

How can we proceed on that matter ?

I don't see a great solution, Mark already applied the change and so did Dave. Don't think we can put them on stable branches now..

Only altera and stmmac-sogfpga are going to break? Maybe we're close enough to the merge window to put our heads in the sand and wait?

only these two should, indeed. I'll still followup with some fixes for kbuild issues still.

Thanks,

Maxime