summaryrefslogtreecommitdiff
path: root/drivers/net/phy/sfp.c
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2022-09-13 20:06:48 +0100
committerJakub Kicinski <kuba@kernel.org>2022-09-20 07:54:13 -0700
commit73472c830eae5fce2107f7f086f1e6827d215caf (patch)
tree05f5fa82edc68681228deab51e37cb4ca8a8b594 /drivers/net/phy/sfp.c
parent5029be761161374a3624aa7b4670174c35449bf5 (diff)
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 maybe uses TX_FAULT as a serial port transmit pin. Rather than use these hardware signals, switch to using software polling for these status signals. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/phy/sfp.c')
-rw-r--r--drivers/net/phy/sfp.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index d2d66c691f97..cb1dbd0d9701 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -321,6 +321,15 @@ static void sfp_fixup_ignore_tx_fault(struct sfp *sfp)
sfp->tx_fault_ignore = true;
}
+static void sfp_fixup_halny_gsfp(struct sfp *sfp)
+{
+ /* Ignore the TX_FAULT and LOS signals on this module.
+ * these are possibly used for other purposes on this
+ * module, e.g. a serial port.
+ */
+ sfp->state_hw_mask &= ~(SFP_F_TX_FAULT | SFP_F_LOS);
+}
+
static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id,
unsigned long *modes)
{
@@ -353,6 +362,10 @@ static const struct sfp_quirk sfp_quirks[] = {
.modes = sfp_quirk_2500basex,
.fixup = sfp_fixup_long_startup,
}, {
+ .vendor = "HALNy",
+ .part = "HL-GSFP",
+ .fixup = sfp_fixup_halny_gsfp,
+ }, {
// Huawei MA5671A can operate at 2500base-X, but report 1.2GBd
// NRZ in their EEPROM
.vendor = "HUAWEI",
@@ -369,16 +382,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;