net: phy: remove fixed_phy_add and first its users
Subsystems (10)
Heiner Kallweit
maintainercover net: phy: remove fixed_phy_add and first its users
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/[email protected]/
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(-)
Signature · 1 line
2.51.1
Heiner Kallweit
maintainerPATCH 1/6 net: phy: fixed_phy: add helper fixed_phy_register_100fd
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.
--- drivers/net/phy/fixed_phy.c | 12 ++++++++++++ include/linux/phy_fixed.h | 6 ++++++ 2 files changed, 18 insertions(+)
drivers/net/phy/fixed_phy.c +12 -0
@@ -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);
include/linux/phy_fixed.h +6 -0
@@ -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) { }
Signature · 1 line
2.51.1
Heiner Kallweit
maintainerPATCH 2/6 net: fec: register a fixed phy using fixed_phy_register_100fd if needed
In reply to Heiner KallweitIn 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.
--- drivers/net/ethernet/freescale/Kconfig | 1 + drivers/net/ethernet/freescale/fec_main.c | 52 +++++++++++------------ 2 files changed, 27 insertions(+), 26 deletions(-)
drivers/net/ethernet/freescale/Kconfig +1 -0
@@ -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
drivers/net/ethernet/freescale/fec_main.c +26 -26
88 lines not on this page · raw message
Signature · 1 line
2.51.1
Wei Fang
maintainerRE: [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed
Quoted 3 lines
Note 2: Usage of
phy_find_next()makes use of the fact thatdev_idcan 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;
}Heiner Kallweit
maintainerRe: [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed
Quoted 8 lines · Wei Fang
Quoted 3 lines
Note 2: Usage of
phy_find_next()makes use of the fact thatdev_idcan 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")
Quoted 8 lines
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;
}Greg Ungerer
maintainerRe: [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed
Quoted 7 lines · Heiner Kallweit
Quoted 6 lines · Wei Fang
Quoted 3 lines
Note 2: Usage of
phy_find_next()makes use of the fact thatdev_idcan only be 0 or 1.I'm not familiar with the ColdFire platforms. Do these platforms only have a maximum of two FEC ports?
Quoted 15 lines
Quoted 2 lines
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")Quoted 8 lines
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
Greg Ungerer
maintainerRe: [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed
In reply to Heiner KallweitHi Heiner,
Quoted 5 lines · Heiner Kallweit
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, usingfixed_phy_register_100fd.
Quoted 8 lines
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 thatdev_idcan 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.
Quoted 11 lines
Signed-off-by Heiner Kallweit <[email protected]>--- drivers/net/ethernet/freescale/Kconfig | 1 + drivers/net/ethernet/freescale/fec_main.c | 52 +++++++++++------------ 2 files changed, 27 insertions(+), 26 deletions(-)drivers/net/ethernet/freescale/Kconfig +0
-0
drivers/net/ethernet/freescale/Kconfig config FEC · line 31
Quoted 4 lines
drivers/net/ethernet/freescale/Kconfig +1
-0@@ -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
Quoted 100 lines
drivers/net/ethernet/freescale/Kconfig +0
-0select PAGE_POOL imply PAGE_POOL_STATS imply NET_SELFTESTSdrivers/net/ethernet/freescale/fec_main.c +26
-26@@ -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 ();
Heiner Kallweit
maintainerRe: [PATCH net-next 2/6] net: fec: register a fixed phy using fixed_phy_register_100fd if needed
Quoted 27 lines · Greg Ungerer
Hi Heiner,
Quoted 5 lines · Heiner Kallweit
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, usingfixed_phy_register_100fd.Quoted 8 lines
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 thatdev_idcan 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.
Quoted 6 lines
Signed-off-by Heiner Kallweit <[email protected]>---
drivers/net/ethernet/freescale/Kconfig | 1 +drivers/net/ethernet/freescale/fec_main.c| 52 +++++++++++------------2 files changed, 27 insertions(+), 26 deletions(-)
Quoted 13 lines
Quoted 9 lines
drivers/net/ethernet/freescale/Kconfig +0
-0@@ -28,6 +28,7 @@ config FECdepends on
PTP_1588_CLOCK_OPTIONAL
select CRC32
select PHYLIB
+ selectFIXED_PHYif M5272Does 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.
Quoted 97 lines
Regards
GregQuoted 91 lines
select
PAGE_POOL
implyPAGE_POOL_STATS
implyNET_SELFTESTSdrivers/net/ethernet/freescale/fec_main.c +26
-21@@ -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();
Heiner Kallweit
maintainerPATCH 3/6 m68k: coldfire: remove creating a fixed phy
In reply to Heiner KallweitNow that the fec ethernet driver creates a fixed phy if needed, we can remove this here.
--- arch/m68k/coldfire/m5272.c | 15 --------------- 1 file changed, 15 deletions(-)
arch/m68k/coldfire/m5272.c +0 -15
@@ -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 ; }
Signature · 1 line
2.51.1
Heiner Kallweit
maintainerPATCH 4/6 net: b44: register a fixed phy using fixed_phy_register_100fd if needed
In reply to Heiner KallweitIn 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.
--- drivers/net/ethernet/broadcom/Kconfig | 1 + drivers/net/ethernet/broadcom/b44.c | 37 +++++++++++++++------------ 2 files changed, 21 insertions(+), 17 deletions(-)
drivers/net/ethernet/broadcom/Kconfig +1 -0
@@ -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.
drivers/net/ethernet/broadcom/b44.c +20 -17
@@ -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); }
Signature · 1 line
2.51.1
Heiner Kallweit
maintainerPATCH 5/6 MIPS: BCM47XX: remove creating a fixed phy
In reply to Heiner KallweitNow that b44 ethernet driver creates a fixed phy if needed, we can remove this here.
--- arch/mips/bcm47xx/setup.c | 7 ------- 1 file changed, 7 deletions(-)
arch/mips/bcm47xx/setup.c +0 -7
@@ -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);
Signature · 1 line
2.51.1
Heiner Kallweit
maintainerPATCH 6/6 net: phy: fixed_phy: remove fixed_phy_add
In reply to Heiner Kallweitfixed_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().
--- drivers/net/phy/fixed_phy.c | 6 ------ include/linux/phy_fixed.h | 2 -- 2 files changed, 8 deletions(-)
drivers/net/phy/fixed_phy.c +0 -6
@@ -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)
include/linux/phy_fixed.h +0 -2
@@ -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)
Signature · 1 line
2.51.1
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · 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 tofixed_phy_register()would also use phy address 0, becausefixed_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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html