diff options
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 @@ | |||
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 | ||
79 | static int efx_test_mdio(struct efx_nic *efx, struct efx_self_tests *tests) | 78 | static 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 | |||
112 | out: | ||
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 | ||