790-SFP-GE-T-ignore-TX_FAULT.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From 7cc39a6bedbd85f3ff7e16845f310e4ce8d9833f Mon Sep 17 00:00:00 2001
  2. From: Daniel Golle <[email protected]>
  3. Date: Tue, 6 Sep 2022 00:31:19 +0100
  4. Subject: [PATCH] net: sfp: add quirk for ATS SFP-GE-T 1000Base-TX module
  5. To: [email protected],
  6. [email protected],
  7. Russell King <[email protected]>,
  8. Andrew Lunn <[email protected]>,
  9. Heiner Kallweit <[email protected]>
  10. Cc: David S. Miller <[email protected]>,
  11. Eric Dumazet <[email protected]>,
  12. Jakub Kicinski <[email protected]>,
  13. Paolo Abeni <[email protected]>,
  14. Josef Schlehofer <[email protected]>
  15. This copper module comes with broken TX_FAULT indicator which must be
  16. ignored for it to work. Implement ignoring TX_FAULT state bit also
  17. during reset/insertion and mute the warning telling the user that the
  18. module indicates TX_FAULT.
  19. Co-authored-by: Josef Schlehofer <[email protected]>
  20. Signed-off-by: Daniel Golle <[email protected]>
  21. ---
  22. drivers/net/phy/sfp.c | 14 +++++++++++---
  23. 1 file changed, 11 insertions(+), 3 deletions(-)
  24. --- a/drivers/net/phy/sfp.c
  25. +++ b/drivers/net/phy/sfp.c
  26. @@ -409,6 +409,9 @@ static const struct sfp_quirk sfp_quirks
  27. SFP_QUIRK("HUAWEI", "MA5671A", sfp_quirk_2500basex,
  28. sfp_fixup_ignore_tx_fault),
  29. + // OEM SFP-GE-T is 1000Base-T module
  30. + SFP_QUIRK_F("OEM", "SFP-GE-T", sfp_fixup_ignore_tx_fault),
  31. +
  32. // Lantech 8330-262D-E can operate at 2500base-X, but incorrectly report
  33. // 2500MBd NRZ in their EEPROM
  34. SFP_QUIRK_M("Lantech", "8330-262D-E", sfp_quirk_2500basex),
  35. @@ -2344,7 +2347,8 @@ static void sfp_sm_main(struct sfp *sfp,
  36. * or t_start_up, so assume there is a fault.
  37. */
  38. sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
  39. - sfp->sm_fault_retries == N_FAULT_INIT);
  40. + !sfp->tx_fault_ignore &&
  41. + (sfp->sm_fault_retries == N_FAULT_INIT));
  42. } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
  43. init_done:
  44. /* Create mdiobus and start trying for PHY */
  45. @@ -2578,10 +2582,12 @@ static void sfp_check_state(struct sfp *
  46. mutex_lock(&sfp->st_mutex);
  47. state = sfp_get_state(sfp);
  48. changed = state ^ sfp->state;
  49. - if (sfp->tx_fault_ignore)
  50. + if (sfp->tx_fault_ignore) {
  51. changed &= SFP_F_PRESENT | SFP_F_LOS;
  52. - else
  53. + state &= ~SFP_F_TX_FAULT;
  54. + } else {
  55. changed &= SFP_F_PRESENT | SFP_F_LOS | SFP_F_TX_FAULT;
  56. + }
  57. for (i = 0; i < GPIO_MAX; i++)
  58. if (changed & BIT(i))