1 /****************************************************************************
2 * Driver for Solarflare Solarstorm network controllers and boards
3 * Copyright 2005-2006 Fen Systems Ltd.
4 * Copyright 2006-2008 Solarflare Communications Inc.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation, incorporated herein by reference.
11 #include <linux/delay.h>
12 #include "net_driver.h"
15 #include "falcon_hwdefs.h"
16 #include "falcon_io.h"
22 #include "workarounds.h"
24 /**************************************************************************
28 **************************************************************************/
30 /* Offset of an XMAC register within Falcon */
31 #define FALCON_XMAC_REG(mac_reg) \
32 (FALCON_XMAC_REGBANK + ((mac_reg) * FALCON_XMAC_REG_SIZE))
34 void falcon_xmac_writel(struct efx_nic *efx,
35 efx_dword_t *value, unsigned int mac_reg)
39 EFX_POPULATE_OWORD_1(temp, MAC_DATA, EFX_DWORD_FIELD(*value, MAC_DATA));
40 falcon_write(efx, &temp, FALCON_XMAC_REG(mac_reg));
43 void falcon_xmac_readl(struct efx_nic *efx,
44 efx_dword_t *value, unsigned int mac_reg)
48 falcon_read(efx, &temp, FALCON_XMAC_REG(mac_reg));
49 EFX_POPULATE_DWORD_1(*value, MAC_DATA, EFX_OWORD_FIELD(temp, MAC_DATA));
52 /**************************************************************************
56 *************************************************************************/
57 static int falcon_reset_xmac(struct efx_nic *efx)
62 EFX_POPULATE_DWORD_1(reg, XM_CORE_RST, 1);
63 falcon_xmac_writel(efx, ®, XM_GLB_CFG_REG_MAC);
65 for (count = 0; count < 10000; count++) { /* wait upto 100ms */
66 falcon_xmac_readl(efx, ®, XM_GLB_CFG_REG_MAC);
67 if (EFX_DWORD_FIELD(reg, XM_CORE_RST) == 0)
72 /* This often fails when DSP is disabled, ignore it */
73 if (sfe4001_phy_flash_cfg != 0)
76 EFX_ERR(efx, "timed out waiting for XMAC core reset\n");
80 /* Configure the XAUI driver that is an output from Falcon */
81 static void falcon_setup_xaui(struct efx_nic *efx)
83 efx_dword_t sdctl, txdrv;
85 /* Move the XAUI into low power, unless there is no PHY, in
86 * which case the XAUI will have to drive a cable. */
87 if (efx->phy_type == PHY_TYPE_NONE)
90 falcon_xmac_readl(efx, &sdctl, XX_SD_CTL_REG_MAC);
91 EFX_SET_DWORD_FIELD(sdctl, XX_HIDRVD, XX_SD_CTL_DRV_DEFAULT);
92 EFX_SET_DWORD_FIELD(sdctl, XX_LODRVD, XX_SD_CTL_DRV_DEFAULT);
93 EFX_SET_DWORD_FIELD(sdctl, XX_HIDRVC, XX_SD_CTL_DRV_DEFAULT);
94 EFX_SET_DWORD_FIELD(sdctl, XX_LODRVC, XX_SD_CTL_DRV_DEFAULT);
95 EFX_SET_DWORD_FIELD(sdctl, XX_HIDRVB, XX_SD_CTL_DRV_DEFAULT);
96 EFX_SET_DWORD_FIELD(sdctl, XX_LODRVB, XX_SD_CTL_DRV_DEFAULT);
97 EFX_SET_DWORD_FIELD(sdctl, XX_HIDRVA, XX_SD_CTL_DRV_DEFAULT);
98 EFX_SET_DWORD_FIELD(sdctl, XX_LODRVA, XX_SD_CTL_DRV_DEFAULT);
99 falcon_xmac_writel(efx, &sdctl, XX_SD_CTL_REG_MAC);
101 EFX_POPULATE_DWORD_8(txdrv,
102 XX_DEQD, XX_TXDRV_DEQ_DEFAULT,
103 XX_DEQC, XX_TXDRV_DEQ_DEFAULT,
104 XX_DEQB, XX_TXDRV_DEQ_DEFAULT,
105 XX_DEQA, XX_TXDRV_DEQ_DEFAULT,
106 XX_DTXD, XX_TXDRV_DTX_DEFAULT,
107 XX_DTXC, XX_TXDRV_DTX_DEFAULT,
108 XX_DTXB, XX_TXDRV_DTX_DEFAULT,
109 XX_DTXA, XX_TXDRV_DTX_DEFAULT);
110 falcon_xmac_writel(efx, &txdrv, XX_TXDRV_CTL_REG_MAC);
113 static void falcon_hold_xaui_in_rst(struct efx_nic *efx)
118 EFX_SET_DWORD_FIELD(reg, XX_PWRDNA_EN, 1);
119 EFX_SET_DWORD_FIELD(reg, XX_PWRDNB_EN, 1);
120 EFX_SET_DWORD_FIELD(reg, XX_PWRDNC_EN, 1);
121 EFX_SET_DWORD_FIELD(reg, XX_PWRDND_EN, 1);
122 EFX_SET_DWORD_FIELD(reg, XX_RSTPLLAB_EN, 1);
123 EFX_SET_DWORD_FIELD(reg, XX_RSTPLLCD_EN, 1);
124 EFX_SET_DWORD_FIELD(reg, XX_RESETA_EN, 1);
125 EFX_SET_DWORD_FIELD(reg, XX_RESETB_EN, 1);
126 EFX_SET_DWORD_FIELD(reg, XX_RESETC_EN, 1);
127 EFX_SET_DWORD_FIELD(reg, XX_RESETD_EN, 1);
128 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSRX_EN, 1);
129 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSTX_EN, 1);
130 falcon_xmac_writel(efx, ®, XX_PWR_RST_REG_MAC);
134 static int _falcon_reset_xaui_a(struct efx_nic *efx)
138 falcon_hold_xaui_in_rst(efx);
139 falcon_xmac_readl(efx, ®, XX_PWR_RST_REG_MAC);
141 /* Follow the RAMBUS XAUI data reset sequencing
142 * Channels A and B first: power down, reset PLL, reset, clear
144 EFX_SET_DWORD_FIELD(reg, XX_PWRDNA_EN, 0);
145 EFX_SET_DWORD_FIELD(reg, XX_PWRDNB_EN, 0);
146 falcon_xmac_writel(efx, ®, XX_PWR_RST_REG_MAC);
149 EFX_SET_DWORD_FIELD(reg, XX_RSTPLLAB_EN, 0);
150 falcon_xmac_writel(efx, ®, XX_PWR_RST_REG_MAC);
153 EFX_SET_DWORD_FIELD(reg, XX_RESETA_EN, 0);
154 EFX_SET_DWORD_FIELD(reg, XX_RESETB_EN, 0);
155 falcon_xmac_writel(efx, ®, XX_PWR_RST_REG_MAC);
158 /* Channels C and D: power down, reset PLL, reset, clear */
159 EFX_SET_DWORD_FIELD(reg, XX_PWRDNC_EN, 0);
160 EFX_SET_DWORD_FIELD(reg, XX_PWRDND_EN, 0);
161 falcon_xmac_writel(efx, ®, XX_PWR_RST_REG_MAC);
164 EFX_SET_DWORD_FIELD(reg, XX_RSTPLLCD_EN, 0);
165 falcon_xmac_writel(efx, ®, XX_PWR_RST_REG_MAC);
168 EFX_SET_DWORD_FIELD(reg, XX_RESETC_EN, 0);
169 EFX_SET_DWORD_FIELD(reg, XX_RESETD_EN, 0);
170 falcon_xmac_writel(efx, ®, XX_PWR_RST_REG_MAC);
174 falcon_setup_xaui(efx);
177 /* Take XGXS out of reset */
179 falcon_xmac_writel(efx, ®, XX_PWR_RST_REG_MAC);
185 static int _falcon_reset_xaui_b(struct efx_nic *efx)
190 EFX_POPULATE_DWORD_1(reg, XX_RST_XX_EN, 1);
191 falcon_xmac_writel(efx, ®, XX_PWR_RST_REG_MAC);
193 /* Give some time for the link to establish */
194 for (count = 0; count < 1000; count++) { /* wait upto 10ms */
195 falcon_xmac_readl(efx, ®, XX_PWR_RST_REG_MAC);
196 if (EFX_DWORD_FIELD(reg, XX_RST_XX_EN) == 0) {
197 falcon_setup_xaui(efx);
202 EFX_ERR(efx, "timed out waiting for XAUI/XGXS reset\n");
206 int falcon_reset_xaui(struct efx_nic *efx)
210 if (EFX_WORKAROUND_9388(efx)) {
211 falcon_hold_xaui_in_rst(efx);
212 efx->phy_op->reset_xaui(efx);
213 rc = _falcon_reset_xaui_a(efx);
215 rc = _falcon_reset_xaui_b(efx);
220 static int falcon_xgmii_status(struct efx_nic *efx)
224 if (falcon_rev(efx) < FALCON_REV_B0)
227 /* The ISR latches, so clear it and re-read */
228 falcon_xmac_readl(efx, ®, XM_MGT_INT_REG_MAC_B0);
229 falcon_xmac_readl(efx, ®, XM_MGT_INT_REG_MAC_B0);
231 if (EFX_DWORD_FIELD(reg, XM_LCLFLT) ||
232 EFX_DWORD_FIELD(reg, XM_RMTFLT)) {
233 EFX_INFO(efx, "MGT_INT: "EFX_DWORD_FMT"\n", EFX_DWORD_VAL(reg));
240 static void falcon_mask_status_intr(struct efx_nic *efx, int enable)
244 if ((falcon_rev(efx) < FALCON_REV_B0) || LOOPBACK_INTERNAL(efx))
249 falcon_xmac_readl(efx, ®, XM_MGT_INT_REG_MAC_B0);
251 EFX_POPULATE_DWORD_2(reg,
252 XM_MSK_RMTFLT, !enable,
253 XM_MSK_LCLFLT, !enable);
254 falcon_xmac_writel(efx, ®, XM_MGT_INT_MSK_REG_MAC_B0);
257 int falcon_init_xmac(struct efx_nic *efx)
261 /* Initialize the PHY first so the clock is around */
262 rc = efx->phy_op->init(efx);
266 rc = falcon_reset_xaui(efx);
270 /* Wait again. Give the PHY and MAC time to come back */
271 schedule_timeout_uninterruptible(HZ / 10);
273 rc = falcon_reset_xmac(efx);
277 falcon_mask_status_intr(efx, 1);
281 efx->phy_op->fini(efx);
286 int falcon_xaui_link_ok(struct efx_nic *efx)
289 int align_done, sync_status, link_ok = 0;
291 if (LOOPBACK_INTERNAL(efx))
294 /* Read link status */
295 falcon_xmac_readl(efx, ®, XX_CORE_STAT_REG_MAC);
297 align_done = EFX_DWORD_FIELD(reg, XX_ALIGN_DONE);
298 sync_status = EFX_DWORD_FIELD(reg, XX_SYNC_STAT);
299 if (align_done && (sync_status == XX_SYNC_STAT_DECODE_SYNCED))
302 /* Clear link status ready for next read */
303 EFX_SET_DWORD_FIELD(reg, XX_COMMA_DET, XX_COMMA_DET_RESET);
304 EFX_SET_DWORD_FIELD(reg, XX_CHARERR, XX_CHARERR_RESET);
305 EFX_SET_DWORD_FIELD(reg, XX_DISPERR, XX_DISPERR_RESET);
306 falcon_xmac_writel(efx, ®, XX_CORE_STAT_REG_MAC);
308 /* If the link is up, then check the phy side of the xaui link
309 * (error conditions from the wire side propoagate back through
310 * the phy to the xaui side). */
311 if (efx->link_up && link_ok) {
312 int has_phyxs = efx->phy_op->mmds & (1 << MDIO_MMD_PHYXS);
314 link_ok = mdio_clause45_phyxgxs_lane_sync(efx);
317 /* If the PHY and XAUI links are up, then check the mac's xgmii
319 if (efx->link_up && link_ok)
320 link_ok = falcon_xgmii_status(efx);
325 static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
327 unsigned int max_frame_len;
329 int rx_fc = (efx->flow_control & EFX_FC_RX) ? 1 : 0;
331 /* Configure MAC - cut-thru mode is hard wired on */
332 EFX_POPULATE_DWORD_3(reg,
336 falcon_xmac_writel(efx, ®, XM_GLB_CFG_REG_MAC);
339 EFX_POPULATE_DWORD_6(reg,
346 falcon_xmac_writel(efx, ®, XM_TX_CFG_REG_MAC);
349 EFX_POPULATE_DWORD_5(reg,
352 XM_ACPT_ALL_MCAST, 1,
353 XM_ACPT_ALL_UCAST, efx->promiscuous,
355 falcon_xmac_writel(efx, ®, XM_RX_CFG_REG_MAC);
357 /* Set frame length */
358 max_frame_len = EFX_MAX_FRAME_LEN(efx->net_dev->mtu);
359 EFX_POPULATE_DWORD_1(reg, XM_MAX_RX_FRM_SIZE, max_frame_len);
360 falcon_xmac_writel(efx, ®, XM_RX_PARAM_REG_MAC);
361 EFX_POPULATE_DWORD_2(reg,
362 XM_MAX_TX_FRM_SIZE, max_frame_len,
363 XM_TX_JUMBO_MODE, 1);
364 falcon_xmac_writel(efx, ®, XM_TX_PARAM_REG_MAC);
366 EFX_POPULATE_DWORD_2(reg,
367 XM_PAUSE_TIME, 0xfffe, /* MAX PAUSE TIME */
368 XM_DIS_FCNTL, rx_fc ? 0 : 1);
369 falcon_xmac_writel(efx, ®, XM_FC_REG_MAC);
371 /* Set MAC address */
372 EFX_POPULATE_DWORD_4(reg,
373 XM_ADR_0, efx->net_dev->dev_addr[0],
374 XM_ADR_1, efx->net_dev->dev_addr[1],
375 XM_ADR_2, efx->net_dev->dev_addr[2],
376 XM_ADR_3, efx->net_dev->dev_addr[3]);
377 falcon_xmac_writel(efx, ®, XM_ADR_LO_REG_MAC);
378 EFX_POPULATE_DWORD_2(reg,
379 XM_ADR_4, efx->net_dev->dev_addr[4],
380 XM_ADR_5, efx->net_dev->dev_addr[5]);
381 falcon_xmac_writel(efx, ®, XM_ADR_HI_REG_MAC);
384 static void falcon_reconfigure_xgxs_core(struct efx_nic *efx)
387 int xgxs_loopback = (efx->loopback_mode == LOOPBACK_XGXS) ? 1 : 0;
388 int xaui_loopback = (efx->loopback_mode == LOOPBACK_XAUI) ? 1 : 0;
390 (efx->loopback_mode == LOOPBACK_XGMII) ? 1 : 0;
392 /* XGXS block is flaky and will need to be reset if moving
393 * into our out of XGMII, XGXS or XAUI loopbacks. */
394 if (EFX_WORKAROUND_5147(efx)) {
395 int old_xgmii_loopback, old_xgxs_loopback, old_xaui_loopback;
398 falcon_xmac_readl(efx, ®, XX_CORE_STAT_REG_MAC);
399 old_xgxs_loopback = EFX_DWORD_FIELD(reg, XX_XGXS_LB_EN);
400 old_xgmii_loopback = EFX_DWORD_FIELD(reg, XX_XGMII_LB_EN);
402 falcon_xmac_readl(efx, ®, XX_SD_CTL_REG_MAC);
403 old_xaui_loopback = EFX_DWORD_FIELD(reg, XX_LPBKA);
405 /* The PHY driver may have turned XAUI off */
406 reset_xgxs = ((xgxs_loopback != old_xgxs_loopback) ||
407 (xaui_loopback != old_xaui_loopback) ||
408 (xgmii_loopback != old_xgmii_loopback));
410 falcon_xmac_readl(efx, ®, XX_PWR_RST_REG_MAC);
411 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSTX_EN, 1);
412 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSRX_EN, 1);
413 falcon_xmac_writel(efx, ®, XX_PWR_RST_REG_MAC);
415 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSTX_EN, 0);
416 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSRX_EN, 0);
417 falcon_xmac_writel(efx, ®, XX_PWR_RST_REG_MAC);
422 falcon_xmac_readl(efx, ®, XX_CORE_STAT_REG_MAC);
423 EFX_SET_DWORD_FIELD(reg, XX_FORCE_SIG,
424 (xgxs_loopback || xaui_loopback) ?
425 XX_FORCE_SIG_DECODE_FORCED : 0);
426 EFX_SET_DWORD_FIELD(reg, XX_XGXS_LB_EN, xgxs_loopback);
427 EFX_SET_DWORD_FIELD(reg, XX_XGMII_LB_EN, xgmii_loopback);
428 falcon_xmac_writel(efx, ®, XX_CORE_STAT_REG_MAC);
430 falcon_xmac_readl(efx, ®, XX_SD_CTL_REG_MAC);
431 EFX_SET_DWORD_FIELD(reg, XX_LPBKD, xaui_loopback);
432 EFX_SET_DWORD_FIELD(reg, XX_LPBKC, xaui_loopback);
433 EFX_SET_DWORD_FIELD(reg, XX_LPBKB, xaui_loopback);
434 EFX_SET_DWORD_FIELD(reg, XX_LPBKA, xaui_loopback);
435 falcon_xmac_writel(efx, ®, XX_SD_CTL_REG_MAC);
439 /* Try and bring the Falcon side of the Falcon-Phy XAUI link fails
440 * to come back up. Bash it until it comes back up */
441 static int falcon_check_xaui_link_up(struct efx_nic *efx)
443 int max_tries, tries;
444 tries = EFX_WORKAROUND_5147(efx) ? 5 : 1;
447 if ((efx->loopback_mode == LOOPBACK_NETWORK) ||
448 (efx->phy_type == PHY_TYPE_NONE))
452 if (falcon_xaui_link_ok(efx))
455 EFX_LOG(efx, "%s Clobbering XAUI (%d tries left).\n",
457 falcon_reset_xaui(efx);
462 EFX_ERR(efx, "Failed to bring XAUI link back up in %d tries!\n",
467 void falcon_reconfigure_xmac(struct efx_nic *efx)
471 falcon_mask_status_intr(efx, 0);
473 falcon_deconfigure_mac_wrapper(efx);
475 efx->tx_disabled = LOOPBACK_INTERNAL(efx);
476 efx->phy_op->reconfigure(efx);
478 falcon_reconfigure_xgxs_core(efx);
479 falcon_reconfigure_xmac_core(efx);
481 falcon_reconfigure_mac_wrapper(efx);
483 /* Ensure XAUI link is up */
484 xaui_link_ok = falcon_check_xaui_link_up(efx);
486 if (xaui_link_ok && efx->link_up)
487 falcon_mask_status_intr(efx, 1);
490 void falcon_fini_xmac(struct efx_nic *efx)
492 /* Isolate the MAC - PHY */
493 falcon_deconfigure_mac_wrapper(efx);
495 /* Potentially power down the PHY */
496 efx->phy_op->fini(efx);
499 void falcon_update_stats_xmac(struct efx_nic *efx)
501 struct efx_mac_stats *mac_stats = &efx->mac_stats;
504 rc = falcon_dma_stats(efx, XgDmaDone_offset);
508 /* Update MAC stats from DMAed values */
509 FALCON_STAT(efx, XgRxOctets, rx_bytes);
510 FALCON_STAT(efx, XgRxOctetsOK, rx_good_bytes);
511 FALCON_STAT(efx, XgRxPkts, rx_packets);
512 FALCON_STAT(efx, XgRxPktsOK, rx_good);
513 FALCON_STAT(efx, XgRxBroadcastPkts, rx_broadcast);
514 FALCON_STAT(efx, XgRxMulticastPkts, rx_multicast);
515 FALCON_STAT(efx, XgRxUnicastPkts, rx_unicast);
516 FALCON_STAT(efx, XgRxUndersizePkts, rx_lt64);
517 FALCON_STAT(efx, XgRxOversizePkts, rx_gtjumbo);
518 FALCON_STAT(efx, XgRxJabberPkts, rx_bad_gtjumbo);
519 FALCON_STAT(efx, XgRxUndersizeFCSerrorPkts, rx_bad_lt64);
520 FALCON_STAT(efx, XgRxDropEvents, rx_overflow);
521 FALCON_STAT(efx, XgRxFCSerrorPkts, rx_bad);
522 FALCON_STAT(efx, XgRxAlignError, rx_align_error);
523 FALCON_STAT(efx, XgRxSymbolError, rx_symbol_error);
524 FALCON_STAT(efx, XgRxInternalMACError, rx_internal_error);
525 FALCON_STAT(efx, XgRxControlPkts, rx_control);
526 FALCON_STAT(efx, XgRxPausePkts, rx_pause);
527 FALCON_STAT(efx, XgRxPkts64Octets, rx_64);
528 FALCON_STAT(efx, XgRxPkts65to127Octets, rx_65_to_127);
529 FALCON_STAT(efx, XgRxPkts128to255Octets, rx_128_to_255);
530 FALCON_STAT(efx, XgRxPkts256to511Octets, rx_256_to_511);
531 FALCON_STAT(efx, XgRxPkts512to1023Octets, rx_512_to_1023);
532 FALCON_STAT(efx, XgRxPkts1024to15xxOctets, rx_1024_to_15xx);
533 FALCON_STAT(efx, XgRxPkts15xxtoMaxOctets, rx_15xx_to_jumbo);
534 FALCON_STAT(efx, XgRxLengthError, rx_length_error);
535 FALCON_STAT(efx, XgTxPkts, tx_packets);
536 FALCON_STAT(efx, XgTxOctets, tx_bytes);
537 FALCON_STAT(efx, XgTxMulticastPkts, tx_multicast);
538 FALCON_STAT(efx, XgTxBroadcastPkts, tx_broadcast);
539 FALCON_STAT(efx, XgTxUnicastPkts, tx_unicast);
540 FALCON_STAT(efx, XgTxControlPkts, tx_control);
541 FALCON_STAT(efx, XgTxPausePkts, tx_pause);
542 FALCON_STAT(efx, XgTxPkts64Octets, tx_64);
543 FALCON_STAT(efx, XgTxPkts65to127Octets, tx_65_to_127);
544 FALCON_STAT(efx, XgTxPkts128to255Octets, tx_128_to_255);
545 FALCON_STAT(efx, XgTxPkts256to511Octets, tx_256_to_511);
546 FALCON_STAT(efx, XgTxPkts512to1023Octets, tx_512_to_1023);
547 FALCON_STAT(efx, XgTxPkts1024to15xxOctets, tx_1024_to_15xx);
548 FALCON_STAT(efx, XgTxPkts1519toMaxOctets, tx_15xx_to_jumbo);
549 FALCON_STAT(efx, XgTxUndersizePkts, tx_lt64);
550 FALCON_STAT(efx, XgTxOversizePkts, tx_gtjumbo);
551 FALCON_STAT(efx, XgTxNonTcpUdpPkt, tx_non_tcpudp);
552 FALCON_STAT(efx, XgTxMacSrcErrPkt, tx_mac_src_error);
553 FALCON_STAT(efx, XgTxIpSrcErrPkt, tx_ip_src_error);
555 /* Update derived statistics */
556 mac_stats->tx_good_bytes =
557 (mac_stats->tx_bytes - mac_stats->tx_bad_bytes);
558 mac_stats->rx_bad_bytes =
559 (mac_stats->rx_bytes - mac_stats->rx_good_bytes);
562 int falcon_check_xmac(struct efx_nic *efx)
564 unsigned xaui_link_ok;
567 if ((efx->loopback_mode == LOOPBACK_NETWORK) ||
568 (efx->phy_type == PHY_TYPE_NONE))
571 falcon_mask_status_intr(efx, 0);
572 xaui_link_ok = falcon_xaui_link_ok(efx);
574 if (EFX_WORKAROUND_5147(efx) && !xaui_link_ok)
575 falcon_reset_xaui(efx);
577 /* Call the PHY check_hw routine */
578 rc = efx->phy_op->check_hw(efx);
580 /* Unmask interrupt if everything was (and still is) ok */
581 if (xaui_link_ok && efx->link_up)
582 falcon_mask_status_intr(efx, 1);
587 /* Simulate a PHY event */
588 void falcon_xmac_sim_phy_event(struct efx_nic *efx)
590 efx_qword_t phy_event;
592 EFX_POPULATE_QWORD_2(phy_event,
593 EV_CODE, GLOBAL_EV_DECODE,
595 falcon_generate_event(&efx->channel[0], &phy_event);
598 int falcon_xmac_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
600 mdio_clause45_get_settings(efx, ecmd);
601 ecmd->transceiver = XCVR_INTERNAL;
602 ecmd->phy_address = efx->mii.phy_id;
603 ecmd->autoneg = AUTONEG_DISABLE;
604 ecmd->duplex = DUPLEX_FULL;
608 int falcon_xmac_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
610 if (ecmd->transceiver != XCVR_INTERNAL)
612 if (ecmd->autoneg != AUTONEG_DISABLE)
614 if (ecmd->duplex != DUPLEX_FULL)
617 return mdio_clause45_set_settings(efx, ecmd);
621 int falcon_xmac_set_pause(struct efx_nic *efx, enum efx_fc_type flow_control)
625 if (flow_control & EFX_FC_AUTO) {
626 EFX_LOG(efx, "10G does not support flow control "
627 "autonegotiation\n");
631 if ((flow_control & EFX_FC_TX) && !(flow_control & EFX_FC_RX))
634 /* TX flow control may automatically turn itself off if the
635 * link partner (intermittently) stops responding to pause
636 * frames. There isn't any indication that this has happened,
637 * so the best we do is leave it up to the user to spot this
638 * and fix it be cycling transmit flow control on this end. */
639 reset = ((flow_control & EFX_FC_TX) &&
640 !(efx->flow_control & EFX_FC_TX));
641 if (EFX_WORKAROUND_11482(efx) && reset) {
642 if (falcon_rev(efx) >= FALCON_REV_B0) {
643 /* Recover by resetting the EM block */
645 falcon_drain_tx_fifo(efx);
647 /* Schedule a reset to recover */
648 efx_schedule_reset(efx, RESET_TYPE_INVISIBLE);
652 efx->flow_control = flow_control;