generic: 5.15: move pending xtx nand patch from pending to backport
[openwrt/openwrt.git] / target / linux / generic / pending-5.15 / 771-net-sfp-move-Alcatel-Lucent-3FE46541AA-fixup.patch
1 From 21fdd8281de3022aee35dd5bfccc892bd46529a3 Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 26 Aug 2022 08:43:35 +0100
4 Subject: [PATCH 2/6] net: sfp: move Alcatel Lucent 3FE46541AA fixup
5
6 Add a new fixup mechanism to the SFP quirks, and use it for this
7 module.
8
9 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
10 ---
11 drivers/net/phy/sfp.c | 14 +++++++++-----
12 drivers/net/phy/sfp.h | 1 +
13 2 files changed, 10 insertions(+), 5 deletions(-)
14
15 --- a/drivers/net/phy/sfp.c
16 +++ b/drivers/net/phy/sfp.c
17 @@ -310,6 +310,11 @@ static const struct of_device_id sfp_of_
18 };
19 MODULE_DEVICE_TABLE(of, sfp_of_match);
20
21 +static void sfp_fixup_long_startup(struct sfp *sfp)
22 +{
23 + sfp->module_t_start_up = T_START_UP_BAD_GPON;
24 +}
25 +
26 static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id,
27 unsigned long *modes)
28 {
29 @@ -340,6 +345,7 @@ static const struct sfp_quirk sfp_quirks
30 .vendor = "ALCATELLUCENT",
31 .part = "3FE46541AA",
32 .modes = sfp_quirk_2500basex,
33 + .fixup = sfp_fixup_long_startup,
34 }, {
35 // Huawei MA5671A can operate at 2500base-X, but report 1.2GBd
36 // NRZ in their EEPROM
37 @@ -2029,11 +2035,7 @@ static int sfp_sm_mod_probe(struct sfp *
38 if (ret < 0)
39 return ret;
40
41 - if (!memcmp(id.base.vendor_name, "ALCATELLUCENT ", 16) &&
42 - !memcmp(id.base.vendor_pn, "3FE46541AA ", 16))
43 - sfp->module_t_start_up = T_START_UP_BAD_GPON;
44 - else
45 - sfp->module_t_start_up = T_START_UP;
46 + sfp->module_t_start_up = T_START_UP;
47
48 if (!memcmp(id.base.vendor_name, "HUAWEI ", 16) &&
49 !memcmp(id.base.vendor_pn, "MA5671A ", 16))
50 @@ -2042,6 +2044,8 @@ static int sfp_sm_mod_probe(struct sfp *
51 sfp->tx_fault_ignore = false;
52
53 sfp->quirk = sfp_lookup_quirk(&id);
54 + if (sfp->quirk && sfp->quirk->fixup)
55 + sfp->quirk->fixup(sfp);
56
57 return 0;
58 }
59 --- a/drivers/net/phy/sfp.h
60 +++ b/drivers/net/phy/sfp.h
61 @@ -10,6 +10,7 @@ struct sfp_quirk {
62 const char *vendor;
63 const char *part;
64 void (*modes)(const struct sfp_eeprom_id *id, unsigned long *modes);
65 + void (*fixup)(struct sfp *sfp);
66 };
67
68 struct sfp_socket_ops {