kernel: bump 6.1 to 6.1.34
[openwrt/openwrt.git] / target / linux / generic / hack-6.1 / 790-SFP-GE-T-ignore-TX_FAULT.patch
1 From 7cc39a6bedbd85f3ff7e16845f310e4ce8d9833f Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Tue, 6 Sep 2022 00:31:19 +0100
4 Subject: [PATCH] net: sfp: add quirk for ATS SFP-GE-T 1000Base-TX module
5 To: netdev@vger.kernel.org,
6 linux-kernel@vger.kernel.org,
7 Russell King <linux@armlinux.org.uk>,
8 Andrew Lunn <andrew@lunn.ch>,
9 Heiner Kallweit <hkallweit1@gmail.com>
10 Cc: David S. Miller <davem@davemloft.net>,
11 Eric Dumazet <edumazet@google.com>,
12 Jakub Kicinski <kuba@kernel.org>,
13 Paolo Abeni <pabeni@redhat.com>,
14 Josef Schlehofer <pepe.schlehofer@gmail.com>
15
16 This copper module comes with broken TX_FAULT indicator which must be
17 ignored for it to work. Implement ignoring TX_FAULT state bit also
18 during reset/insertion and mute the warning telling the user that the
19 module indicates TX_FAULT.
20
21 Co-authored-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
22 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
23 ---
24 drivers/net/phy/sfp.c | 14 +++++++++++---
25 1 file changed, 11 insertions(+), 3 deletions(-)
26
27 --- a/drivers/net/phy/sfp.c
28 +++ b/drivers/net/phy/sfp.c
29 @@ -404,6 +404,9 @@ static const struct sfp_quirk sfp_quirks
30 SFP_QUIRK("HUAWEI", "MA5671A", sfp_quirk_2500basex,
31 sfp_fixup_ignore_tx_fault),
32
33 + // OEM SFP-GE-T is 1000Base-T module
34 + SFP_QUIRK_F("OEM", "SFP-GE-T", sfp_fixup_ignore_tx_fault),
35 +
36 // Lantech 8330-262D-E can operate at 2500base-X, but incorrectly report
37 // 2500MBd NRZ in their EEPROM
38 SFP_QUIRK_M("Lantech", "8330-262D-E", sfp_quirk_2500basex),
39 @@ -2339,7 +2342,8 @@ static void sfp_sm_main(struct sfp *sfp,
40 * or t_start_up, so assume there is a fault.
41 */
42 sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
43 - sfp->sm_fault_retries == N_FAULT_INIT);
44 + !sfp->tx_fault_ignore &&
45 + (sfp->sm_fault_retries == N_FAULT_INIT));
46 } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
47 init_done:
48 /* Create mdiobus and start trying for PHY */
49 @@ -2568,10 +2572,12 @@ static void sfp_check_state(struct sfp *
50 mutex_lock(&sfp->st_mutex);
51 state = sfp_get_state(sfp);
52 changed = state ^ sfp->state;
53 - if (sfp->tx_fault_ignore)
54 + if (sfp->tx_fault_ignore) {
55 changed &= SFP_F_PRESENT | SFP_F_LOS;
56 - else
57 + state &= ~SFP_F_TX_FAULT;
58 + } else {
59 changed &= SFP_F_PRESENT | SFP_F_LOS | SFP_F_TX_FAULT;
60 + }
61
62 for (i = 0; i < GPIO_MAX; i++)
63 if (changed & BIT(i))