Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: phy: fixed_phy: remove link gpio support

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.

Note: 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.
However we care about in-tree device trees only.

Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/75295a9a-e162-432c-ba9f-5d3125078788@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
43a42b85 16c61016

+4 -64
+4 -64
drivers/net/phy/fixed_phy.c
··· 17 17 #include <linux/err.h> 18 18 #include <linux/slab.h> 19 19 #include <linux/of.h> 20 - #include <linux/gpio/consumer.h> 21 20 #include <linux/idr.h> 22 21 #include <linux/netdevice.h> 23 22 #include <linux/linkmode.h> ··· 35 36 bool no_carrier; 36 37 int (*link_update)(struct net_device *, struct fixed_phy_status *); 37 38 struct list_head node; 38 - struct gpio_desc *link_gpiod; 39 39 }; 40 40 41 41 static struct fixed_mdio_bus platform_fmb = { ··· 60 62 } 61 63 EXPORT_SYMBOL_GPL(fixed_phy_change_carrier); 62 64 63 - static void fixed_phy_update(struct fixed_phy *fp) 64 - { 65 - if (!fp->no_carrier && fp->link_gpiod) 66 - fp->status.link = !!gpiod_get_value_cansleep(fp->link_gpiod); 67 - } 68 - 69 65 static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num) 70 66 { 71 67 struct fixed_mdio_bus *fmb = bus->priv; ··· 73 81 if (fp->link_update) 74 82 fp->link_update(fp->phydev->attached_dev, 75 83 &fp->status); 76 - 77 - /* Check the GPIO for change in status */ 78 - fixed_phy_update(fp); 79 84 80 85 return swphy_read_reg(reg_num, &fp->status); 81 86 } ··· 114 125 } 115 126 EXPORT_SYMBOL_GPL(fixed_phy_set_link_update); 116 127 117 - static int fixed_phy_add_gpiod(unsigned int irq, int phy_addr, 118 - const struct fixed_phy_status *status, 119 - struct gpio_desc *gpiod) 128 + static int __fixed_phy_add(unsigned int irq, int phy_addr, 129 + const struct fixed_phy_status *status) 120 130 { 121 131 int ret; 122 132 struct fixed_mdio_bus *fmb = &platform_fmb; ··· 134 146 135 147 fp->addr = phy_addr; 136 148 fp->status = *status; 137 - fp->link_gpiod = gpiod; 138 - 139 - fixed_phy_update(fp); 140 149 141 150 list_add_tail(&fp->node, &fmb->phys); 142 151 ··· 142 157 143 158 void fixed_phy_add(const struct fixed_phy_status *status) 144 159 { 145 - fixed_phy_add_gpiod(PHY_POLL, 0, status, NULL); 160 + __fixed_phy_add(PHY_POLL, 0, status); 146 161 } 147 162 EXPORT_SYMBOL_GPL(fixed_phy_add); 148 163 ··· 156 171 list_for_each_entry_safe(fp, tmp, &fmb->phys, node) { 157 172 if (fp->addr == phy_addr) { 158 173 list_del(&fp->node); 159 - if (fp->link_gpiod) 160 - gpiod_put(fp->link_gpiod); 161 174 kfree(fp); 162 175 ida_free(&phy_fixed_ida, phy_addr); 163 176 return; ··· 163 180 } 164 181 } 165 182 166 - #ifdef CONFIG_OF_GPIO 167 - static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np) 168 - { 169 - struct device_node *fixed_link_node; 170 - struct gpio_desc *gpiod; 171 - 172 - if (!np) 173 - return NULL; 174 - 175 - fixed_link_node = of_get_child_by_name(np, "fixed-link"); 176 - if (!fixed_link_node) 177 - return NULL; 178 - 179 - /* 180 - * As the fixed link is just a device tree node without any 181 - * Linux device associated with it, we simply have obtain 182 - * the GPIO descriptor from the device tree like this. 183 - */ 184 - gpiod = fwnode_gpiod_get_index(of_fwnode_handle(fixed_link_node), 185 - "link", 0, GPIOD_IN, "mdio"); 186 - if (IS_ERR(gpiod) && PTR_ERR(gpiod) != -EPROBE_DEFER) { 187 - if (PTR_ERR(gpiod) != -ENOENT) 188 - pr_err("error getting GPIO for fixed link %pOF, proceed without\n", 189 - fixed_link_node); 190 - gpiod = NULL; 191 - } 192 - of_node_put(fixed_link_node); 193 - 194 - return gpiod; 195 - } 196 - #else 197 - static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np) 198 - { 199 - return NULL; 200 - } 201 - #endif 202 - 203 183 struct phy_device *fixed_phy_register(const struct fixed_phy_status *status, 204 184 struct device_node *np) 205 185 { 206 186 struct fixed_mdio_bus *fmb = &platform_fmb; 207 - struct gpio_desc *gpiod; 208 187 struct phy_device *phy; 209 188 int phy_addr; 210 189 int ret; ··· 174 229 if (!fmb->mii_bus || fmb->mii_bus->state != MDIOBUS_REGISTERED) 175 230 return ERR_PTR(-EPROBE_DEFER); 176 231 177 - /* Check if we have a GPIO associated with this fixed phy */ 178 - gpiod = fixed_phy_get_gpiod(np); 179 - if (IS_ERR(gpiod)) 180 - return ERR_CAST(gpiod); 181 - 182 232 /* Get the next available PHY address, up to PHY_MAX_ADDR */ 183 233 phy_addr = ida_alloc_max(&phy_fixed_ida, PHY_MAX_ADDR - 1, GFP_KERNEL); 184 234 if (phy_addr < 0) 185 235 return ERR_PTR(phy_addr); 186 236 187 - ret = fixed_phy_add_gpiod(PHY_POLL, phy_addr, status, gpiod); 237 + ret = __fixed_phy_add(PHY_POLL, phy_addr, status); 188 238 if (ret < 0) { 189 239 ida_free(&phy_fixed_ida, phy_addr); 190 240 return ERR_PTR(ret);