aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/e1000/e1000_main.c4
-rw-r--r--drivers/net/gianfar_mii.c2
-rw-r--r--drivers/net/netxen/netxen_nic.h2
-rw-r--r--drivers/net/netxen/netxen_nic_init.c4
-rw-r--r--drivers/net/r6040.c1
-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
-rw-r--r--drivers/net/skfp/skfddi.c4
-rw-r--r--drivers/net/sky2.c6
-rw-r--r--drivers/net/smsc911x.c2
-rw-r--r--drivers/net/smsc9420.c3
-rw-r--r--drivers/net/tulip/21142.c23
-rw-r--r--drivers/net/ucc_geth.c20
-rw-r--r--drivers/net/ucc_geth.h2
-rw-r--r--drivers/net/ucc_geth_mii.c12
-rw-r--r--drivers/net/ucc_geth_mii.h1
-rw-r--r--drivers/net/virtio_net.c6
-rw-r--r--drivers/net/wimax/i2400m/debugfs.c14
-rw-r--r--drivers/net/wimax/i2400m/driver.c16
-rw-r--r--drivers/net/wireless/ath5k/base.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c4
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_rtl8225.c10
32 files changed, 385 insertions, 342 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 7ec1a0c5a0cf..c4a303023b31 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -31,7 +31,7 @@
31 31
32char e1000_driver_name[] = "e1000"; 32char e1000_driver_name[] = "e1000";
33static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; 33static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
34#define DRV_VERSION "7.3.21-k2-NAPI" 34#define DRV_VERSION "7.3.21-k3-NAPI"
35const char e1000_driver_version[] = DRV_VERSION; 35const char e1000_driver_version[] = DRV_VERSION;
36static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; 36static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
37 37
@@ -3697,7 +3697,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
3697 struct e1000_hw *hw = &adapter->hw; 3697 struct e1000_hw *hw = &adapter->hw;
3698 u32 rctl, icr = er32(ICR); 3698 u32 rctl, icr = er32(ICR);
3699 3699
3700 if (unlikely(!icr)) 3700 if (unlikely((!icr) || test_bit(__E1000_RESETTING, &adapter->flags)))
3701 return IRQ_NONE; /* Not our interrupt */ 3701 return IRQ_NONE; /* Not our interrupt */
3702 3702
3703 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is 3703 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index f3706e415b45..f49a426ad681 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -234,6 +234,8 @@ static int gfar_mdio_probe(struct of_device *ofdev,
234 if (NULL == new_bus) 234 if (NULL == new_bus)
235 return -ENOMEM; 235 return -ENOMEM;
236 236
237 device_init_wakeup(&ofdev->dev, 1);
238
237 new_bus->name = "Gianfar MII Bus", 239 new_bus->name = "Gianfar MII Bus",
238 new_bus->read = &gfar_mdio_read, 240 new_bus->read = &gfar_mdio_read,
239 new_bus->write = &gfar_mdio_write, 241 new_bus->write = &gfar_mdio_write,
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index a75a31005fd3..9c78c963b721 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -210,7 +210,7 @@
210#define MAX_CMD_DESCRIPTORS_HOST 1024 210#define MAX_CMD_DESCRIPTORS_HOST 1024
211#define MAX_RCV_DESCRIPTORS_1G 2048 211#define MAX_RCV_DESCRIPTORS_1G 2048
212#define MAX_RCV_DESCRIPTORS_10G 4096 212#define MAX_RCV_DESCRIPTORS_10G 4096
213#define MAX_JUMBO_RCV_DESCRIPTORS 512 213#define MAX_JUMBO_RCV_DESCRIPTORS 1024
214#define MAX_LRO_RCV_DESCRIPTORS 8 214#define MAX_LRO_RCV_DESCRIPTORS 8
215#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS 215#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS
216#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS 216#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index ca7c8d8050c9..ffd37bea1628 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -947,8 +947,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
947 } 947 }
948 for (i = 0; i < n; i++) { 948 for (i = 0; i < n; i++) {
949 if (netxen_rom_fast_read(adapter, 8*i + 4*offset, &val) != 0 || 949 if (netxen_rom_fast_read(adapter, 8*i + 4*offset, &val) != 0 ||
950 netxen_rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0) 950 netxen_rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0) {
951 kfree(buf);
951 return -EIO; 952 return -EIO;
953 }
952 954
953 buf[i].addr = addr; 955 buf[i].addr = addr;
954 buf[i].data = val; 956 buf[i].data = val;
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index cc0f886b0c29..3c27a7bfea49 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -438,7 +438,6 @@ static void r6040_down(struct net_device *dev)
438{ 438{
439 struct r6040_private *lp = netdev_priv(dev); 439 struct r6040_private *lp = netdev_priv(dev);
440 void __iomem *ioaddr = lp->base; 440 void __iomem *ioaddr = lp->base;
441 struct pci_dev *pdev = lp->pdev;
442 int limit = 2048; 441 int limit = 2048;
443 u16 *adrp; 442 u16 *adrp;
444 u16 cmd; 443 u16 cmd;
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 */
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
index 607efeaf0bc5..9a00e5566af7 100644
--- a/drivers/net/skfp/skfddi.c
+++ b/drivers/net/skfp/skfddi.c
@@ -1003,9 +1003,9 @@ static int skfp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1003 break; 1003 break;
1004 case SKFP_CLR_STATS: /* Zero out the driver statistics */ 1004 case SKFP_CLR_STATS: /* Zero out the driver statistics */
1005 if (!capable(CAP_NET_ADMIN)) { 1005 if (!capable(CAP_NET_ADMIN)) {
1006 memset(&lp->MacStat, 0, sizeof(lp->MacStat));
1007 } else {
1008 status = -EPERM; 1006 status = -EPERM;
1007 } else {
1008 memset(&lp->MacStat, 0, sizeof(lp->MacStat));
1009 } 1009 }
1010 break; 1010 break;
1011 default: 1011 default:
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 3668e81e474d..994703cc0db3 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1403,9 +1403,6 @@ static int sky2_up(struct net_device *dev)
1403 1403
1404 } 1404 }
1405 1405
1406 if (netif_msg_ifup(sky2))
1407 printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
1408
1409 netif_carrier_off(dev); 1406 netif_carrier_off(dev);
1410 1407
1411 /* must be power of 2 */ 1408 /* must be power of 2 */
@@ -1484,6 +1481,9 @@ static int sky2_up(struct net_device *dev)
1484 sky2_write32(hw, B0_IMSK, imask); 1481 sky2_write32(hw, B0_IMSK, imask);
1485 1482
1486 sky2_set_multicast(dev); 1483 sky2_set_multicast(dev);
1484
1485 if (netif_msg_ifup(sky2))
1486 printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
1487 return 0; 1487 return 0;
1488 1488
1489err_out: 1489err_out:
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index aaf0b4314ce2..ae4c74b51827 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -954,7 +954,7 @@ smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes)
954 do { 954 do {
955 udelay(1); 955 udelay(1);
956 val = smsc911x_reg_read(pdata, RX_DP_CTRL); 956 val = smsc911x_reg_read(pdata, RX_DP_CTRL);
957 } while (timeout-- && (val & RX_DP_CTRL_RX_FFWD_)); 957 } while (--timeout && (val & RX_DP_CTRL_RX_FFWD_));
958 958
959 if (unlikely(timeout == 0)) 959 if (unlikely(timeout == 0))
960 SMSC_WARNING(HW, "Timed out waiting for " 960 SMSC_WARNING(HW, "Timed out waiting for "
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c
index ce4e2e864bc7..1aa9be3975ed 100644
--- a/drivers/net/smsc9420.c
+++ b/drivers/net/smsc9420.c
@@ -1378,6 +1378,7 @@ static int smsc9420_open(struct net_device *dev)
1378 1378
1379 /* test the IRQ connection to the ISR */ 1379 /* test the IRQ connection to the ISR */
1380 smsc_dbg(IFUP, "Testing ISR using IRQ %d", dev->irq); 1380 smsc_dbg(IFUP, "Testing ISR using IRQ %d", dev->irq);
1381 pd->software_irq_signal = false;
1381 1382
1382 spin_lock_irqsave(&pd->int_lock, flags); 1383 spin_lock_irqsave(&pd->int_lock, flags);
1383 /* configure interrupt deassertion timer and enable interrupts */ 1384 /* configure interrupt deassertion timer and enable interrupts */
@@ -1393,8 +1394,6 @@ static int smsc9420_open(struct net_device *dev)
1393 smsc9420_pci_flush_write(pd); 1394 smsc9420_pci_flush_write(pd);
1394 1395
1395 timeout = 1000; 1396 timeout = 1000;
1396 pd->software_irq_signal = false;
1397 smp_wmb();
1398 while (timeout--) { 1397 while (timeout--) {
1399 if (pd->software_irq_signal) 1398 if (pd->software_irq_signal)
1400 break; 1399 break;
diff --git a/drivers/net/tulip/21142.c b/drivers/net/tulip/21142.c
index 1210fb3748a7..db7d5e11855d 100644
--- a/drivers/net/tulip/21142.c
+++ b/drivers/net/tulip/21142.c
@@ -9,6 +9,11 @@
9 9
10 Please refer to Documentation/DocBook/tulip-user.{pdf,ps,html} 10 Please refer to Documentation/DocBook/tulip-user.{pdf,ps,html}
11 for more information on this driver. 11 for more information on this driver.
12
13 DC21143 manual "21143 PCI/CardBus 10/100Mb/s Ethernet LAN Controller
14 Hardware Reference Manual" is currently available at :
15 http://developer.intel.com/design/network/manuals/278074.htm
16
12 Please submit bugs to http://bugzilla.kernel.org/ . 17 Please submit bugs to http://bugzilla.kernel.org/ .
13*/ 18*/
14 19
@@ -32,7 +37,11 @@ void t21142_media_task(struct work_struct *work)
32 int csr12 = ioread32(ioaddr + CSR12); 37 int csr12 = ioread32(ioaddr + CSR12);
33 int next_tick = 60*HZ; 38 int next_tick = 60*HZ;
34 int new_csr6 = 0; 39 int new_csr6 = 0;
40 int csr14 = ioread32(ioaddr + CSR14);
35 41
42 /* CSR12[LS10,LS100] are not reliable during autonegotiation */
43 if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000)
44 csr12 |= 6;
36 if (tulip_debug > 2) 45 if (tulip_debug > 2)
37 printk(KERN_INFO"%s: 21143 negotiation status %8.8x, %s.\n", 46 printk(KERN_INFO"%s: 21143 negotiation status %8.8x, %s.\n",
38 dev->name, csr12, medianame[dev->if_port]); 47 dev->name, csr12, medianame[dev->if_port]);
@@ -76,7 +85,7 @@ void t21142_media_task(struct work_struct *work)
76 new_csr6 = 0x83860000; 85 new_csr6 = 0x83860000;
77 dev->if_port = 3; 86 dev->if_port = 3;
78 iowrite32(0, ioaddr + CSR13); 87 iowrite32(0, ioaddr + CSR13);
79 iowrite32(0x0003FF7F, ioaddr + CSR14); 88 iowrite32(0x0003FFFF, ioaddr + CSR14);
80 iowrite16(8, ioaddr + CSR15); 89 iowrite16(8, ioaddr + CSR15);
81 iowrite32(1, ioaddr + CSR13); 90 iowrite32(1, ioaddr + CSR13);
82 } 91 }
@@ -132,10 +141,14 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
132 struct tulip_private *tp = netdev_priv(dev); 141 struct tulip_private *tp = netdev_priv(dev);
133 void __iomem *ioaddr = tp->base_addr; 142 void __iomem *ioaddr = tp->base_addr;
134 int csr12 = ioread32(ioaddr + CSR12); 143 int csr12 = ioread32(ioaddr + CSR12);
144 int csr14 = ioread32(ioaddr + CSR14);
135 145
146 /* CSR12[LS10,LS100] are not reliable during autonegotiation */
147 if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000)
148 csr12 |= 6;
136 if (tulip_debug > 1) 149 if (tulip_debug > 1)
137 printk(KERN_INFO"%s: 21143 link status interrupt %8.8x, CSR5 %x, " 150 printk(KERN_INFO"%s: 21143 link status interrupt %8.8x, CSR5 %x, "
138 "%8.8x.\n", dev->name, csr12, csr5, ioread32(ioaddr + CSR14)); 151 "%8.8x.\n", dev->name, csr12, csr5, csr14);
139 152
140 /* If NWay finished and we have a negotiated partner capability. */ 153 /* If NWay finished and we have a negotiated partner capability. */
141 if (tp->nway && !tp->nwayset && (csr12 & 0x7000) == 0x5000) { 154 if (tp->nway && !tp->nwayset && (csr12 & 0x7000) == 0x5000) {
@@ -143,7 +156,9 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
143 int negotiated = tp->sym_advertise & (csr12 >> 16); 156 int negotiated = tp->sym_advertise & (csr12 >> 16);
144 tp->lpar = csr12 >> 16; 157 tp->lpar = csr12 >> 16;
145 tp->nwayset = 1; 158 tp->nwayset = 1;
146 if (negotiated & 0x0100) dev->if_port = 5; 159 /* If partner cannot negotiate, it is 10Mbps Half Duplex */
160 if (!(csr12 & 0x8000)) dev->if_port = 0;
161 else if (negotiated & 0x0100) dev->if_port = 5;
147 else if (negotiated & 0x0080) dev->if_port = 3; 162 else if (negotiated & 0x0080) dev->if_port = 3;
148 else if (negotiated & 0x0040) dev->if_port = 4; 163 else if (negotiated & 0x0040) dev->if_port = 4;
149 else if (negotiated & 0x0020) dev->if_port = 0; 164 else if (negotiated & 0x0020) dev->if_port = 0;
@@ -214,7 +229,7 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
214 tp->timer.expires = RUN_AT(3*HZ); 229 tp->timer.expires = RUN_AT(3*HZ);
215 add_timer(&tp->timer); 230 add_timer(&tp->timer);
216 } else if (dev->if_port == 5) 231 } else if (dev->if_port == 5)
217 iowrite32(ioread32(ioaddr + CSR14) & ~0x080, ioaddr + CSR14); 232 iowrite32(csr14 & ~0x080, ioaddr + CSR14);
218 } else if (dev->if_port == 0 || dev->if_port == 4) { 233 } else if (dev->if_port == 0 || dev->if_port == 4) {
219 if ((csr12 & 4) == 0) 234 if ((csr12 & 4) == 0)
220 printk(KERN_INFO"%s: 21143 10baseT link beat good.\n", 235 printk(KERN_INFO"%s: 21143 10baseT link beat good.\n",
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 6def6f826a54..4a8d5747204a 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1536,6 +1536,11 @@ static void adjust_link(struct net_device *dev)
1536static int init_phy(struct net_device *dev) 1536static int init_phy(struct net_device *dev)
1537{ 1537{
1538 struct ucc_geth_private *priv = netdev_priv(dev); 1538 struct ucc_geth_private *priv = netdev_priv(dev);
1539 struct device_node *np = priv->node;
1540 struct device_node *phy, *mdio;
1541 const phandle *ph;
1542 char bus_name[MII_BUS_ID_SIZE];
1543 const unsigned int *id;
1539 struct phy_device *phydev; 1544 struct phy_device *phydev;
1540 char phy_id[BUS_ID_SIZE]; 1545 char phy_id[BUS_ID_SIZE];
1541 1546
@@ -1543,8 +1548,18 @@ static int init_phy(struct net_device *dev)
1543 priv->oldspeed = 0; 1548 priv->oldspeed = 0;
1544 priv->oldduplex = -1; 1549 priv->oldduplex = -1;
1545 1550
1546 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, priv->ug_info->mdio_bus, 1551 ph = of_get_property(np, "phy-handle", NULL);
1547 priv->ug_info->phy_address); 1552 phy = of_find_node_by_phandle(*ph);
1553 mdio = of_get_parent(phy);
1554
1555 id = of_get_property(phy, "reg", NULL);
1556
1557 of_node_put(phy);
1558 of_node_put(mdio);
1559
1560 uec_mdio_bus_name(bus_name, mdio);
1561 snprintf(phy_id, sizeof(phy_id), "%s:%02x",
1562 bus_name, *id);
1548 1563
1549 phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface); 1564 phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface);
1550 1565
@@ -3748,6 +3763,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3748 3763
3749 ugeth->ug_info = ug_info; 3764 ugeth->ug_info = ug_info;
3750 ugeth->dev = dev; 3765 ugeth->dev = dev;
3766 ugeth->node = np;
3751 3767
3752 return 0; 3768 return 0;
3753} 3769}
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index 8f699cb773ee..16cbe42ba43c 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -1186,6 +1186,8 @@ struct ucc_geth_private {
1186 int oldspeed; 1186 int oldspeed;
1187 int oldduplex; 1187 int oldduplex;
1188 int oldlink; 1188 int oldlink;
1189
1190 struct device_node *node;
1189}; 1191};
1190 1192
1191void uec_set_ethtool_ops(struct net_device *netdev); 1193void uec_set_ethtool_ops(struct net_device *netdev);
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index c001d261366b..54635911305c 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -156,7 +156,7 @@ static int uec_mdio_probe(struct of_device *ofdev, const struct of_device_id *ma
156 if (err) 156 if (err)
157 goto reg_map_fail; 157 goto reg_map_fail;
158 158
159 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start); 159 uec_mdio_bus_name(new_bus->id, np);
160 160
161 new_bus->irq = kmalloc(32 * sizeof(int), GFP_KERNEL); 161 new_bus->irq = kmalloc(32 * sizeof(int), GFP_KERNEL);
162 162
@@ -283,3 +283,13 @@ void uec_mdio_exit(void)
283{ 283{
284 of_unregister_platform_driver(&uec_mdio_driver); 284 of_unregister_platform_driver(&uec_mdio_driver);
285} 285}
286
287void uec_mdio_bus_name(char *name, struct device_node *np)
288{
289 const u32 *reg;
290
291 reg = of_get_property(np, "reg", NULL);
292
293 snprintf(name, MII_BUS_ID_SIZE, "%s@%x", np->name, reg ? *reg : 0);
294}
295
diff --git a/drivers/net/ucc_geth_mii.h b/drivers/net/ucc_geth_mii.h
index 1e45b2028a50..840cf80235b7 100644
--- a/drivers/net/ucc_geth_mii.h
+++ b/drivers/net/ucc_geth_mii.h
@@ -97,4 +97,5 @@ int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
97int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value); 97int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
98int __init uec_mdio_init(void); 98int __init uec_mdio_init(void);
99void uec_mdio_exit(void); 99void uec_mdio_exit(void);
100void uec_mdio_bus_name(char *name, struct device_node *np);
100#endif /* __UEC_MII_H */ 101#endif /* __UEC_MII_H */
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 3b6225a2c7d2..fe576e75a538 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -288,7 +288,7 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi)
288 skb_put(skb, MAX_PACKET_LEN); 288 skb_put(skb, MAX_PACKET_LEN);
289 289
290 hdr = skb_vnet_hdr(skb); 290 hdr = skb_vnet_hdr(skb);
291 sg_init_one(sg, hdr, sizeof(*hdr)); 291 sg_set_buf(sg, hdr, sizeof(*hdr));
292 292
293 if (vi->big_packets) { 293 if (vi->big_packets) {
294 for (i = 0; i < MAX_SKB_FRAGS; i++) { 294 for (i = 0; i < MAX_SKB_FRAGS; i++) {
@@ -489,9 +489,9 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
489 489
490 /* Encode metadata header at front. */ 490 /* Encode metadata header at front. */
491 if (vi->mergeable_rx_bufs) 491 if (vi->mergeable_rx_bufs)
492 sg_init_one(sg, mhdr, sizeof(*mhdr)); 492 sg_set_buf(sg, mhdr, sizeof(*mhdr));
493 else 493 else
494 sg_init_one(sg, hdr, sizeof(*hdr)); 494 sg_set_buf(sg, hdr, sizeof(*hdr));
495 495
496 num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1; 496 num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;
497 497
diff --git a/drivers/net/wimax/i2400m/debugfs.c b/drivers/net/wimax/i2400m/debugfs.c
index 626632985977..9b81af3f80a9 100644
--- a/drivers/net/wimax/i2400m/debugfs.c
+++ b/drivers/net/wimax/i2400m/debugfs.c
@@ -234,20 +234,6 @@ struct dentry *debugfs_create_i2400m_reset(
234 &fops_i2400m_reset); 234 &fops_i2400m_reset);
235} 235}
236 236
237/*
238 * Debug levels control; see debug.h
239 */
240struct d_level D_LEVEL[] = {
241 D_SUBMODULE_DEFINE(control),
242 D_SUBMODULE_DEFINE(driver),
243 D_SUBMODULE_DEFINE(debugfs),
244 D_SUBMODULE_DEFINE(fw),
245 D_SUBMODULE_DEFINE(netdev),
246 D_SUBMODULE_DEFINE(rfkill),
247 D_SUBMODULE_DEFINE(rx),
248 D_SUBMODULE_DEFINE(tx),
249};
250size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
251 237
252#define __debugfs_register(prefix, name, parent) \ 238#define __debugfs_register(prefix, name, parent) \
253do { \ 239do { \
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c
index 5f98047e18cf..e80a0b65a754 100644
--- a/drivers/net/wimax/i2400m/driver.c
+++ b/drivers/net/wimax/i2400m/driver.c
@@ -707,6 +707,22 @@ void i2400m_release(struct i2400m *i2400m)
707EXPORT_SYMBOL_GPL(i2400m_release); 707EXPORT_SYMBOL_GPL(i2400m_release);
708 708
709 709
710/*
711 * Debug levels control; see debug.h
712 */
713struct d_level D_LEVEL[] = {
714 D_SUBMODULE_DEFINE(control),
715 D_SUBMODULE_DEFINE(driver),
716 D_SUBMODULE_DEFINE(debugfs),
717 D_SUBMODULE_DEFINE(fw),
718 D_SUBMODULE_DEFINE(netdev),
719 D_SUBMODULE_DEFINE(rfkill),
720 D_SUBMODULE_DEFINE(rx),
721 D_SUBMODULE_DEFINE(tx),
722};
723size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
724
725
710static 726static
711int __init i2400m_driver_init(void) 727int __init i2400m_driver_init(void)
712{ 728{
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 8ef87356e083..a533ed60bb4d 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1028,6 +1028,8 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
1028 * it's done by reseting the chip. To accomplish this we must 1028 * it's done by reseting the chip. To accomplish this we must
1029 * first cleanup any pending DMA, then restart stuff after a la 1029 * first cleanup any pending DMA, then restart stuff after a la
1030 * ath5k_init. 1030 * ath5k_init.
1031 *
1032 * Called with sc->lock.
1031 */ 1033 */
1032static int 1034static int
1033ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan) 1035ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan)
@@ -2814,11 +2816,17 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
2814{ 2816{
2815 struct ath5k_softc *sc = hw->priv; 2817 struct ath5k_softc *sc = hw->priv;
2816 struct ieee80211_conf *conf = &hw->conf; 2818 struct ieee80211_conf *conf = &hw->conf;
2819 int ret;
2820
2821 mutex_lock(&sc->lock);
2817 2822
2818 sc->bintval = conf->beacon_int; 2823 sc->bintval = conf->beacon_int;
2819 sc->power_level = conf->power_level; 2824 sc->power_level = conf->power_level;
2820 2825
2821 return ath5k_chan_set(sc, conf->channel); 2826 ret = ath5k_chan_set(sc, conf->channel);
2827
2828 mutex_unlock(&sc->lock);
2829 return ret;
2822} 2830}
2823 2831
2824static int 2832static int
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 0dc8eed16404..b35c8813bef4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1719,6 +1719,10 @@ static int iwl_read_ucode(struct iwl_priv *priv)
1719 priv->ucode_data_backup.len = data_size; 1719 priv->ucode_data_backup.len = data_size;
1720 iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); 1720 iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
1721 1721
1722 if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr ||
1723 !priv->ucode_data_backup.v_addr)
1724 goto err_pci_alloc;
1725
1722 /* Initialization instructions and data */ 1726 /* Initialization instructions and data */
1723 if (init_size && init_data_size) { 1727 if (init_size && init_data_size) {
1724 priv->ucode_init.len = init_size; 1728 priv->ucode_init.len = init_size;
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
index 4e75e8e7fa90..78df281b297a 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
@@ -285,7 +285,10 @@ static void rtl8225_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
285 ofdm_power = priv->channels[channel - 1].hw_value >> 4; 285 ofdm_power = priv->channels[channel - 1].hw_value >> 4;
286 286
287 cck_power = min(cck_power, (u8)11); 287 cck_power = min(cck_power, (u8)11);
288 ofdm_power = min(ofdm_power, (u8)35); 288 if (ofdm_power > (u8)15)
289 ofdm_power = 25;
290 else
291 ofdm_power += 10;
289 292
290 rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, 293 rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
291 rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1); 294 rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1);
@@ -536,7 +539,10 @@ static void rtl8225z2_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
536 cck_power += priv->txpwr_base & 0xF; 539 cck_power += priv->txpwr_base & 0xF;
537 cck_power = min(cck_power, (u8)35); 540 cck_power = min(cck_power, (u8)35);
538 541
539 ofdm_power = min(ofdm_power, (u8)15); 542 if (ofdm_power > (u8)15)
543 ofdm_power = 25;
544 else
545 ofdm_power += 10;
540 ofdm_power += priv->txpwr_base >> 4; 546 ofdm_power += priv->txpwr_base >> 4;
541 ofdm_power = min(ofdm_power, (u8)35); 547 ofdm_power = min(ofdm_power, (u8)35);
542 548