diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-04-29 04:05:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-29 20:32:30 -0400 |
commit | 68e7f45e118f98b77cfa007aa2d97b5dac69fe6b (patch) | |
tree | d2e05579a0fc1f5a28bce8ff09ac6863d1907186 /drivers/net/sfc/selftest.c | |
parent | 1b1c2e95103ce391c2ea39a9460968fcb73deb30 (diff) |
sfc: Use generic MDIO functions and definitions
Make use of the newly-added generic MDIO clause 45 support and remove
redundant definitions.
Add an 'efx_' prefix to the remaining driver-specific MDIO functions
and remove arguments which are redundant with efx->mdio.prtad.
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 | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c index 0a598084c513..043795715955 100644 --- a/drivers/net/sfc/selftest.c +++ b/drivers/net/sfc/selftest.c | |||
@@ -80,39 +80,38 @@ struct efx_loopback_state { | |||
80 | * | 80 | * |
81 | **************************************************************************/ | 81 | **************************************************************************/ |
82 | 82 | ||
83 | static int efx_test_mii(struct efx_nic *efx, struct efx_self_tests *tests) | 83 | static int efx_test_mdio(struct efx_nic *efx, struct efx_self_tests *tests) |
84 | { | 84 | { |
85 | int rc = 0; | 85 | int rc = 0; |
86 | int devad = __ffs(efx->mdio.mmds); | ||
86 | u16 physid1, physid2; | 87 | u16 physid1, physid2; |
87 | struct mii_if_info *mii = &efx->mii; | ||
88 | struct net_device *net_dev = efx->net_dev; | ||
89 | 88 | ||
90 | if (efx->phy_type == PHY_TYPE_NONE) | 89 | if (efx->phy_type == PHY_TYPE_NONE) |
91 | return 0; | 90 | return 0; |
92 | 91 | ||
93 | mutex_lock(&efx->mac_lock); | 92 | mutex_lock(&efx->mac_lock); |
94 | tests->mii = -1; | 93 | tests->mdio = -1; |
95 | 94 | ||
96 | physid1 = mii->mdio_read(net_dev, mii->phy_id, MII_PHYSID1); | 95 | physid1 = efx_mdio_read(efx, devad, MDIO_DEVID1); |
97 | physid2 = mii->mdio_read(net_dev, mii->phy_id, MII_PHYSID2); | 96 | physid2 = efx_mdio_read(efx, devad, MDIO_DEVID2); |
98 | 97 | ||
99 | if ((physid1 == 0x0000) || (physid1 == 0xffff) || | 98 | if ((physid1 == 0x0000) || (physid1 == 0xffff) || |
100 | (physid2 == 0x0000) || (physid2 == 0xffff)) { | 99 | (physid2 == 0x0000) || (physid2 == 0xffff)) { |
101 | EFX_ERR(efx, "no MII PHY present with ID %d\n", | 100 | EFX_ERR(efx, "no MDIO PHY present with ID %d\n", |
102 | mii->phy_id); | 101 | efx->mdio.prtad); |
103 | rc = -EINVAL; | 102 | rc = -EINVAL; |
104 | goto out; | 103 | goto out; |
105 | } | 104 | } |
106 | 105 | ||
107 | if (EFX_IS10G(efx)) { | 106 | if (EFX_IS10G(efx)) { |
108 | rc = mdio_clause45_check_mmds(efx, efx->phy_op->mmds, 0); | 107 | rc = efx_mdio_check_mmds(efx, efx->phy_op->mmds, 0); |
109 | if (rc) | 108 | if (rc) |
110 | goto out; | 109 | goto out; |
111 | } | 110 | } |
112 | 111 | ||
113 | out: | 112 | out: |
114 | mutex_unlock(&efx->mac_lock); | 113 | mutex_unlock(&efx->mac_lock); |
115 | tests->mii = rc ? -1 : 1; | 114 | tests->mdio = rc ? -1 : 1; |
116 | return rc; | 115 | return rc; |
117 | } | 116 | } |
118 | 117 | ||
@@ -673,7 +672,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, | |||
673 | /* Online (i.e. non-disruptive) testing | 672 | /* Online (i.e. non-disruptive) testing |
674 | * This checks interrupt generation, event delivery and PHY presence. */ | 673 | * This checks interrupt generation, event delivery and PHY presence. */ |
675 | 674 | ||
676 | rc = efx_test_mii(efx, tests); | 675 | rc = efx_test_mdio(efx, tests); |
677 | if (rc && !rc_test) | 676 | if (rc && !rc_test) |
678 | rc_test = rc; | 677 | rc_test = rc; |
679 | 678 | ||