Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134997
b: refs/heads/master
c: 22ef02c
h: refs/heads/master
i:
  134995: 8fc5c90
v: v3
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Mar 2, 2009
1 parent dbc417b commit 471f537
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c747583d19d5d5147a9f0eae480c1fdbc84c4252
refs/heads/master: 22ef02c23a236cb825b13f3335ff05ef5072a03d
45 changes: 24 additions & 21 deletions trunk/drivers/net/sfc/tenxpress.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,31 +679,33 @@ static int sft9001_run_tests(struct efx_nic *efx, int *results, unsigned flags)
{
struct ethtool_cmd ecmd;
int phy_id = efx->mii.phy_id;
int rc = 0, rc2, i, res_reg;
int rc = 0, rc2, i, ctrl_reg, res_reg;

if (!(flags & ETH_TEST_FL_OFFLINE))
return 0;

efx->phy_op->get_settings(efx, &ecmd);
if (flags & ETH_TEST_FL_OFFLINE)
efx->phy_op->get_settings(efx, &ecmd);

/* Initialise cable diagnostic results to unknown failure */
for (i = 1; i < 9; ++i)
results[i] = -1;

/* Run cable diagnostics; wait up to 5 seconds for them to complete.
* A cable fault is not a self-test failure, but a timeout is. */
ctrl_reg = ((1 << CDIAG_CTRL_IMMED_LBN) |
(CDIAG_CTRL_LEN_METRES << CDIAG_CTRL_LEN_UNIT_LBN));
if (flags & ETH_TEST_FL_OFFLINE) {
/* Break the link in order to run full diagnostics. We
* must reset the PHY to resume normal service. */
ctrl_reg |= (1 << CDIAG_CTRL_BRK_LINK_LBN);
}
mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD,
PMA_PMD_CDIAG_CTRL_REG,
(1 << CDIAG_CTRL_IMMED_LBN) |
(1 << CDIAG_CTRL_BRK_LINK_LBN) |
(CDIAG_CTRL_LEN_METRES << CDIAG_CTRL_LEN_UNIT_LBN));
PMA_PMD_CDIAG_CTRL_REG, ctrl_reg);
i = 0;
while (mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD,
PMA_PMD_CDIAG_CTRL_REG) &
(1 << CDIAG_CTRL_IN_PROG_LBN)) {
if (++i == 50) {
rc = -ETIMEDOUT;
goto reset;
goto out;
}
msleep(100);
}
Expand All @@ -728,17 +730,18 @@ static int sft9001_run_tests(struct efx_nic *efx, int *results, unsigned flags)
results[5 + i] = len_reg;
}

/* We must reset to exit cable diagnostic mode. The BIST will
* also run when we do this. */
reset:
rc2 = tenxpress_special_reset(efx);
results[0] = rc2 ? -1 : 1;
if (!rc)
rc = rc2;

rc2 = efx->phy_op->set_settings(efx, &ecmd);
if (!rc)
rc = rc2;
out:
if (flags & ETH_TEST_FL_OFFLINE) {
/* Reset, running the BIST and then resuming normal service. */
rc2 = tenxpress_special_reset(efx);
results[0] = rc2 ? -1 : 1;
if (!rc)
rc = rc2;

rc2 = efx->phy_op->set_settings(efx, &ecmd);
if (!rc)
rc = rc2;
}

return rc;
}
Expand Down

0 comments on commit 471f537

Please sign in to comment.