* [PATCH v2 net-next] net: phy: fixed_phy: remove link gpio support
@ 2025-09-02 18:37 Heiner Kallweit
2025-09-04 0:32 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2025-09-02 18:37 UTC (permalink / raw)
To: Russell King - ARM Linux, Andrew Lunn, Andrew Lunn, Paolo Abeni,
Eric Dumazet, Jakub Kicinski, David Miller
Cc: netdev@vger.kernel.org, Florian Fainelli
The only user of fixed_phy gpio functionality was here:
arch/arm/boot/dts/nxp/vf/vf610-zii-dev-rev-b.dts
Support for the switch on this board was migrated to phylink
(DSA - mv88e6xxx) years ago, so the functionality is unused now.
Therefore remove it.
Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- fix typo in commit message
---
drivers/net/phy/fixed_phy.c | 68 +++----------------------------------
1 file changed, 4 insertions(+), 64 deletions(-)
diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
index 7f4e1a155..aae7bd4ce 100644
--- a/drivers/net/phy/fixed_phy.c
+++ b/drivers/net/phy/fixed_phy.c
@@ -17,7 +17,6 @@
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/of.h>
-#include <linux/gpio/consumer.h>
#include <linux/idr.h>
#include <linux/netdevice.h>
#include <linux/linkmode.h>
@@ -36,7 +35,6 @@ struct fixed_phy {
bool no_carrier;
int (*link_update)(struct net_device *, struct fixed_phy_status *);
struct list_head node;
- struct gpio_desc *link_gpiod;
};
static struct fixed_mdio_bus platform_fmb = {
@@ -62,12 +60,6 @@ int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
}
EXPORT_SYMBOL_GPL(fixed_phy_change_carrier);
-static void fixed_phy_update(struct fixed_phy *fp)
-{
- if (!fp->no_carrier && fp->link_gpiod)
- fp->status.link = !!gpiod_get_value_cansleep(fp->link_gpiod);
-}
-
static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num)
{
struct fixed_mdio_bus *fmb = bus->priv;
@@ -82,9 +74,6 @@ static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num)
fp->link_update(fp->phydev->attached_dev,
&fp->status);
- /* Check the GPIO for change in status */
- fixed_phy_update(fp);
-
return swphy_read_reg(reg_num, &fp->status);
}
}
@@ -125,9 +114,8 @@ int fixed_phy_set_link_update(struct phy_device *phydev,
}
EXPORT_SYMBOL_GPL(fixed_phy_set_link_update);
-static int fixed_phy_add_gpiod(unsigned int irq, int phy_addr,
- const struct fixed_phy_status *status,
- struct gpio_desc *gpiod)
+static int __fixed_phy_add(unsigned int irq, int phy_addr,
+ const struct fixed_phy_status *status)
{
int ret;
struct fixed_mdio_bus *fmb = &platform_fmb;
@@ -146,9 +134,6 @@ static int fixed_phy_add_gpiod(unsigned int irq, int phy_addr,
fp->addr = phy_addr;
fp->status = *status;
- fp->link_gpiod = gpiod;
-
- fixed_phy_update(fp);
list_add_tail(&fp->node, &fmb->phys);
@@ -157,7 +142,7 @@ static int fixed_phy_add_gpiod(unsigned int irq, int phy_addr,
void fixed_phy_add(const struct fixed_phy_status *status)
{
- fixed_phy_add_gpiod(PHY_POLL, 0, status, NULL);
+ __fixed_phy_add(PHY_POLL, 0, status);
}
EXPORT_SYMBOL_GPL(fixed_phy_add);
@@ -171,8 +156,6 @@ static void fixed_phy_del(int phy_addr)
list_for_each_entry_safe(fp, tmp, &fmb->phys, node) {
if (fp->addr == phy_addr) {
list_del(&fp->node);
- if (fp->link_gpiod)
- gpiod_put(fp->link_gpiod);
kfree(fp);
ida_free(&phy_fixed_ida, phy_addr);
return;
@@ -180,48 +163,10 @@ static void fixed_phy_del(int phy_addr)
}
}
-#ifdef CONFIG_OF_GPIO
-static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np)
-{
- struct device_node *fixed_link_node;
- struct gpio_desc *gpiod;
-
- if (!np)
- return NULL;
-
- fixed_link_node = of_get_child_by_name(np, "fixed-link");
- if (!fixed_link_node)
- return NULL;
-
- /*
- * As the fixed link is just a device tree node without any
- * Linux device associated with it, we simply have obtain
- * the GPIO descriptor from the device tree like this.
- */
- gpiod = fwnode_gpiod_get_index(of_fwnode_handle(fixed_link_node),
- "link", 0, GPIOD_IN, "mdio");
- if (IS_ERR(gpiod) && PTR_ERR(gpiod) != -EPROBE_DEFER) {
- if (PTR_ERR(gpiod) != -ENOENT)
- pr_err("error getting GPIO for fixed link %pOF, proceed without\n",
- fixed_link_node);
- gpiod = NULL;
- }
- of_node_put(fixed_link_node);
-
- return gpiod;
-}
-#else
-static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np)
-{
- return NULL;
-}
-#endif
-
struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
struct device_node *np)
{
struct fixed_mdio_bus *fmb = &platform_fmb;
- struct gpio_desc *gpiod;
struct phy_device *phy;
int phy_addr;
int ret;
@@ -229,17 +174,12 @@ struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
if (!fmb->mii_bus || fmb->mii_bus->state != MDIOBUS_REGISTERED)
return ERR_PTR(-EPROBE_DEFER);
- /* Check if we have a GPIO associated with this fixed phy */
- gpiod = fixed_phy_get_gpiod(np);
- if (IS_ERR(gpiod))
- return ERR_CAST(gpiod);
-
/* Get the next available PHY address, up to PHY_MAX_ADDR */
phy_addr = ida_alloc_max(&phy_fixed_ida, PHY_MAX_ADDR - 1, GFP_KERNEL);
if (phy_addr < 0)
return ERR_PTR(phy_addr);
- ret = fixed_phy_add_gpiod(PHY_POLL, phy_addr, status, gpiod);
+ ret = __fixed_phy_add(PHY_POLL, phy_addr, status);
if (ret < 0) {
ida_free(&phy_fixed_ida, phy_addr);
return ERR_PTR(ret);
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 net-next] net: phy: fixed_phy: remove link gpio support
2025-09-02 18:37 [PATCH v2 net-next] net: phy: fixed_phy: remove link gpio support Heiner Kallweit
@ 2025-09-04 0:32 ` Jakub Kicinski
2025-09-04 6:03 ` Heiner Kallweit
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2025-09-04 0:32 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Russell King - ARM Linux, Andrew Lunn, Andrew Lunn, Paolo Abeni,
Eric Dumazet, David Miller, netdev@vger.kernel.org,
Florian Fainelli
On Tue, 2 Sep 2025 20:37:02 +0200 Heiner Kallweit wrote:
> The only user of fixed_phy gpio functionality was here:
> arch/arm/boot/dts/nxp/vf/vf610-zii-dev-rev-b.dts
> Support for the switch on this board was migrated to phylink
> (DSA - mv88e6xxx) years ago, so the functionality is unused now.
> Therefore remove it.
Sorry if I'm mixing things up and misunderstanding.
There was a recent conversation regarding backward compat
with device trees. Was it related to this patch? Is the policy
that we only care about in-tree device trees?
Would it make sense to document in the commit message?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 net-next] net: phy: fixed_phy: remove link gpio support
2025-09-04 0:32 ` Jakub Kicinski
@ 2025-09-04 6:03 ` Heiner Kallweit
0 siblings, 0 replies; 3+ messages in thread
From: Heiner Kallweit @ 2025-09-04 6:03 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Russell King - ARM Linux, Andrew Lunn, Andrew Lunn, Paolo Abeni,
Eric Dumazet, David Miller, netdev@vger.kernel.org,
Florian Fainelli
On 9/4/2025 2:32 AM, Jakub Kicinski wrote:
> On Tue, 2 Sep 2025 20:37:02 +0200 Heiner Kallweit wrote:
>> The only user of fixed_phy gpio functionality was here:
>> arch/arm/boot/dts/nxp/vf/vf610-zii-dev-rev-b.dts
>> Support for the switch on this board was migrated to phylink
>> (DSA - mv88e6xxx) years ago, so the functionality is unused now.
>> Therefore remove it.
>
> Sorry if I'm mixing things up and misunderstanding.
> There was a recent conversation regarding backward compat
> with device trees. Was it related to this patch? Is the policy
> that we only care about in-tree device trees?
> Would it make sense to document in the commit message?
>
This other conversation was about something different, the deprecated
old fixed-link binding. Wrt link gpio there is a very small risk
that there's out-of-tree users who use link gpio with a switch chip
not handled by DSA. I can mention this in the commit message. And yes,
my current understanding is that we care about in-tree dt's only.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-04 6:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-02 18:37 [PATCH v2 net-next] net: phy: fixed_phy: remove link gpio support Heiner Kallweit
2025-09-04 0:32 ` Jakub Kicinski
2025-09-04 6:03 ` Heiner Kallweit
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).