aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2011-02-24 18:59:15 -0500
committerBen Hutchings <bhutchings@solarflare.com>2011-02-28 18:57:23 -0500
commita461103ba2e22cbb70771588b36f40df39a50f46 (patch)
tree526fe1532d3c69d9b322a458b8b26341058c6aa3 /drivers
parente5f0fd278084d79d6be0920043519749374b0507 (diff)
sfc: Do not read STAT1.FAULT in efx_mdio_check_mmd()
This field does not exist in all MMDs we want to check, and all callers allow it to be set (fault_fatal = 0). Remove the loopback condition, as STAT2.DEVPRST should be valid regardless of any fault. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sfc/mdio_10g.c32
-rw-r--r--drivers/net/sfc/mdio_10g.h3
-rw-r--r--drivers/net/sfc/tenxpress.c2
-rw-r--r--drivers/net/sfc/txc43128_phy.c2
4 files changed, 8 insertions, 31 deletions
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c
index 56b0266b441f..6e82e5ba583a 100644
--- a/drivers/net/sfc/mdio_10g.c
+++ b/drivers/net/sfc/mdio_10g.c
@@ -51,13 +51,10 @@ int efx_mdio_reset_mmd(struct efx_nic *port, int mmd,
51 return spins ? spins : -ETIMEDOUT; 51 return spins ? spins : -ETIMEDOUT;
52} 52}
53 53
54static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd, int fault_fatal) 54static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd)
55{ 55{
56 int status; 56 int status;
57 57
58 if (LOOPBACK_INTERNAL(efx))
59 return 0;
60
61 if (mmd != MDIO_MMD_AN) { 58 if (mmd != MDIO_MMD_AN) {
62 /* Read MMD STATUS2 to check it is responding. */ 59 /* Read MMD STATUS2 to check it is responding. */
63 status = efx_mdio_read(efx, mmd, MDIO_STAT2); 60 status = efx_mdio_read(efx, mmd, MDIO_STAT2);
@@ -68,20 +65,6 @@ static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd, int fault_fatal)
68 } 65 }
69 } 66 }
70 67
71 /* Read MMD STATUS 1 to check for fault. */
72 status = efx_mdio_read(efx, mmd, MDIO_STAT1);
73 if (status & MDIO_STAT1_FAULT) {
74 if (fault_fatal) {
75 netif_err(efx, hw, efx->net_dev,
76 "PHY MMD %d reporting fatal"
77 " fault: status %x\n", mmd, status);
78 return -EIO;
79 } else {
80 netif_dbg(efx, hw, efx->net_dev,
81 "PHY MMD %d reporting status"
82 " %x (expected)\n", mmd, status);
83 }
84 }
85 return 0; 68 return 0;
86} 69}
87 70
@@ -130,8 +113,7 @@ int efx_mdio_wait_reset_mmds(struct efx_nic *efx, unsigned int mmd_mask)
130 return rc; 113 return rc;
131} 114}
132 115
133int efx_mdio_check_mmds(struct efx_nic *efx, 116int efx_mdio_check_mmds(struct efx_nic *efx, unsigned int mmd_mask)
134 unsigned int mmd_mask, unsigned int fatal_mask)
135{ 117{
136 int mmd = 0, probe_mmd, devs1, devs2; 118 int mmd = 0, probe_mmd, devs1, devs2;
137 u32 devices; 119 u32 devices;
@@ -161,13 +143,9 @@ int efx_mdio_check_mmds(struct efx_nic *efx,
161 143
162 /* Check all required MMDs are responding and happy. */ 144 /* Check all required MMDs are responding and happy. */
163 while (mmd_mask) { 145 while (mmd_mask) {
164 if (mmd_mask & 1) { 146 if ((mmd_mask & 1) && efx_mdio_check_mmd(efx, mmd))
165 int fault_fatal = fatal_mask & 1; 147 return -EIO;
166 if (efx_mdio_check_mmd(efx, mmd, fault_fatal))
167 return -EIO;
168 }
169 mmd_mask = mmd_mask >> 1; 148 mmd_mask = mmd_mask >> 1;
170 fatal_mask = fatal_mask >> 1;
171 mmd++; 149 mmd++;
172 } 150 }
173 151
@@ -337,7 +315,7 @@ int efx_mdio_test_alive(struct efx_nic *efx)
337 "no MDIO PHY present with ID %d\n", efx->mdio.prtad); 315 "no MDIO PHY present with ID %d\n", efx->mdio.prtad);
338 rc = -EINVAL; 316 rc = -EINVAL;
339 } else { 317 } else {
340 rc = efx_mdio_check_mmds(efx, efx->mdio.mmds, 0); 318 rc = efx_mdio_check_mmds(efx, efx->mdio.mmds);
341 } 319 }
342 320
343 mutex_unlock(&efx->mac_lock); 321 mutex_unlock(&efx->mac_lock);
diff --git a/drivers/net/sfc/mdio_10g.h b/drivers/net/sfc/mdio_10g.h
index 75791d3d4963..44c5dee52107 100644
--- a/drivers/net/sfc/mdio_10g.h
+++ b/drivers/net/sfc/mdio_10g.h
@@ -68,8 +68,7 @@ extern int efx_mdio_reset_mmd(struct efx_nic *efx, int mmd,
68 int spins, int spintime); 68 int spins, int spintime);
69 69
70/* As efx_mdio_check_mmd but for multiple MMDs */ 70/* As efx_mdio_check_mmd but for multiple MMDs */
71int efx_mdio_check_mmds(struct efx_nic *efx, 71int efx_mdio_check_mmds(struct efx_nic *efx, unsigned int mmd_mask);
72 unsigned int mmd_mask, unsigned int fatal_mask);
73 72
74/* Check the link status of specified mmds in bit mask */ 73/* Check the link status of specified mmds in bit mask */
75extern bool efx_mdio_links_ok(struct efx_nic *efx, unsigned int mmd_mask); 74extern bool efx_mdio_links_ok(struct efx_nic *efx, unsigned int mmd_mask);
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c
index f102912eba91..581911f70441 100644
--- a/drivers/net/sfc/tenxpress.c
+++ b/drivers/net/sfc/tenxpress.c
@@ -196,7 +196,7 @@ static int tenxpress_phy_init(struct efx_nic *efx)
196 if (rc < 0) 196 if (rc < 0)
197 return rc; 197 return rc;
198 198
199 rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0); 199 rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS);
200 if (rc < 0) 200 if (rc < 0)
201 return rc; 201 return rc;
202 } 202 }
diff --git a/drivers/net/sfc/txc43128_phy.c b/drivers/net/sfc/txc43128_phy.c
index 351794a79215..4e2b48a8f5c4 100644
--- a/drivers/net/sfc/txc43128_phy.c
+++ b/drivers/net/sfc/txc43128_phy.c
@@ -193,7 +193,7 @@ static int txc_reset_phy(struct efx_nic *efx)
193 goto fail; 193 goto fail;
194 194
195 /* Check that all the MMDs we expect are present and responding. */ 195 /* Check that all the MMDs we expect are present and responding. */
196 rc = efx_mdio_check_mmds(efx, TXC_REQUIRED_DEVS, 0); 196 rc = efx_mdio_check_mmds(efx, TXC_REQUIRED_DEVS);
197 if (rc < 0) 197 if (rc < 0)
198 goto fail; 198 goto fail;
199 199