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
172#define T_RESET_US 10172#define T_RESET_US 10
173#define T_FAULT_RECOVER msecs_to_jiffies(1000)173#define T_FAULT_RECOVER msecs_to_jiffies(1000)
174 174
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
175/* SFP module presence detection is poor: the three MOD DEF signals are183/* SFP module presence detection is poor: the three MOD DEF signals are
176 * the same length on the PCB, which means it's possible for MOD DEF 0 to184 * the same length on the PCB, which means it's possible for MOD DEF 0 to
177 * connect before the I2C bus on MOD DEF 1/2.185 * 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
1885 sfp_module_tx_enable(sfp);1893 sfp_module_tx_enable(sfp);
1886 1894
1887 /* Initialise the fault clearance retries */1895 /* Initialise the fault clearance retries */
1888 sfp->sm_retries = 5;1896 sfp->sm_retries = N_FAULT_INIT;
1889 1897
1890 /* We need to check the TX_FAULT state, which is not defined1898 /* We need to check the TX_FAULT state, which is not defined
1891 * while TX_DISABLE is asserted. The earliest we want to do1899 * 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
1925 * or t_start_up, so assume there is a fault.1933 * or t_start_up, so assume there is a fault.
1926 */1934 */
1927 sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,1935 sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
1928 sfp->sm_retries == 5);1936 sfp->sm_retries == N_FAULT_INIT);
1929 } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {1937 } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
1930 init_done: /* TX_FAULT deasserted or we timed out with TX_FAULT1938 init_done: /* TX_FAULT deasserted or we timed out with TX_FAULT
1931 * clear. Probe for the PHY and check the LOS state.1939 * 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
1938 sfp_sm_link_check_los(sfp);1946 sfp_sm_link_check_los(sfp);
1939 1947
1940 /* Reset the fault retry count */1948 /* Reset the fault retry count */
1941 sfp->sm_retries = 5;1949 sfp->sm_retries = N_FAULT;
1942 }1950 }
1943 break;1951 break;
1944 1952

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