Skip to content

Commit

Permalink
net: sfp: split the PHY probe from sfp_sm_mod_init()
Browse files Browse the repository at this point in the history
Move the PHY probe into a separate function, splitting it from
sfp_sm_mod_init().  This will allow us to eliminate the 50ms mdelay()
inside the state machine.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Russell King authored and David S. Miller committed Nov 12, 2019
1 parent 8e210b6 commit 181f29d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions drivers/net/phy/sfp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1353,14 +1353,10 @@ static void sfp_sm_fault(struct sfp *sfp, bool warn)
static void sfp_sm_mod_init(struct sfp *sfp)
{
sfp_module_tx_enable(sfp);
}

/* Wait t_init before indicating that the link is up, provided the
* current state indicates no TX_FAULT. If TX_FAULT clears before
* this time, that's fine too.
*/
sfp_sm_next(sfp, SFP_S_INIT, T_INIT_JIFFIES);
sfp->sm_retries = 5;

static void sfp_sm_probe_for_phy(struct sfp *sfp)
{
/* Setting the serdes link mode is guesswork: there's no
* field in the EEPROM which indicates what mode should
* be used.
Expand Down Expand Up @@ -1645,8 +1641,17 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
switch (sfp->sm_state) {
case SFP_S_DOWN:
if (sfp->sm_mod_state == SFP_MOD_PRESENT &&
sfp->sm_dev_state == SFP_DEV_UP)
sfp->sm_dev_state == SFP_DEV_UP) {
sfp_sm_mod_init(sfp);
sfp_sm_probe_for_phy(sfp);

/* Wait t_init before indicating that the link is up,
* provided the current state indicates no TX_FAULT. If
* TX_FAULT clears before this time, that's fine too.
*/
sfp_sm_next(sfp, SFP_S_INIT, T_INIT_JIFFIES);
sfp->sm_retries = 5;
}
break;

case SFP_S_INIT:
Expand Down

0 comments on commit 181f29d

Please sign in to comment.