History

net: sfp: use a definition for the fault recovery attempts

Russell King committed 6 years ago

Commit 65ef2d51 parent b58e9fd1 file · +11 −3Browse files

Unified · Split

drivers/net/phy/sfp.c+11−3
@@ -172,6 +172,14 @@ static const enum gpiod_flags gpio_flags[] = { · 171 unmodified lines
172172 #define T_RESET_US 10
173173 #define T_FAULT_RECOVER msecs_to_jiffies(1000)
174174
175+/* N_FAULT_INIT is the number of recovery attempts at module initialisation
176+ * time. If the TX_FAULT signal is not deasserted after this number of
177+ * attempts at clearing it, we decide that the module is faulty.
178+ * N_FAULT is the same but after the module has initialised.
179+ */
180+#define N_FAULT_INIT 5
181+#define N_FAULT 5
182+
175183 /* SFP module presence detection is poor: the three MOD DEF signals are
176184 * the same length on the PCB, which means it's possible for MOD DEF 0 to
177185 * connect before the I2C bus on MOD DEF 1/2.
@@ -1885,7 +1893,7 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event) · 1707 unmodified lines
18851893 sfp_module_tx_enable(sfp);
18861894
18871895 /* Initialise the fault clearance retries */
1888− sfp->sm_retries = 5;
1896+ sfp->sm_retries = N_FAULT_INIT;
18891897
18901898 /* We need to check the TX_FAULT state, which is not defined
18911899 * while TX_DISABLE is asserted. The earliest we want to do
@@ -1925,7 +1933,7 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event) · 33 unmodified lines
19251933 * or t_start_up, so assume there is a fault.
19261934 */
19271935 sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
1928− sfp->sm_retries == 5);
1936+ sfp->sm_retries == N_FAULT_INIT);
19291937 } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
19301938 init_done: /* TX_FAULT deasserted or we timed out with TX_FAULT
19311939 * clear. Probe for the PHY and check the LOS state.
@@ -1938,7 +1946,7 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event) · 6 unmodified lines
19381946 sfp_sm_link_check_los(sfp);
19391947
19401948 /* Reset the fault retry count */
1941− sfp->sm_retries = 5;
1949+ sfp->sm_retries = N_FAULT;
19421950 }
19431951 break;
19441952

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t