Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: sfp: fix PHY discovery for FS SFP-10G-T module

Commit 2f3ce7a56c6e ("net: sfp: rework the RollBall PHY waiting code")
changed the long wait before accessing RollBall / FS modules into
probing for PHY every 1 second, and trying 25 times.

Wei Lei reports that this does not work correctly on FS modules: when
initializing, they may report values different from 0xffff in PHY ID
registers for some MMDs, causing get_phy_c45_ids() to find some bogus
MMD.

Fix this by adding the module_t_wait member back, and setting it to 4
seconds for FS modules.

Fixes: 2f3ce7a56c6e ("net: sfp: rework the RollBall PHY waiting code")
Reported-by: Wei Lei <quic_leiwei@quicinc.com>
Signed-off-by: Marek Behún <kabel@kernel.org>
Tested-by: Lei Wei <quic_leiwei@quicinc.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Marek Behún and committed by
David S. Miller
e9301af3 3b83fa94

+13 -4
+13 -4
drivers/net/phy/sfp.c
··· 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 278 unsigned int phy_t_retry; 278 279 279 280 unsigned int rate_kbd; ··· 389 388 { 390 389 sfp_fixup_10gbaset_30m(sfp); 391 390 sfp_fixup_rollball(sfp); 391 + 392 + /* The RollBall fixup is not enough for FS modules, the AQR chip inside 393 + * them does not return 0xffff for PHY ID registers in all MMDs for the 394 + * while initializing. They need a 4 second wait before accessing PHY. 395 + */ 396 + sfp->module_t_wait = msecs_to_jiffies(4000); 392 397 } 393 398 394 399 static void sfp_fixup_halny_gsfp(struct sfp *sfp) ··· 2336 2329 mask |= SFP_F_RS1; 2337 2330 2338 2331 sfp->module_t_start_up = T_START_UP; 2332 + sfp->module_t_wait = T_WAIT; 2339 2333 sfp->phy_t_retry = T_PHY_RETRY; 2340 2334 2341 2335 sfp->state_ignore_mask = 0; ··· 2574 2566 2575 2567 /* We need to check the TX_FAULT state, which is not defined 2576 2568 * while TX_DISABLE is asserted. The earliest we want to do 2577 - * anything (such as probe for a PHY) is 50ms. 2569 + * anything (such as probe for a PHY) is 50ms (or more on 2570 + * specific modules). 2578 2571 */ 2579 - sfp_sm_next(sfp, SFP_S_WAIT, T_WAIT); 2572 + sfp_sm_next(sfp, SFP_S_WAIT, sfp->module_t_wait); 2580 2573 break; 2581 2574 2582 2575 case SFP_S_WAIT: ··· 2591 2582 * deasserting. 2592 2583 */ 2593 2584 timeout = sfp->module_t_start_up; 2594 - if (timeout > T_WAIT) 2595 - timeout -= T_WAIT; 2585 + if (timeout > sfp->module_t_wait) 2586 + timeout -= sfp->module_t_wait; 2596 2587 else 2597 2588 timeout = 1; 2598 2589