030-mvneta-consolidate-autoneg-enabling.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From: Stas Sergeev <stsp@list.ru>
  2. Date: Wed, 2 Dec 2015 20:33:56 +0300
  3. Subject: [PATCH] mvneta: consolidate autoneg enabling
  4. This moves autoneg-related bit manipulations to the single place.
  5. CC: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  6. CC: netdev@vger.kernel.org
  7. CC: linux-kernel@vger.kernel.org
  8. Signed-off-by: Stas Sergeev <stsp@users.sourceforge.net>
  9. Signed-off-by: David S. Miller <davem@davemloft.net>
  10. ---
  11. --- a/drivers/net/ethernet/marvell/mvneta.c
  12. +++ b/drivers/net/ethernet/marvell/mvneta.c
  13. @@ -1072,15 +1072,28 @@ static void mvneta_defaults_set(struct m
  14. MVNETA_GMAC_AN_SPEED_EN |
  15. MVNETA_GMAC_AN_DUPLEX_EN;
  16. mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
  17. +
  18. val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
  19. val |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
  20. mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
  21. +
  22. + val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
  23. + val |= MVNETA_GMAC2_INBAND_AN_ENABLE;
  24. + mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
  25. } else {
  26. val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
  27. val &= ~(MVNETA_GMAC_INBAND_AN_ENABLE |
  28. MVNETA_GMAC_AN_SPEED_EN |
  29. MVNETA_GMAC_AN_DUPLEX_EN);
  30. mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
  31. +
  32. + val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
  33. + val &= ~MVNETA_GMAC_1MS_CLOCK_ENABLE;
  34. + mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
  35. +
  36. + val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
  37. + val &= ~MVNETA_GMAC2_INBAND_AN_ENABLE;
  38. + mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
  39. }
  40. mvneta_set_ucast_table(pp, -1);
  41. @@ -3232,9 +3245,6 @@ static int mvneta_port_power_up(struct m
  42. return -EINVAL;
  43. }
  44. - if (pp->use_inband_status)
  45. - ctrl |= MVNETA_GMAC2_INBAND_AN_ENABLE;
  46. -
  47. /* Cancel Port Reset */
  48. ctrl &= ~MVNETA_GMAC2_PORT_RESET;
  49. mvreg_write(pp, MVNETA_GMAC_CTRL_2, ctrl);