|
|
@@ -1,36 +1,54 @@
|
|
|
+From 7cc39a6bedbd85f3ff7e16845f310e4ce8d9833f Mon Sep 17 00:00:00 2001
|
|
|
+From: Daniel Golle <[email protected]>
|
|
|
+Date: Tue, 6 Sep 2022 00:31:19 +0100
|
|
|
+Subject: [PATCH] net: sfp: add quirk for ATS SFP-GE-T 1000Base-TX module
|
|
|
+To: [email protected],
|
|
|
+ [email protected],
|
|
|
+ Russell King <[email protected]>,
|
|
|
+ Andrew Lunn <[email protected]>,
|
|
|
+ Heiner Kallweit <[email protected]>
|
|
|
+Cc: David S. Miller <[email protected]>,
|
|
|
+ Eric Dumazet <[email protected]>,
|
|
|
+ Jakub Kicinski <[email protected]>,
|
|
|
+ Paolo Abeni <[email protected]>,
|
|
|
+ Josef Schlehofer <[email protected]>
|
|
|
+
|
|
|
+This copper module comes with broken TX_FAULT indicator which must be
|
|
|
+ignored for it to work. Implement ignoring TX_FAULT state bit also
|
|
|
+during reset/insertion and mute the warning telling the user that the
|
|
|
+module indicates TX_FAULT.
|
|
|
+
|
|
|
+Co-authored-by: Josef Schlehofer <[email protected]>
|
|
|
+Signed-off-by: Daniel Golle <[email protected]>
|
|
|
+---
|
|
|
+ drivers/net/phy/sfp.c | 14 +++++++++++---
|
|
|
+ 1 file changed, 11 insertions(+), 3 deletions(-)
|
|
|
+
|
|
|
--- a/drivers/net/phy/sfp.c
|
|
|
+++ b/drivers/net/phy/sfp.c
|
|
|
-@@ -1803,6 +1803,7 @@ static int sfp_sm_mod_probe(struct sfp *
|
|
|
- struct sfp_eeprom_id id;
|
|
|
- bool cotsworks_sfbg;
|
|
|
- bool cotsworks;
|
|
|
-+ bool oem_ge_t;
|
|
|
- u8 check;
|
|
|
- int ret;
|
|
|
-
|
|
|
-@@ -1851,6 +1852,10 @@ static int sfp_sm_mod_probe(struct sfp *
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-+ /* Some cheap SFP-GE-T modules always indicate TX fault */
|
|
|
-+ oem_ge_t = !memcmp(id.base.vendor_name, "OEM ", 16) &&
|
|
|
-+ !memcmp(id.base.vendor_pn, "SFP-GE-T ", 12);
|
|
|
-+
|
|
|
- /* Cotsworks do not seem to update the checksums when they
|
|
|
- * do the final programming with the final module part number,
|
|
|
- * serial number and date code.
|
|
|
-@@ -1946,8 +1951,8 @@ static int sfp_sm_mod_probe(struct sfp *
|
|
|
- else
|
|
|
- sfp->module_t_start_up = T_START_UP;
|
|
|
-
|
|
|
-- if (!memcmp(id.base.vendor_name, "HUAWEI ", 16) &&
|
|
|
-- !memcmp(id.base.vendor_pn, "MA5671A ", 16))
|
|
|
-+ if ((!memcmp(id.base.vendor_name, "HUAWEI ", 16) &&
|
|
|
-+ !memcmp(id.base.vendor_pn, "MA5671A ", 16)) || oem_ge_t)
|
|
|
- sfp->tx_fault_ignore = true;
|
|
|
- else
|
|
|
- sfp->tx_fault_ignore = false;
|
|
|
-@@ -2404,10 +2409,12 @@ static void sfp_check_state(struct sfp *
|
|
|
+@@ -369,6 +369,11 @@ static const struct sfp_quirk sfp_quirks
|
|
|
+ .modes = sfp_quirk_2500basex,
|
|
|
+ .fixup = sfp_fixup_ignore_tx_fault,
|
|
|
+ }, {
|
|
|
++ // OEM SFP-GE-T is 1000Base-T module
|
|
|
++ .vendor = "OEM",
|
|
|
++ .part = "SFP-GE-T",
|
|
|
++ .fixup = sfp_fixup_ignore_tx_fault,
|
|
|
++ }, {
|
|
|
+ // Lantech 8330-262D-E can operate at 2500base-X, but
|
|
|
+ // incorrectly report 2500MBd NRZ in their EEPROM
|
|
|
+ .vendor = "Lantech",
|
|
|
+@@ -2303,7 +2308,8 @@ static void sfp_sm_main(struct sfp *sfp,
|
|
|
+ * or t_start_up, so assume there is a fault.
|
|
|
+ */
|
|
|
+ sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
|
|
|
+- sfp->sm_fault_retries == N_FAULT_INIT);
|
|
|
++ !sfp->tx_fault_ignore &&
|
|
|
++ (sfp->sm_fault_retries == N_FAULT_INIT));
|
|
|
+ } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
|
|
|
+ init_done:
|
|
|
+ sfp->sm_phy_retries = R_PHY_RETRY;
|
|
|
+@@ -2526,10 +2532,12 @@ static void sfp_check_state(struct sfp *
|
|
|
mutex_lock(&sfp->st_mutex);
|
|
|
state = sfp_get_state(sfp);
|
|
|
changed = state ^ sfp->state;
|