/* Issue callback if user registered it. */ if (fp->link_update)
fp->link_update(fp->phydev->attached_dev,
&fp->status);
/* Check the GPIO for change in status */
fixed_phy_update(fp);
state = fp->status;
return swphy_read_reg(reg_num, &state);
}
}
return 0xFFFF;
}
staticint fixed_mdio_write(struct mii_bus *bus, int phy_addr, int reg_num,
u16 val)
{ return 0;
}
/* * If something weird is required to be done with link/speed, * network driver is able to assign a function to implement this. * May be useful for PHY's that need to be software-driven.
*/ int fixed_phy_set_link_update(struct phy_device *phydev, int (*link_update)(struct net_device *, struct fixed_phy_status *))
{ struct fixed_mdio_bus *fmb = &platform_fmb; struct fixed_phy *fp;
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);
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); if (ret < 0) {
ida_free(&phy_fixed_ida, phy_addr); return ERR_PTR(ret);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.