738-net-phy-at803x-only-the-AT8030-needs-a-hardware-rese.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. From: Timur Tabi <timur@codeaurora.org>
  2. Date: Tue, 26 Apr 2016 12:44:18 -0500
  3. Subject: [PATCH] net: phy: at803x: only the AT8030 needs a hardware reset on
  4. link change
  5. Commit 13a56b44 ("at803x: Add support for hardware reset") added a
  6. work-around for a hardware bug on the AT8030. However, the work-around
  7. was being called for all 803x PHYs, even those that don't need it.
  8. Function at803x_link_change_notify() checks to make sure that it only
  9. resets the PHY on the 8030, but it makes more sense to not call that
  10. function at all if it isn't needed.
  11. Signed-off-by: Timur Tabi <timur@codeaurora.org>
  12. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
  13. Signed-off-by: David S. Miller <davem@davemloft.net>
  14. ---
  15. --- a/drivers/net/phy/at803x.c
  16. +++ b/drivers/net/phy/at803x.c
  17. @@ -374,27 +374,25 @@ static void at803x_link_change_notify(st
  18. * in the FIFO. In such cases, the FIFO enters an error mode it
  19. * cannot recover from by software.
  20. */
  21. - if (phydev->drv->phy_id == ATH8030_PHY_ID) {
  22. - if (phydev->state == PHY_NOLINK) {
  23. - if (priv->gpiod_reset && !priv->phy_reset) {
  24. - struct at803x_context context;
  25. -
  26. - at803x_context_save(phydev, &context);
  27. -
  28. - gpiod_set_value(priv->gpiod_reset, 1);
  29. - msleep(1);
  30. - gpiod_set_value(priv->gpiod_reset, 0);
  31. - msleep(1);
  32. -
  33. - at803x_context_restore(phydev, &context);
  34. -
  35. - dev_dbg(&phydev->dev, "%s(): phy was reset\n",
  36. - __func__);
  37. - priv->phy_reset = true;
  38. - }
  39. - } else {
  40. - priv->phy_reset = false;
  41. + if (phydev->state == PHY_NOLINK) {
  42. + if (priv->gpiod_reset && !priv->phy_reset) {
  43. + struct at803x_context context;
  44. +
  45. + at803x_context_save(phydev, &context);
  46. +
  47. + gpiod_set_value(priv->gpiod_reset, 1);
  48. + msleep(1);
  49. + gpiod_set_value(priv->gpiod_reset, 0);
  50. + msleep(1);
  51. +
  52. + at803x_context_restore(phydev, &context);
  53. +
  54. + dev_dbg(&phydev->dev, "%s(): phy was reset\n",
  55. + __func__);
  56. + priv->phy_reset = true;
  57. }
  58. + } else {
  59. + priv->phy_reset = false;
  60. }
  61. if (pdata && pdata->fixup_rgmii_tx_delay &&
  62. phydev->speed != priv->prev_speed) {
  63. @@ -426,7 +424,6 @@ static struct phy_driver at803x_driver[]
  64. .phy_id_mask = AT803X_PHY_ID_MASK,
  65. .probe = at803x_probe,
  66. .config_init = at803x_config_init,
  67. - .link_change_notify = at803x_link_change_notify,
  68. .set_wol = at803x_set_wol,
  69. .get_wol = at803x_get_wol,
  70. .suspend = at803x_suspend,
  71. @@ -468,7 +465,6 @@ static struct phy_driver at803x_driver[]
  72. .phy_id_mask = AT803X_PHY_ID_MASK,
  73. .probe = at803x_probe,
  74. .config_init = at803x_config_init,
  75. - .link_change_notify = at803x_link_change_notify,
  76. .set_wol = at803x_set_wol,
  77. .get_wol = at803x_get_wol,
  78. .suspend = at803x_suspend,