180-net-phy-at803x-add-support-for-AT8032.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Subject: net: phy: at803x: add support for AT8032
  3. Like AT8030, this PHY needs the GPIO reset workaround
  4. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5. ---
  6. --- a/drivers/net/phy/at803x.c
  7. +++ b/drivers/net/phy/at803x.c
  8. @@ -62,8 +62,10 @@
  9. #define ATH8030_PHY_ID 0x004dd076
  10. #define ATH8031_PHY_ID 0x004dd074
  11. +#define ATH8032_PHY_ID 0x004dd023
  12. #define ATH8035_PHY_ID 0x004dd072
  13. #define AT803X_PHY_ID_MASK 0xffffffef
  14. +#define AT8032_PHY_ID_MASK 0xffffffff
  15. MODULE_DESCRIPTION("Atheros 803x PHY driver");
  16. MODULE_AUTHOR("Matus Ujhelyi");
  17. @@ -256,7 +258,8 @@ static int at803x_probe(struct phy_devic
  18. if (!priv)
  19. return -ENOMEM;
  20. - if (phydev->drv->phy_id != ATH8030_PHY_ID)
  21. + if (phydev->drv->phy_id != ATH8030_PHY_ID &&
  22. + phydev->drv->phy_id != ATH8032_PHY_ID)
  23. goto does_not_require_reset_workaround;
  24. gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
  25. @@ -332,7 +335,7 @@ static void at803x_link_change_notify(st
  26. struct at803x_priv *priv = phydev->priv;
  27. /*
  28. - * Conduct a hardware reset for AT8030 every time a link loss is
  29. + * Conduct a hardware reset for AT8030/2 every time a link loss is
  30. * signalled. This is necessary to circumvent a hardware bug that
  31. * occurs when the cable is unplugged while TX packets are pending
  32. * in the FIFO. In such cases, the FIFO enters an error mode it
  33. @@ -444,6 +447,24 @@ static struct phy_driver at803x_driver[]
  34. .aneg_done = at803x_aneg_done,
  35. .ack_interrupt = &at803x_ack_interrupt,
  36. .config_intr = &at803x_config_intr,
  37. +}, {
  38. + /* ATHEROS 8032 */
  39. + .phy_id = ATH8032_PHY_ID,
  40. + .name = "Atheros 8032 ethernet",
  41. + .phy_id_mask = AT8032_PHY_ID_MASK,
  42. + .probe = at803x_probe,
  43. + .config_init = at803x_config_init,
  44. + .link_change_notify = at803x_link_change_notify,
  45. + .set_wol = at803x_set_wol,
  46. + .get_wol = at803x_get_wol,
  47. + .suspend = at803x_suspend,
  48. + .resume = at803x_resume,
  49. + .features = PHY_BASIC_FEATURES,
  50. + .flags = PHY_HAS_INTERRUPT,
  51. + .config_aneg = genphy_config_aneg,
  52. + .read_status = genphy_read_status,
  53. + .ack_interrupt = at803x_ack_interrupt,
  54. + .config_intr = at803x_config_intr,
  55. } };
  56. module_phy_driver(at803x_driver);
  57. @@ -451,6 +472,7 @@ module_phy_driver(at803x_driver);
  58. static struct mdio_device_id __maybe_unused atheros_tbl[] = {
  59. { ATH8030_PHY_ID, AT803X_PHY_ID_MASK },
  60. { ATH8031_PHY_ID, AT803X_PHY_ID_MASK },
  61. + { ATH8032_PHY_ID, AT8032_PHY_ID_MASK },
  62. { ATH8035_PHY_ID, AT803X_PHY_ID_MASK },
  63. { }
  64. };