sfc: Do not read STAT1.FAULT in efx_mdio_check_mmd()
This field does not exist in all MMDs we want to check, and all callers allow it to be set (fault_fatal = 0). Remove the loopback condition, as STAT2.DEVPRST should be valid regardless of any fault. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
This commit is contained in:
parent
e5f0fd2780
commit
a461103ba2
4 changed files with 8 additions and 31 deletions
|
@ -51,13 +51,10 @@ int efx_mdio_reset_mmd(struct efx_nic *port, int mmd,
|
||||||
return spins ? spins : -ETIMEDOUT;
|
return spins ? spins : -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd, int fault_fatal)
|
static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (LOOPBACK_INTERNAL(efx))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (mmd != MDIO_MMD_AN) {
|
if (mmd != MDIO_MMD_AN) {
|
||||||
/* Read MMD STATUS2 to check it is responding. */
|
/* Read MMD STATUS2 to check it is responding. */
|
||||||
status = efx_mdio_read(efx, mmd, MDIO_STAT2);
|
status = efx_mdio_read(efx, mmd, MDIO_STAT2);
|
||||||
|
@ -68,20 +65,6 @@ static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd, int fault_fatal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read MMD STATUS 1 to check for fault. */
|
|
||||||
status = efx_mdio_read(efx, mmd, MDIO_STAT1);
|
|
||||||
if (status & MDIO_STAT1_FAULT) {
|
|
||||||
if (fault_fatal) {
|
|
||||||
netif_err(efx, hw, efx->net_dev,
|
|
||||||
"PHY MMD %d reporting fatal"
|
|
||||||
" fault: status %x\n", mmd, status);
|
|
||||||
return -EIO;
|
|
||||||
} else {
|
|
||||||
netif_dbg(efx, hw, efx->net_dev,
|
|
||||||
"PHY MMD %d reporting status"
|
|
||||||
" %x (expected)\n", mmd, status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,8 +113,7 @@ int efx_mdio_wait_reset_mmds(struct efx_nic *efx, unsigned int mmd_mask)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int efx_mdio_check_mmds(struct efx_nic *efx,
|
int efx_mdio_check_mmds(struct efx_nic *efx, unsigned int mmd_mask)
|
||||||
unsigned int mmd_mask, unsigned int fatal_mask)
|
|
||||||
{
|
{
|
||||||
int mmd = 0, probe_mmd, devs1, devs2;
|
int mmd = 0, probe_mmd, devs1, devs2;
|
||||||
u32 devices;
|
u32 devices;
|
||||||
|
@ -161,13 +143,9 @@ int efx_mdio_check_mmds(struct efx_nic *efx,
|
||||||
|
|
||||||
/* Check all required MMDs are responding and happy. */
|
/* Check all required MMDs are responding and happy. */
|
||||||
while (mmd_mask) {
|
while (mmd_mask) {
|
||||||
if (mmd_mask & 1) {
|
if ((mmd_mask & 1) && efx_mdio_check_mmd(efx, mmd))
|
||||||
int fault_fatal = fatal_mask & 1;
|
return -EIO;
|
||||||
if (efx_mdio_check_mmd(efx, mmd, fault_fatal))
|
|
||||||
return -EIO;
|
|
||||||
}
|
|
||||||
mmd_mask = mmd_mask >> 1;
|
mmd_mask = mmd_mask >> 1;
|
||||||
fatal_mask = fatal_mask >> 1;
|
|
||||||
mmd++;
|
mmd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +315,7 @@ int efx_mdio_test_alive(struct efx_nic *efx)
|
||||||
"no MDIO PHY present with ID %d\n", efx->mdio.prtad);
|
"no MDIO PHY present with ID %d\n", efx->mdio.prtad);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
} else {
|
} else {
|
||||||
rc = efx_mdio_check_mmds(efx, efx->mdio.mmds, 0);
|
rc = efx_mdio_check_mmds(efx, efx->mdio.mmds);
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&efx->mac_lock);
|
mutex_unlock(&efx->mac_lock);
|
||||||
|
|
|
@ -68,8 +68,7 @@ extern int efx_mdio_reset_mmd(struct efx_nic *efx, int mmd,
|
||||||
int spins, int spintime);
|
int spins, int spintime);
|
||||||
|
|
||||||
/* As efx_mdio_check_mmd but for multiple MMDs */
|
/* As efx_mdio_check_mmd but for multiple MMDs */
|
||||||
int efx_mdio_check_mmds(struct efx_nic *efx,
|
int efx_mdio_check_mmds(struct efx_nic *efx, unsigned int mmd_mask);
|
||||||
unsigned int mmd_mask, unsigned int fatal_mask);
|
|
||||||
|
|
||||||
/* Check the link status of specified mmds in bit mask */
|
/* Check the link status of specified mmds in bit mask */
|
||||||
extern bool efx_mdio_links_ok(struct efx_nic *efx, unsigned int mmd_mask);
|
extern bool efx_mdio_links_ok(struct efx_nic *efx, unsigned int mmd_mask);
|
||||||
|
|
|
@ -196,7 +196,7 @@ static int tenxpress_phy_init(struct efx_nic *efx)
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0);
|
rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,7 +193,7 @@ static int txc_reset_phy(struct efx_nic *efx)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Check that all the MMDs we expect are present and responding. */
|
/* Check that all the MMDs we expect are present and responding. */
|
||||||
rc = efx_mdio_check_mmds(efx, TXC_REQUIRED_DEVS, 0);
|
rc = efx_mdio_check_mmds(efx, TXC_REQUIRED_DEVS);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue