@@ -191,7 +191,7 @@ static const enum gpiod_flags gpio_flags[] = {
191
191
* R_PHY_RETRY is the number of attempts.
192
192
*/
193
193
#define T_PHY_RETRY msecs_to_jiffies(50)
194
- #define R_PHY_RETRY 12
194
+ #define R_PHY_RETRY 25
195
195
196
196
/* SFP module presence detection is poor: the three MOD DEF signals are
197
197
* the same length on the PCB, which means it's possible for MOD DEF 0 to
@@ -274,7 +274,7 @@ struct sfp {
274
274
struct sfp_eeprom_id id ;
275
275
unsigned int module_power_mW ;
276
276
unsigned int module_t_start_up ;
277
- unsigned int module_t_wait ;
277
+ unsigned int phy_t_retry ;
278
278
279
279
unsigned int rate_kbd ;
280
280
unsigned int rs_threshold_kbd ;
@@ -372,18 +372,22 @@ static void sfp_fixup_10gbaset_30m(struct sfp *sfp)
372
372
sfp -> id .base .extended_cc = SFF8024_ECC_10GBASE_T_SR ;
373
373
}
374
374
375
- static void sfp_fixup_rollball_proto (struct sfp * sfp , unsigned int secs )
375
+ static void sfp_fixup_rollball (struct sfp * sfp )
376
376
{
377
377
sfp -> mdio_protocol = MDIO_I2C_ROLLBALL ;
378
- sfp -> module_t_wait = msecs_to_jiffies (secs * 1000 );
378
+
379
+ /* RollBall modules may disallow access to PHY registers for up to 25
380
+ * seconds, and the reads return 0xffff before that. Increase the time
381
+ * between PHY probe retries from 50ms to 1s so that we will wait for
382
+ * the PHY for a sufficient amount of time.
383
+ */
384
+ sfp -> phy_t_retry = msecs_to_jiffies (1000 );
379
385
}
380
386
381
387
static void sfp_fixup_fs_10gt (struct sfp * sfp )
382
388
{
383
389
sfp_fixup_10gbaset_30m (sfp );
384
-
385
- // These SFPs need 4 seconds before the PHY can be accessed
386
- sfp_fixup_rollball_proto (sfp , 4 );
390
+ sfp_fixup_rollball (sfp );
387
391
}
388
392
389
393
static void sfp_fixup_halny_gsfp (struct sfp * sfp )
@@ -395,12 +399,6 @@ static void sfp_fixup_halny_gsfp(struct sfp *sfp)
395
399
sfp -> state_hw_mask &= ~(SFP_F_TX_FAULT | SFP_F_LOS );
396
400
}
397
401
398
- static void sfp_fixup_rollball (struct sfp * sfp )
399
- {
400
- // Rollball SFPs need 25 seconds before the PHY can be accessed
401
- sfp_fixup_rollball_proto (sfp , 25 );
402
- }
403
-
404
402
static void sfp_fixup_rollball_cc (struct sfp * sfp )
405
403
{
406
404
sfp_fixup_rollball (sfp );
@@ -2331,7 +2329,7 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report)
2331
2329
mask |= SFP_F_RS1 ;
2332
2330
2333
2331
sfp -> module_t_start_up = T_START_UP ;
2334
- sfp -> module_t_wait = T_WAIT ;
2332
+ sfp -> phy_t_retry = T_PHY_RETRY ;
2335
2333
2336
2334
sfp -> state_ignore_mask = 0 ;
2337
2335
@@ -2568,10 +2566,9 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
2568
2566
2569
2567
/* We need to check the TX_FAULT state, which is not defined
2570
2568
* while TX_DISABLE is asserted. The earliest we want to do
2571
- * anything (such as probe for a PHY) is 50ms (or more on
2572
- * specific modules).
2569
+ * anything (such as probe for a PHY) is 50ms.
2573
2570
*/
2574
- sfp_sm_next (sfp , SFP_S_WAIT , sfp -> module_t_wait );
2571
+ sfp_sm_next (sfp , SFP_S_WAIT , T_WAIT );
2575
2572
break ;
2576
2573
2577
2574
case SFP_S_WAIT :
@@ -2585,8 +2582,8 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
2585
2582
* deasserting.
2586
2583
*/
2587
2584
timeout = sfp -> module_t_start_up ;
2588
- if (timeout > sfp -> module_t_wait )
2589
- timeout -= sfp -> module_t_wait ;
2585
+ if (timeout > T_WAIT )
2586
+ timeout -= T_WAIT ;
2590
2587
else
2591
2588
timeout = 1 ;
2592
2589
@@ -2629,7 +2626,11 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
2629
2626
ret = sfp_sm_probe_for_phy (sfp );
2630
2627
if (ret == - ENODEV ) {
2631
2628
if (-- sfp -> sm_phy_retries ) {
2632
- sfp_sm_next (sfp , SFP_S_INIT_PHY , T_PHY_RETRY );
2629
+ sfp_sm_next (sfp , SFP_S_INIT_PHY ,
2630
+ sfp -> phy_t_retry );
2631
+ dev_dbg (sfp -> dev ,
2632
+ "no PHY detected, %u tries left\n" ,
2633
+ sfp -> sm_phy_retries );
2633
2634
break ;
2634
2635
} else {
2635
2636
dev_info (sfp -> dev , "no PHY detected\n" );
0 commit comments