aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-01-30 17:31:07 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-30 17:31:07 -0500
commit05bee4737774881e027bfd9a8b5c40a7d68f6325 (patch)
tree5fd32eb8fe345d2d30e85910beac241a4439e8cd /drivers/net/sfc
parent80595d59ba9917227856e663da249c2276a8628d (diff)
parent905db44087855e3c1709f538ecdc22fd149cadd8 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/e1000/e1000_main.c
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r--drivers/net/sfc/efx.c59
-rw-r--r--drivers/net/sfc/efx.h9
-rw-r--r--drivers/net/sfc/ethtool.c3
-rw-r--r--drivers/net/sfc/falcon.c32
-rw-r--r--drivers/net/sfc/mdio_10g.c191
-rw-r--r--drivers/net/sfc/mdio_10g.h3
-rw-r--r--drivers/net/sfc/net_driver.h9
-rw-r--r--drivers/net/sfc/phy.h1
-rw-r--r--drivers/net/sfc/selftest.c7
-rw-r--r--drivers/net/sfc/sfe4001.c42
-rw-r--r--drivers/net/sfc/tenxpress.c213
-rw-r--r--drivers/net/sfc/workarounds.h12
12 files changed, 279 insertions, 302 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 3ee2a4548cba..75836599e43d 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -675,9 +675,8 @@ static int efx_init_port(struct efx_nic *efx)
675 rc = efx->phy_op->init(efx); 675 rc = efx->phy_op->init(efx);
676 if (rc) 676 if (rc)
677 return rc; 677 return rc;
678 efx->phy_op->reconfigure(efx);
679
680 mutex_lock(&efx->mac_lock); 678 mutex_lock(&efx->mac_lock);
679 efx->phy_op->reconfigure(efx);
681 rc = falcon_switch_mac(efx); 680 rc = falcon_switch_mac(efx);
682 mutex_unlock(&efx->mac_lock); 681 mutex_unlock(&efx->mac_lock);
683 if (rc) 682 if (rc)
@@ -685,7 +684,7 @@ static int efx_init_port(struct efx_nic *efx)
685 efx->mac_op->reconfigure(efx); 684 efx->mac_op->reconfigure(efx);
686 685
687 efx->port_initialized = true; 686 efx->port_initialized = true;
688 efx->stats_enabled = true; 687 efx_stats_enable(efx);
689 return 0; 688 return 0;
690 689
691fail: 690fail:
@@ -734,6 +733,7 @@ static void efx_fini_port(struct efx_nic *efx)
734 if (!efx->port_initialized) 733 if (!efx->port_initialized)
735 return; 734 return;
736 735
736 efx_stats_disable(efx);
737 efx->phy_op->fini(efx); 737 efx->phy_op->fini(efx);
738 efx->port_initialized = false; 738 efx->port_initialized = false;
739 739
@@ -1352,6 +1352,20 @@ static int efx_net_stop(struct net_device *net_dev)
1352 return 0; 1352 return 0;
1353} 1353}
1354 1354
1355void efx_stats_disable(struct efx_nic *efx)
1356{
1357 spin_lock(&efx->stats_lock);
1358 ++efx->stats_disable_count;
1359 spin_unlock(&efx->stats_lock);
1360}
1361
1362void efx_stats_enable(struct efx_nic *efx)
1363{
1364 spin_lock(&efx->stats_lock);
1365 --efx->stats_disable_count;
1366 spin_unlock(&efx->stats_lock);
1367}
1368
1355/* Context: process, dev_base_lock or RTNL held, non-blocking. */ 1369/* Context: process, dev_base_lock or RTNL held, non-blocking. */
1356static struct net_device_stats *efx_net_stats(struct net_device *net_dev) 1370static struct net_device_stats *efx_net_stats(struct net_device *net_dev)
1357{ 1371{
@@ -1360,12 +1374,12 @@ static struct net_device_stats *efx_net_stats(struct net_device *net_dev)
1360 struct net_device_stats *stats = &net_dev->stats; 1374 struct net_device_stats *stats = &net_dev->stats;
1361 1375
1362 /* Update stats if possible, but do not wait if another thread 1376 /* Update stats if possible, but do not wait if another thread
1363 * is updating them (or resetting the NIC); slightly stale 1377 * is updating them or if MAC stats fetches are temporarily
1364 * stats are acceptable. 1378 * disabled; slightly stale stats are acceptable.
1365 */ 1379 */
1366 if (!spin_trylock(&efx->stats_lock)) 1380 if (!spin_trylock(&efx->stats_lock))
1367 return stats; 1381 return stats;
1368 if (efx->stats_enabled) { 1382 if (!efx->stats_disable_count) {
1369 efx->mac_op->update_stats(efx); 1383 efx->mac_op->update_stats(efx);
1370 falcon_update_nic_stats(efx); 1384 falcon_update_nic_stats(efx);
1371 } 1385 }
@@ -1613,16 +1627,12 @@ static void efx_unregister_netdev(struct efx_nic *efx)
1613 1627
1614/* Tears down the entire software state and most of the hardware state 1628/* Tears down the entire software state and most of the hardware state
1615 * before reset. */ 1629 * before reset. */
1616void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd) 1630void efx_reset_down(struct efx_nic *efx, enum reset_type method,
1631 struct ethtool_cmd *ecmd)
1617{ 1632{
1618 EFX_ASSERT_RESET_SERIALISED(efx); 1633 EFX_ASSERT_RESET_SERIALISED(efx);
1619 1634
1620 /* The net_dev->get_stats handler is quite slow, and will fail 1635 efx_stats_disable(efx);
1621 * if a fetch is pending over reset. Serialise against it. */
1622 spin_lock(&efx->stats_lock);
1623 efx->stats_enabled = false;
1624 spin_unlock(&efx->stats_lock);
1625
1626 efx_stop_all(efx); 1636 efx_stop_all(efx);
1627 mutex_lock(&efx->mac_lock); 1637 mutex_lock(&efx->mac_lock);
1628 mutex_lock(&efx->spi_lock); 1638 mutex_lock(&efx->spi_lock);
@@ -1630,6 +1640,8 @@ void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd)
1630 efx->phy_op->get_settings(efx, ecmd); 1640 efx->phy_op->get_settings(efx, ecmd);
1631 1641
1632 efx_fini_channels(efx); 1642 efx_fini_channels(efx);
1643 if (efx->port_initialized && method != RESET_TYPE_INVISIBLE)
1644 efx->phy_op->fini(efx);
1633} 1645}
1634 1646
1635/* This function will always ensure that the locks acquired in 1647/* This function will always ensure that the locks acquired in
@@ -1637,7 +1649,8 @@ void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd)
1637 * that we were unable to reinitialise the hardware, and the 1649 * that we were unable to reinitialise the hardware, and the
1638 * driver should be disabled. If ok is false, then the rx and tx 1650 * driver should be disabled. If ok is false, then the rx and tx
1639 * engines are not restarted, pending a RESET_DISABLE. */ 1651 * engines are not restarted, pending a RESET_DISABLE. */
1640int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd, bool ok) 1652int efx_reset_up(struct efx_nic *efx, enum reset_type method,
1653 struct ethtool_cmd *ecmd, bool ok)
1641{ 1654{
1642 int rc; 1655 int rc;
1643 1656
@@ -1649,6 +1662,15 @@ int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd, bool ok)
1649 ok = false; 1662 ok = false;
1650 } 1663 }
1651 1664
1665 if (efx->port_initialized && method != RESET_TYPE_INVISIBLE) {
1666 if (ok) {
1667 rc = efx->phy_op->init(efx);
1668 if (rc)
1669 ok = false;
1670 } else
1671 efx->port_initialized = false;
1672 }
1673
1652 if (ok) { 1674 if (ok) {
1653 efx_init_channels(efx); 1675 efx_init_channels(efx);
1654 1676
@@ -1661,7 +1683,7 @@ int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd, bool ok)
1661 1683
1662 if (ok) { 1684 if (ok) {
1663 efx_start_all(efx); 1685 efx_start_all(efx);
1664 efx->stats_enabled = true; 1686 efx_stats_enable(efx);
1665 } 1687 }
1666 return rc; 1688 return rc;
1667} 1689}
@@ -1693,7 +1715,7 @@ static int efx_reset(struct efx_nic *efx)
1693 1715
1694 EFX_INFO(efx, "resetting (%d)\n", method); 1716 EFX_INFO(efx, "resetting (%d)\n", method);
1695 1717
1696 efx_reset_down(efx, &ecmd); 1718 efx_reset_down(efx, method, &ecmd);
1697 1719
1698 rc = falcon_reset_hw(efx, method); 1720 rc = falcon_reset_hw(efx, method);
1699 if (rc) { 1721 if (rc) {
@@ -1712,10 +1734,10 @@ static int efx_reset(struct efx_nic *efx)
1712 1734
1713 /* Leave device stopped if necessary */ 1735 /* Leave device stopped if necessary */
1714 if (method == RESET_TYPE_DISABLE) { 1736 if (method == RESET_TYPE_DISABLE) {
1715 efx_reset_up(efx, &ecmd, false); 1737 efx_reset_up(efx, method, &ecmd, false);
1716 rc = -EIO; 1738 rc = -EIO;
1717 } else { 1739 } else {
1718 rc = efx_reset_up(efx, &ecmd, true); 1740 rc = efx_reset_up(efx, method, &ecmd, true);
1719 } 1741 }
1720 1742
1721out_disable: 1743out_disable:
@@ -1867,6 +1889,7 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
1867 efx->rx_checksum_enabled = true; 1889 efx->rx_checksum_enabled = true;
1868 spin_lock_init(&efx->netif_stop_lock); 1890 spin_lock_init(&efx->netif_stop_lock);
1869 spin_lock_init(&efx->stats_lock); 1891 spin_lock_init(&efx->stats_lock);
1892 efx->stats_disable_count = 1;
1870 mutex_init(&efx->mac_lock); 1893 mutex_init(&efx->mac_lock);
1871 efx->mac_op = &efx_dummy_mac_operations; 1894 efx->mac_op = &efx_dummy_mac_operations;
1872 efx->phy_op = &efx_dummy_phy_operations; 1895 efx->phy_op = &efx_dummy_phy_operations;
diff --git a/drivers/net/sfc/efx.h b/drivers/net/sfc/efx.h
index fb1ac0e63c0b..8bde1d2a21db 100644
--- a/drivers/net/sfc/efx.h
+++ b/drivers/net/sfc/efx.h
@@ -36,13 +36,16 @@ extern void efx_process_channel_now(struct efx_channel *channel);
36extern void efx_flush_queues(struct efx_nic *efx); 36extern void efx_flush_queues(struct efx_nic *efx);
37 37
38/* Ports */ 38/* Ports */
39extern void efx_stats_disable(struct efx_nic *efx);
40extern void efx_stats_enable(struct efx_nic *efx);
39extern void efx_reconfigure_port(struct efx_nic *efx); 41extern void efx_reconfigure_port(struct efx_nic *efx);
40extern void __efx_reconfigure_port(struct efx_nic *efx); 42extern void __efx_reconfigure_port(struct efx_nic *efx);
41 43
42/* Reset handling */ 44/* Reset handling */
43extern void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd); 45extern void efx_reset_down(struct efx_nic *efx, enum reset_type method,
44extern int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd, 46 struct ethtool_cmd *ecmd);
45 bool ok); 47extern int efx_reset_up(struct efx_nic *efx, enum reset_type method,
48 struct ethtool_cmd *ecmd, bool ok);
46 49
47/* Global */ 50/* Global */
48extern void efx_schedule_reset(struct efx_nic *efx, enum reset_type type); 51extern void efx_schedule_reset(struct efx_nic *efx, enum reset_type type);
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index 53d259e90187..7b5924c039b3 100644
--- a/drivers/net/sfc/ethtool.c
+++ b/drivers/net/sfc/ethtool.c
@@ -219,9 +219,6 @@ int efx_ethtool_set_settings(struct net_device *net_dev,
219 struct efx_nic *efx = netdev_priv(net_dev); 219 struct efx_nic *efx = netdev_priv(net_dev);
220 int rc; 220 int rc;
221 221
222 if (EFX_WORKAROUND_13963(efx) && !ecmd->autoneg)
223 return -EINVAL;
224
225 /* Falcon GMAC does not support 1000Mbps HD */ 222 /* Falcon GMAC does not support 1000Mbps HD */
226 if (ecmd->speed == SPEED_1000 && ecmd->duplex != DUPLEX_FULL) { 223 if (ecmd->speed == SPEED_1000 && ecmd->duplex != DUPLEX_FULL) {
227 EFX_LOG(efx, "rejecting unsupported 1000Mbps HD" 224 EFX_LOG(efx, "rejecting unsupported 1000Mbps HD"
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 5b9f2d9cc4ed..d5378e60fcdd 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -824,10 +824,6 @@ static void falcon_handle_rx_not_ok(struct efx_rx_queue *rx_queue,
824 rx_ev_pause_frm ? " [PAUSE]" : ""); 824 rx_ev_pause_frm ? " [PAUSE]" : "");
825 } 825 }
826#endif 826#endif
827
828 if (unlikely(rx_ev_eth_crc_err && EFX_WORKAROUND_10750(efx) &&
829 efx->phy_type == PHY_TYPE_SFX7101))
830 tenxpress_crc_err(efx);
831} 827}
832 828
833/* Handle receive events that are not in-order. */ 829/* Handle receive events that are not in-order. */
@@ -1887,7 +1883,7 @@ static int falcon_reset_macs(struct efx_nic *efx)
1887 1883
1888 /* MAC stats will fail whilst the TX fifo is draining. Serialise 1884 /* MAC stats will fail whilst the TX fifo is draining. Serialise
1889 * the drain sequence with the statistics fetch */ 1885 * the drain sequence with the statistics fetch */
1890 spin_lock(&efx->stats_lock); 1886 efx_stats_disable(efx);
1891 1887
1892 falcon_read(efx, &reg, MAC0_CTRL_REG_KER); 1888 falcon_read(efx, &reg, MAC0_CTRL_REG_KER);
1893 EFX_SET_OWORD_FIELD(reg, TXFIFO_DRAIN_EN_B0, 1); 1889 EFX_SET_OWORD_FIELD(reg, TXFIFO_DRAIN_EN_B0, 1);
@@ -1917,7 +1913,7 @@ static int falcon_reset_macs(struct efx_nic *efx)
1917 udelay(10); 1913 udelay(10);
1918 } 1914 }
1919 1915
1920 spin_unlock(&efx->stats_lock); 1916 efx_stats_enable(efx);
1921 1917
1922 /* If we've reset the EM block and the link is up, then 1918 /* If we've reset the EM block and the link is up, then
1923 * we'll have to kick the XAUI link so the PHY can recover */ 1919 * we'll have to kick the XAUI link so the PHY can recover */
@@ -2277,6 +2273,10 @@ int falcon_switch_mac(struct efx_nic *efx)
2277 struct efx_mac_operations *old_mac_op = efx->mac_op; 2273 struct efx_mac_operations *old_mac_op = efx->mac_op;
2278 efx_oword_t nic_stat; 2274 efx_oword_t nic_stat;
2279 unsigned strap_val; 2275 unsigned strap_val;
2276 int rc = 0;
2277
2278 /* Don't try to fetch MAC stats while we're switching MACs */
2279 efx_stats_disable(efx);
2280 2280
2281 /* Internal loopbacks override the phy speed setting */ 2281 /* Internal loopbacks override the phy speed setting */
2282 if (efx->loopback_mode == LOOPBACK_GMAC) { 2282 if (efx->loopback_mode == LOOPBACK_GMAC) {
@@ -2287,16 +2287,12 @@ int falcon_switch_mac(struct efx_nic *efx)
2287 efx->link_fd = true; 2287 efx->link_fd = true;
2288 } 2288 }
2289 2289
2290 WARN_ON(!mutex_is_locked(&efx->mac_lock));
2290 efx->mac_op = (EFX_IS10G(efx) ? 2291 efx->mac_op = (EFX_IS10G(efx) ?
2291 &falcon_xmac_operations : &falcon_gmac_operations); 2292 &falcon_xmac_operations : &falcon_gmac_operations);
2292 if (old_mac_op == efx->mac_op)
2293 return 0;
2294
2295 WARN_ON(!mutex_is_locked(&efx->mac_lock));
2296
2297 /* Not all macs support a mac-level link state */
2298 efx->mac_up = true;
2299 2293
2294 /* Always push the NIC_STAT_REG setting even if the mac hasn't
2295 * changed, because this function is run post online reset */
2300 falcon_read(efx, &nic_stat, NIC_STAT_REG); 2296 falcon_read(efx, &nic_stat, NIC_STAT_REG);
2301 strap_val = EFX_IS10G(efx) ? 5 : 3; 2297 strap_val = EFX_IS10G(efx) ? 5 : 3;
2302 if (falcon_rev(efx) >= FALCON_REV_B0) { 2298 if (falcon_rev(efx) >= FALCON_REV_B0) {
@@ -2309,9 +2305,17 @@ int falcon_switch_mac(struct efx_nic *efx)
2309 BUG_ON(EFX_OWORD_FIELD(nic_stat, STRAP_PINS) != strap_val); 2305 BUG_ON(EFX_OWORD_FIELD(nic_stat, STRAP_PINS) != strap_val);
2310 } 2306 }
2311 2307
2308 if (old_mac_op == efx->mac_op)
2309 goto out;
2312 2310
2313 EFX_LOG(efx, "selected %cMAC\n", EFX_IS10G(efx) ? 'X' : 'G'); 2311 EFX_LOG(efx, "selected %cMAC\n", EFX_IS10G(efx) ? 'X' : 'G');
2314 return falcon_reset_macs(efx); 2312 /* Not all macs support a mac-level link state */
2313 efx->mac_up = true;
2314
2315 rc = falcon_reset_macs(efx);
2316out:
2317 efx_stats_enable(efx);
2318 return rc;
2315} 2319}
2316 2320
2317/* This call is responsible for hooking in the MAC and PHY operations */ 2321/* This call is responsible for hooking in the MAC and PHY operations */
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c
index f6a16428113d..f9e2f95c3b48 100644
--- a/drivers/net/sfc/mdio_10g.c
+++ b/drivers/net/sfc/mdio_10g.c
@@ -15,6 +15,7 @@
15#include "net_driver.h" 15#include "net_driver.h"
16#include "mdio_10g.h" 16#include "mdio_10g.h"
17#include "boards.h" 17#include "boards.h"
18#include "workarounds.h"
18 19
19int mdio_clause45_reset_mmd(struct efx_nic *port, int mmd, 20int mdio_clause45_reset_mmd(struct efx_nic *port, int mmd,
20 int spins, int spintime) 21 int spins, int spintime)
@@ -179,17 +180,12 @@ bool mdio_clause45_links_ok(struct efx_nic *efx, unsigned int mmd_mask)
179 return false; 180 return false;
180 else if (efx_phy_mode_disabled(efx->phy_mode)) 181 else if (efx_phy_mode_disabled(efx->phy_mode))
181 return false; 182 return false;
182 else if (efx->loopback_mode == LOOPBACK_PHYXS) { 183 else if (efx->loopback_mode == LOOPBACK_PHYXS)
183 mmd_mask &= ~(MDIO_MMDREG_DEVS_PHYXS | 184 mmd_mask &= ~(MDIO_MMDREG_DEVS_PHYXS |
184 MDIO_MMDREG_DEVS_PCS | 185 MDIO_MMDREG_DEVS_PCS |
185 MDIO_MMDREG_DEVS_PMAPMD | 186 MDIO_MMDREG_DEVS_PMAPMD |
186 MDIO_MMDREG_DEVS_AN); 187 MDIO_MMDREG_DEVS_AN);
187 if (!mmd_mask) { 188 else if (efx->loopback_mode == LOOPBACK_PCS)
188 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PHYXS,
189 MDIO_PHYXS_STATUS2);
190 return !(reg & (1 << MDIO_PHYXS_STATUS2_RX_FAULT_LBN));
191 }
192 } else if (efx->loopback_mode == LOOPBACK_PCS)
193 mmd_mask &= ~(MDIO_MMDREG_DEVS_PCS | 189 mmd_mask &= ~(MDIO_MMDREG_DEVS_PCS |
194 MDIO_MMDREG_DEVS_PMAPMD | 190 MDIO_MMDREG_DEVS_PMAPMD |
195 MDIO_MMDREG_DEVS_AN); 191 MDIO_MMDREG_DEVS_AN);
@@ -197,6 +193,13 @@ bool mdio_clause45_links_ok(struct efx_nic *efx, unsigned int mmd_mask)
197 mmd_mask &= ~(MDIO_MMDREG_DEVS_PMAPMD | 193 mmd_mask &= ~(MDIO_MMDREG_DEVS_PMAPMD |
198 MDIO_MMDREG_DEVS_AN); 194 MDIO_MMDREG_DEVS_AN);
199 195
196 if (!mmd_mask) {
197 /* Use presence of XGMII faults in leui of link state */
198 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PHYXS,
199 MDIO_PHYXS_STATUS2);
200 return !(reg & (1 << MDIO_PHYXS_STATUS2_RX_FAULT_LBN));
201 }
202
200 while (mmd_mask) { 203 while (mmd_mask) {
201 if (mmd_mask & 1) { 204 if (mmd_mask & 1) {
202 /* Double reads because link state is latched, and a 205 /* Double reads because link state is latched, and a
@@ -263,7 +266,7 @@ void mdio_clause45_set_mmds_lpower(struct efx_nic *efx,
263 } 266 }
264} 267}
265 268
266static u32 mdio_clause45_get_an(struct efx_nic *efx, u16 addr, u32 xnp) 269static u32 mdio_clause45_get_an(struct efx_nic *efx, u16 addr)
267{ 270{
268 int phy_id = efx->mii.phy_id; 271 int phy_id = efx->mii.phy_id;
269 u32 result = 0; 272 u32 result = 0;
@@ -278,9 +281,6 @@ static u32 mdio_clause45_get_an(struct efx_nic *efx, u16 addr, u32 xnp)
278 result |= ADVERTISED_100baseT_Half; 281 result |= ADVERTISED_100baseT_Half;
279 if (reg & ADVERTISE_100FULL) 282 if (reg & ADVERTISE_100FULL)
280 result |= ADVERTISED_100baseT_Full; 283 result |= ADVERTISED_100baseT_Full;
281 if (reg & LPA_RESV)
282 result |= xnp;
283
284 return result; 284 return result;
285} 285}
286 286
@@ -310,7 +310,7 @@ void mdio_clause45_get_settings(struct efx_nic *efx,
310 */ 310 */
311void mdio_clause45_get_settings_ext(struct efx_nic *efx, 311void mdio_clause45_get_settings_ext(struct efx_nic *efx,
312 struct ethtool_cmd *ecmd, 312 struct ethtool_cmd *ecmd,
313 u32 xnp, u32 xnp_lpa) 313 u32 npage_adv, u32 npage_lpa)
314{ 314{
315 int phy_id = efx->mii.phy_id; 315 int phy_id = efx->mii.phy_id;
316 int reg; 316 int reg;
@@ -361,8 +361,8 @@ void mdio_clause45_get_settings_ext(struct efx_nic *efx,
361 ecmd->autoneg = AUTONEG_ENABLE; 361 ecmd->autoneg = AUTONEG_ENABLE;
362 ecmd->advertising |= 362 ecmd->advertising |=
363 ADVERTISED_Autoneg | 363 ADVERTISED_Autoneg |
364 mdio_clause45_get_an(efx, 364 mdio_clause45_get_an(efx, MDIO_AN_ADVERTISE) |
365 MDIO_AN_ADVERTISE, xnp); 365 npage_adv;
366 } else 366 } else
367 ecmd->autoneg = AUTONEG_DISABLE; 367 ecmd->autoneg = AUTONEG_DISABLE;
368 } else 368 } else
@@ -371,27 +371,30 @@ void mdio_clause45_get_settings_ext(struct efx_nic *efx,
371 if (ecmd->autoneg) { 371 if (ecmd->autoneg) {
372 /* If AN is complete, report best common mode, 372 /* If AN is complete, report best common mode,
373 * otherwise report best advertised mode. */ 373 * otherwise report best advertised mode. */
374 u32 common = ecmd->advertising; 374 u32 modes = 0;
375 if (mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, 375 if (mdio_clause45_read(efx, phy_id, MDIO_MMD_AN,
376 MDIO_MMDREG_STAT1) & 376 MDIO_MMDREG_STAT1) &
377 (1 << MDIO_AN_STATUS_AN_DONE_LBN)) { 377 (1 << MDIO_AN_STATUS_AN_DONE_LBN))
378 common &= mdio_clause45_get_an(efx, MDIO_AN_LPA, 378 modes = (ecmd->advertising &
379 xnp_lpa); 379 (mdio_clause45_get_an(efx, MDIO_AN_LPA) |
380 } 380 npage_lpa));
381 if (common & ADVERTISED_10000baseT_Full) { 381 if (modes == 0)
382 modes = ecmd->advertising;
383
384 if (modes & ADVERTISED_10000baseT_Full) {
382 ecmd->speed = SPEED_10000; 385 ecmd->speed = SPEED_10000;
383 ecmd->duplex = DUPLEX_FULL; 386 ecmd->duplex = DUPLEX_FULL;
384 } else if (common & (ADVERTISED_1000baseT_Full | 387 } else if (modes & (ADVERTISED_1000baseT_Full |
385 ADVERTISED_1000baseT_Half)) { 388 ADVERTISED_1000baseT_Half)) {
386 ecmd->speed = SPEED_1000; 389 ecmd->speed = SPEED_1000;
387 ecmd->duplex = !!(common & ADVERTISED_1000baseT_Full); 390 ecmd->duplex = !!(modes & ADVERTISED_1000baseT_Full);
388 } else if (common & (ADVERTISED_100baseT_Full | 391 } else if (modes & (ADVERTISED_100baseT_Full |
389 ADVERTISED_100baseT_Half)) { 392 ADVERTISED_100baseT_Half)) {
390 ecmd->speed = SPEED_100; 393 ecmd->speed = SPEED_100;
391 ecmd->duplex = !!(common & ADVERTISED_100baseT_Full); 394 ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full);
392 } else { 395 } else {
393 ecmd->speed = SPEED_10; 396 ecmd->speed = SPEED_10;
394 ecmd->duplex = !!(common & ADVERTISED_10baseT_Full); 397 ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full);
395 } 398 }
396 } else { 399 } else {
397 /* Report forced settings */ 400 /* Report forced settings */
@@ -415,7 +418,7 @@ int mdio_clause45_set_settings(struct efx_nic *efx,
415 int phy_id = efx->mii.phy_id; 418 int phy_id = efx->mii.phy_id;
416 struct ethtool_cmd prev; 419 struct ethtool_cmd prev;
417 u32 required; 420 u32 required;
418 int ctrl1_bits, reg; 421 int reg;
419 422
420 efx->phy_op->get_settings(efx, &prev); 423 efx->phy_op->get_settings(efx, &prev);
421 424
@@ -430,99 +433,83 @@ int mdio_clause45_set_settings(struct efx_nic *efx,
430 if (prev.port != PORT_TP || ecmd->port != PORT_TP) 433 if (prev.port != PORT_TP || ecmd->port != PORT_TP)
431 return -EINVAL; 434 return -EINVAL;
432 435
433 /* Check that PHY supports these settings and work out the 436 /* Check that PHY supports these settings */
434 * basic control bits */ 437 if (ecmd->autoneg) {
435 if (ecmd->duplex) { 438 required = SUPPORTED_Autoneg;
439 } else if (ecmd->duplex) {
436 switch (ecmd->speed) { 440 switch (ecmd->speed) {
437 case SPEED_10: 441 case SPEED_10: required = SUPPORTED_10baseT_Full; break;
438 ctrl1_bits = BMCR_FULLDPLX; 442 case SPEED_100: required = SUPPORTED_100baseT_Full; break;
439 required = SUPPORTED_10baseT_Full; 443 default: return -EINVAL;
440 break;
441 case SPEED_100:
442 ctrl1_bits = BMCR_SPEED100 | BMCR_FULLDPLX;
443 required = SUPPORTED_100baseT_Full;
444 break;
445 case SPEED_1000:
446 ctrl1_bits = BMCR_SPEED1000 | BMCR_FULLDPLX;
447 required = SUPPORTED_1000baseT_Full;
448 break;
449 case SPEED_10000:
450 ctrl1_bits = (BMCR_SPEED1000 | BMCR_SPEED100 |
451 BMCR_FULLDPLX);
452 required = SUPPORTED_10000baseT_Full;
453 break;
454 default:
455 return -EINVAL;
456 } 444 }
457 } else { 445 } else {
458 switch (ecmd->speed) { 446 switch (ecmd->speed) {
459 case SPEED_10: 447 case SPEED_10: required = SUPPORTED_10baseT_Half; break;
460 ctrl1_bits = 0; 448 case SPEED_100: required = SUPPORTED_100baseT_Half; break;
461 required = SUPPORTED_10baseT_Half; 449 default: return -EINVAL;
462 break;
463 case SPEED_100:
464 ctrl1_bits = BMCR_SPEED100;
465 required = SUPPORTED_100baseT_Half;
466 break;
467 case SPEED_1000:
468 ctrl1_bits = BMCR_SPEED1000;
469 required = SUPPORTED_1000baseT_Half;
470 break;
471 default:
472 return -EINVAL;
473 } 450 }
474 } 451 }
475 if (ecmd->autoneg)
476 required |= SUPPORTED_Autoneg;
477 required |= ecmd->advertising; 452 required |= ecmd->advertising;
478 if (required & ~prev.supported) 453 if (required & ~prev.supported)
479 return -EINVAL; 454 return -EINVAL;
480 455
481 /* Set the basic control bits */ 456 if (ecmd->autoneg) {
482 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD, 457 bool xnp = (ecmd->advertising & ADVERTISED_10000baseT_Full
483 MDIO_MMDREG_CTRL1); 458 || EFX_WORKAROUND_13204(efx));
484 reg &= ~(BMCR_SPEED1000 | BMCR_SPEED100 | BMCR_FULLDPLX | 0x003c); 459
485 reg |= ctrl1_bits; 460 /* Set up the base page */
486 mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD, MDIO_MMDREG_CTRL1, 461 reg = ADVERTISE_CSMA;
487 reg); 462 if (ecmd->advertising & ADVERTISED_10baseT_Half)
488 463 reg |= ADVERTISE_10HALF;
489 /* Set the AN registers */ 464 if (ecmd->advertising & ADVERTISED_10baseT_Full)
490 if (ecmd->autoneg != prev.autoneg || 465 reg |= ADVERTISE_10FULL;
491 ecmd->advertising != prev.advertising) { 466 if (ecmd->advertising & ADVERTISED_100baseT_Half)
492 bool xnp = false; 467 reg |= ADVERTISE_100HALF;
493 468 if (ecmd->advertising & ADVERTISED_100baseT_Full)
494 if (efx->phy_op->set_xnp_advertise) 469 reg |= ADVERTISE_100FULL;
495 xnp = efx->phy_op->set_xnp_advertise(efx, 470 if (xnp)
496 ecmd->advertising); 471 reg |= ADVERTISE_RESV;
497 472 else if (ecmd->advertising & (ADVERTISED_1000baseT_Half |
498 if (ecmd->autoneg) { 473 ADVERTISED_1000baseT_Full))
499 reg = 0; 474 reg |= ADVERTISE_NPAGE;
500 if (ecmd->advertising & ADVERTISED_10baseT_Half) 475 reg |= efx_fc_advertise(efx->wanted_fc);
501 reg |= ADVERTISE_10HALF; 476 mdio_clause45_write(efx, phy_id, MDIO_MMD_AN,
502 if (ecmd->advertising & ADVERTISED_10baseT_Full) 477 MDIO_AN_ADVERTISE, reg);
503 reg |= ADVERTISE_10FULL; 478
504 if (ecmd->advertising & ADVERTISED_100baseT_Half) 479 /* Set up the (extended) next page if necessary */
505 reg |= ADVERTISE_100HALF; 480 if (efx->phy_op->set_npage_adv)
506 if (ecmd->advertising & ADVERTISED_100baseT_Full) 481 efx->phy_op->set_npage_adv(efx, ecmd->advertising);
507 reg |= ADVERTISE_100FULL;
508 if (xnp)
509 reg |= ADVERTISE_RESV;
510 mdio_clause45_write(efx, phy_id, MDIO_MMD_AN,
511 MDIO_AN_ADVERTISE, reg);
512 }
513 482
483 /* Enable and restart AN */
514 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, 484 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN,
515 MDIO_MMDREG_CTRL1); 485 MDIO_MMDREG_CTRL1);
516 if (ecmd->autoneg) 486 reg |= BMCR_ANENABLE;
517 reg |= BMCR_ANENABLE | BMCR_ANRESTART; 487 if (!(EFX_WORKAROUND_15195(efx) &&
518 else 488 LOOPBACK_MASK(efx) & efx->phy_op->loopbacks))
519 reg &= ~BMCR_ANENABLE; 489 reg |= BMCR_ANRESTART;
520 if (xnp) 490 if (xnp)
521 reg |= 1 << MDIO_AN_CTRL_XNP_LBN; 491 reg |= 1 << MDIO_AN_CTRL_XNP_LBN;
522 else 492 else
523 reg &= ~(1 << MDIO_AN_CTRL_XNP_LBN); 493 reg &= ~(1 << MDIO_AN_CTRL_XNP_LBN);
524 mdio_clause45_write(efx, phy_id, MDIO_MMD_AN, 494 mdio_clause45_write(efx, phy_id, MDIO_MMD_AN,
525 MDIO_MMDREG_CTRL1, reg); 495 MDIO_MMDREG_CTRL1, reg);
496 } else {
497 /* Disable AN */
498 mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_AN,
499 MDIO_MMDREG_CTRL1,
500 __ffs(BMCR_ANENABLE), false);
501
502 /* Set the basic control bits */
503 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD,
504 MDIO_MMDREG_CTRL1);
505 reg &= ~(BMCR_SPEED1000 | BMCR_SPEED100 | BMCR_FULLDPLX |
506 0x003c);
507 if (ecmd->speed == SPEED_100)
508 reg |= BMCR_SPEED100;
509 if (ecmd->duplex)
510 reg |= BMCR_FULLDPLX;
511 mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD,
512 MDIO_MMDREG_CTRL1, reg);
526 } 513 }
527 514
528 return 0; 515 return 0;
diff --git a/drivers/net/sfc/mdio_10g.h b/drivers/net/sfc/mdio_10g.h
index 09bf801d0569..8ba49773ce7e 100644
--- a/drivers/net/sfc/mdio_10g.h
+++ b/drivers/net/sfc/mdio_10g.h
@@ -155,7 +155,8 @@
155#define MDIO_AN_XNP 22 155#define MDIO_AN_XNP 22
156#define MDIO_AN_LPA_XNP 25 156#define MDIO_AN_LPA_XNP 25
157 157
158#define MDIO_AN_10GBT_ADVERTISE 32 158#define MDIO_AN_10GBT_CTRL 32
159#define MDIO_AN_10GBT_CTRL_ADV_10G_LBN 12
159#define MDIO_AN_10GBT_STATUS (33) 160#define MDIO_AN_10GBT_STATUS (33)
160#define MDIO_AN_10GBT_STATUS_MS_FLT_LBN (15) /* MASTER/SLAVE config fault */ 161#define MDIO_AN_10GBT_STATUS_MS_FLT_LBN (15) /* MASTER/SLAVE config fault */
161#define MDIO_AN_10GBT_STATUS_MS_LBN (14) /* MASTER/SLAVE config */ 162#define MDIO_AN_10GBT_STATUS_MS_LBN (14) /* MASTER/SLAVE config */
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 8643505788cc..19930ff9df7b 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -557,7 +557,7 @@ struct efx_mac_operations {
557 * @poll: Poll for hardware state. Serialised by the mac_lock. 557 * @poll: Poll for hardware state. Serialised by the mac_lock.
558 * @get_settings: Get ethtool settings. Serialised by the mac_lock. 558 * @get_settings: Get ethtool settings. Serialised by the mac_lock.
559 * @set_settings: Set ethtool settings. Serialised by the mac_lock. 559 * @set_settings: Set ethtool settings. Serialised by the mac_lock.
560 * @set_xnp_advertise: Set abilities advertised in Extended Next Page 560 * @set_npage_adv: Set abilities advertised in (Extended) Next Page
561 * (only needed where AN bit is set in mmds) 561 * (only needed where AN bit is set in mmds)
562 * @num_tests: Number of PHY-specific tests/results 562 * @num_tests: Number of PHY-specific tests/results
563 * @test_names: Names of the tests/results 563 * @test_names: Names of the tests/results
@@ -577,7 +577,7 @@ struct efx_phy_operations {
577 struct ethtool_cmd *ecmd); 577 struct ethtool_cmd *ecmd);
578 int (*set_settings) (struct efx_nic *efx, 578 int (*set_settings) (struct efx_nic *efx,
579 struct ethtool_cmd *ecmd); 579 struct ethtool_cmd *ecmd);
580 bool (*set_xnp_advertise) (struct efx_nic *efx, u32); 580 void (*set_npage_adv) (struct efx_nic *efx, u32);
581 u32 num_tests; 581 u32 num_tests;
582 const char *const *test_names; 582 const char *const *test_names;
583 int (*run_tests) (struct efx_nic *efx, int *results, unsigned flags); 583 int (*run_tests) (struct efx_nic *efx, int *results, unsigned flags);
@@ -745,8 +745,7 @@ union efx_multicast_hash {
745 * &struct net_device_stats. 745 * &struct net_device_stats.
746 * @stats_buffer: DMA buffer for statistics 746 * @stats_buffer: DMA buffer for statistics
747 * @stats_lock: Statistics update lock. Serialises statistics fetches 747 * @stats_lock: Statistics update lock. Serialises statistics fetches
748 * @stats_enabled: Temporarily disable statistics fetches. 748 * @stats_disable_count: Nest count for disabling statistics fetches
749 * Serialised by @stats_lock
750 * @mac_op: MAC interface 749 * @mac_op: MAC interface
751 * @mac_address: Permanent MAC address 750 * @mac_address: Permanent MAC address
752 * @phy_type: PHY type 751 * @phy_type: PHY type
@@ -828,7 +827,7 @@ struct efx_nic {
828 struct efx_mac_stats mac_stats; 827 struct efx_mac_stats mac_stats;
829 struct efx_buffer stats_buffer; 828 struct efx_buffer stats_buffer;
830 spinlock_t stats_lock; 829 spinlock_t stats_lock;
831 bool stats_enabled; 830 unsigned int stats_disable_count;
832 831
833 struct efx_mac_operations *mac_op; 832 struct efx_mac_operations *mac_op;
834 unsigned char mac_address[ETH_ALEN]; 833 unsigned char mac_address[ETH_ALEN];
diff --git a/drivers/net/sfc/phy.h b/drivers/net/sfc/phy.h
index 58c493ef81bb..07e855c148bc 100644
--- a/drivers/net/sfc/phy.h
+++ b/drivers/net/sfc/phy.h
@@ -17,7 +17,6 @@ extern struct efx_phy_operations falcon_sfx7101_phy_ops;
17extern struct efx_phy_operations falcon_sft9001_phy_ops; 17extern struct efx_phy_operations falcon_sft9001_phy_ops;
18 18
19extern void tenxpress_phy_blink(struct efx_nic *efx, bool blink); 19extern void tenxpress_phy_blink(struct efx_nic *efx, bool blink);
20extern void tenxpress_crc_err(struct efx_nic *efx);
21 20
22/**************************************************************************** 21/****************************************************************************
23 * Exported functions from the driver for XFP optical PHYs 22 * Exported functions from the driver for XFP optical PHYs
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index dba0d64d50cd..0a598084c513 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -665,6 +665,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
665{ 665{
666 enum efx_loopback_mode loopback_mode = efx->loopback_mode; 666 enum efx_loopback_mode loopback_mode = efx->loopback_mode;
667 int phy_mode = efx->phy_mode; 667 int phy_mode = efx->phy_mode;
668 enum reset_type reset_method = RESET_TYPE_INVISIBLE;
668 struct ethtool_cmd ecmd; 669 struct ethtool_cmd ecmd;
669 struct efx_channel *channel; 670 struct efx_channel *channel;
670 int rc_test = 0, rc_reset = 0, rc; 671 int rc_test = 0, rc_reset = 0, rc;
@@ -718,21 +719,21 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
718 mutex_unlock(&efx->mac_lock); 719 mutex_unlock(&efx->mac_lock);
719 720
720 /* free up all consumers of SRAM (including all the queues) */ 721 /* free up all consumers of SRAM (including all the queues) */
721 efx_reset_down(efx, &ecmd); 722 efx_reset_down(efx, reset_method, &ecmd);
722 723
723 rc = efx_test_chip(efx, tests); 724 rc = efx_test_chip(efx, tests);
724 if (rc && !rc_test) 725 if (rc && !rc_test)
725 rc_test = rc; 726 rc_test = rc;
726 727
727 /* reset the chip to recover from the register test */ 728 /* reset the chip to recover from the register test */
728 rc_reset = falcon_reset_hw(efx, RESET_TYPE_ALL); 729 rc_reset = falcon_reset_hw(efx, reset_method);
729 730
730 /* Ensure that the phy is powered and out of loopback 731 /* Ensure that the phy is powered and out of loopback
731 * for the bist and loopback tests */ 732 * for the bist and loopback tests */
732 efx->phy_mode &= ~PHY_MODE_LOW_POWER; 733 efx->phy_mode &= ~PHY_MODE_LOW_POWER;
733 efx->loopback_mode = LOOPBACK_NONE; 734 efx->loopback_mode = LOOPBACK_NONE;
734 735
735 rc = efx_reset_up(efx, &ecmd, rc_reset == 0); 736 rc = efx_reset_up(efx, reset_method, &ecmd, rc_reset == 0);
736 if (rc && !rc_reset) 737 if (rc && !rc_reset)
737 rc_reset = rc; 738 rc_reset = rc;
738 739
diff --git a/drivers/net/sfc/sfe4001.c b/drivers/net/sfc/sfe4001.c
index d21d014bf0c1..c0e906831623 100644
--- a/drivers/net/sfc/sfe4001.c
+++ b/drivers/net/sfc/sfe4001.c
@@ -187,19 +187,22 @@ static int sfn4111t_reset(struct efx_nic *efx)
187{ 187{
188 efx_oword_t reg; 188 efx_oword_t reg;
189 189
190 /* GPIO pins are also used for I2C, so block that temporarily */ 190 /* GPIO 3 and the GPIO register are shared with I2C, so block that */
191 mutex_lock(&efx->i2c_adap.bus_lock); 191 mutex_lock(&efx->i2c_adap.bus_lock);
192 192
193 /* Pull RST_N (GPIO 2) low then let it up again, setting the
194 * FLASH_CFG_1 strap (GPIO 3) appropriately. Only change the
195 * output enables; the output levels should always be 0 (low)
196 * and we rely on external pull-ups. */
193 falcon_read(efx, &reg, GPIO_CTL_REG_KER); 197 falcon_read(efx, &reg, GPIO_CTL_REG_KER);
194 EFX_SET_OWORD_FIELD(reg, GPIO2_OEN, true); 198 EFX_SET_OWORD_FIELD(reg, GPIO2_OEN, true);
195 EFX_SET_OWORD_FIELD(reg, GPIO2_OUT, false);
196 falcon_write(efx, &reg, GPIO_CTL_REG_KER); 199 falcon_write(efx, &reg, GPIO_CTL_REG_KER);
197 msleep(1000); 200 msleep(1000);
198 EFX_SET_OWORD_FIELD(reg, GPIO2_OUT, true); 201 EFX_SET_OWORD_FIELD(reg, GPIO2_OEN, false);
199 EFX_SET_OWORD_FIELD(reg, GPIO3_OEN, true); 202 EFX_SET_OWORD_FIELD(reg, GPIO3_OEN,
200 EFX_SET_OWORD_FIELD(reg, GPIO3_OUT, 203 !!(efx->phy_mode & PHY_MODE_SPECIAL));
201 !(efx->phy_mode & PHY_MODE_SPECIAL));
202 falcon_write(efx, &reg, GPIO_CTL_REG_KER); 204 falcon_write(efx, &reg, GPIO_CTL_REG_KER);
205 msleep(1);
203 206
204 mutex_unlock(&efx->i2c_adap.bus_lock); 207 mutex_unlock(&efx->i2c_adap.bus_lock);
205 208
@@ -233,12 +236,18 @@ static ssize_t set_phy_flash_cfg(struct device *dev,
233 } else if (efx->state != STATE_RUNNING || netif_running(efx->net_dev)) { 236 } else if (efx->state != STATE_RUNNING || netif_running(efx->net_dev)) {
234 err = -EBUSY; 237 err = -EBUSY;
235 } else { 238 } else {
239 /* Reset the PHY, reconfigure the MAC and enable/disable
240 * MAC stats accordingly. */
236 efx->phy_mode = new_mode; 241 efx->phy_mode = new_mode;
242 if (new_mode & PHY_MODE_SPECIAL)
243 efx_stats_disable(efx);
237 if (efx->board_info.type == EFX_BOARD_SFE4001) 244 if (efx->board_info.type == EFX_BOARD_SFE4001)
238 err = sfe4001_poweron(efx); 245 err = sfe4001_poweron(efx);
239 else 246 else
240 err = sfn4111t_reset(efx); 247 err = sfn4111t_reset(efx);
241 efx_reconfigure_port(efx); 248 efx_reconfigure_port(efx);
249 if (!(new_mode & PHY_MODE_SPECIAL))
250 efx_stats_enable(efx);
242 } 251 }
243 rtnl_unlock(); 252 rtnl_unlock();
244 253
@@ -327,6 +336,11 @@ int sfe4001_init(struct efx_nic *efx)
327 efx->board_info.monitor = sfe4001_check_hw; 336 efx->board_info.monitor = sfe4001_check_hw;
328 efx->board_info.fini = sfe4001_fini; 337 efx->board_info.fini = sfe4001_fini;
329 338
339 if (efx->phy_mode & PHY_MODE_SPECIAL) {
340 /* PHY won't generate a 156.25 MHz clock and MAC stats fetch
341 * will fail. */
342 efx_stats_disable(efx);
343 }
330 rc = sfe4001_poweron(efx); 344 rc = sfe4001_poweron(efx);
331 if (rc) 345 if (rc)
332 goto fail_ioexp; 346 goto fail_ioexp;
@@ -373,17 +387,25 @@ static void sfn4111t_fini(struct efx_nic *efx)
373 i2c_unregister_device(efx->board_info.hwmon_client); 387 i2c_unregister_device(efx->board_info.hwmon_client);
374} 388}
375 389
376static struct i2c_board_info sfn4111t_hwmon_info = { 390static struct i2c_board_info sfn4111t_a0_hwmon_info = {
377 I2C_BOARD_INFO("max6647", 0x4e), 391 I2C_BOARD_INFO("max6647", 0x4e),
378 .irq = -1, 392 .irq = -1,
379}; 393};
380 394
395static struct i2c_board_info sfn4111t_r5_hwmon_info = {
396 I2C_BOARD_INFO("max6646", 0x4d),
397 .irq = -1,
398};
399
381int sfn4111t_init(struct efx_nic *efx) 400int sfn4111t_init(struct efx_nic *efx)
382{ 401{
383 int rc; 402 int rc;
384 403
385 efx->board_info.hwmon_client = 404 efx->board_info.hwmon_client =
386 i2c_new_device(&efx->i2c_adap, &sfn4111t_hwmon_info); 405 i2c_new_device(&efx->i2c_adap,
406 (efx->board_info.minor < 5) ?
407 &sfn4111t_a0_hwmon_info :
408 &sfn4111t_r5_hwmon_info);
387 if (!efx->board_info.hwmon_client) 409 if (!efx->board_info.hwmon_client)
388 return -EIO; 410 return -EIO;
389 411
@@ -395,8 +417,10 @@ int sfn4111t_init(struct efx_nic *efx)
395 if (rc) 417 if (rc)
396 goto fail_hwmon; 418 goto fail_hwmon;
397 419
398 if (efx->phy_mode & PHY_MODE_SPECIAL) 420 if (efx->phy_mode & PHY_MODE_SPECIAL) {
421 efx_stats_disable(efx);
399 sfn4111t_reset(efx); 422 sfn4111t_reset(efx);
423 }
400 424
401 return 0; 425 return 0;
402 426
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c
index f1365097b4fd..ac9eeab79f20 100644
--- a/drivers/net/sfc/tenxpress.c
+++ b/drivers/net/sfc/tenxpress.c
@@ -68,6 +68,8 @@
68#define PMA_PMD_EXT_CLK312_WIDTH 1 68#define PMA_PMD_EXT_CLK312_WIDTH 1
69#define PMA_PMD_EXT_LPOWER_LBN 12 69#define PMA_PMD_EXT_LPOWER_LBN 12
70#define PMA_PMD_EXT_LPOWER_WIDTH 1 70#define PMA_PMD_EXT_LPOWER_WIDTH 1
71#define PMA_PMD_EXT_ROBUST_LBN 14
72#define PMA_PMD_EXT_ROBUST_WIDTH 1
71#define PMA_PMD_EXT_SSR_LBN 15 73#define PMA_PMD_EXT_SSR_LBN 15
72#define PMA_PMD_EXT_SSR_WIDTH 1 74#define PMA_PMD_EXT_SSR_WIDTH 1
73 75
@@ -178,35 +180,24 @@
178#define C22EXT_STATUS_LINK_LBN 2 180#define C22EXT_STATUS_LINK_LBN 2
179#define C22EXT_STATUS_LINK_WIDTH 1 181#define C22EXT_STATUS_LINK_WIDTH 1
180 182
181#define C22EXT_MSTSLV_REG 49162 183#define C22EXT_MSTSLV_CTRL 49161
182#define C22EXT_MSTSLV_1000_HD_LBN 10 184#define C22EXT_MSTSLV_CTRL_ADV_1000_HD_LBN 8
183#define C22EXT_MSTSLV_1000_HD_WIDTH 1 185#define C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN 9
184#define C22EXT_MSTSLV_1000_FD_LBN 11 186
185#define C22EXT_MSTSLV_1000_FD_WIDTH 1 187#define C22EXT_MSTSLV_STATUS 49162
188#define C22EXT_MSTSLV_STATUS_LP_1000_HD_LBN 10
189#define C22EXT_MSTSLV_STATUS_LP_1000_FD_LBN 11
186 190
187/* Time to wait between powering down the LNPGA and turning off the power 191/* Time to wait between powering down the LNPGA and turning off the power
188 * rails */ 192 * rails */
189#define LNPGA_PDOWN_WAIT (HZ / 5) 193#define LNPGA_PDOWN_WAIT (HZ / 5)
190 194
191static int crc_error_reset_threshold = 100;
192module_param(crc_error_reset_threshold, int, 0644);
193MODULE_PARM_DESC(crc_error_reset_threshold,
194 "Max number of CRC errors before XAUI reset");
195
196struct tenxpress_phy_data { 195struct tenxpress_phy_data {
197 enum efx_loopback_mode loopback_mode; 196 enum efx_loopback_mode loopback_mode;
198 atomic_t bad_crc_count;
199 enum efx_phy_mode phy_mode; 197 enum efx_phy_mode phy_mode;
200 int bad_lp_tries; 198 int bad_lp_tries;
201}; 199};
202 200
203void tenxpress_crc_err(struct efx_nic *efx)
204{
205 struct tenxpress_phy_data *phy_data = efx->phy_data;
206 if (phy_data != NULL)
207 atomic_inc(&phy_data->bad_crc_count);
208}
209
210static ssize_t show_phy_short_reach(struct device *dev, 201static ssize_t show_phy_short_reach(struct device *dev,
211 struct device_attribute *attr, char *buf) 202 struct device_attribute *attr, char *buf)
212{ 203{
@@ -285,7 +276,9 @@ static int tenxpress_init(struct efx_nic *efx)
285 PMA_PMD_XCONTROL_REG); 276 PMA_PMD_XCONTROL_REG);
286 reg |= ((1 << PMA_PMD_EXT_GMII_EN_LBN) | 277 reg |= ((1 << PMA_PMD_EXT_GMII_EN_LBN) |
287 (1 << PMA_PMD_EXT_CLK_OUT_LBN) | 278 (1 << PMA_PMD_EXT_CLK_OUT_LBN) |
288 (1 << PMA_PMD_EXT_CLK312_LBN)); 279 (1 << PMA_PMD_EXT_CLK312_LBN) |
280 (1 << PMA_PMD_EXT_ROBUST_LBN));
281
289 mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD, 282 mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD,
290 PMA_PMD_XCONTROL_REG, reg); 283 PMA_PMD_XCONTROL_REG, reg);
291 mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT, 284 mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT,
@@ -347,6 +340,7 @@ static int tenxpress_phy_init(struct efx_nic *efx)
347 rc = tenxpress_init(efx); 340 rc = tenxpress_init(efx);
348 if (rc < 0) 341 if (rc < 0)
349 goto fail; 342 goto fail;
343 mdio_clause45_set_pause(efx);
350 344
351 if (efx->phy_type == PHY_TYPE_SFT9001B) { 345 if (efx->phy_type == PHY_TYPE_SFT9001B) {
352 rc = device_create_file(&efx->pci_dev->dev, 346 rc = device_create_file(&efx->pci_dev->dev,
@@ -377,8 +371,8 @@ static int tenxpress_special_reset(struct efx_nic *efx)
377 371
378 /* The XGMAC clock is driven from the SFC7101/SFT9001 312MHz clock, so 372 /* The XGMAC clock is driven from the SFC7101/SFT9001 312MHz clock, so
379 * a special software reset can glitch the XGMAC sufficiently for stats 373 * a special software reset can glitch the XGMAC sufficiently for stats
380 * requests to fail. Since we don't often special_reset, just lock. */ 374 * requests to fail. */
381 spin_lock(&efx->stats_lock); 375 efx_stats_disable(efx);
382 376
383 /* Initiate reset */ 377 /* Initiate reset */
384 reg = mdio_clause45_read(efx, efx->mii.phy_id, 378 reg = mdio_clause45_read(efx, efx->mii.phy_id,
@@ -393,17 +387,17 @@ static int tenxpress_special_reset(struct efx_nic *efx)
393 rc = mdio_clause45_wait_reset_mmds(efx, 387 rc = mdio_clause45_wait_reset_mmds(efx,
394 TENXPRESS_REQUIRED_DEVS); 388 TENXPRESS_REQUIRED_DEVS);
395 if (rc < 0) 389 if (rc < 0)
396 goto unlock; 390 goto out;
397 391
398 /* Try and reconfigure the device */ 392 /* Try and reconfigure the device */
399 rc = tenxpress_init(efx); 393 rc = tenxpress_init(efx);
400 if (rc < 0) 394 if (rc < 0)
401 goto unlock; 395 goto out;
402 396
403 /* Wait for the XGXS state machine to churn */ 397 /* Wait for the XGXS state machine to churn */
404 mdelay(10); 398 mdelay(10);
405unlock: 399out:
406 spin_unlock(&efx->stats_lock); 400 efx_stats_enable(efx);
407 return rc; 401 return rc;
408} 402}
409 403
@@ -521,7 +515,7 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx)
521{ 515{
522 struct tenxpress_phy_data *phy_data = efx->phy_data; 516 struct tenxpress_phy_data *phy_data = efx->phy_data;
523 struct ethtool_cmd ecmd; 517 struct ethtool_cmd ecmd;
524 bool phy_mode_change, loop_reset, loop_toggle, loopback; 518 bool phy_mode_change, loop_reset;
525 519
526 if (efx->phy_mode & (PHY_MODE_OFF | PHY_MODE_SPECIAL)) { 520 if (efx->phy_mode & (PHY_MODE_OFF | PHY_MODE_SPECIAL)) {
527 phy_data->phy_mode = efx->phy_mode; 521 phy_data->phy_mode = efx->phy_mode;
@@ -532,12 +526,10 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx)
532 526
533 phy_mode_change = (efx->phy_mode == PHY_MODE_NORMAL && 527 phy_mode_change = (efx->phy_mode == PHY_MODE_NORMAL &&
534 phy_data->phy_mode != PHY_MODE_NORMAL); 528 phy_data->phy_mode != PHY_MODE_NORMAL);
535 loopback = LOOPBACK_MASK(efx) & efx->phy_op->loopbacks;
536 loop_toggle = LOOPBACK_CHANGED(phy_data, efx, efx->phy_op->loopbacks);
537 loop_reset = (LOOPBACK_OUT_OF(phy_data, efx, efx->phy_op->loopbacks) || 529 loop_reset = (LOOPBACK_OUT_OF(phy_data, efx, efx->phy_op->loopbacks) ||
538 LOOPBACK_CHANGED(phy_data, efx, 1 << LOOPBACK_GPHY)); 530 LOOPBACK_CHANGED(phy_data, efx, 1 << LOOPBACK_GPHY));
539 531
540 if (loop_reset || loop_toggle || loopback || phy_mode_change) { 532 if (loop_reset || phy_mode_change) {
541 int rc; 533 int rc;
542 534
543 efx->phy_op->get_settings(efx, &ecmd); 535 efx->phy_op->get_settings(efx, &ecmd);
@@ -552,20 +544,6 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx)
552 falcon_reset_xaui(efx); 544 falcon_reset_xaui(efx);
553 } 545 }
554 546
555 if (efx->phy_type != PHY_TYPE_SFX7101) {
556 /* Only change autoneg once, on coming out or
557 * going into loopback */
558 if (loop_toggle)
559 ecmd.autoneg = !loopback;
560 if (loopback) {
561 ecmd.duplex = DUPLEX_FULL;
562 if (efx->loopback_mode == LOOPBACK_GPHY)
563 ecmd.speed = SPEED_1000;
564 else
565 ecmd.speed = SPEED_10000;
566 }
567 }
568
569 rc = efx->phy_op->set_settings(efx, &ecmd); 547 rc = efx->phy_op->set_settings(efx, &ecmd);
570 WARN_ON(rc); 548 WARN_ON(rc);
571 } 549 }
@@ -624,13 +602,6 @@ static void tenxpress_phy_poll(struct efx_nic *efx)
624 602
625 if (phy_data->phy_mode != PHY_MODE_NORMAL) 603 if (phy_data->phy_mode != PHY_MODE_NORMAL)
626 return; 604 return;
627
628 if (EFX_WORKAROUND_10750(efx) &&
629 atomic_read(&phy_data->bad_crc_count) > crc_error_reset_threshold) {
630 EFX_ERR(efx, "Resetting XAUI due to too many CRC errors\n");
631 falcon_reset_xaui(efx);
632 atomic_set(&phy_data->bad_crc_count, 0);
633 }
634} 605}
635 606
636static void tenxpress_phy_fini(struct efx_nic *efx) 607static void tenxpress_phy_fini(struct efx_nic *efx)
@@ -773,107 +744,76 @@ reset:
773 return rc; 744 return rc;
774} 745}
775 746
776static u32 tenxpress_get_xnp_lpa(struct efx_nic *efx) 747static void
748tenxpress_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
777{ 749{
778 int phy = efx->mii.phy_id; 750 int phy_id = efx->mii.phy_id;
779 u32 lpa = 0; 751 u32 adv = 0, lpa = 0;
780 int reg; 752 int reg;
781 753
782 if (efx->phy_type != PHY_TYPE_SFX7101) { 754 if (efx->phy_type != PHY_TYPE_SFX7101) {
783 reg = mdio_clause45_read(efx, phy, MDIO_MMD_C22EXT, 755 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_C22EXT,
784 C22EXT_MSTSLV_REG); 756 C22EXT_MSTSLV_CTRL);
785 if (reg & (1 << C22EXT_MSTSLV_1000_HD_LBN)) 757 if (reg & (1 << C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN))
758 adv |= ADVERTISED_1000baseT_Full;
759 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_C22EXT,
760 C22EXT_MSTSLV_STATUS);
761 if (reg & (1 << C22EXT_MSTSLV_STATUS_LP_1000_HD_LBN))
786 lpa |= ADVERTISED_1000baseT_Half; 762 lpa |= ADVERTISED_1000baseT_Half;
787 if (reg & (1 << C22EXT_MSTSLV_1000_FD_LBN)) 763 if (reg & (1 << C22EXT_MSTSLV_STATUS_LP_1000_FD_LBN))
788 lpa |= ADVERTISED_1000baseT_Full; 764 lpa |= ADVERTISED_1000baseT_Full;
789 } 765 }
790 reg = mdio_clause45_read(efx, phy, MDIO_MMD_AN, MDIO_AN_10GBT_STATUS); 766 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN,
767 MDIO_AN_10GBT_CTRL);
768 if (reg & (1 << MDIO_AN_10GBT_CTRL_ADV_10G_LBN))
769 adv |= ADVERTISED_10000baseT_Full;
770 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN,
771 MDIO_AN_10GBT_STATUS);
791 if (reg & (1 << MDIO_AN_10GBT_STATUS_LP_10G_LBN)) 772 if (reg & (1 << MDIO_AN_10GBT_STATUS_LP_10G_LBN))
792 lpa |= ADVERTISED_10000baseT_Full; 773 lpa |= ADVERTISED_10000baseT_Full;
793 return lpa;
794}
795 774
796static void sfx7101_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) 775 mdio_clause45_get_settings_ext(efx, ecmd, adv, lpa);
797{ 776
798 mdio_clause45_get_settings_ext(efx, ecmd, ADVERTISED_10000baseT_Full, 777 if (efx->phy_type != PHY_TYPE_SFX7101)
799 tenxpress_get_xnp_lpa(efx)); 778 ecmd->supported |= (SUPPORTED_100baseT_Full |
800 ecmd->supported |= SUPPORTED_10000baseT_Full; 779 SUPPORTED_1000baseT_Full);
801 ecmd->advertising |= ADVERTISED_10000baseT_Full; 780
781 /* In loopback, the PHY automatically brings up the correct interface,
782 * but doesn't advertise the correct speed. So override it */
783 if (efx->loopback_mode == LOOPBACK_GPHY)
784 ecmd->speed = SPEED_1000;
785 else if (LOOPBACK_MASK(efx) & efx->phy_op->loopbacks)
786 ecmd->speed = SPEED_10000;
802} 787}
803 788
804static void sft9001_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) 789static int tenxpress_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
805{ 790{
806 int phy_id = efx->mii.phy_id; 791 if (!ecmd->autoneg)
807 u32 xnp_adv = 0; 792 return -EINVAL;
808 int reg;
809
810 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD,
811 PMA_PMD_SPEED_ENABLE_REG);
812 if (EFX_WORKAROUND_13204(efx) && (reg & (1 << PMA_PMD_100TX_ADV_LBN)))
813 xnp_adv |= ADVERTISED_100baseT_Full;
814 if (reg & (1 << PMA_PMD_1000T_ADV_LBN))
815 xnp_adv |= ADVERTISED_1000baseT_Full;
816 if (reg & (1 << PMA_PMD_10000T_ADV_LBN))
817 xnp_adv |= ADVERTISED_10000baseT_Full;
818
819 mdio_clause45_get_settings_ext(efx, ecmd, xnp_adv,
820 tenxpress_get_xnp_lpa(efx));
821
822 ecmd->supported |= (SUPPORTED_100baseT_Half |
823 SUPPORTED_100baseT_Full |
824 SUPPORTED_1000baseT_Full);
825 793
826 /* Use the vendor defined C22ext register for duplex settings */ 794 return mdio_clause45_set_settings(efx, ecmd);
827 if (ecmd->speed != SPEED_10000 && !ecmd->autoneg) {
828 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_C22EXT,
829 GPHY_XCONTROL_REG);
830 ecmd->duplex = (reg & (1 << GPHY_DUPLEX_LBN) ?
831 DUPLEX_FULL : DUPLEX_HALF);
832 }
833} 795}
834 796
835static int sft9001_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) 797static void sfx7101_set_npage_adv(struct efx_nic *efx, u32 advertising)
836{ 798{
837 int phy_id = efx->mii.phy_id; 799 mdio_clause45_set_flag(efx, efx->mii.phy_id, MDIO_MMD_AN,
838 int rc; 800 MDIO_AN_10GBT_CTRL,
839 801 MDIO_AN_10GBT_CTRL_ADV_10G_LBN,
840 rc = mdio_clause45_set_settings(efx, ecmd); 802 advertising & ADVERTISED_10000baseT_Full);
841 if (rc)
842 return rc;
843
844 if (ecmd->speed != SPEED_10000 && !ecmd->autoneg)
845 mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT,
846 GPHY_XCONTROL_REG, GPHY_DUPLEX_LBN,
847 ecmd->duplex == DUPLEX_FULL);
848
849 return rc;
850} 803}
851 804
852static bool sft9001_set_xnp_advertise(struct efx_nic *efx, u32 advertising) 805static void sft9001_set_npage_adv(struct efx_nic *efx, u32 advertising)
853{ 806{
854 int phy = efx->mii.phy_id; 807 int phy_id = efx->mii.phy_id;
855 int reg = mdio_clause45_read(efx, phy, MDIO_MMD_PMAPMD, 808
856 PMA_PMD_SPEED_ENABLE_REG); 809 mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT,
857 bool enabled; 810 C22EXT_MSTSLV_CTRL,
858 811 C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN,
859 reg &= ~((1 << 2) | (1 << 3)); 812 advertising & ADVERTISED_1000baseT_Full);
860 if (EFX_WORKAROUND_13204(efx) && 813 mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_AN,
861 (advertising & ADVERTISED_100baseT_Full)) 814 MDIO_AN_10GBT_CTRL,
862 reg |= 1 << PMA_PMD_100TX_ADV_LBN; 815 MDIO_AN_10GBT_CTRL_ADV_10G_LBN,
863 if (advertising & ADVERTISED_1000baseT_Full) 816 advertising & ADVERTISED_10000baseT_Full);
864 reg |= 1 << PMA_PMD_1000T_ADV_LBN;
865 if (advertising & ADVERTISED_10000baseT_Full)
866 reg |= 1 << PMA_PMD_10000T_ADV_LBN;
867 mdio_clause45_write(efx, phy, MDIO_MMD_PMAPMD,
868 PMA_PMD_SPEED_ENABLE_REG, reg);
869
870 enabled = (advertising &
871 (ADVERTISED_1000baseT_Half |
872 ADVERTISED_1000baseT_Full |
873 ADVERTISED_10000baseT_Full));
874 if (EFX_WORKAROUND_13204(efx))
875 enabled |= (advertising & ADVERTISED_100baseT_Full);
876 return enabled;
877} 817}
878 818
879struct efx_phy_operations falcon_sfx7101_phy_ops = { 819struct efx_phy_operations falcon_sfx7101_phy_ops = {
@@ -883,8 +823,9 @@ struct efx_phy_operations falcon_sfx7101_phy_ops = {
883 .poll = tenxpress_phy_poll, 823 .poll = tenxpress_phy_poll,
884 .fini = tenxpress_phy_fini, 824 .fini = tenxpress_phy_fini,
885 .clear_interrupt = efx_port_dummy_op_void, 825 .clear_interrupt = efx_port_dummy_op_void,
886 .get_settings = sfx7101_get_settings, 826 .get_settings = tenxpress_get_settings,
887 .set_settings = mdio_clause45_set_settings, 827 .set_settings = tenxpress_set_settings,
828 .set_npage_adv = sfx7101_set_npage_adv,
888 .num_tests = ARRAY_SIZE(sfx7101_test_names), 829 .num_tests = ARRAY_SIZE(sfx7101_test_names),
889 .test_names = sfx7101_test_names, 830 .test_names = sfx7101_test_names,
890 .run_tests = sfx7101_run_tests, 831 .run_tests = sfx7101_run_tests,
@@ -899,9 +840,9 @@ struct efx_phy_operations falcon_sft9001_phy_ops = {
899 .poll = tenxpress_phy_poll, 840 .poll = tenxpress_phy_poll,
900 .fini = tenxpress_phy_fini, 841 .fini = tenxpress_phy_fini,
901 .clear_interrupt = efx_port_dummy_op_void, 842 .clear_interrupt = efx_port_dummy_op_void,
902 .get_settings = sft9001_get_settings, 843 .get_settings = tenxpress_get_settings,
903 .set_settings = sft9001_set_settings, 844 .set_settings = tenxpress_set_settings,
904 .set_xnp_advertise = sft9001_set_xnp_advertise, 845 .set_npage_adv = sft9001_set_npage_adv,
905 .num_tests = ARRAY_SIZE(sft9001_test_names), 846 .num_tests = ARRAY_SIZE(sft9001_test_names),
906 .test_names = sft9001_test_names, 847 .test_names = sft9001_test_names,
907 .run_tests = sft9001_run_tests, 848 .run_tests = sft9001_run_tests,
diff --git a/drivers/net/sfc/workarounds.h b/drivers/net/sfc/workarounds.h
index 82e03e1d7371..78de68f4a95b 100644
--- a/drivers/net/sfc/workarounds.h
+++ b/drivers/net/sfc/workarounds.h
@@ -18,8 +18,8 @@
18#define EFX_WORKAROUND_ALWAYS(efx) 1 18#define EFX_WORKAROUND_ALWAYS(efx) 1
19#define EFX_WORKAROUND_FALCON_A(efx) (falcon_rev(efx) <= FALCON_REV_A1) 19#define EFX_WORKAROUND_FALCON_A(efx) (falcon_rev(efx) <= FALCON_REV_A1)
20#define EFX_WORKAROUND_10G(efx) EFX_IS10G(efx) 20#define EFX_WORKAROUND_10G(efx) EFX_IS10G(efx)
21#define EFX_WORKAROUND_SFX7101(efx) ((efx)->phy_type == PHY_TYPE_SFX7101) 21#define EFX_WORKAROUND_SFT9001(efx) ((efx)->phy_type == PHY_TYPE_SFT9001A || \
22#define EFX_WORKAROUND_SFT9001A(efx) ((efx)->phy_type == PHY_TYPE_SFT9001A) 22 (efx)->phy_type == PHY_TYPE_SFT9001B)
23 23
24/* XAUI resets if link not detected */ 24/* XAUI resets if link not detected */
25#define EFX_WORKAROUND_5147 EFX_WORKAROUND_ALWAYS 25#define EFX_WORKAROUND_5147 EFX_WORKAROUND_ALWAYS
@@ -29,8 +29,6 @@
29#define EFX_WORKAROUND_7884 EFX_WORKAROUND_10G 29#define EFX_WORKAROUND_7884 EFX_WORKAROUND_10G
30/* TX pkt parser problem with <= 16 byte TXes */ 30/* TX pkt parser problem with <= 16 byte TXes */
31#define EFX_WORKAROUND_9141 EFX_WORKAROUND_ALWAYS 31#define EFX_WORKAROUND_9141 EFX_WORKAROUND_ALWAYS
32/* Low rate CRC errors require XAUI reset */
33#define EFX_WORKAROUND_10750 EFX_WORKAROUND_SFX7101
34/* TX_EV_PKT_ERR can be caused by a dangling TX descriptor 32/* TX_EV_PKT_ERR can be caused by a dangling TX descriptor
35 * or a PCIe error (bug 11028) */ 33 * or a PCIe error (bug 11028) */
36#define EFX_WORKAROUND_10727 EFX_WORKAROUND_ALWAYS 34#define EFX_WORKAROUND_10727 EFX_WORKAROUND_ALWAYS
@@ -55,8 +53,8 @@
55#define EFX_WORKAROUND_8071 EFX_WORKAROUND_FALCON_A 53#define EFX_WORKAROUND_8071 EFX_WORKAROUND_FALCON_A
56 54
57/* Need to send XNP pages for 100BaseT */ 55/* Need to send XNP pages for 100BaseT */
58#define EFX_WORKAROUND_13204 EFX_WORKAROUND_SFT9001A 56#define EFX_WORKAROUND_13204 EFX_WORKAROUND_SFT9001
59/* Need to keep AN enabled */ 57/* Don't restart AN in near-side loopback */
60#define EFX_WORKAROUND_13963 EFX_WORKAROUND_SFT9001A 58#define EFX_WORKAROUND_15195 EFX_WORKAROUND_SFT9001
61 59
62#endif /* EFX_WORKAROUNDS_H */ 60#endif /* EFX_WORKAROUNDS_H */