Commit d1a0ff5f authored by Maxime Chevallier's avatar Maxime Chevallier Committed by Jakub Kicinski

net: pcs: altera-tse: use read_poll_timeout to wait for reset

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: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 7f0c940b
...@@ -60,7 +60,6 @@ static void tse_pcs_write(struct altera_tse_pcs *tse_pcs, int regnum, ...@@ -60,7 +60,6 @@ static void tse_pcs_write(struct altera_tse_pcs *tse_pcs, int regnum,
static int tse_pcs_reset(struct altera_tse_pcs *tse_pcs) static int tse_pcs_reset(struct altera_tse_pcs *tse_pcs)
{ {
int i = 0;
u16 bmcr; u16 bmcr;
/* Reset PCS block */ /* Reset PCS block */
...@@ -68,13 +67,9 @@ static int tse_pcs_reset(struct altera_tse_pcs *tse_pcs) ...@@ -68,13 +67,9 @@ static int tse_pcs_reset(struct altera_tse_pcs *tse_pcs)
bmcr |= BMCR_RESET; bmcr |= BMCR_RESET;
tse_pcs_write(tse_pcs, MII_BMCR, bmcr); tse_pcs_write(tse_pcs, MII_BMCR, bmcr);
for (i = 0; i < SGMII_PCS_SW_RESET_TIMEOUT; i++) { return read_poll_timeout(tse_pcs_read, bmcr, (bmcr & BMCR_RESET),
if (!(tse_pcs_read(tse_pcs, MII_BMCR) & BMCR_RESET)) 10, SGMII_PCS_SW_RESET_TIMEOUT, 1,
return 0; tse_pcs, MII_BMCR);
udelay(1);
}
return -ETIMEDOUT;
} }
static int alt_tse_pcs_validate(struct phylink_pcs *pcs, static int alt_tse_pcs_validate(struct phylink_pcs *pcs,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment