702-phy_add_aneg_done_function.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --- a/include/linux/phy.h
  2. +++ b/include/linux/phy.h
  3. @@ -386,9 +386,18 @@ struct phy_driver {
  4. */
  5. int (*config_aneg)(struct phy_device *phydev);
  6. + /* Determine if autonegotiation is done */
  7. + int (*aneg_done)(struct phy_device *phydev);
  8. +
  9. /* Determines the negotiated speed and duplex */
  10. int (*read_status)(struct phy_device *phydev);
  11. + /*
  12. + * Update the value in phydev->link to reflect the
  13. + * current link value
  14. + */
  15. + int (*update_link)(struct phy_device *phydev);
  16. +
  17. /* Clears any pending interrupts */
  18. int (*ack_interrupt)(struct phy_device *phydev);
  19. --- a/drivers/net/phy/phy_device.c
  20. +++ b/drivers/net/phy/phy_device.c
  21. @@ -715,6 +715,9 @@ int genphy_update_link(struct phy_device
  22. {
  23. int status;
  24. + if (phydev->drv->update_link)
  25. + return phydev->drv->update_link(phydev);
  26. +
  27. /* Do a fake read */
  28. status = phy_read(phydev, MII_BMSR);
  29. --- a/drivers/net/phy/phy.c
  30. +++ b/drivers/net/phy/phy.c
  31. @@ -106,6 +106,9 @@ static inline int phy_aneg_done(struct p
  32. {
  33. int retval;
  34. + if (phydev->drv->aneg_done)
  35. + return phydev->drv->aneg_done(phydev);
  36. +
  37. retval = phy_read(phydev, MII_BMSR);
  38. return (retval < 0) ? retval : (retval & BMSR_ANEGCOMPLETE);