Skip to content

Commit e9301af

Browse files
elkablodavem330
authored andcommitted
net: sfp: fix PHY discovery for FS SFP-10G-T module
Commit 2f3ce7a ("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: 2f3ce7a ("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>
1 parent 3b83fa9 commit e9301af

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

drivers/net/phy/sfp.c

+13-4
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ struct sfp {
274274
struct sfp_eeprom_id id;
275275
unsigned int module_power_mW;
276276
unsigned int module_t_start_up;
277+
unsigned int module_t_wait;
277278
unsigned int phy_t_retry;
278279

279280
unsigned int rate_kbd;
@@ -388,6 +389,12 @@ static void sfp_fixup_fs_10gt(struct sfp *sfp)
388389
{
389390
sfp_fixup_10gbaset_30m(sfp);
390391
sfp_fixup_rollball(sfp);
392+
393+
/* The RollBall fixup is not enough for FS modules, the AQR chip inside
394+
* them does not return 0xffff for PHY ID registers in all MMDs for the
395+
* while initializing. They need a 4 second wait before accessing PHY.
396+
*/
397+
sfp->module_t_wait = msecs_to_jiffies(4000);
391398
}
392399

393400
static void sfp_fixup_halny_gsfp(struct sfp *sfp)
@@ -2329,6 +2336,7 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report)
23292336
mask |= SFP_F_RS1;
23302337

23312338
sfp->module_t_start_up = T_START_UP;
2339+
sfp->module_t_wait = T_WAIT;
23322340
sfp->phy_t_retry = T_PHY_RETRY;
23332341

23342342
sfp->state_ignore_mask = 0;
@@ -2566,9 +2574,10 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
25662574

25672575
/* We need to check the TX_FAULT state, which is not defined
25682576
* while TX_DISABLE is asserted. The earliest we want to do
2569-
* anything (such as probe for a PHY) is 50ms.
2577+
* anything (such as probe for a PHY) is 50ms (or more on
2578+
* specific modules).
25702579
*/
2571-
sfp_sm_next(sfp, SFP_S_WAIT, T_WAIT);
2580+
sfp_sm_next(sfp, SFP_S_WAIT, sfp->module_t_wait);
25722581
break;
25732582

25742583
case SFP_S_WAIT:
@@ -2582,8 +2591,8 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
25822591
* deasserting.
25832592
*/
25842593
timeout = sfp->module_t_start_up;
2585-
if (timeout > T_WAIT)
2586-
timeout -= T_WAIT;
2594+
if (timeout > sfp->module_t_wait)
2595+
timeout -= sfp->module_t_wait;
25872596
else
25882597
timeout = 1;
25892598

0 commit comments

Comments
 (0)