aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/pending-4.19/756-net-sfp-use-a-definition-for-the-fault-recovery-atte.patch
diff options
context:
space:
mode:
authorJonas Gorski <jonas.gorski@gmail.com>2019-12-04 23:11:34 +0100
committerJonas Gorski <jonas.gorski@gmail.com>2020-01-21 22:32:48 +0100
commit947163b9d28db96923f91301d2289ec195a3f61f (patch)
treefa6ef5086ecb603a58651141e24c5f3a6c6c7ee4 /target/linux/generic/pending-4.19/756-net-sfp-use-a-definition-for-the-fault-recovery-atte.patch
parent10b12b5d687215d4f9dfd3bb4012d861ebdad84f (diff)
downloadupstream-947163b9d28db96923f91301d2289ec195a3f61f.tar.gz
upstream-947163b9d28db96923f91301d2289ec195a3f61f.tar.bz2
upstream-947163b9d28db96923f91301d2289ec195a3f61f.zip
kernel: sfp: re-attempt probing for phy
Add patches retrying to probe the PHY to restore support for PHYs taking longer to initialize without breaking modules without PHYs. Patches taken from http://git.armlinux.org.uk/cgit/linux-arm.git/log/?h=phy Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux/generic/pending-4.19/756-net-sfp-use-a-definition-for-the-fault-recovery-atte.patch')
-rw-r--r--target/linux/generic/pending-4.19/756-net-sfp-use-a-definition-for-the-fault-recovery-atte.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/target/linux/generic/pending-4.19/756-net-sfp-use-a-definition-for-the-fault-recovery-atte.patch b/target/linux/generic/pending-4.19/756-net-sfp-use-a-definition-for-the-fault-recovery-atte.patch
new file mode 100644
index 0000000000..0e5005ed19
--- /dev/null
+++ b/target/linux/generic/pending-4.19/756-net-sfp-use-a-definition-for-the-fault-recovery-atte.patch
@@ -0,0 +1,55 @@
+From 4d6bfb6fbb00af38402db4d1ce464e22def9fd9e Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Thu, 28 Nov 2019 14:24:40 +0000
+Subject: [PATCH 1/4] net: sfp: use a definition for the fault recovery
+ attempts
+
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+---
+ drivers/net/phy/sfp.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -160,6 +160,14 @@ static const enum gpiod_flags gpio_flags
+ #define T_RESET_US 10
+ #define T_FAULT_RECOVER msecs_to_jiffies(1000)
+
++/* N_FAULT_INIT is the number of recovery attempts at module initialisation
++ * time. If the TX_FAULT signal is not deasserted after this number of
++ * attempts at clearing it, we decide that the module is faulty.
++ * N_FAULT is the same but after the module has initialised.
++ */
++#define N_FAULT_INIT 5
++#define N_FAULT 5
++
+ /* SFP module presence detection is poor: the three MOD DEF signals are
+ * the same length on the PCB, which means it's possible for MOD DEF 0 to
+ * connect before the I2C bus on MOD DEF 1/2.
+@@ -1803,7 +1811,7 @@ static void sfp_sm_main(struct sfp *sfp,
+ sfp_module_tx_enable(sfp);
+
+ /* Initialise the fault clearance retries */
+- sfp->sm_retries = 5;
++ sfp->sm_retries = N_FAULT_INIT;
+
+ /* We need to check the TX_FAULT state, which is not defined
+ * while TX_DISABLE is asserted. The earliest we want to do
+@@ -1842,7 +1850,7 @@ static void sfp_sm_main(struct sfp *sfp,
+ * there is a fault.
+ */
+ sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
+- sfp->sm_retries == 5);
++ sfp->sm_retries == N_FAULT_INIT);
+ } 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.
+@@ -1855,7 +1863,7 @@ static void sfp_sm_main(struct sfp *sfp,
+ sfp_sm_link_check_los(sfp);
+
+ /* Reset the fault retry count */
+- sfp->sm_retries = 5;
++ sfp->sm_retries = N_FAULT;
+ }
+ break;
+