0b085ff09471b35dc2d8249f5aed21dc8095a943
[openwrt/openwrt.git] / target / linux / generic / backport-5.4 / 743-v5.5-net-sfp-add-some-quirks-for-GPON-modules.patch
1 From ecaa542cfed078dbc356dadff0bad4b6a8e704a0 Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 17 May 2019 10:14:45 +0100
4 Subject: [PATCH 641/660] net: sfp: add some quirks for GPON modules
5
6 Marc Micalizzi reports that Huawei MA5671A and Alcatel/Lucent G-010S-P
7 modules are capable of 2500base-X, but incorrectly report their
8 capabilities in the EEPROM. It seems rather common that GPON modules
9 mis-report.
10
11 Let's fix these modules by adding some quirks.
12
13 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
14 ---
15 drivers/net/phy/sfp-bus.c | 25 +++++++++++++++++++++++++
16 1 file changed, 25 insertions(+)
17
18 --- a/drivers/net/phy/sfp-bus.c
19 +++ b/drivers/net/phy/sfp-bus.c
20 @@ -38,7 +38,32 @@ struct sfp_bus {
21 bool started;
22 };
23
24 +static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id,
25 + unsigned long *modes)
26 +{
27 + phylink_set(modes, 2500baseX_Full);
28 +}
29 +
30 static const struct sfp_quirk sfp_quirks[] = {
31 + {
32 + // Alcatel Lucent G-010S-P can operate at 2500base-X, but
33 + // incorrectly report 2500MBd NRZ in their EEPROM
34 + .vendor = "ALCATELLUCENT",
35 + .part = "G010SP",
36 + .modes = sfp_quirk_2500basex,
37 + }, {
38 + // Alcatel Lucent G-010S-A can operate at 2500base-X, but
39 + // report 3.2GBd NRZ in their EEPROM
40 + .vendor = "ALCATELLUCENT",
41 + .part = "3FE46541AA",
42 + .modes = sfp_quirk_2500basex,
43 + }, {
44 + // Huawei MA5671A can operate at 2500base-X, but report 1.2GBd
45 + // NRZ in their EEPROM
46 + .vendor = "HUAWEI",
47 + .part = "MA5671A",
48 + .modes = sfp_quirk_2500basex,
49 + },
50 };
51
52 static size_t sfp_strlen(const char *str, size_t maxlen)