Unified · Split
| @@ -172,6 +172,14 @@ static const enum gpiod_flags gpio_flags[] = { · 171 unmodified lines | ||
| 172 | 172 | #define T_RESET_US 10 |
| 173 | 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 | 183 | /* SFP module presence detection is poor: the three MOD DEF signals are |
| 176 | 184 | * the same length on the PCB, which means it's possible for MOD DEF 0 to |
| 177 | 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 | 1893 | sfp_module_tx_enable(sfp); |
| 1886 | 1894 | |
| 1887 | 1895 | /* Initialise the fault clearance retries */ |
| 1888 | − sfp->sm_retries = 5; | |
| 1896 | + sfp->sm_retries = N_FAULT_INIT; | |
| 1889 | 1897 | |
| 1890 | 1898 | /* We need to check the TX_FAULT state, which is not defined |
| 1891 | 1899 | * 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 | 1933 | * or t_start_up, so assume there is a fault. |
| 1926 | 1934 | */ |
| 1927 | 1935 | sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT, |
| 1928 | − sfp->sm_retries == 5); | |
| 1936 | + sfp->sm_retries == N_FAULT_INIT); | |
| 1929 | 1937 | } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) { |
| 1930 | 1938 | init_done: /* TX_FAULT deasserted or we timed out with TX_FAULT |
| 1931 | 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 | 1946 | sfp_sm_link_check_los(sfp); |
| 1939 | 1947 | |
| 1940 | 1948 | /* Reset the fault retry count */ |
| 1941 | − sfp->sm_retries = 5; | |
| 1949 | + sfp->sm_retries = N_FAULT; | |
| 1942 | 1950 | } |
| 1943 | 1951 | break; |
| 1944 | 1952 | |