netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users
@ 2025-10-30 21:39 Heiner Kallweit
  2025-10-30 21:41 ` [PATCH net-next 1/6] net: phy: fixed_phy: add helper fixed_phy_register_100fd Heiner Kallweit
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Heiner Kallweit @ 2025-10-30 21:39 UTC (permalink / raw)
  To: Greg Ungerer, Geert Uytterhoeven, Hauke Mehrtens,
	Rafał Miłecki, Thomas Bogendoerfer, Michael Chan,
	Wei Fang, Shenwei Wang, Clark Wang, Russell King - ARM Linux,
	Andrew Lunn, Andrew Lunn, Jakub Kicinski, Paolo Abeni,
	David Miller, Eric Dumazet
  Cc: linux-m68k, linux-mips, imx, netdev@vger.kernel.org

fixed_phy_add() has a number of problems/disadvantages:
- It uses phy address 0 w/o checking whether a fixed phy with this
  address exists already.
- A subsequent call to fixed_phy_register() would also use phy address 0,
  because fixed_phy_add() doesn't mark it as used.
- fixed_phy_add() is used from platform code, therefore requires that
  fixed phy code is built-in.

fixed_phy_add() has only two users
- coldfire/5272, using fec
- bcm47xx, using b44

So migrate fec and b44 to use fixed_phy_register_100fd(), afterwards
remove usage of fixed_phy_add() from the two platforms, and eventually
remove fixed_phy_add().

When I proposed helper fixed_phy_register_100fd() first, there was
the question whether it's worth it, and Jakub asked to submit the
full series:
https://lore.kernel.org/netdev/20251021182021.15223c1e@kernel.org/
Apart from this series, there are two more places where the helper
can be used to simplify the code: dsa_loop, ftgmac100
I left this for a follow-up.

Heiner Kallweit (6):
  net: phy: fixed_phy: add helper fixed_phy_register_100fd
  net: fec: register a fixed phy using fixed_phy_register_100fd if
    needed
  m68k: coldfire: remove creating a fixed phy
  net: b44: register a fixed phy using fixed_phy_register_100fd if
    needed
  MIPS: BCM47XX: remove creating a fixed phy
  net: phy: fixed_phy: remove fixed_phy_add

 arch/m68k/coldfire/m5272.c                | 15 -------
 arch/mips/bcm47xx/setup.c                 |  7 ---
 drivers/net/ethernet/broadcom/Kconfig     |  1 +
 drivers/net/ethernet/broadcom/b44.c       | 37 ++++++++--------
 drivers/net/ethernet/freescale/Kconfig    |  1 +
 drivers/net/ethernet/freescale/fec_main.c | 52 +++++++++++------------
 drivers/net/phy/fixed_phy.c               | 18 +++++---
 include/linux/phy_fixed.h                 |  8 +++-
 8 files changed, 66 insertions(+), 73 deletions(-)

-- 
2.51.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH net-next 1/6] net: phy: fixed_phy: add helper fixed_phy_register_100fd
  2025-10-30 21:39 [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users Heiner Kallweit
@ 2025-10-30 21:41 ` Heiner Kallweit
  2025-10-30 21:42 ` [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed Heiner Kallweit
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Heiner Kallweit @ 2025-10-30 21:41 UTC (permalink / raw)
  To: Greg Ungerer, Geert Uytterhoeven, Hauke Mehrtens,
	Rafał Miłecki, Thomas Bogendoerfer, Michael Chan,
	Wei Fang, Shenwei Wang, Clark Wang, Russell King - ARM Linux,
	Andrew Lunn, Andrew Lunn, Jakub Kicinski, Paolo Abeni,
	David Miller, Eric Dumazet
  Cc: linux-m68k, linux-mips, imx, netdev@vger.kernel.org

In few places a 100FD fixed PHY is used. Create a helper so that users
don't have to define the struct fixed_phy_status.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/fixed_phy.c | 12 ++++++++++++
 include/linux/phy_fixed.h   |  6 ++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
index 0e1b28f06..bdc3a4bff 100644
--- a/drivers/net/phy/fixed_phy.c
+++ b/drivers/net/phy/fixed_phy.c
@@ -227,6 +227,18 @@ struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
 }
 EXPORT_SYMBOL_GPL(fixed_phy_register);
 
+struct phy_device *fixed_phy_register_100fd(void)
+{
+	static const struct fixed_phy_status status = {
+		.link	= 1,
+		.speed	= SPEED_100,
+		.duplex	= DUPLEX_FULL,
+	};
+
+	return fixed_phy_register(&status, NULL);
+}
+EXPORT_SYMBOL_GPL(fixed_phy_register_100fd);
+
 void fixed_phy_unregister(struct phy_device *phy)
 {
 	phy_device_remove(phy);
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index d17ff750c..08275ef64 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -20,6 +20,7 @@ extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
 void fixed_phy_add(const struct fixed_phy_status *status);
 struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
 				      struct device_node *np);
+struct phy_device *fixed_phy_register_100fd(void);
 
 extern void fixed_phy_unregister(struct phy_device *phydev);
 extern int fixed_phy_set_link_update(struct phy_device *phydev,
@@ -34,6 +35,11 @@ fixed_phy_register(const struct fixed_phy_status *status,
 	return ERR_PTR(-ENODEV);
 }
 
+static inline struct phy_device *fixed_phy_register_100fd(void)
+{
+	return ERR_PTR(-ENODEV);
+}
+
 static inline void fixed_phy_unregister(struct phy_device *phydev)
 {
 }
-- 
2.51.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed
  2025-10-30 21:39 [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users Heiner Kallweit
  2025-10-30 21:41 ` [PATCH net-next 1/6] net: phy: fixed_phy: add helper fixed_phy_register_100fd Heiner Kallweit
@ 2025-10-30 21:42 ` Heiner Kallweit
  2025-10-31  3:36   ` Wei Fang
  2025-11-03  3:15   ` Greg Ungerer
  2025-10-30 21:43 ` [PATCH net-next 3/6] m68k: coldfire: remove creating a fixed phy Heiner Kallweit
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 13+ messages in thread
From: Heiner Kallweit @ 2025-10-30 21:42 UTC (permalink / raw)
  To: Greg Ungerer, Geert Uytterhoeven, Hauke Mehrtens,
	Rafał Miłecki, Thomas Bogendoerfer, Michael Chan,
	Wei Fang, Shenwei Wang, Clark Wang, Russell King - ARM Linux,
	Andrew Lunn, Andrew Lunn, Jakub Kicinski, Paolo Abeni,
	David Miller, Eric Dumazet
  Cc: linux-m68k, linux-mips, imx, netdev@vger.kernel.org

In case of coldfire/5272 a fixed phy is used, which so far is created
by platform code, using fixed_phy_add(). This function has a number of
problems, therefore create a potentially needed fixed phy here, using
fixed_phy_register_100fd.

Note 1: This includes a small functional change, as coldfire/5272
created a fixed phy in half-duplex mode. Likely this was by mistake,
because the fec MAC is 100FD-capable, and connection is to a switch.

Note 2: Usage of phy_find_next() makes use of the fact that dev_id can
only be 0 or 1.

Due to lack of hardware, this is compile-tested only.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/freescale/Kconfig    |  1 +
 drivers/net/ethernet/freescale/fec_main.c | 52 +++++++++++------------
 2 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
index bbef47c34..e2a591cf9 100644
--- a/drivers/net/ethernet/freescale/Kconfig
+++ b/drivers/net/ethernet/freescale/Kconfig
@@ -28,6 +28,7 @@ config FEC
 	depends on PTP_1588_CLOCK_OPTIONAL
 	select CRC32
 	select PHYLIB
+	select FIXED_PHY if M5272
 	select PAGE_POOL
 	imply PAGE_POOL_STATS
 	imply NET_SELFTESTS
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index c60ed8bac..0b71e4c15 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -52,6 +52,7 @@
 #include <linux/of_net.h>
 #include <linux/phy.h>
 #include <linux/pinctrl/consumer.h>
+#include <linux/phy_fixed.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/prefetch.h>
@@ -2476,11 +2477,8 @@ static int fec_enet_parse_rgmii_delay(struct fec_enet_private *fep,
 static int fec_enet_mii_probe(struct net_device *ndev)
 {
 	struct fec_enet_private *fep = netdev_priv(ndev);
-	struct phy_device *phy_dev = NULL;
-	char mdio_bus_id[MII_BUS_ID_SIZE];
-	char phy_name[MII_BUS_ID_SIZE + 3];
-	int phy_id;
-	int dev_id = fep->dev_id;
+	struct phy_device *phy_dev;
+	int ret;
 
 	if (fep->phy_node) {
 		phy_dev = of_phy_connect(ndev, fep->phy_node,
@@ -2492,30 +2490,28 @@ static int fec_enet_mii_probe(struct net_device *ndev)
 		}
 	} else {
 		/* check for attached phy */
-		for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) {
-			if (!mdiobus_is_registered_device(fep->mii_bus, phy_id))
-				continue;
-			if (dev_id--)
-				continue;
-			strscpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE);
-			break;
-		}
+		phy_dev = phy_find_first(fep->mii_bus);
+		if (fep->dev_id && phy_dev)
+			phy_dev = phy_find_next(fep->mii_bus, phy_dev);
 
-		if (phy_id >= PHY_MAX_ADDR) {
+		if (!phy_dev) {
 			netdev_info(ndev, "no PHY, assuming direct connection to switch\n");
-			strscpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE);
-			phy_id = 0;
+			phy_dev = fixed_phy_register_100fd();
+			if (IS_ERR(phy_dev)) {
+				netdev_err(ndev, "could not register fixed PHY\n");
+				return PTR_ERR(phy_dev);
+			}
 		}
 
-		snprintf(phy_name, sizeof(phy_name),
-			 PHY_ID_FMT, mdio_bus_id, phy_id);
-		phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link,
-				      fep->phy_interface);
-	}
+		ret = phy_connect_direct(ndev, phy_dev, &fec_enet_adjust_link,
+					 fep->phy_interface);
+		if (ret) {
+			if (phy_is_pseudo_fixed_link(phy_dev))
+				fixed_phy_unregister(phy_dev);
+			netdev_err(ndev, "could not attach to PHY\n");
+			return ret;
+		}
 
-	if (IS_ERR(phy_dev)) {
-		netdev_err(ndev, "could not attach to PHY\n");
-		return PTR_ERR(phy_dev);
 	}
 
 	/* mask with MAC supported features */
@@ -3622,8 +3618,9 @@ static int
 fec_enet_close(struct net_device *ndev)
 {
 	struct fec_enet_private *fep = netdev_priv(ndev);
+	struct phy_device *phy_dev = ndev->phydev;
 
-	phy_stop(ndev->phydev);
+	phy_stop(phy_dev);
 
 	if (netif_device_present(ndev)) {
 		napi_disable(&fep->napi);
@@ -3631,7 +3628,10 @@ fec_enet_close(struct net_device *ndev)
 		fec_stop(ndev);
 	}
 
-	phy_disconnect(ndev->phydev);
+	phy_disconnect(phy_dev);
+
+	if (!fep->phy_node && phy_is_pseudo_fixed_link(phy_dev))
+		fixed_phy_unregister(phy_dev);
 
 	if (fep->quirks & FEC_QUIRK_ERR006687)
 		imx6q_cpuidle_fec_irqs_unused();
-- 
2.51.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 3/6] m68k: coldfire: remove creating a fixed phy
  2025-10-30 21:39 [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users Heiner Kallweit
  2025-10-30 21:41 ` [PATCH net-next 1/6] net: phy: fixed_phy: add helper fixed_phy_register_100fd Heiner Kallweit
  2025-10-30 21:42 ` [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed Heiner Kallweit
@ 2025-10-30 21:43 ` Heiner Kallweit
  2025-10-30 21:44 ` [PATCH net-next 4/6] net: b44: register a fixed phy using fixed_phy_register_100fd if needed Heiner Kallweit
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Heiner Kallweit @ 2025-10-30 21:43 UTC (permalink / raw)
  To: Greg Ungerer, Geert Uytterhoeven, Hauke Mehrtens,
	Rafał Miłecki, Thomas Bogendoerfer, Michael Chan,
	Wei Fang, Shenwei Wang, Clark Wang, Russell King - ARM Linux,
	Andrew Lunn, Andrew Lunn, Jakub Kicinski, Paolo Abeni,
	David Miller, Eric Dumazet
  Cc: linux-m68k, linux-mips, imx, netdev@vger.kernel.org

Now that the fec ethernet driver creates a fixed phy if needed,
we can remove this here.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 arch/m68k/coldfire/m5272.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/arch/m68k/coldfire/m5272.c b/arch/m68k/coldfire/m5272.c
index 918e2a323..28b3ffa25 100644
--- a/arch/m68k/coldfire/m5272.c
+++ b/arch/m68k/coldfire/m5272.c
@@ -16,7 +16,6 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/phy.h>
-#include <linux/phy_fixed.h>
 #include <asm/machdep.h>
 #include <asm/coldfire.h>
 #include <asm/mcfsim.h>
@@ -103,23 +102,9 @@ void __init config_BSP(char *commandp, int size)
 
 /***************************************************************************/
 
-/*
- * Some 5272 based boards have the FEC ethernet directly connected to
- * an ethernet switch. In this case we need to use the fixed phy type,
- * and we need to declare it early in boot.
- */
-static const struct fixed_phy_status nettel_fixed_phy_status __initconst = {
-	.link	= 1,
-	.speed	= 100,
-	.duplex	= 0,
-};
-
-/***************************************************************************/
-
 static int __init init_BSP(void)
 {
 	m5272_uarts_init();
-	fixed_phy_add(&nettel_fixed_phy_status);
 	clkdev_add_table(m5272_clk_lookup, ARRAY_SIZE(m5272_clk_lookup));
 	return 0;
 }
-- 
2.51.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 4/6] net: b44: register a fixed phy using fixed_phy_register_100fd if needed
  2025-10-30 21:39 [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users Heiner Kallweit
                   ` (2 preceding siblings ...)
  2025-10-30 21:43 ` [PATCH net-next 3/6] m68k: coldfire: remove creating a fixed phy Heiner Kallweit
@ 2025-10-30 21:44 ` Heiner Kallweit
  2025-10-30 21:45 ` [PATCH net-next 5/6] MIPS: BCM47XX: remove creating a fixed phy Heiner Kallweit
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Heiner Kallweit @ 2025-10-30 21:44 UTC (permalink / raw)
  To: Greg Ungerer, Geert Uytterhoeven, Hauke Mehrtens,
	Rafał Miłecki, Thomas Bogendoerfer, Michael Chan,
	Wei Fang, Shenwei Wang, Clark Wang, Russell King - ARM Linux,
	Andrew Lunn, Andrew Lunn, Jakub Kicinski, Paolo Abeni,
	David Miller, Eric Dumazet
  Cc: linux-m68k, linux-mips, imx, netdev@vger.kernel.org

In case of bcm47xx a fixed phy is used, which so far is created
by platform code, using fixed_phy_add(). This function has a number of
problems, therefore create a potentially needed fixed phy here, using
fixed_phy_register_100fd.

Due to lack of hardware, this is compile-tested only.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/broadcom/Kconfig |  1 +
 drivers/net/ethernet/broadcom/b44.c   | 37 +++++++++++++++------------
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig
index 9fdef874f..666522d64 100644
--- a/drivers/net/ethernet/broadcom/Kconfig
+++ b/drivers/net/ethernet/broadcom/Kconfig
@@ -25,6 +25,7 @@ config B44
 	select SSB
 	select MII
 	select PHYLIB
+	select FIXED_PHY if BCM47XX
 	help
 	  If you have a network (Ethernet) controller of this type, say Y
 	  or M here.
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 0353359c3..888f28f11 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -31,6 +31,7 @@
 #include <linux/ssb/ssb.h>
 #include <linux/slab.h>
 #include <linux/phy.h>
+#include <linux/phy_fixed.h>
 
 #include <linux/uaccess.h>
 #include <asm/io.h>
@@ -2233,7 +2234,6 @@ static int b44_register_phy_one(struct b44 *bp)
 	struct mii_bus *mii_bus;
 	struct ssb_device *sdev = bp->sdev;
 	struct phy_device *phydev;
-	char bus_id[MII_BUS_ID_SIZE + 3];
 	struct ssb_sprom *sprom = &sdev->bus->sprom;
 	int err;
 
@@ -2260,27 +2260,26 @@ static int b44_register_phy_one(struct b44 *bp)
 		goto err_out_mdiobus;
 	}
 
-	if (!mdiobus_is_registered_device(bp->mii_bus, bp->phy_addr) &&
-	    (sprom->boardflags_lo & (B44_BOARDFLAG_ROBO | B44_BOARDFLAG_ADM))) {
-
+	phydev = mdiobus_get_phy(bp->mii_bus, bp->phy_addr);
+	if (!phydev &&
+	    sprom->boardflags_lo & (B44_BOARDFLAG_ROBO | B44_BOARDFLAG_ADM)) {
 		dev_info(sdev->dev,
 			 "could not find PHY at %i, use fixed one\n",
 			 bp->phy_addr);
 
-		bp->phy_addr = 0;
-		snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, "fixed-0",
-			 bp->phy_addr);
-	} else {
-		snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, mii_bus->id,
-			 bp->phy_addr);
+		phydev = fixed_phy_register_100fd();
+		if (!IS_ERR(phydev))
+			bp->phy_addr = phydev->mdio.addr;
 	}
 
-	phydev = phy_connect(bp->dev, bus_id, &b44_adjust_link,
-			     PHY_INTERFACE_MODE_MII);
-	if (IS_ERR(phydev)) {
+	if (IS_ERR_OR_NULL(phydev))
+		err = -ENODEV;
+	else
+		err = phy_connect_direct(bp->dev, phydev, &b44_adjust_link,
+					 PHY_INTERFACE_MODE_MII);
+	if (err) {
 		dev_err(sdev->dev, "could not attach PHY at %i\n",
 			bp->phy_addr);
-		err = PTR_ERR(phydev);
 		goto err_out_mdiobus_unregister;
 	}
 
@@ -2293,7 +2292,6 @@ static int b44_register_phy_one(struct b44 *bp)
 	linkmode_copy(phydev->advertising, phydev->supported);
 
 	bp->old_link = 0;
-	bp->phy_addr = phydev->mdio.addr;
 
 	phy_attached_info(phydev);
 
@@ -2311,10 +2309,15 @@ static int b44_register_phy_one(struct b44 *bp)
 
 static void b44_unregister_phy_one(struct b44 *bp)
 {
-	struct net_device *dev = bp->dev;
 	struct mii_bus *mii_bus = bp->mii_bus;
+	struct net_device *dev = bp->dev;
+	struct phy_device *phydev;
+
+	phydev = dev->phydev;
 
-	phy_disconnect(dev->phydev);
+	phy_disconnect(phydev);
+	if (phy_is_pseudo_fixed_link(phydev))
+		fixed_phy_unregister(phydev);
 	mdiobus_unregister(mii_bus);
 	mdiobus_free(mii_bus);
 }
-- 
2.51.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 5/6] MIPS: BCM47XX: remove creating a fixed phy
  2025-10-30 21:39 [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users Heiner Kallweit
                   ` (3 preceding siblings ...)
  2025-10-30 21:44 ` [PATCH net-next 4/6] net: b44: register a fixed phy using fixed_phy_register_100fd if needed Heiner Kallweit
@ 2025-10-30 21:45 ` Heiner Kallweit
  2025-10-30 21:46 ` [PATCH net-next 6/6] net: phy: fixed_phy: remove fixed_phy_add Heiner Kallweit
  2025-11-05  2:50 ` [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users patchwork-bot+netdevbpf
  6 siblings, 0 replies; 13+ messages in thread
From: Heiner Kallweit @ 2025-10-30 21:45 UTC (permalink / raw)
  To: Greg Ungerer, Geert Uytterhoeven, Hauke Mehrtens,
	Rafał Miłecki, Thomas Bogendoerfer, Michael Chan,
	Wei Fang, Shenwei Wang, Clark Wang, Russell King - ARM Linux,
	Andrew Lunn, Andrew Lunn, Jakub Kicinski, Paolo Abeni,
	David Miller, Eric Dumazet
  Cc: linux-m68k, linux-mips, imx, netdev@vger.kernel.org

Now that b44 ethernet driver creates a fixed phy if needed, we can
remove this here.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 arch/mips/bcm47xx/setup.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index a93a4266d..38ed61b4b 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -256,12 +256,6 @@ static int __init bcm47xx_cpu_fixes(void)
 }
 arch_initcall(bcm47xx_cpu_fixes);
 
-static const struct fixed_phy_status bcm47xx_fixed_phy_status __initconst = {
-	.link	= 1,
-	.speed	= SPEED_100,
-	.duplex	= DUPLEX_FULL,
-};
-
 static int __init bcm47xx_register_bus_complete(void)
 {
 	switch (bcm47xx_bus_type) {
@@ -282,7 +276,6 @@ static int __init bcm47xx_register_bus_complete(void)
 	bcm47xx_leds_register();
 	bcm47xx_workarounds();
 
-	fixed_phy_add(&bcm47xx_fixed_phy_status);
 	return 0;
 }
 device_initcall(bcm47xx_register_bus_complete);
-- 
2.51.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 6/6] net: phy: fixed_phy: remove fixed_phy_add
  2025-10-30 21:39 [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users Heiner Kallweit
                   ` (4 preceding siblings ...)
  2025-10-30 21:45 ` [PATCH net-next 5/6] MIPS: BCM47XX: remove creating a fixed phy Heiner Kallweit
@ 2025-10-30 21:46 ` Heiner Kallweit
  2025-11-05  2:50 ` [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users patchwork-bot+netdevbpf
  6 siblings, 0 replies; 13+ messages in thread
From: Heiner Kallweit @ 2025-10-30 21:46 UTC (permalink / raw)
  To: Greg Ungerer, Geert Uytterhoeven, Hauke Mehrtens,
	Rafał Miłecki, Thomas Bogendoerfer, Michael Chan,
	Wei Fang, Shenwei Wang, Clark Wang, Russell King - ARM Linux,
	Andrew Lunn, Andrew Lunn, Jakub Kicinski, Paolo Abeni,
	David Miller, Eric Dumazet
  Cc: linux-m68k, linux-mips, imx, netdev@vger.kernel.org

fixed_phy_add() has a number of problems/disadvantages:
- It uses phy address 0 w/o checking whether a fixed phy with this
  address exists already.
- A subsequent call to fixed_phy_register() would also use phy address 0,
  because fixed_phy_add() doesn't mark it as used.
- fixed_phy_add() is used from platform code, therefore requires that
  fixed_phy code is built-in.

Now that for the only two users (coldfire/5272 and bcm47xx) fixed_phy
creation has been moved to the respective ethernet driver (fec, b44),
we can remove fixed_phy_add().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/fixed_phy.c | 6 ------
 include/linux/phy_fixed.h   | 2 --
 2 files changed, 8 deletions(-)

diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
index bdc3a4bff..d498d8a9b 100644
--- a/drivers/net/phy/fixed_phy.c
+++ b/drivers/net/phy/fixed_phy.c
@@ -131,12 +131,6 @@ static int __fixed_phy_add(int phy_addr,
 	return 0;
 }
 
-void fixed_phy_add(const struct fixed_phy_status *status)
-{
-	__fixed_phy_add(0, status);
-}
-EXPORT_SYMBOL_GPL(fixed_phy_add);
-
 static DEFINE_IDA(phy_fixed_ida);
 
 static void fixed_phy_del(int phy_addr)
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index 08275ef64..8bade9998 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -17,7 +17,6 @@ struct net_device;
 
 #if IS_ENABLED(CONFIG_FIXED_PHY)
 extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
-void fixed_phy_add(const struct fixed_phy_status *status);
 struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
 				      struct device_node *np);
 struct phy_device *fixed_phy_register_100fd(void);
@@ -27,7 +26,6 @@ extern int fixed_phy_set_link_update(struct phy_device *phydev,
 			int (*link_update)(struct net_device *,
 					   struct fixed_phy_status *));
 #else
-static inline void fixed_phy_add(const struct fixed_phy_status *status) {}
 static inline struct phy_device *
 fixed_phy_register(const struct fixed_phy_status *status,
 		   struct device_node *np)
-- 
2.51.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* RE: [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed
  2025-10-30 21:42 ` [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed Heiner Kallweit
@ 2025-10-31  3:36   ` Wei Fang
  2025-10-31  8:01     ` Heiner Kallweit
  2025-11-03  3:15   ` Greg Ungerer
  1 sibling, 1 reply; 13+ messages in thread
From: Wei Fang @ 2025-10-31  3:36 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org,
	imx@lists.linux.dev, netdev@vger.kernel.org, Greg Ungerer,
	Geert Uytterhoeven, Hauke Mehrtens, Rafał Miłecki,
	Thomas Bogendoerfer, Michael Chan, Shenwei Wang, Clark Wang,
	Russell King - ARM Linux, Andrew Lunn, Andrew Lunn,
	Jakub Kicinski, Paolo Abeni, David Miller, Eric Dumazet

> Note 2: Usage of phy_find_next() makes use of the fact that dev_id can
> only be 0 or 1.
> 
I'm not familiar with the ColdFire platforms. Do these platforms only have
a maximum of two FEC ports?

The logic below doesn't show a maximum of two FEC ports.

for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) {
	if (!mdiobus_is_registered_device(fep->mii_bus, phy_id))
		continue;
	if (dev_id--)
		continue;
	strscpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE);
	break;
}

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed
  2025-10-31  3:36   ` Wei Fang
@ 2025-10-31  8:01     ` Heiner Kallweit
  2025-11-03  3:11       ` Greg Ungerer
  0 siblings, 1 reply; 13+ messages in thread
From: Heiner Kallweit @ 2025-10-31  8:01 UTC (permalink / raw)
  To: Wei Fang
  Cc: linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org,
	imx@lists.linux.dev, netdev@vger.kernel.org, Greg Ungerer,
	Geert Uytterhoeven, Hauke Mehrtens, Rafał Miłecki,
	Thomas Bogendoerfer, Michael Chan, Shenwei Wang, Clark Wang,
	Russell King - ARM Linux, Andrew Lunn, Andrew Lunn,
	Jakub Kicinski, Paolo Abeni, David Miller, Eric Dumazet

On 10/31/2025 4:36 AM, Wei Fang wrote:
>> Note 2: Usage of phy_find_next() makes use of the fact that dev_id can
>> only be 0 or 1.
>>
> I'm not familiar with the ColdFire platforms. Do these platforms only have
> a maximum of two FEC ports?
> 
> The logic below doesn't show a maximum of two FEC ports.
> 
Right, the quoted logic would support more ports. But AFAIK there's no
hardware with more than two ports. Max is dual fec designs, see comments
in the code wrt i.MX28, and also following commit description:
3d125f9c91c5 ("net: fec: fix MDIO bus assignement for dual fec SoC's")

> for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) {
> 	if (!mdiobus_is_registered_device(fep->mii_bus, phy_id))
> 		continue;
> 	if (dev_id--)
> 		continue;
> 	strscpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE);
> 	break;
> }


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed
  2025-10-31  8:01     ` Heiner Kallweit
@ 2025-11-03  3:11       ` Greg Ungerer
  0 siblings, 0 replies; 13+ messages in thread
From: Greg Ungerer @ 2025-11-03  3:11 UTC (permalink / raw)
  To: Heiner Kallweit, Wei Fang
  Cc: linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org,
	imx@lists.linux.dev, netdev@vger.kernel.org, Geert Uytterhoeven,
	Hauke Mehrtens, Rafał Miłecki, Thomas Bogendoerfer,
	Michael Chan, Shenwei Wang, Clark Wang, Russell King - ARM Linux,
	Andrew Lunn, Andrew Lunn, Jakub Kicinski, Paolo Abeni,
	David Miller, Eric Dumazet


On 31/10/25 18:01, Heiner Kallweit wrote:
> On 10/31/2025 4:36 AM, Wei Fang wrote:
>>> Note 2: Usage of phy_find_next() makes use of the fact that dev_id can
>>> only be 0 or 1.
>>>
>> I'm not familiar with the ColdFire platforms. Do these platforms only have
>> a maximum of two FEC ports?
>>
>> The logic below doesn't show a maximum of two FEC ports.
>>
> Right, the quoted logic would support more ports. But AFAIK there's no
> hardware with more than two ports. Max is dual fec designs, see comments
> in the code wrt i.MX28, and also following commit description:
> 3d125f9c91c5 ("net: fec: fix MDIO bus assignement for dual fec SoC's")
> 
>> for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) {
>> 	if (!mdiobus_is_registered_device(fep->mii_bus, phy_id))
>> 		continue;
>> 	if (dev_id--)
>> 		continue;
>> 	strscpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE);
>> 	break;
>> }

There are a few ColdFire parts that have 2 FEC ports (M5274/5275 and M54418 at the very least).
I don't know of any that have more than 2.

Regards
Greg





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed
  2025-10-30 21:42 ` [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed Heiner Kallweit
  2025-10-31  3:36   ` Wei Fang
@ 2025-11-03  3:15   ` Greg Ungerer
  2025-11-03  7:36     ` Heiner Kallweit
  1 sibling, 1 reply; 13+ messages in thread
From: Greg Ungerer @ 2025-11-03  3:15 UTC (permalink / raw)
  To: Heiner Kallweit, Geert Uytterhoeven, Hauke Mehrtens,
	Rafał Miłecki, Thomas Bogendoerfer, Michael Chan,
	Wei Fang, Shenwei Wang, Clark Wang, Russell King - ARM Linux,
	Andrew Lunn, Andrew Lunn, Jakub Kicinski, Paolo Abeni,
	David Miller, Eric Dumazet
  Cc: linux-m68k, linux-mips, imx, netdev@vger.kernel.org

Hi Heiner,

On 31/10/25 07:42, Heiner Kallweit wrote:
> In case of coldfire/5272 a fixed phy is used, which so far is created
> by platform code, using fixed_phy_add(). This function has a number of
> problems, therefore create a potentially needed fixed phy here, using
> fixed_phy_register_100fd.
> 
> Note 1: This includes a small functional change, as coldfire/5272
> created a fixed phy in half-duplex mode. Likely this was by mistake,
> because the fec MAC is 100FD-capable, and connection is to a switch.
> 
> Note 2: Usage of phy_find_next() makes use of the fact that dev_id can
> only be 0 or 1.
> 
> Due to lack of hardware, this is compile-tested only.

I did not get net-next and try this all out, but it doesn't compile when
applied to 6.18-rc4.


> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>   drivers/net/ethernet/freescale/Kconfig    |  1 +
>   drivers/net/ethernet/freescale/fec_main.c | 52 +++++++++++------------
>   2 files changed, 27 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
> index bbef47c34..e2a591cf9 100644
> --- a/drivers/net/ethernet/freescale/Kconfig
> +++ b/drivers/net/ethernet/freescale/Kconfig
> @@ -28,6 +28,7 @@ config FEC
>   	depends on PTP_1588_CLOCK_OPTIONAL
>   	select CRC32
>   	select PHYLIB
> +	select FIXED_PHY if M5272

Does it make sense to limit this to 5272 only here?
I get that this most closely keeps functionality same as before.

Regards
Greg



>   	select PAGE_POOL
>   	imply PAGE_POOL_STATS
>   	imply NET_SELFTESTS
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index c60ed8bac..0b71e4c15 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -52,6 +52,7 @@
>   #include <linux/of_net.h>
>   #include <linux/phy.h>
>   #include <linux/pinctrl/consumer.h>
> +#include <linux/phy_fixed.h>
>   #include <linux/platform_device.h>
>   #include <linux/pm_runtime.h>
>   #include <linux/prefetch.h>
> @@ -2476,11 +2477,8 @@ static int fec_enet_parse_rgmii_delay(struct fec_enet_private *fep,
>   static int fec_enet_mii_probe(struct net_device *ndev)
>   {
>   	struct fec_enet_private *fep = netdev_priv(ndev);
> -	struct phy_device *phy_dev = NULL;
> -	char mdio_bus_id[MII_BUS_ID_SIZE];
> -	char phy_name[MII_BUS_ID_SIZE + 3];
> -	int phy_id;
> -	int dev_id = fep->dev_id;
> +	struct phy_device *phy_dev;
> +	int ret;
>   
>   	if (fep->phy_node) {
>   		phy_dev = of_phy_connect(ndev, fep->phy_node,
> @@ -2492,30 +2490,28 @@ static int fec_enet_mii_probe(struct net_device *ndev)
>   		}
>   	} else {
>   		/* check for attached phy */
> -		for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) {
> -			if (!mdiobus_is_registered_device(fep->mii_bus, phy_id))
> -				continue;
> -			if (dev_id--)
> -				continue;
> -			strscpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE);
> -			break;
> -		}
> +		phy_dev = phy_find_first(fep->mii_bus);
> +		if (fep->dev_id && phy_dev)
> +			phy_dev = phy_find_next(fep->mii_bus, phy_dev);
>   
> -		if (phy_id >= PHY_MAX_ADDR) {
> +		if (!phy_dev) {
>   			netdev_info(ndev, "no PHY, assuming direct connection to switch\n");
> -			strscpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE);
> -			phy_id = 0;
> +			phy_dev = fixed_phy_register_100fd();
> +			if (IS_ERR(phy_dev)) {
> +				netdev_err(ndev, "could not register fixed PHY\n");
> +				return PTR_ERR(phy_dev);
> +			}
>   		}
>   
> -		snprintf(phy_name, sizeof(phy_name),
> -			 PHY_ID_FMT, mdio_bus_id, phy_id);
> -		phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link,
> -				      fep->phy_interface);
> -	}
> +		ret = phy_connect_direct(ndev, phy_dev, &fec_enet_adjust_link,
> +					 fep->phy_interface);
> +		if (ret) {
> +			if (phy_is_pseudo_fixed_link(phy_dev))
> +				fixed_phy_unregister(phy_dev);
> +			netdev_err(ndev, "could not attach to PHY\n");
> +			return ret;
> +		}
>   
> -	if (IS_ERR(phy_dev)) {
> -		netdev_err(ndev, "could not attach to PHY\n");
> -		return PTR_ERR(phy_dev);
>   	}
>   
>   	/* mask with MAC supported features */
> @@ -3622,8 +3618,9 @@ static int
>   fec_enet_close(struct net_device *ndev)
>   {
>   	struct fec_enet_private *fep = netdev_priv(ndev);
> +	struct phy_device *phy_dev = ndev->phydev;
>   
> -	phy_stop(ndev->phydev);
> +	phy_stop(phy_dev);
>   
>   	if (netif_device_present(ndev)) {
>   		napi_disable(&fep->napi);
> @@ -3631,7 +3628,10 @@ fec_enet_close(struct net_device *ndev)
>   		fec_stop(ndev);
>   	}
>   
> -	phy_disconnect(ndev->phydev);
> +	phy_disconnect(phy_dev);
> +
> +	if (!fep->phy_node && phy_is_pseudo_fixed_link(phy_dev))
> +		fixed_phy_unregister(phy_dev);
>   
>   	if (fep->quirks & FEC_QUIRK_ERR006687)
>   		imx6q_cpuidle_fec_irqs_unused();


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed
  2025-11-03  3:15   ` Greg Ungerer
@ 2025-11-03  7:36     ` Heiner Kallweit
  0 siblings, 0 replies; 13+ messages in thread
From: Heiner Kallweit @ 2025-11-03  7:36 UTC (permalink / raw)
  To: Greg Ungerer, Geert Uytterhoeven, Hauke Mehrtens,
	Rafał Miłecki, Thomas Bogendoerfer, Michael Chan,
	Wei Fang, Shenwei Wang, Clark Wang, Russell King - ARM Linux,
	Andrew Lunn, Andrew Lunn, Jakub Kicinski, Paolo Abeni,
	David Miller, Eric Dumazet
  Cc: linux-m68k, linux-mips, imx, netdev@vger.kernel.org

On 11/3/2025 4:15 AM, Greg Ungerer wrote:
> Hi Heiner,
> 
> On 31/10/25 07:42, Heiner Kallweit wrote:
>> In case of coldfire/5272 a fixed phy is used, which so far is created
>> by platform code, using fixed_phy_add(). This function has a number of
>> problems, therefore create a potentially needed fixed phy here, using
>> fixed_phy_register_100fd.
>>
>> Note 1: This includes a small functional change, as coldfire/5272
>> created a fixed phy in half-duplex mode. Likely this was by mistake,
>> because the fec MAC is 100FD-capable, and connection is to a switch.
>>
>> Note 2: Usage of phy_find_next() makes use of the fact that dev_id can
>> only be 0 or 1.
>>
>> Due to lack of hardware, this is compile-tested only.
> 
> I did not get net-next and try this all out, but it doesn't compile when
> applied to 6.18-rc4.
> 
> 
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>   drivers/net/ethernet/freescale/Kconfig    |  1 +
>>   drivers/net/ethernet/freescale/fec_main.c | 52 +++++++++++------------
>>   2 files changed, 27 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
>> index bbef47c34..e2a591cf9 100644
>> --- a/drivers/net/ethernet/freescale/Kconfig
>> +++ b/drivers/net/ethernet/freescale/Kconfig
>> @@ -28,6 +28,7 @@ config FEC
>>       depends on PTP_1588_CLOCK_OPTIONAL
>>       select CRC32
>>       select PHYLIB
>> +    select FIXED_PHY if M5272
> 
> Does it make sense to limit this to 5272 only here?
> I get that this most closely keeps functionality same as before.
> 
On DT-based systems FIXED_PHY is selected by OF_MDIO.
For non-DT systems I limited this to M5272, because it provides the
same functionality as before, and reduces object code size a little
on other platforms due to using fixed_phy function stubs.

> Regards
> Greg
> 
> 
> 
>>       select PAGE_POOL
>>       imply PAGE_POOL_STATS
>>       imply NET_SELFTESTS
>> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
>> index c60ed8bac..0b71e4c15 100644
>> --- a/drivers/net/ethernet/freescale/fec_main.c
>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>> @@ -52,6 +52,7 @@
>>   #include <linux/of_net.h>
>>   #include <linux/phy.h>
>>   #include <linux/pinctrl/consumer.h>
>> +#include <linux/phy_fixed.h>
>>   #include <linux/platform_device.h>
>>   #include <linux/pm_runtime.h>
>>   #include <linux/prefetch.h>
>> @@ -2476,11 +2477,8 @@ static int fec_enet_parse_rgmii_delay(struct fec_enet_private *fep,
>>   static int fec_enet_mii_probe(struct net_device *ndev)
>>   {
>>       struct fec_enet_private *fep = netdev_priv(ndev);
>> -    struct phy_device *phy_dev = NULL;
>> -    char mdio_bus_id[MII_BUS_ID_SIZE];
>> -    char phy_name[MII_BUS_ID_SIZE + 3];
>> -    int phy_id;
>> -    int dev_id = fep->dev_id;
>> +    struct phy_device *phy_dev;
>> +    int ret;
>>         if (fep->phy_node) {
>>           phy_dev = of_phy_connect(ndev, fep->phy_node,
>> @@ -2492,30 +2490,28 @@ static int fec_enet_mii_probe(struct net_device *ndev)
>>           }
>>       } else {
>>           /* check for attached phy */
>> -        for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) {
>> -            if (!mdiobus_is_registered_device(fep->mii_bus, phy_id))
>> -                continue;
>> -            if (dev_id--)
>> -                continue;
>> -            strscpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE);
>> -            break;
>> -        }
>> +        phy_dev = phy_find_first(fep->mii_bus);
>> +        if (fep->dev_id && phy_dev)
>> +            phy_dev = phy_find_next(fep->mii_bus, phy_dev);
>>   -        if (phy_id >= PHY_MAX_ADDR) {
>> +        if (!phy_dev) {
>>               netdev_info(ndev, "no PHY, assuming direct connection to switch\n");
>> -            strscpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE);
>> -            phy_id = 0;
>> +            phy_dev = fixed_phy_register_100fd();
>> +            if (IS_ERR(phy_dev)) {
>> +                netdev_err(ndev, "could not register fixed PHY\n");
>> +                return PTR_ERR(phy_dev);
>> +            }
>>           }
>>   -        snprintf(phy_name, sizeof(phy_name),
>> -             PHY_ID_FMT, mdio_bus_id, phy_id);
>> -        phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link,
>> -                      fep->phy_interface);
>> -    }
>> +        ret = phy_connect_direct(ndev, phy_dev, &fec_enet_adjust_link,
>> +                     fep->phy_interface);
>> +        if (ret) {
>> +            if (phy_is_pseudo_fixed_link(phy_dev))
>> +                fixed_phy_unregister(phy_dev);
>> +            netdev_err(ndev, "could not attach to PHY\n");
>> +            return ret;
>> +        }
>>   -    if (IS_ERR(phy_dev)) {
>> -        netdev_err(ndev, "could not attach to PHY\n");
>> -        return PTR_ERR(phy_dev);
>>       }
>>         /* mask with MAC supported features */
>> @@ -3622,8 +3618,9 @@ static int
>>   fec_enet_close(struct net_device *ndev)
>>   {
>>       struct fec_enet_private *fep = netdev_priv(ndev);
>> +    struct phy_device *phy_dev = ndev->phydev;
>>   -    phy_stop(ndev->phydev);
>> +    phy_stop(phy_dev);
>>         if (netif_device_present(ndev)) {
>>           napi_disable(&fep->napi);
>> @@ -3631,7 +3628,10 @@ fec_enet_close(struct net_device *ndev)
>>           fec_stop(ndev);
>>       }
>>   -    phy_disconnect(ndev->phydev);
>> +    phy_disconnect(phy_dev);
>> +
>> +    if (!fep->phy_node && phy_is_pseudo_fixed_link(phy_dev))
>> +        fixed_phy_unregister(phy_dev);
>>         if (fep->quirks & FEC_QUIRK_ERR006687)
>>           imx6q_cpuidle_fec_irqs_unused();
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users
  2025-10-30 21:39 [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users Heiner Kallweit
                   ` (5 preceding siblings ...)
  2025-10-30 21:46 ` [PATCH net-next 6/6] net: phy: fixed_phy: remove fixed_phy_add Heiner Kallweit
@ 2025-11-05  2:50 ` patchwork-bot+netdevbpf
  6 siblings, 0 replies; 13+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-05  2:50 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: gerg, geert, hauke, zajec5, tsbogend, michael.chan, wei.fang,
	shenwei.wang, xiaoning.wang, linux, andrew, andrew+netdev, kuba,
	pabeni, davem, edumazet, linux-m68k, linux-mips, imx, netdev

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 30 Oct 2025 22:39:34 +0100 you wrote:
> fixed_phy_add() has a number of problems/disadvantages:
> - It uses phy address 0 w/o checking whether a fixed phy with this
>   address exists already.
> - A subsequent call to fixed_phy_register() would also use phy address 0,
>   because fixed_phy_add() doesn't mark it as used.
> - fixed_phy_add() is used from platform code, therefore requires that
>   fixed phy code is built-in.
> 
> [...]

Here is the summary with links:
  - [net-next,1/6] net: phy: fixed_phy: add helper fixed_phy_register_100fd
    https://git.kernel.org/netdev/net-next/c/c9445e3c0876
  - [net-next,2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed
    https://git.kernel.org/netdev/net-next/c/dc86b621e1b4
  - [net-next,3/6] m68k: coldfire: remove creating a fixed phy
    https://git.kernel.org/netdev/net-next/c/0ee21f39c5d8
  - [net-next,4/6] net: b44: register a fixed phy using fixed_phy_register_100fd if needed
    https://git.kernel.org/netdev/net-next/c/10d2f15afba2
  - [net-next,5/6] MIPS: BCM47XX: remove creating a fixed phy
    https://git.kernel.org/netdev/net-next/c/458639c42b7e
  - [net-next,6/6] net: phy: fixed_phy: remove fixed_phy_add
    https://git.kernel.org/netdev/net-next/c/5de9ea1c50f0

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-11-05  2:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 21:39 [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users Heiner Kallweit
2025-10-30 21:41 ` [PATCH net-next 1/6] net: phy: fixed_phy: add helper fixed_phy_register_100fd Heiner Kallweit
2025-10-30 21:42 ` [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed Heiner Kallweit
2025-10-31  3:36   ` Wei Fang
2025-10-31  8:01     ` Heiner Kallweit
2025-11-03  3:11       ` Greg Ungerer
2025-11-03  3:15   ` Greg Ungerer
2025-11-03  7:36     ` Heiner Kallweit
2025-10-30 21:43 ` [PATCH net-next 3/6] m68k: coldfire: remove creating a fixed phy Heiner Kallweit
2025-10-30 21:44 ` [PATCH net-next 4/6] net: b44: register a fixed phy using fixed_phy_register_100fd if needed Heiner Kallweit
2025-10-30 21:45 ` [PATCH net-next 5/6] MIPS: BCM47XX: remove creating a fixed phy Heiner Kallweit
2025-10-30 21:46 ` [PATCH net-next 6/6] net: phy: fixed_phy: remove fixed_phy_add Heiner Kallweit
2025-11-05  2:50 ` [PATCH net-next 0/6] net: phy: remove fixed_phy_add and first its users patchwork-bot+netdevbpf

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).