aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/backport-4.19/731-v5.5-net-sfp-ensure-TX_FAULT-has-deasserted-before-probin.patch
diff options
context:
space:
mode:
authorRussell King <linux@armlinux.org.uk>2019-11-27 11:45:25 +0000
committerJonas Gorski <jonas.gorski@gmail.com>2020-01-21 22:32:48 +0100
commit1c16b574c4f77a30a0268acee30be96ae0dc5948 (patch)
tree716fd94ee81e332ba19e1af7bf98371120ea1856 /target/linux/generic/backport-4.19/731-v5.5-net-sfp-ensure-TX_FAULT-has-deasserted-before-probin.patch
parenta07638eb24b8310a35ea6c3b09f6db59bb31cd68 (diff)
downloadupstream-1c16b574c4f77a30a0268acee30be96ae0dc5948.tar.gz
upstream-1c16b574c4f77a30a0268acee30be96ae0dc5948.tar.bz2
upstream-1c16b574c4f77a30a0268acee30be96ae0dc5948.zip
kernel: add backported phy/phylink/sfp patches
Backport the phy/phylink/sfp patches currently queued in netdev or in mainline necessary to support GPON popular modules, specifically to support Huawei and Nokia GPON modules. Signed-off-by: Russell King <linux@armlinux.org.uk> [jonas.gorski: include kernel version in file names, refresh patches] Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux/generic/backport-4.19/731-v5.5-net-sfp-ensure-TX_FAULT-has-deasserted-before-probin.patch')
-rw-r--r--target/linux/generic/backport-4.19/731-v5.5-net-sfp-ensure-TX_FAULT-has-deasserted-before-probin.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/target/linux/generic/backport-4.19/731-v5.5-net-sfp-ensure-TX_FAULT-has-deasserted-before-probin.patch b/target/linux/generic/backport-4.19/731-v5.5-net-sfp-ensure-TX_FAULT-has-deasserted-before-probin.patch
new file mode 100644
index 0000000000..03415fb6e7
--- /dev/null
+++ b/target/linux/generic/backport-4.19/731-v5.5-net-sfp-ensure-TX_FAULT-has-deasserted-before-probin.patch
@@ -0,0 +1,80 @@
+From 38b62a12231be4b86fc5ca5477579d29831c02a5 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Fri, 18 Oct 2019 10:31:07 +0100
+Subject: [PATCH 629/660] net: sfp: ensure TX_FAULT has deasserted before
+ probing the PHY
+
+TX_FAULT should be deasserted to indicate that the module has completed
+its initialisation. This may include the on-board PHY, so wait until
+the module has deasserted TX_FAULT before probing the PHY.
+
+This means that we need an extra state to handle a TX_FAULT that
+remains set for longer than t_init, since using the existing handling
+state would bypass the PHY probe.
+
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+---
+ drivers/net/phy/sfp.c | 31 +++++++++++++++++++++++++------
+ 1 file changed, 25 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -54,6 +54,7 @@ enum {
+ SFP_S_DOWN = 0,
+ SFP_S_WAIT,
+ SFP_S_INIT,
++ SFP_S_INIT_TX_FAULT,
+ SFP_S_WAIT_LOS,
+ SFP_S_LINK_UP,
+ SFP_S_TX_FAULT,
+@@ -111,6 +112,7 @@ static const char * const sm_state_strin
+ [SFP_S_DOWN] = "down",
+ [SFP_S_WAIT] = "wait",
+ [SFP_S_INIT] = "init",
++ [SFP_S_INIT_TX_FAULT] = "init_tx_fault",
+ [SFP_S_WAIT_LOS] = "wait_los",
+ [SFP_S_LINK_UP] = "link_up",
+ [SFP_S_TX_FAULT] = "tx_fault",
+@@ -1595,8 +1597,6 @@ static void sfp_sm_main(struct sfp *sfp,
+ if (event != SFP_E_TIMEOUT)
+ break;
+
+- sfp_sm_probe_for_phy(sfp);
+-
+ if (sfp->state & SFP_F_TX_FAULT) {
+ /* Wait t_init before indicating that the link is up,
+ * provided the current state indicates no TX_FAULT. If
+@@ -1618,10 +1618,29 @@ static void sfp_sm_main(struct sfp *sfp,
+ break;
+
+ case SFP_S_INIT:
+- if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT)
+- sfp_sm_fault(sfp, SFP_S_TX_FAULT, true);
+- else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR)
+- init_done: sfp_sm_link_check_los(sfp);
++ if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT) {
++ /* TX_FAULT is still asserted after t_init, so assume
++ * there is a fault.
++ */
++ sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
++ sfp->sm_retries == 5);
++ } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
++ init_done: /* TX_FAULT deasserted or we timed out with TX_FAULT
++ * clear. Probe for the PHY and check the LOS state.
++ */
++ sfp_sm_probe_for_phy(sfp);
++ sfp_sm_link_check_los(sfp);
++
++ /* Reset the fault retry count */
++ sfp->sm_retries = 5;
++ }
++ break;
++
++ case SFP_S_INIT_TX_FAULT:
++ if (event == SFP_E_TIMEOUT) {
++ sfp_module_tx_fault_reset(sfp);
++ sfp_sm_next(sfp, SFP_S_INIT, T_INIT_JIFFIES);
++ }
+ break;
+
+ case SFP_S_WAIT_LOS: