[PATCH 2/5] sfc: Fix conditions for MDIO self-test

Ben Hutchings bhutchings at solarflare.com
Wed Jan 13 10:59:13 GMT 2010


https://lists.ubuntu.com/archives/kernel-team/2010-January/008303.html

The MDIO self-test should not be run on boards without an MDIO PHY,
such as SFN5122F-R3 and later revisions.  It should also not try to
address a specific MMD in an MDIO clause 22 PHY.  Check the
mode_support field to decide which mode to use, if any.

Signed-off-by: Ben Hutchings <bhutchings at solarflare.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit f3766c26a5d00189e5c0965c66f01956d15a92d6)

Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
---
 drivers/net/sfc/selftest.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index af39335..250c882 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -79,10 +79,14 @@ struct efx_loopback_state {
 static int efx_test_mdio(struct efx_nic *efx, struct efx_self_tests *tests)
 {
 	int rc = 0;
-	int devad = __ffs(efx->mdio.mmds);
+	int devad;
 	u16 physid1, physid2;
 
-	if (efx->phy_type == PHY_TYPE_NONE)
+	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);
-- 
1.6.2.4




More information about the kernel-team mailing list