diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-02-03 09:30:50 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-03 19:12:44 -0800 |
commit | 4f16c0739145476ba37a7fa9eea0c33850efc2ce (patch) | |
tree | 3ba72c3d44a3d7ca4814cdb83caf2ca4aa608a85 /drivers/net/sfc/selftest.c | |
parent | 7a6b8f6f7f74085a1330b0f9765d81bcea8c58b7 (diff) | |
download | linux-4f16c0739145476ba37a7fa9eea0c33850efc2ce.tar.gz linux-4f16c0739145476ba37a7fa9eea0c33850efc2ce.tar.bz2 linux-4f16c0739145476ba37a7fa9eea0c33850efc2ce.zip |
sfc: Replace PHY MDIO test with an 'alive' test
SFC9000-family boards do not all use MDIO PHYs, so we need a different
test for PHY aliveness.
Introduce a PHY operation test_alive(). For PHYs attached to Falcon,
use a common implementation based on the existing PHY MDIO test.
For PHYs managed through MCDI, use the appropriate MCDI request.
Change test name in ethtool from 'core mdio' to 'phy alive'.
Rename test_results::mdio to phy_alive and test_results::phy to phy_ext.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/selftest.c')
-rw-r--r-- | drivers/net/sfc/selftest.c | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c index 250c8827b842..8a5a7b6d042d 100644 --- a/drivers/net/sfc/selftest.c +++ b/drivers/net/sfc/selftest.c @@ -26,7 +26,6 @@ #include "workarounds.h" #include "spi.h" #include "io.h" -#include "mdio_10g.h" /* * Loopback test packet structure @@ -76,42 +75,15 @@ struct efx_loopback_state { * **************************************************************************/ -static int efx_test_mdio(struct efx_nic *efx, struct efx_self_tests *tests) +static int efx_test_phy_alive(struct efx_nic *efx, struct efx_self_tests *tests) { int rc = 0; - int devad; - u16 physid1, physid2; - - if (efx->mdio.mode_support & MDIO_SUPPORTS_C45) - devad = __ffs(efx->mdio.mmds); - else if (efx->mdio.mode_support & MDIO_SUPPORTS_C22) - devad = MDIO_DEVAD_NONE; - else - return 0; - - mutex_lock(&efx->mac_lock); - tests->mdio = -1; - - physid1 = efx_mdio_read(efx, devad, MDIO_DEVID1); - physid2 = efx_mdio_read(efx, devad, MDIO_DEVID2); - if ((physid1 == 0x0000) || (physid1 == 0xffff) || - (physid2 == 0x0000) || (physid2 == 0xffff)) { - EFX_ERR(efx, "no MDIO PHY present with ID %d\n", - efx->mdio.prtad); - rc = -EINVAL; - goto out; + if (efx->phy_op->test_alive) { + rc = efx->phy_op->test_alive(efx); + tests->phy_alive = rc ? -1 : 1; } - if (EFX_IS10G(efx)) { - rc = efx_mdio_check_mmds(efx, efx->mdio.mmds, 0); - if (rc) - goto out; - } - -out: - mutex_unlock(&efx->mac_lock); - tests->mdio = rc ? -1 : 1; return rc; } @@ -258,7 +230,7 @@ static int efx_test_phy(struct efx_nic *efx, struct efx_self_tests *tests, return 0; mutex_lock(&efx->mac_lock); - rc = efx->phy_op->run_tests(efx, tests->phy, flags); + rc = efx->phy_op->run_tests(efx, tests->phy_ext, flags); mutex_unlock(&efx->mac_lock); return rc; } @@ -684,7 +656,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, /* Online (i.e. non-disruptive) testing * This checks interrupt generation, event delivery and PHY presence. */ - rc = efx_test_mdio(efx, tests); + rc = efx_test_phy_alive(efx, tests); if (rc && !rc_test) rc_test = rc; |