610-phy_detect.patch 775 B

1234567891011121314151617181920212223242526
  1. --- a/drivers/net/phy/mdio_bus.c
  2. +++ b/drivers/net/phy/mdio_bus.c
  3. @@ -135,6 +135,9 @@ static int mdio_bus_match(struct device
  4. struct phy_device *phydev = to_phy_device(dev);
  5. struct phy_driver *phydrv = to_phy_driver(drv);
  6. + if (phydrv->detect)
  7. + return (phydrv->detect(phydev->bus, phydev->addr));
  8. +
  9. return ((phydrv->phy_id & phydrv->phy_id_mask) ==
  10. (phydev->phy_id & phydrv->phy_id_mask));
  11. }
  12. --- a/include/linux/phy.h
  13. +++ b/include/linux/phy.h
  14. @@ -339,6 +339,11 @@ struct phy_driver {
  15. u32 features;
  16. u32 flags;
  17. + /* Called during discovery to test if the
  18. + * device can attach to the bus, even if
  19. + * phy id and mask do not match */
  20. + bool (*detect)(struct mii_bus *bus, int addr);
  21. +
  22. /*
  23. * Called to initialize the PHY,
  24. * including after a reset