aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/falcon_xmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sfc/falcon_xmac.c')
-rw-r--r--drivers/net/sfc/falcon_xmac.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c
index 3da933f8f079..8ccab2c67a20 100644
--- a/drivers/net/sfc/falcon_xmac.c
+++ b/drivers/net/sfc/falcon_xmac.c
@@ -111,16 +111,12 @@ static void falcon_mask_status_intr(struct efx_nic *efx, bool enable)
111 efx_writeo(efx, &reg, FR_AB_XM_MGT_INT_MASK); 111 efx_writeo(efx, &reg, FR_AB_XM_MGT_INT_MASK);
112} 112}
113 113
114/* Get status of XAUI link */ 114static bool falcon_xgxs_link_ok(struct efx_nic *efx)
115static bool falcon_xaui_link_ok(struct efx_nic *efx)
116{ 115{
117 efx_oword_t reg; 116 efx_oword_t reg;
118 bool align_done, link_ok = false; 117 bool align_done, link_ok = false;
119 int sync_status; 118 int sync_status;
120 119
121 if (LOOPBACK_INTERNAL(efx))
122 return true;
123
124 /* Read link status */ 120 /* Read link status */
125 efx_reado(efx, &reg, FR_AB_XX_CORE_STAT); 121 efx_reado(efx, &reg, FR_AB_XX_CORE_STAT);
126 122
@@ -135,14 +131,24 @@ static bool falcon_xaui_link_ok(struct efx_nic *efx)
135 EFX_SET_OWORD_FIELD(reg, FRF_AB_XX_DISPERR, FFE_AB_XX_STAT_ALL_LANES); 131 EFX_SET_OWORD_FIELD(reg, FRF_AB_XX_DISPERR, FFE_AB_XX_STAT_ALL_LANES);
136 efx_writeo(efx, &reg, FR_AB_XX_CORE_STAT); 132 efx_writeo(efx, &reg, FR_AB_XX_CORE_STAT);
137 133
138 /* If the link is up, then check the phy side of the xaui link */
139 if (efx->link_state.up && link_ok)
140 if (efx->mdio.mmds & (1 << MDIO_MMD_PHYXS))
141 link_ok = efx_mdio_phyxgxs_lane_sync(efx);
142
143 return link_ok; 134 return link_ok;
144} 135}
145 136
137static bool falcon_xmac_link_ok(struct efx_nic *efx)
138{
139 /*
140 * Check MAC's XGXS link status except when using XGMII loopback
141 * which bypasses the XGXS block.
142 * If possible, check PHY's XGXS link status except when using
143 * MAC loopback.
144 */
145 return (efx->loopback_mode == LOOPBACK_XGMII ||
146 falcon_xgxs_link_ok(efx)) &&
147 (!(efx->mdio.mmds & (1 << MDIO_MMD_PHYXS)) ||
148 LOOPBACK_INTERNAL(efx) ||
149 efx_mdio_phyxgxs_lane_sync(efx));
150}
151
146void falcon_reconfigure_xmac_core(struct efx_nic *efx) 152void falcon_reconfigure_xmac_core(struct efx_nic *efx)
147{ 153{
148 unsigned int max_frame_len; 154 unsigned int max_frame_len;
@@ -245,9 +251,9 @@ static void falcon_reconfigure_xgxs_core(struct efx_nic *efx)
245 251
246 252
247/* Try to bring up the Falcon side of the Falcon-Phy XAUI link */ 253/* Try to bring up the Falcon side of the Falcon-Phy XAUI link */
248static bool falcon_check_xaui_link_up(struct efx_nic *efx, int tries) 254static bool falcon_xmac_link_ok_retry(struct efx_nic *efx, int tries)
249{ 255{
250 bool mac_up = falcon_xaui_link_ok(efx); 256 bool mac_up = falcon_xmac_link_ok(efx);
251 257
252 if (LOOPBACK_MASK(efx) & LOOPBACKS_EXTERNAL(efx) & LOOPBACKS_WS || 258 if (LOOPBACK_MASK(efx) & LOOPBACKS_EXTERNAL(efx) & LOOPBACKS_WS ||
253 efx_phy_mode_disabled(efx->phy_mode)) 259 efx_phy_mode_disabled(efx->phy_mode))
@@ -261,7 +267,7 @@ static bool falcon_check_xaui_link_up(struct efx_nic *efx, int tries)
261 falcon_reset_xaui(efx); 267 falcon_reset_xaui(efx);
262 udelay(200); 268 udelay(200);
263 269
264 mac_up = falcon_xaui_link_ok(efx); 270 mac_up = falcon_xmac_link_ok(efx);
265 --tries; 271 --tries;
266 } 272 }
267 273
@@ -272,7 +278,7 @@ static bool falcon_check_xaui_link_up(struct efx_nic *efx, int tries)
272 278
273static bool falcon_xmac_check_fault(struct efx_nic *efx) 279static bool falcon_xmac_check_fault(struct efx_nic *efx)
274{ 280{
275 return !falcon_check_xaui_link_up(efx, 5); 281 return !falcon_xmac_link_ok_retry(efx, 5);
276} 282}
277 283
278static int falcon_reconfigure_xmac(struct efx_nic *efx) 284static int falcon_reconfigure_xmac(struct efx_nic *efx)
@@ -284,7 +290,7 @@ static int falcon_reconfigure_xmac(struct efx_nic *efx)
284 290
285 falcon_reconfigure_mac_wrapper(efx); 291 falcon_reconfigure_mac_wrapper(efx);
286 292
287 efx->xmac_poll_required = !falcon_check_xaui_link_up(efx, 5); 293 efx->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 5);
288 falcon_mask_status_intr(efx, true); 294 falcon_mask_status_intr(efx, true);
289 295
290 return 0; 296 return 0;
@@ -357,7 +363,7 @@ void falcon_poll_xmac(struct efx_nic *efx)
357 return; 363 return;
358 364
359 falcon_mask_status_intr(efx, false); 365 falcon_mask_status_intr(efx, false);
360 efx->xmac_poll_required = !falcon_check_xaui_link_up(efx, 1); 366 efx->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 1);
361 falcon_mask_status_intr(efx, true); 367 falcon_mask_status_intr(efx, true);
362} 368}
363 369