diff options
Diffstat (limited to 'pkgs/patches-linux-5.15/113-net-sfp-add-support-for-HALNy-GPON-SFP.patch')
-rw-r--r-- | pkgs/patches-linux-5.15/113-net-sfp-add-support-for-HALNy-GPON-SFP.patch | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/pkgs/patches-linux-5.15/113-net-sfp-add-support-for-HALNy-GPON-SFP.patch b/pkgs/patches-linux-5.15/113-net-sfp-add-support-for-HALNy-GPON-SFP.patch new file mode 100644 index 0000000..e66bcb7 --- /dev/null +++ b/pkgs/patches-linux-5.15/113-net-sfp-add-support-for-HALNy-GPON-SFP.patch @@ -0,0 +1,93 @@ +From 9490075c53cec3925039d2b1c5afc4507e772660 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> +Date: Fri, 26 Aug 2022 08:43:45 +0100 +Subject: [PATCH 4/4] net: sfp: add support for HALNy GPON SFP + +Add a quirk for the HALNy HL-GSFP module, which appears to have an +inverted RX_LOS signal, and possibly uses TX_FAULT as an inverted +host-link status signal. As we can't be certain about the modules +use of TX_FAULT, we ignore it. + +Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> +--- + drivers/net/phy/sfp-bus.c | 2 +- + drivers/net/phy/sfp.c | 29 ++++++++++++++++++++++++++--- + 2 files changed, 27 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c +index 267182d32bd5..4566348a6d05 100644 +--- a/drivers/net/phy/sfp-bus.c ++++ b/drivers/net/phy/sfp-bus.c +@@ -283,7 +283,7 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id, + phylink_set(modes, 2500baseX_Full); + } + +- if (bus->sfp_quirk) ++ if (bus->sfp_quirk && bus->sfp_quirk->modes) + bus->sfp_quirk->modes(id, modes); + + bitmap_or(support, support, modes, __ETHTOOL_LINK_MODE_MASK_NBITS); +diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c +index db922d27ee79..2ebc577bfc56 100644 +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -320,6 +320,23 @@ static void sfp_fixup_ignore_tx_fault(struct sfp *sfp) + sfp->tx_fault_ignore = true; + } + ++static void sfp_fixup_inverted_los(struct sfp *sfp) ++{ ++ const __be16 los_inverted = cpu_to_be16(SFP_OPTIONS_LOS_INVERTED); ++ const __be16 los_normal = cpu_to_be16(SFP_OPTIONS_LOS_NORMAL); ++ ++ sfp->id.ext.options &= ~los_normal; ++ sfp->id.ext.options |= los_inverted; ++} ++ ++static void sfp_fixup_hanly_gsfp(struct sfp *sfp) ++{ ++ /* LOS is inverted */ ++ sfp_fixup_inverted_los(sfp); ++ /* TX fault might be inverted, but we don't know for certain. */ ++ sfp_fixup_ignore_tx_fault(sfp); ++} ++ + static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id, + unsigned long *modes) + { +@@ -351,6 +368,10 @@ static const struct sfp_quirk sfp_quirks[] = { + .part = "3FE46541AA", + .modes = sfp_quirk_2500basex, + .fixup = sfp_fixup_long_startup, ++ }, { ++ .vendor = "HANLy", ++ .part = "HL-GSFP", ++ .fixup = sfp_fixup_hanly_gsfp, + }, { + // Huawei MA5671A can operate at 2500base-X, but report 1.2GBd + // NRZ in their EEPROM +@@ -368,16 +389,18 @@ static const struct sfp_quirk sfp_quirks[] = { + .vendor = "UBNT", + .part = "UF-INSTANT", + .modes = sfp_quirk_ubnt_uf_instant, +- }, ++ } + }; + + static size_t sfp_strlen(const char *str, size_t maxlen) + { + size_t size, i; + +- /* Trailing characters should be filled with space chars */ ++ /* Trailing characters should be filled with space chars, but ++ * some manufacturers can't read SFF-8472 and use NUL. ++ */ + for (i = 0, size = 0; i < maxlen; i++) +- if (str[i] != ' ') ++ if (str[i] != ' ' && str[i] != '\0') + size = i + 1; + + return size; +-- +2.34.1 + |