aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/selftest.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2010-02-03 04:30:50 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-03 22:12:44 -0500
commit4f16c0739145476ba37a7fa9eea0c33850efc2ce (patch)
tree3ba72c3d44a3d7ca4814cdb83caf2ca4aa608a85 /drivers/net/sfc/selftest.c
parent7a6b8f6f7f74085a1330b0f9765d81bcea8c58b7 (diff)
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.c40
1 files changed, 6 insertions, 34 deletions
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index 250c8827b84..8a5a7b6d042 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -26,7 +26,6 @@
26#include "workarounds.h" 26#include "workarounds.h"
27#include "spi.h" 27#include "spi.h"
28#include "io.h" 28#include "io.h"
29#include "mdio_10g.h"
30 29
31/* 30/*
32 * Loopback test packet structure 31 * Loopback test packet structure
@@ -76,42 +75,15 @@ struct efx_loopback_state {
76 * 75 *
77 **************************************************************************/ 76 **************************************************************************/
78 77
79static int efx_test_mdio(struct efx_nic *efx, struct efx_self_tests *tests) 78static int efx_test_phy_alive(struct efx_nic *efx, struct efx_self_tests *tests)
80{ 79{
81 int rc = 0; 80 int rc = 0;
82 int devad;
83 u16 physid1, physid2;
84
85 if (efx->mdio.mode_support & MDIO_SUPPORTS_C45)
86 devad = __ffs(efx->mdio.mmds);
87 else if (efx->mdio.mode_support & MDIO_SUPPORTS_C22)
88 devad = MDIO_DEVAD_NONE;
89 else
90 return 0;
91
92 mutex_lock(&efx->mac_lock);
93 tests->mdio = -1;
94
95 physid1 = efx_mdio_read(efx, devad, MDIO_DEVID1);
96 physid2 = efx_mdio_read(efx, devad, MDIO_DEVID2);
97 81
98 if ((physid1 == 0x0000) || (physid1 == 0xffff) || 82 if (efx->phy_op->test_alive) {
99 (physid2 == 0x0000) || (physid2 == 0xffff)) { 83 rc = efx->phy_op->test_alive(efx);
100 EFX_ERR(efx, "no MDIO PHY present with ID %d\n", 84 tests->phy_alive = rc ? -1 : 1;
101 efx->mdio.prtad);
102 rc = -EINVAL;
103 goto out;
104 } 85 }
105 86
106 if (EFX_IS10G(efx)) {
107 rc = efx_mdio_check_mmds(efx, efx->mdio.mmds, 0);
108 if (rc)
109 goto out;
110 }
111
112out:
113 mutex_unlock(&efx->mac_lock);
114 tests->mdio = rc ? -1 : 1;
115 return rc; 87 return rc;
116} 88}
117 89
@@ -258,7 +230,7 @@ static int efx_test_phy(struct efx_nic *efx, struct efx_self_tests *tests,
258 return 0; 230 return 0;
259 231
260 mutex_lock(&efx->mac_lock); 232 mutex_lock(&efx->mac_lock);
261 rc = efx->phy_op->run_tests(efx, tests->phy, flags); 233 rc = efx->phy_op->run_tests(efx, tests->phy_ext, flags);
262 mutex_unlock(&efx->mac_lock); 234 mutex_unlock(&efx->mac_lock);
263 return rc; 235 return rc;
264} 236}
@@ -684,7 +656,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
684 /* Online (i.e. non-disruptive) testing 656 /* Online (i.e. non-disruptive) testing
685 * This checks interrupt generation, event delivery and PHY presence. */ 657 * This checks interrupt generation, event delivery and PHY presence. */
686 658
687 rc = efx_test_mdio(efx, tests); 659 rc = efx_test_phy_alive(efx, tests);
688 if (rc && !rc_test) 660 if (rc && !rc_test)
689 rc_test = rc; 661 rc_test = rc;
690 662