Skip to content

Commit

Permalink
net: pcs: altera-tse: use read_poll_timeout to wait for reset
Browse files Browse the repository at this point in the history
Software resets on the TSE PCS don't clear registers, but rather reset
all internal state machines regarding AN, comma detection and
encoding/decoding. Use read_poll_timeout to wait for the reset to clear
instead of manually polling the register.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Maxime Chevallier authored and Jakub Kicinski committed Nov 30, 2022
1 parent 7f0c940 commit d1a0ff5
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/net/pcs/pcs-altera-tse.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,16 @@ static void tse_pcs_write(struct altera_tse_pcs *tse_pcs, int regnum,

static int tse_pcs_reset(struct altera_tse_pcs *tse_pcs)
{
int i = 0;
u16 bmcr;

/* Reset PCS block */
bmcr = tse_pcs_read(tse_pcs, MII_BMCR);
bmcr |= BMCR_RESET;
tse_pcs_write(tse_pcs, MII_BMCR, bmcr);

for (i = 0; i < SGMII_PCS_SW_RESET_TIMEOUT; i++) {
if (!(tse_pcs_read(tse_pcs, MII_BMCR) & BMCR_RESET))
return 0;
udelay(1);
}

return -ETIMEDOUT;
return read_poll_timeout(tse_pcs_read, bmcr, (bmcr & BMCR_RESET),
10, SGMII_PCS_SW_RESET_TIMEOUT, 1,
tse_pcs, MII_BMCR);
}

static int alt_tse_pcs_validate(struct phylink_pcs *pcs,
Expand Down

0 comments on commit d1a0ff5

Please sign in to comment.