kernel: bump 5.10 to 5.10.114
[openwrt/openwrt.git] / target / linux / generic / backport-5.10 / 711-v5.12-sfp-add-support-for-100-base-x-SFPs.patch
1 From 6e12f35cef6b8a458d7ecf507ae330e0bffaad8c Mon Sep 17 00:00:00 2001
2 From: Bjarni Jonasson <bjarni.jonasson@microchip.com>
3 Date: Wed, 13 Jan 2021 12:56:26 +0100
4 Subject: [PATCH] sfp: add support for 100 base-x SFPs
5
6 Add support for 100Base-FX, 100Base-LX, 100Base-PX and 100Base-BX10 modules
7 This is needed for Sparx-5 switch.
8
9 Signed-off-by: Bjarni Jonasson <bjarni.jonasson@microchip.com>
10 Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk>
11 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12 ---
13 drivers/net/phy/sfp-bus.c | 9 +++++++++
14 1 file changed, 9 insertions(+)
15
16 --- a/drivers/net/phy/sfp-bus.c
17 +++ b/drivers/net/phy/sfp-bus.c
18 @@ -286,6 +286,12 @@ void sfp_parse_support(struct sfp_bus *b
19 br_min <= 1300 && br_max >= 1200)
20 phylink_set(modes, 1000baseX_Full);
21
22 + /* 100Base-FX, 100Base-LX, 100Base-PX, 100Base-BX10 */
23 + if (id->base.e100_base_fx || id->base.e100_base_lx)
24 + phylink_set(modes, 100baseFX_Full);
25 + if ((id->base.e_base_px || id->base.e_base_bx10) && br_nom == 100)
26 + phylink_set(modes, 100baseFX_Full);
27 +
28 /* For active or passive cables, select the link modes
29 * based on the bit rates and the cable compliance bytes.
30 */
31 @@ -405,6 +411,9 @@ phy_interface_t sfp_select_interface(str
32 if (phylink_test(link_modes, 1000baseX_Full))
33 return PHY_INTERFACE_MODE_1000BASEX;
34
35 + if (phylink_test(link_modes, 100baseFX_Full))
36 + return PHY_INTERFACE_MODE_100BASEX;
37 +
38 dev_warn(bus->sfp_dev, "Unable to ascertain link mode\n");
39
40 return PHY_INTERFACE_MODE_NA;