aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-04-01 13:36:50 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-01 13:36:50 -0400
commita210576cf891e9e6d2c238eabcf5c1286b1e7526 (patch)
tree0fa81a901cf628b25e6ee79057700cf39e59818a /drivers/net
parent7d4c04fc170087119727119074e72445f2bb192b (diff)
parent3658f3604066d5500ebd73a04084f127dc779441 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: net/mac80211/sta_info.c net/wireless/core.h Two minor conflicts in wireless. Overlapping additions of extern declarations in net/wireless/core.h and a bug fix overlapping with the addition of a boolean parameter to __ieee80211_key_free(). Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_sysfs.c92
-rw-r--r--drivers/net/can/sja1000/Kconfig1
-rw-r--r--drivers/net/can/sja1000/plx_pci.c4
-rw-r--r--drivers/net/can/sja1000/sja1000.c6
-rw-r--r--drivers/net/can/sja1000/sja1000.h2
-rw-r--r--drivers/net/ethernet/atheros/atl1e/atl1e.h1
-rw-r--r--drivers/net/ethernet/atheros/atl1e/atl1e_main.c19
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c7
-rw-r--r--drivers/net/ethernet/calxeda/xgmac.c9
-rw-r--r--drivers/net/ethernet/davicom/dm9000.c214
-rw-r--r--drivers/net/ethernet/davicom/dm9000.h11
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c82
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_ethtool.c14
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c7
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_main.c7
-rw-r--r--drivers/net/ethernet/marvell/sky2.c2
-rw-r--r--drivers/net/ethernet/marvell/sky2.h2
-rw-r--r--drivers/net/ethernet/micrel/ks8851.c2
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c28
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.h2
-rw-r--r--drivers/net/ethernet/ti/cpsw.c2
-rw-r--r--drivers/net/ethernet/ti/davinci_emac.c2
-rw-r--r--drivers/net/usb/smsc75xx.c12
-rw-r--r--drivers/net/wireless/ath/ath9k/link.c3
-rw-r--r--drivers/net/wireless/b43/dma.c65
-rw-r--r--drivers/net/wireless/b43/phy_n.c8
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c369
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c64
-rw-r--r--drivers/net/wireless/iwlegacy/4965-rs.c3
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/lib.c9
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/ucode.c4
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c13
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/tx.c2
-rw-r--r--drivers/net/wireless/mwifiex/pcie.c1
34 files changed, 544 insertions, 525 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index db103e03ba05..ea7a388f4843 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -527,7 +527,7 @@ static ssize_t bonding_store_arp_interval(struct device *d,
527 goto out; 527 goto out;
528 } 528 }
529 if (new_value < 0) { 529 if (new_value < 0) {
530 pr_err("%s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", 530 pr_err("%s: Invalid arp_interval value %d not in range 0-%d; rejected.\n",
531 bond->dev->name, new_value, INT_MAX); 531 bond->dev->name, new_value, INT_MAX);
532 ret = -EINVAL; 532 ret = -EINVAL;
533 goto out; 533 goto out;
@@ -542,14 +542,15 @@ static ssize_t bonding_store_arp_interval(struct device *d,
542 pr_info("%s: Setting ARP monitoring interval to %d.\n", 542 pr_info("%s: Setting ARP monitoring interval to %d.\n",
543 bond->dev->name, new_value); 543 bond->dev->name, new_value);
544 bond->params.arp_interval = new_value; 544 bond->params.arp_interval = new_value;
545 if (bond->params.miimon) { 545 if (new_value) {
546 pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", 546 if (bond->params.miimon) {
547 bond->dev->name, bond->dev->name); 547 pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n",
548 bond->params.miimon = 0; 548 bond->dev->name, bond->dev->name);
549 } 549 bond->params.miimon = 0;
550 if (!bond->params.arp_targets[0]) { 550 }
551 pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", 551 if (!bond->params.arp_targets[0])
552 bond->dev->name); 552 pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n",
553 bond->dev->name);
553 } 554 }
554 if (bond->dev->flags & IFF_UP) { 555 if (bond->dev->flags & IFF_UP) {
555 /* If the interface is up, we may need to fire off 556 /* If the interface is up, we may need to fire off
@@ -557,10 +558,13 @@ static ssize_t bonding_store_arp_interval(struct device *d,
557 * timer will get fired off when the open function 558 * timer will get fired off when the open function
558 * is called. 559 * is called.
559 */ 560 */
560 cancel_delayed_work_sync(&bond->mii_work); 561 if (!new_value) {
561 queue_delayed_work(bond->wq, &bond->arp_work, 0); 562 cancel_delayed_work_sync(&bond->arp_work);
563 } else {
564 cancel_delayed_work_sync(&bond->mii_work);
565 queue_delayed_work(bond->wq, &bond->arp_work, 0);
566 }
562 } 567 }
563
564out: 568out:
565 rtnl_unlock(); 569 rtnl_unlock();
566 return ret; 570 return ret;
@@ -702,7 +706,7 @@ static ssize_t bonding_store_downdelay(struct device *d,
702 } 706 }
703 if (new_value < 0) { 707 if (new_value < 0) {
704 pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", 708 pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n",
705 bond->dev->name, new_value, 1, INT_MAX); 709 bond->dev->name, new_value, 0, INT_MAX);
706 ret = -EINVAL; 710 ret = -EINVAL;
707 goto out; 711 goto out;
708 } else { 712 } else {
@@ -757,8 +761,8 @@ static ssize_t bonding_store_updelay(struct device *d,
757 goto out; 761 goto out;
758 } 762 }
759 if (new_value < 0) { 763 if (new_value < 0) {
760 pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", 764 pr_err("%s: Invalid up delay value %d not in range %d-%d; rejected.\n",
761 bond->dev->name, new_value, 1, INT_MAX); 765 bond->dev->name, new_value, 0, INT_MAX);
762 ret = -EINVAL; 766 ret = -EINVAL;
763 goto out; 767 goto out;
764 } else { 768 } else {
@@ -968,37 +972,37 @@ static ssize_t bonding_store_miimon(struct device *d,
968 } 972 }
969 if (new_value < 0) { 973 if (new_value < 0) {
970 pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", 974 pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n",
971 bond->dev->name, new_value, 1, INT_MAX); 975 bond->dev->name, new_value, 0, INT_MAX);
972 ret = -EINVAL; 976 ret = -EINVAL;
973 goto out; 977 goto out;
974 } else { 978 }
975 pr_info("%s: Setting MII monitoring interval to %d.\n", 979 pr_info("%s: Setting MII monitoring interval to %d.\n",
976 bond->dev->name, new_value); 980 bond->dev->name, new_value);
977 bond->params.miimon = new_value; 981 bond->params.miimon = new_value;
978 if (bond->params.updelay) 982 if (bond->params.updelay)
979 pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", 983 pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n",
980 bond->dev->name, 984 bond->dev->name,
981 bond->params.updelay * bond->params.miimon); 985 bond->params.updelay * bond->params.miimon);
982 if (bond->params.downdelay) 986 if (bond->params.downdelay)
983 pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", 987 pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n",
984 bond->dev->name, 988 bond->dev->name,
985 bond->params.downdelay * bond->params.miimon); 989 bond->params.downdelay * bond->params.miimon);
986 if (bond->params.arp_interval) { 990 if (new_value && bond->params.arp_interval) {
987 pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", 991 pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n",
988 bond->dev->name); 992 bond->dev->name);
989 bond->params.arp_interval = 0; 993 bond->params.arp_interval = 0;
990 if (bond->params.arp_validate) { 994 if (bond->params.arp_validate)
991 bond->params.arp_validate = 995 bond->params.arp_validate = BOND_ARP_VALIDATE_NONE;
992 BOND_ARP_VALIDATE_NONE; 996 }
993 } 997 if (bond->dev->flags & IFF_UP) {
994 } 998 /* If the interface is up, we may need to fire off
995 999 * the MII timer. If the interface is down, the
996 if (bond->dev->flags & IFF_UP) { 1000 * timer will get fired off when the open function
997 /* If the interface is up, we may need to fire off 1001 * is called.
998 * the MII timer. If the interface is down, the 1002 */
999 * timer will get fired off when the open function 1003 if (!new_value) {
1000 * is called. 1004 cancel_delayed_work_sync(&bond->mii_work);
1001 */ 1005 } else {
1002 cancel_delayed_work_sync(&bond->arp_work); 1006 cancel_delayed_work_sync(&bond->arp_work);
1003 queue_delayed_work(bond->wq, &bond->mii_work, 0); 1007 queue_delayed_work(bond->wq, &bond->mii_work, 0);
1004 } 1008 }
diff --git a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig
index b39ca5b3ea7f..ff2ba86cd4a4 100644
--- a/drivers/net/can/sja1000/Kconfig
+++ b/drivers/net/can/sja1000/Kconfig
@@ -46,6 +46,7 @@ config CAN_EMS_PCI
46config CAN_PEAK_PCMCIA 46config CAN_PEAK_PCMCIA
47 tristate "PEAK PCAN-PC Card" 47 tristate "PEAK PCAN-PC Card"
48 depends on PCMCIA 48 depends on PCMCIA
49 depends on HAS_IOPORT
49 ---help--- 50 ---help---
50 This driver is for the PCAN-PC Card PCMCIA adapter (1 or 2 channels) 51 This driver is for the PCAN-PC Card PCMCIA adapter (1 or 2 channels)
51 from PEAK-System (http://www.peak-system.com). To compile this 52 from PEAK-System (http://www.peak-system.com). To compile this
diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c
index a042cdc260dc..3c18d7d000ed 100644
--- a/drivers/net/can/sja1000/plx_pci.c
+++ b/drivers/net/can/sja1000/plx_pci.c
@@ -348,7 +348,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv)
348 */ 348 */
349 if ((priv->read_reg(priv, REG_CR) & REG_CR_BASICCAN_INITIAL_MASK) == 349 if ((priv->read_reg(priv, REG_CR) & REG_CR_BASICCAN_INITIAL_MASK) ==
350 REG_CR_BASICCAN_INITIAL && 350 REG_CR_BASICCAN_INITIAL &&
351 (priv->read_reg(priv, REG_SR) == REG_SR_BASICCAN_INITIAL) && 351 (priv->read_reg(priv, SJA1000_REG_SR) == REG_SR_BASICCAN_INITIAL) &&
352 (priv->read_reg(priv, REG_IR) == REG_IR_BASICCAN_INITIAL)) 352 (priv->read_reg(priv, REG_IR) == REG_IR_BASICCAN_INITIAL))
353 flag = 1; 353 flag = 1;
354 354
@@ -360,7 +360,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv)
360 * See states on p. 23 of the Datasheet. 360 * See states on p. 23 of the Datasheet.
361 */ 361 */
362 if (priv->read_reg(priv, REG_MOD) == REG_MOD_PELICAN_INITIAL && 362 if (priv->read_reg(priv, REG_MOD) == REG_MOD_PELICAN_INITIAL &&
363 priv->read_reg(priv, REG_SR) == REG_SR_PELICAN_INITIAL && 363 priv->read_reg(priv, SJA1000_REG_SR) == REG_SR_PELICAN_INITIAL &&
364 priv->read_reg(priv, REG_IR) == REG_IR_PELICAN_INITIAL) 364 priv->read_reg(priv, REG_IR) == REG_IR_PELICAN_INITIAL)
365 return flag; 365 return flag;
366 366
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index daf4013a8fc7..e4df307eaa90 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -92,7 +92,7 @@ static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val)
92 */ 92 */
93 spin_lock_irqsave(&priv->cmdreg_lock, flags); 93 spin_lock_irqsave(&priv->cmdreg_lock, flags);
94 priv->write_reg(priv, REG_CMR, val); 94 priv->write_reg(priv, REG_CMR, val);
95 priv->read_reg(priv, REG_SR); 95 priv->read_reg(priv, SJA1000_REG_SR);
96 spin_unlock_irqrestore(&priv->cmdreg_lock, flags); 96 spin_unlock_irqrestore(&priv->cmdreg_lock, flags);
97} 97}
98 98
@@ -502,7 +502,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
502 502
503 while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) { 503 while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) {
504 n++; 504 n++;
505 status = priv->read_reg(priv, REG_SR); 505 status = priv->read_reg(priv, SJA1000_REG_SR);
506 /* check for absent controller due to hw unplug */ 506 /* check for absent controller due to hw unplug */
507 if (status == 0xFF && sja1000_is_absent(priv)) 507 if (status == 0xFF && sja1000_is_absent(priv))
508 return IRQ_NONE; 508 return IRQ_NONE;
@@ -530,7 +530,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
530 /* receive interrupt */ 530 /* receive interrupt */
531 while (status & SR_RBS) { 531 while (status & SR_RBS) {
532 sja1000_rx(dev); 532 sja1000_rx(dev);
533 status = priv->read_reg(priv, REG_SR); 533 status = priv->read_reg(priv, SJA1000_REG_SR);
534 /* check for absent controller */ 534 /* check for absent controller */
535 if (status == 0xFF && sja1000_is_absent(priv)) 535 if (status == 0xFF && sja1000_is_absent(priv))
536 return IRQ_NONE; 536 return IRQ_NONE;
diff --git a/drivers/net/can/sja1000/sja1000.h b/drivers/net/can/sja1000/sja1000.h
index afa99847a510..aa48e053da27 100644
--- a/drivers/net/can/sja1000/sja1000.h
+++ b/drivers/net/can/sja1000/sja1000.h
@@ -56,7 +56,7 @@
56/* SJA1000 registers - manual section 6.4 (Pelican Mode) */ 56/* SJA1000 registers - manual section 6.4 (Pelican Mode) */
57#define REG_MOD 0x00 57#define REG_MOD 0x00
58#define REG_CMR 0x01 58#define REG_CMR 0x01
59#define REG_SR 0x02 59#define SJA1000_REG_SR 0x02
60#define REG_IR 0x03 60#define REG_IR 0x03
61#define REG_IER 0x04 61#define REG_IER 0x04
62#define REG_ALC 0x0B 62#define REG_ALC 0x0B
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e.h b/drivers/net/ethernet/atheros/atl1e/atl1e.h
index 829b5ad71d0d..edfdf6b950e7 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e.h
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e.h
@@ -438,7 +438,6 @@ struct atl1e_adapter {
438 struct atl1e_hw hw; 438 struct atl1e_hw hw;
439 struct atl1e_hw_stats hw_stats; 439 struct atl1e_hw_stats hw_stats;
440 440
441 bool have_msi;
442 u32 wol; 441 u32 wol;
443 u16 link_speed; 442 u16 link_speed;
444 u16 link_duplex; 443 u16 link_duplex;
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
index e1f1b2a0673a..7e0a822289c3 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
@@ -1847,34 +1847,19 @@ static void atl1e_free_irq(struct atl1e_adapter *adapter)
1847 struct net_device *netdev = adapter->netdev; 1847 struct net_device *netdev = adapter->netdev;
1848 1848
1849 free_irq(adapter->pdev->irq, netdev); 1849 free_irq(adapter->pdev->irq, netdev);
1850
1851 if (adapter->have_msi)
1852 pci_disable_msi(adapter->pdev);
1853} 1850}
1854 1851
1855static int atl1e_request_irq(struct atl1e_adapter *adapter) 1852static int atl1e_request_irq(struct atl1e_adapter *adapter)
1856{ 1853{
1857 struct pci_dev *pdev = adapter->pdev; 1854 struct pci_dev *pdev = adapter->pdev;
1858 struct net_device *netdev = adapter->netdev; 1855 struct net_device *netdev = adapter->netdev;
1859 int flags = 0;
1860 int err = 0; 1856 int err = 0;
1861 1857
1862 adapter->have_msi = true; 1858 err = request_irq(pdev->irq, atl1e_intr, IRQF_SHARED, netdev->name,
1863 err = pci_enable_msi(pdev); 1859 netdev);
1864 if (err) {
1865 netdev_dbg(netdev,
1866 "Unable to allocate MSI interrupt Error: %d\n", err);
1867 adapter->have_msi = false;
1868 }
1869
1870 if (!adapter->have_msi)
1871 flags |= IRQF_SHARED;
1872 err = request_irq(pdev->irq, atl1e_intr, flags, netdev->name, netdev);
1873 if (err) { 1860 if (err) {
1874 netdev_dbg(adapter->netdev, 1861 netdev_dbg(adapter->netdev,
1875 "Unable to allocate interrupt Error: %d\n", err); 1862 "Unable to allocate interrupt Error: %d\n", err);
1876 if (adapter->have_msi)
1877 pci_disable_msi(pdev);
1878 return err; 1863 return err;
1879 } 1864 }
1880 netdev_dbg(netdev, "atl1e_request_irq OK\n"); 1865 netdev_dbg(netdev, "atl1e_request_irq OK\n");
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index dea7d7d1f730..a4416b09f209 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -14756,8 +14756,11 @@ static void tg3_read_vpd(struct tg3 *tp)
14756 if (j + len > block_end) 14756 if (j + len > block_end)
14757 goto partno; 14757 goto partno;
14758 14758
14759 memcpy(tp->fw_ver, &vpd_data[j], len); 14759 if (len >= sizeof(tp->fw_ver))
14760 strncat(tp->fw_ver, " bc ", vpdlen - len - 1); 14760 len = sizeof(tp->fw_ver) - 1;
14761 memset(tp->fw_ver, 0, sizeof(tp->fw_ver));
14762 snprintf(tp->fw_ver, sizeof(tp->fw_ver), "%.*s bc ", len,
14763 &vpd_data[j]);
14761 } 14764 }
14762 14765
14763partno: 14766partno:
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index a170065b5973..b0ebc9f6d55e 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -163,6 +163,7 @@
163#define XGMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */ 163#define XGMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */
164 164
165/* XGMAC_INT_STAT reg */ 165/* XGMAC_INT_STAT reg */
166#define XGMAC_INT_STAT_PMTIM 0x00800000 /* PMT Interrupt Mask */
166#define XGMAC_INT_STAT_PMT 0x0080 /* PMT Interrupt Status */ 167#define XGMAC_INT_STAT_PMT 0x0080 /* PMT Interrupt Status */
167#define XGMAC_INT_STAT_LPI 0x0040 /* LPI Interrupt Status */ 168#define XGMAC_INT_STAT_LPI 0x0040 /* LPI Interrupt Status */
168 169
@@ -960,6 +961,9 @@ static int xgmac_hw_init(struct net_device *dev)
960 writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_STATUS); 961 writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_STATUS);
961 writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_INTR_ENA); 962 writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_INTR_ENA);
962 963
964 /* Mask power mgt interrupt */
965 writel(XGMAC_INT_STAT_PMTIM, ioaddr + XGMAC_INT_STAT);
966
963 /* XGMAC requires AXI bus init. This is a 'magic number' for now */ 967 /* XGMAC requires AXI bus init. This is a 'magic number' for now */
964 writel(0x0077000E, ioaddr + XGMAC_DMA_AXI_BUS); 968 writel(0x0077000E, ioaddr + XGMAC_DMA_AXI_BUS);
965 969
@@ -1141,6 +1145,9 @@ static int xgmac_rx(struct xgmac_priv *priv, int limit)
1141 struct sk_buff *skb; 1145 struct sk_buff *skb;
1142 int frame_len; 1146 int frame_len;
1143 1147
1148 if (!dma_ring_cnt(priv->rx_head, priv->rx_tail, DMA_RX_RING_SZ))
1149 break;
1150
1144 entry = priv->rx_tail; 1151 entry = priv->rx_tail;
1145 p = priv->dma_rx + entry; 1152 p = priv->dma_rx + entry;
1146 if (desc_get_owner(p)) 1153 if (desc_get_owner(p))
@@ -1825,7 +1832,7 @@ static void xgmac_pmt(void __iomem *ioaddr, unsigned long mode)
1825 unsigned int pmt = 0; 1832 unsigned int pmt = 0;
1826 1833
1827 if (mode & WAKE_MAGIC) 1834 if (mode & WAKE_MAGIC)
1828 pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_MAGIC_PKT; 1835 pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_MAGIC_PKT_EN;
1829 if (mode & WAKE_UCAST) 1836 if (mode & WAKE_UCAST)
1830 pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_GLBL_UNICAST; 1837 pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_GLBL_UNICAST;
1831 1838
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index f38f677f8420..9105465b2a1a 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -257,6 +257,107 @@ static void dm9000_dumpblk_32bit(void __iomem *reg, int count)
257 tmp = readl(reg); 257 tmp = readl(reg);
258} 258}
259 259
260/*
261 * Sleep, either by using msleep() or if we are suspending, then
262 * use mdelay() to sleep.
263 */
264static void dm9000_msleep(board_info_t *db, unsigned int ms)
265{
266 if (db->in_suspend)
267 mdelay(ms);
268 else
269 msleep(ms);
270}
271
272/* Read a word from phyxcer */
273static int
274dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg)
275{
276 board_info_t *db = netdev_priv(dev);
277 unsigned long flags;
278 unsigned int reg_save;
279 int ret;
280
281 mutex_lock(&db->addr_lock);
282
283 spin_lock_irqsave(&db->lock, flags);
284
285 /* Save previous register address */
286 reg_save = readb(db->io_addr);
287
288 /* Fill the phyxcer register into REG_0C */
289 iow(db, DM9000_EPAR, DM9000_PHY | reg);
290
291 /* Issue phyxcer read command */
292 iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS);
293
294 writeb(reg_save, db->io_addr);
295 spin_unlock_irqrestore(&db->lock, flags);
296
297 dm9000_msleep(db, 1); /* Wait read complete */
298
299 spin_lock_irqsave(&db->lock, flags);
300 reg_save = readb(db->io_addr);
301
302 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */
303
304 /* The read data keeps on REG_0D & REG_0E */
305 ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL);
306
307 /* restore the previous address */
308 writeb(reg_save, db->io_addr);
309 spin_unlock_irqrestore(&db->lock, flags);
310
311 mutex_unlock(&db->addr_lock);
312
313 dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret);
314 return ret;
315}
316
317/* Write a word to phyxcer */
318static void
319dm9000_phy_write(struct net_device *dev,
320 int phyaddr_unused, int reg, int value)
321{
322 board_info_t *db = netdev_priv(dev);
323 unsigned long flags;
324 unsigned long reg_save;
325
326 dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value);
327 mutex_lock(&db->addr_lock);
328
329 spin_lock_irqsave(&db->lock, flags);
330
331 /* Save previous register address */
332 reg_save = readb(db->io_addr);
333
334 /* Fill the phyxcer register into REG_0C */
335 iow(db, DM9000_EPAR, DM9000_PHY | reg);
336
337 /* Fill the written data into REG_0D & REG_0E */
338 iow(db, DM9000_EPDRL, value);
339 iow(db, DM9000_EPDRH, value >> 8);
340
341 /* Issue phyxcer write command */
342 iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW);
343
344 writeb(reg_save, db->io_addr);
345 spin_unlock_irqrestore(&db->lock, flags);
346
347 dm9000_msleep(db, 1); /* Wait write complete */
348
349 spin_lock_irqsave(&db->lock, flags);
350 reg_save = readb(db->io_addr);
351
352 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */
353
354 /* restore the previous address */
355 writeb(reg_save, db->io_addr);
356
357 spin_unlock_irqrestore(&db->lock, flags);
358 mutex_unlock(&db->addr_lock);
359}
360
260/* dm9000_set_io 361/* dm9000_set_io
261 * 362 *
262 * select the specified set of io routines to use with the 363 * select the specified set of io routines to use with the
@@ -795,6 +896,9 @@ dm9000_init_dm9000(struct net_device *dev)
795 896
796 iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ 897 iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */
797 898
899 dm9000_phy_write(dev, 0, MII_BMCR, BMCR_RESET); /* PHY RESET */
900 dm9000_phy_write(dev, 0, MII_DM_DSPCR, DSPCR_INIT_PARAM); /* Init */
901
798 ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; 902 ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0;
799 903
800 /* if wol is needed, then always set NCR_WAKEEN otherwise we end 904 /* if wol is needed, then always set NCR_WAKEEN otherwise we end
@@ -1201,109 +1305,6 @@ dm9000_open(struct net_device *dev)
1201 return 0; 1305 return 0;
1202} 1306}
1203 1307
1204/*
1205 * Sleep, either by using msleep() or if we are suspending, then
1206 * use mdelay() to sleep.
1207 */
1208static void dm9000_msleep(board_info_t *db, unsigned int ms)
1209{
1210 if (db->in_suspend)
1211 mdelay(ms);
1212 else
1213 msleep(ms);
1214}
1215
1216/*
1217 * Read a word from phyxcer
1218 */
1219static int
1220dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg)
1221{
1222 board_info_t *db = netdev_priv(dev);
1223 unsigned long flags;
1224 unsigned int reg_save;
1225 int ret;
1226
1227 mutex_lock(&db->addr_lock);
1228
1229 spin_lock_irqsave(&db->lock,flags);
1230
1231 /* Save previous register address */
1232 reg_save = readb(db->io_addr);
1233
1234 /* Fill the phyxcer register into REG_0C */
1235 iow(db, DM9000_EPAR, DM9000_PHY | reg);
1236
1237 iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS); /* Issue phyxcer read command */
1238
1239 writeb(reg_save, db->io_addr);
1240 spin_unlock_irqrestore(&db->lock,flags);
1241
1242 dm9000_msleep(db, 1); /* Wait read complete */
1243
1244 spin_lock_irqsave(&db->lock,flags);
1245 reg_save = readb(db->io_addr);
1246
1247 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */
1248
1249 /* The read data keeps on REG_0D & REG_0E */
1250 ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL);
1251
1252 /* restore the previous address */
1253 writeb(reg_save, db->io_addr);
1254 spin_unlock_irqrestore(&db->lock,flags);
1255
1256 mutex_unlock(&db->addr_lock);
1257
1258 dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret);
1259 return ret;
1260}
1261
1262/*
1263 * Write a word to phyxcer
1264 */
1265static void
1266dm9000_phy_write(struct net_device *dev,
1267 int phyaddr_unused, int reg, int value)
1268{
1269 board_info_t *db = netdev_priv(dev);
1270 unsigned long flags;
1271 unsigned long reg_save;
1272
1273 dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value);
1274 mutex_lock(&db->addr_lock);
1275
1276 spin_lock_irqsave(&db->lock,flags);
1277
1278 /* Save previous register address */
1279 reg_save = readb(db->io_addr);
1280
1281 /* Fill the phyxcer register into REG_0C */
1282 iow(db, DM9000_EPAR, DM9000_PHY | reg);
1283
1284 /* Fill the written data into REG_0D & REG_0E */
1285 iow(db, DM9000_EPDRL, value);
1286 iow(db, DM9000_EPDRH, value >> 8);
1287
1288 iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW); /* Issue phyxcer write command */
1289
1290 writeb(reg_save, db->io_addr);
1291 spin_unlock_irqrestore(&db->lock, flags);
1292
1293 dm9000_msleep(db, 1); /* Wait write complete */
1294
1295 spin_lock_irqsave(&db->lock,flags);
1296 reg_save = readb(db->io_addr);
1297
1298 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */
1299
1300 /* restore the previous address */
1301 writeb(reg_save, db->io_addr);
1302
1303 spin_unlock_irqrestore(&db->lock, flags);
1304 mutex_unlock(&db->addr_lock);
1305}
1306
1307static void 1308static void
1308dm9000_shutdown(struct net_device *dev) 1309dm9000_shutdown(struct net_device *dev)
1309{ 1310{
@@ -1502,7 +1503,12 @@ dm9000_probe(struct platform_device *pdev)
1502 db->flags |= DM9000_PLATF_SIMPLE_PHY; 1503 db->flags |= DM9000_PLATF_SIMPLE_PHY;
1503#endif 1504#endif
1504 1505
1505 dm9000_reset(db); 1506 /* Fixing bug on dm9000_probe, takeover dm9000_reset(db),
1507 * Need 'NCR_MAC_LBK' bit to indeed stable our DM9000 fifo
1508 * while probe stage.
1509 */
1510
1511 iow(db, DM9000_NCR, NCR_MAC_LBK | NCR_RST);
1506 1512
1507 /* try multiple times, DM9000 sometimes gets the read wrong */ 1513 /* try multiple times, DM9000 sometimes gets the read wrong */
1508 for (i = 0; i < 8; i++) { 1514 for (i = 0; i < 8; i++) {
diff --git a/drivers/net/ethernet/davicom/dm9000.h b/drivers/net/ethernet/davicom/dm9000.h
index 55688bd1a3ef..9ce058adabab 100644
--- a/drivers/net/ethernet/davicom/dm9000.h
+++ b/drivers/net/ethernet/davicom/dm9000.h
@@ -69,7 +69,9 @@
69#define NCR_WAKEEN (1<<6) 69#define NCR_WAKEEN (1<<6)
70#define NCR_FCOL (1<<4) 70#define NCR_FCOL (1<<4)
71#define NCR_FDX (1<<3) 71#define NCR_FDX (1<<3)
72#define NCR_LBK (3<<1) 72
73#define NCR_RESERVED (3<<1)
74#define NCR_MAC_LBK (1<<1)
73#define NCR_RST (1<<0) 75#define NCR_RST (1<<0)
74 76
75#define NSR_SPEED (1<<7) 77#define NSR_SPEED (1<<7)
@@ -167,5 +169,12 @@
167#define ISR_LNKCHNG (1<<5) 169#define ISR_LNKCHNG (1<<5)
168#define ISR_UNDERRUN (1<<4) 170#define ISR_UNDERRUN (1<<4)
169 171
172/* Davicom MII registers.
173 */
174
175#define MII_DM_DSPCR 0x1b /* DSP Control Register */
176
177#define DSPCR_INIT_PARAM 0xE100 /* DSP init parameter */
178
170#endif /* _DM9000X_H_ */ 179#endif /* _DM9000X_H_ */
171 180
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 2b78a1ebe903..a82a70345bbf 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -344,6 +344,53 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
344 return NETDEV_TX_OK; 344 return NETDEV_TX_OK;
345} 345}
346 346
347/* Init RX & TX buffer descriptors
348 */
349static void fec_enet_bd_init(struct net_device *dev)
350{
351 struct fec_enet_private *fep = netdev_priv(dev);
352 struct bufdesc *bdp;
353 unsigned int i;
354
355 /* Initialize the receive buffer descriptors. */
356 bdp = fep->rx_bd_base;
357 for (i = 0; i < RX_RING_SIZE; i++) {
358
359 /* Initialize the BD for every fragment in the page. */
360 if (bdp->cbd_bufaddr)
361 bdp->cbd_sc = BD_ENET_RX_EMPTY;
362 else
363 bdp->cbd_sc = 0;
364 bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
365 }
366
367 /* Set the last buffer to wrap */
368 bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
369 bdp->cbd_sc |= BD_SC_WRAP;
370
371 fep->cur_rx = fep->rx_bd_base;
372
373 /* ...and the same for transmit */
374 bdp = fep->tx_bd_base;
375 fep->cur_tx = bdp;
376 for (i = 0; i < TX_RING_SIZE; i++) {
377
378 /* Initialize the BD for every fragment in the page. */
379 bdp->cbd_sc = 0;
380 if (bdp->cbd_bufaddr && fep->tx_skbuff[i]) {
381 dev_kfree_skb_any(fep->tx_skbuff[i]);
382 fep->tx_skbuff[i] = NULL;
383 }
384 bdp->cbd_bufaddr = 0;
385 bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
386 }
387
388 /* Set the last buffer to wrap */
389 bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
390 bdp->cbd_sc |= BD_SC_WRAP;
391 fep->dirty_tx = bdp;
392}
393
347/* This function is called to start or restart the FEC during a link 394/* This function is called to start or restart the FEC during a link
348 * change. This only happens when switching between half and full 395 * change. This only happens when switching between half and full
349 * duplex. 396 * duplex.
@@ -387,6 +434,8 @@ fec_restart(struct net_device *ndev, int duplex)
387 /* Set maximum receive buffer size. */ 434 /* Set maximum receive buffer size. */
388 writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE); 435 writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE);
389 436
437 fec_enet_bd_init(ndev);
438
390 /* Set receive and transmit descriptor base. */ 439 /* Set receive and transmit descriptor base. */
391 writel(fep->bd_dma, fep->hwp + FEC_R_DES_START); 440 writel(fep->bd_dma, fep->hwp + FEC_R_DES_START);
392 if (fep->bufdesc_ex) 441 if (fep->bufdesc_ex)
@@ -396,7 +445,6 @@ fec_restart(struct net_device *ndev, int duplex)
396 writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc) 445 writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc)
397 * RX_RING_SIZE, fep->hwp + FEC_X_DES_START); 446 * RX_RING_SIZE, fep->hwp + FEC_X_DES_START);
398 447
399 fep->cur_rx = fep->rx_bd_base;
400 448
401 for (i = 0; i <= TX_RING_MOD_MASK; i++) { 449 for (i = 0; i <= TX_RING_MOD_MASK; i++) {
402 if (fep->tx_skbuff[i]) { 450 if (fep->tx_skbuff[i]) {
@@ -1594,8 +1642,6 @@ static int fec_enet_init(struct net_device *ndev)
1594{ 1642{
1595 struct fec_enet_private *fep = netdev_priv(ndev); 1643 struct fec_enet_private *fep = netdev_priv(ndev);
1596 struct bufdesc *cbd_base; 1644 struct bufdesc *cbd_base;
1597 struct bufdesc *bdp;
1598 unsigned int i;
1599 1645
1600 /* Allocate memory for buffer descriptors. */ 1646 /* Allocate memory for buffer descriptors. */
1601 cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, 1647 cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma,
@@ -1603,6 +1649,7 @@ static int fec_enet_init(struct net_device *ndev)
1603 if (!cbd_base) 1649 if (!cbd_base)
1604 return -ENOMEM; 1650 return -ENOMEM;
1605 1651
1652 memset(cbd_base, 0, PAGE_SIZE);
1606 spin_lock_init(&fep->hw_lock); 1653 spin_lock_init(&fep->hw_lock);
1607 1654
1608 fep->netdev = ndev; 1655 fep->netdev = ndev;
@@ -1626,35 +1673,6 @@ static int fec_enet_init(struct net_device *ndev)
1626 writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); 1673 writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK);
1627 netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); 1674 netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT);
1628 1675
1629 /* Initialize the receive buffer descriptors. */
1630 bdp = fep->rx_bd_base;
1631 for (i = 0; i < RX_RING_SIZE; i++) {
1632
1633 /* Initialize the BD for every fragment in the page. */
1634 bdp->cbd_sc = 0;
1635 bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
1636 }
1637
1638 /* Set the last buffer to wrap */
1639 bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
1640 bdp->cbd_sc |= BD_SC_WRAP;
1641
1642 /* ...and the same for transmit */
1643 bdp = fep->tx_bd_base;
1644 fep->cur_tx = bdp;
1645 for (i = 0; i < TX_RING_SIZE; i++) {
1646
1647 /* Initialize the BD for every fragment in the page. */
1648 bdp->cbd_sc = 0;
1649 bdp->cbd_bufaddr = 0;
1650 bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
1651 }
1652
1653 /* Set the last buffer to wrap */
1654 bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
1655 bdp->cbd_sc |= BD_SC_WRAP;
1656 fep->dirty_tx = bdp;
1657
1658 fec_restart(ndev, 0); 1676 fec_restart(ndev, 0);
1659 1677
1660 return 0; 1678 return 0;
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index a9f9c7906769..82a967c95598 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -1052,6 +1052,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1052 txdr->buffer_info[i].dma = 1052 txdr->buffer_info[i].dma =
1053 dma_map_single(&pdev->dev, skb->data, skb->len, 1053 dma_map_single(&pdev->dev, skb->data, skb->len,
1054 DMA_TO_DEVICE); 1054 DMA_TO_DEVICE);
1055 if (dma_mapping_error(&pdev->dev, txdr->buffer_info[i].dma)) {
1056 ret_val = 4;
1057 goto err_nomem;
1058 }
1055 tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma); 1059 tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma);
1056 tx_desc->lower.data = cpu_to_le32(skb->len); 1060 tx_desc->lower.data = cpu_to_le32(skb->len);
1057 tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | 1061 tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP |
@@ -1068,7 +1072,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1068 rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer), 1072 rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer),
1069 GFP_KERNEL); 1073 GFP_KERNEL);
1070 if (!rxdr->buffer_info) { 1074 if (!rxdr->buffer_info) {
1071 ret_val = 4; 1075 ret_val = 5;
1072 goto err_nomem; 1076 goto err_nomem;
1073 } 1077 }
1074 1078
@@ -1076,7 +1080,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1076 rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, 1080 rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
1077 GFP_KERNEL | __GFP_ZERO); 1081 GFP_KERNEL | __GFP_ZERO);
1078 if (!rxdr->desc) { 1082 if (!rxdr->desc) {
1079 ret_val = 5; 1083 ret_val = 6;
1080 goto err_nomem; 1084 goto err_nomem;
1081 } 1085 }
1082 rxdr->next_to_use = rxdr->next_to_clean = 0; 1086 rxdr->next_to_use = rxdr->next_to_clean = 0;
@@ -1099,7 +1103,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1099 1103
1100 skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL); 1104 skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL);
1101 if (!skb) { 1105 if (!skb) {
1102 ret_val = 6; 1106 ret_val = 7;
1103 goto err_nomem; 1107 goto err_nomem;
1104 } 1108 }
1105 skb_reserve(skb, NET_IP_ALIGN); 1109 skb_reserve(skb, NET_IP_ALIGN);
@@ -1108,6 +1112,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1108 rxdr->buffer_info[i].dma = 1112 rxdr->buffer_info[i].dma =
1109 dma_map_single(&pdev->dev, skb->data, 1113 dma_map_single(&pdev->dev, skb->data,
1110 E1000_RXBUFFER_2048, DMA_FROM_DEVICE); 1114 E1000_RXBUFFER_2048, DMA_FROM_DEVICE);
1115 if (dma_mapping_error(&pdev->dev, rxdr->buffer_info[i].dma)) {
1116 ret_val = 8;
1117 goto err_nomem;
1118 }
1111 rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma); 1119 rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma);
1112 memset(skb->data, 0x00, skb->len); 1120 memset(skb->data, 0x00, skb->len);
1113 } 1121 }
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 858d2a3b3672..b18fad5b579e 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -846,11 +846,16 @@ check_page:
846 } 846 }
847 } 847 }
848 848
849 if (!buffer_info->dma) 849 if (!buffer_info->dma) {
850 buffer_info->dma = dma_map_page(&pdev->dev, 850 buffer_info->dma = dma_map_page(&pdev->dev,
851 buffer_info->page, 0, 851 buffer_info->page, 0,
852 PAGE_SIZE, 852 PAGE_SIZE,
853 DMA_FROM_DEVICE); 853 DMA_FROM_DEVICE);
854 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
855 adapter->alloc_rx_buff_failed++;
856 break;
857 }
858 }
854 859
855 rx_desc = E1000_RX_DESC_EXT(*rx_ring, i); 860 rx_desc = E1000_RX_DESC_EXT(*rx_ring, i);
856 rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma); 861 rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma);
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index 74464c348454..5dc119fd95a8 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -2154,6 +2154,10 @@ map_skb:
2154 skb->data, 2154 skb->data,
2155 adapter->rx_buffer_len, 2155 adapter->rx_buffer_len,
2156 DMA_FROM_DEVICE); 2156 DMA_FROM_DEVICE);
2157 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
2158 adapter->alloc_rx_buff_failed++;
2159 break;
2160 }
2157 2161
2158 rx_desc = IXGB_RX_DESC(*rx_ring, i); 2162 rx_desc = IXGB_RX_DESC(*rx_ring, i);
2159 rx_desc->buff_addr = cpu_to_le64(buffer_info->dma); 2163 rx_desc->buff_addr = cpu_to_le64(buffer_info->dma);
@@ -2163,7 +2167,8 @@ map_skb:
2163 rx_desc->status = 0; 2167 rx_desc->status = 0;
2164 2168
2165 2169
2166 if (++i == rx_ring->count) i = 0; 2170 if (++i == rx_ring->count)
2171 i = 0;
2167 buffer_info = &rx_ring->buffer_info[i]; 2172 buffer_info = &rx_ring->buffer_info[i];
2168 } 2173 }
2169 2174
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index fc07ca35721b..6a0e671fcecd 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -1067,7 +1067,7 @@ static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 space)
1067 sky2_write32(hw, RB_ADDR(q, RB_RX_UTHP), tp); 1067 sky2_write32(hw, RB_ADDR(q, RB_RX_UTHP), tp);
1068 sky2_write32(hw, RB_ADDR(q, RB_RX_LTHP), space/2); 1068 sky2_write32(hw, RB_ADDR(q, RB_RX_LTHP), space/2);
1069 1069
1070 tp = space - 2048/8; 1070 tp = space - 8192/8;
1071 sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp); 1071 sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp);
1072 sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4); 1072 sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4);
1073 } else { 1073 } else {
diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h
index 615ac63ea860..ec6dcd80152b 100644
--- a/drivers/net/ethernet/marvell/sky2.h
+++ b/drivers/net/ethernet/marvell/sky2.h
@@ -2074,7 +2074,7 @@ enum {
2074 GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */ 2074 GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */
2075 GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */ 2075 GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */
2076 2076
2077#define GMAC_DEF_MSK GM_IS_TX_FF_UR 2077#define GMAC_DEF_MSK (GM_IS_TX_FF_UR | GM_IS_RX_FF_OR)
2078}; 2078};
2079 2079
2080/* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */ 2080/* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index 33bcb63d56a2..8fb481252e2c 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -528,7 +528,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
528 for (; rxfc != 0; rxfc--) { 528 for (; rxfc != 0; rxfc--) {
529 rxh = ks8851_rdreg32(ks, KS_RXFHSR); 529 rxh = ks8851_rdreg32(ks, KS_RXFHSR);
530 rxstat = rxh & 0xffff; 530 rxstat = rxh & 0xffff;
531 rxlen = rxh >> 16; 531 rxlen = (rxh >> 16) & 0xfff;
532 532
533 netif_dbg(ks, rx_status, ks->netdev, 533 netif_dbg(ks, rx_status, ks->netdev,
534 "rx: stat 0x%04x, len 0x%04x\n", rxstat, rxlen); 534 "rx: stat 0x%04x, len 0x%04x\n", rxstat, rxlen);
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index da604059b148..a7499cbf4503 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1517,10 +1517,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
1517 if (felic_stat & ECSR_LCHNG) { 1517 if (felic_stat & ECSR_LCHNG) {
1518 /* Link Changed */ 1518 /* Link Changed */
1519 if (mdp->cd->no_psr || mdp->no_ether_link) { 1519 if (mdp->cd->no_psr || mdp->no_ether_link) {
1520 if (mdp->link == PHY_DOWN) 1520 goto ignore_link;
1521 link_stat = 0;
1522 else
1523 link_stat = PHY_ST_LINK;
1524 } else { 1521 } else {
1525 link_stat = (sh_eth_read(ndev, PSR)); 1522 link_stat = (sh_eth_read(ndev, PSR));
1526 if (mdp->ether_link_active_low) 1523 if (mdp->ether_link_active_low)
@@ -1543,6 +1540,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
1543 } 1540 }
1544 } 1541 }
1545 1542
1543ignore_link:
1546 if (intr_status & EESR_TWB) { 1544 if (intr_status & EESR_TWB) {
1547 /* Write buck end. unused write back interrupt */ 1545 /* Write buck end. unused write back interrupt */
1548 if (intr_status & EESR_TABT) /* Transmit Abort int */ 1546 if (intr_status & EESR_TABT) /* Transmit Abort int */
@@ -1627,12 +1625,18 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
1627 struct sh_eth_private *mdp = netdev_priv(ndev); 1625 struct sh_eth_private *mdp = netdev_priv(ndev);
1628 struct sh_eth_cpu_data *cd = mdp->cd; 1626 struct sh_eth_cpu_data *cd = mdp->cd;
1629 irqreturn_t ret = IRQ_NONE; 1627 irqreturn_t ret = IRQ_NONE;
1630 u32 intr_status = 0; 1628 unsigned long intr_status;
1631 1629
1632 spin_lock(&mdp->lock); 1630 spin_lock(&mdp->lock);
1633 1631
1634 /* Get interrpt stat */ 1632 /* Get interrupt status */
1635 intr_status = sh_eth_read(ndev, EESR); 1633 intr_status = sh_eth_read(ndev, EESR);
1634 /* Mask it with the interrupt mask, forcing ECI interrupt to be always
1635 * enabled since it's the one that comes thru regardless of the mask,
1636 * and we need to fully handle it in sh_eth_error() in order to quench
1637 * it as it doesn't get cleared by just writing 1 to the ECI bit...
1638 */
1639 intr_status &= sh_eth_read(ndev, EESIPR) | DMAC_M_ECI;
1636 /* Clear interrupt */ 1640 /* Clear interrupt */
1637 if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF | 1641 if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF |
1638 EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF | 1642 EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF |
@@ -1674,7 +1678,7 @@ static void sh_eth_adjust_link(struct net_device *ndev)
1674 struct phy_device *phydev = mdp->phydev; 1678 struct phy_device *phydev = mdp->phydev;
1675 int new_state = 0; 1679 int new_state = 0;
1676 1680
1677 if (phydev->link != PHY_DOWN) { 1681 if (phydev->link) {
1678 if (phydev->duplex != mdp->duplex) { 1682 if (phydev->duplex != mdp->duplex) {
1679 new_state = 1; 1683 new_state = 1;
1680 mdp->duplex = phydev->duplex; 1684 mdp->duplex = phydev->duplex;
@@ -1688,17 +1692,21 @@ static void sh_eth_adjust_link(struct net_device *ndev)
1688 if (mdp->cd->set_rate) 1692 if (mdp->cd->set_rate)
1689 mdp->cd->set_rate(ndev); 1693 mdp->cd->set_rate(ndev);
1690 } 1694 }
1691 if (mdp->link == PHY_DOWN) { 1695 if (!mdp->link) {
1692 sh_eth_write(ndev, 1696 sh_eth_write(ndev,
1693 (sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR); 1697 (sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR);
1694 new_state = 1; 1698 new_state = 1;
1695 mdp->link = phydev->link; 1699 mdp->link = phydev->link;
1700 if (mdp->cd->no_psr || mdp->no_ether_link)
1701 sh_eth_rcv_snd_enable(ndev);
1696 } 1702 }
1697 } else if (mdp->link) { 1703 } else if (mdp->link) {
1698 new_state = 1; 1704 new_state = 1;
1699 mdp->link = PHY_DOWN; 1705 mdp->link = 0;
1700 mdp->speed = 0; 1706 mdp->speed = 0;
1701 mdp->duplex = -1; 1707 mdp->duplex = -1;
1708 if (mdp->cd->no_psr || mdp->no_ether_link)
1709 sh_eth_rcv_snd_disable(ndev);
1702 } 1710 }
1703 1711
1704 if (new_state && netif_msg_link(mdp)) 1712 if (new_state && netif_msg_link(mdp))
@@ -1715,7 +1723,7 @@ static int sh_eth_phy_init(struct net_device *ndev)
1715 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, 1723 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
1716 mdp->mii_bus->id , mdp->phy_id); 1724 mdp->mii_bus->id , mdp->phy_id);
1717 1725
1718 mdp->link = PHY_DOWN; 1726 mdp->link = 0;
1719 mdp->speed = 0; 1727 mdp->speed = 0;
1720 mdp->duplex = -1; 1728 mdp->duplex = -1;
1721 1729
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index e5292973900b..1ddc9f235bcb 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -503,7 +503,7 @@ struct sh_eth_private {
503 u32 phy_id; /* PHY ID */ 503 u32 phy_id; /* PHY ID */
504 struct mii_bus *mii_bus; /* MDIO bus control */ 504 struct mii_bus *mii_bus; /* MDIO bus control */
505 struct phy_device *phydev; /* PHY device control */ 505 struct phy_device *phydev; /* PHY device control */
506 enum phy_state link; 506 int link;
507 phy_interface_t phy_interface; 507 phy_interface_t phy_interface;
508 int msg_enable; 508 int msg_enable;
509 int speed; 509 int speed;
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 7aebc0cb35e1..1d740423a053 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -458,7 +458,7 @@ void cpsw_tx_handler(void *token, int len, int status)
458 * queue is stopped then start the queue as we have free desc for tx 458 * queue is stopped then start the queue as we have free desc for tx
459 */ 459 */
460 if (unlikely(netif_queue_stopped(ndev))) 460 if (unlikely(netif_queue_stopped(ndev)))
461 netif_start_queue(ndev); 461 netif_wake_queue(ndev);
462 cpts_tx_timestamp(priv->cpts, skb); 462 cpts_tx_timestamp(priv->cpts, skb);
463 priv->stats.tx_packets++; 463 priv->stats.tx_packets++;
464 priv->stats.tx_bytes += len; 464 priv->stats.tx_bytes += len;
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 8121a3d5897c..6a0b47715a84 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1053,7 +1053,7 @@ static void emac_tx_handler(void *token, int len, int status)
1053 * queue is stopped then start the queue as we have free desc for tx 1053 * queue is stopped then start the queue as we have free desc for tx
1054 */ 1054 */
1055 if (unlikely(netif_queue_stopped(ndev))) 1055 if (unlikely(netif_queue_stopped(ndev)))
1056 netif_start_queue(ndev); 1056 netif_wake_queue(ndev);
1057 ndev->stats.tx_packets++; 1057 ndev->stats.tx_packets++;
1058 ndev->stats.tx_bytes += len; 1058 ndev->stats.tx_bytes += len;
1059 dev_kfree_skb_any(skb); 1059 dev_kfree_skb_any(skb);
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 9abe51710f22..1a15ec14c386 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -914,8 +914,12 @@ static int smsc75xx_set_rx_max_frame_length(struct usbnet *dev, int size)
914static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu) 914static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu)
915{ 915{
916 struct usbnet *dev = netdev_priv(netdev); 916 struct usbnet *dev = netdev_priv(netdev);
917 int ret;
918
919 if (new_mtu > MAX_SINGLE_PACKET_SIZE)
920 return -EINVAL;
917 921
918 int ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu); 922 ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu + ETH_HLEN);
919 if (ret < 0) { 923 if (ret < 0) {
920 netdev_warn(dev->net, "Failed to set mac rx frame length\n"); 924 netdev_warn(dev->net, "Failed to set mac rx frame length\n");
921 return ret; 925 return ret;
@@ -1324,7 +1328,7 @@ static int smsc75xx_reset(struct usbnet *dev)
1324 1328
1325 netif_dbg(dev, ifup, dev->net, "FCT_TX_CTL set to 0x%08x\n", buf); 1329 netif_dbg(dev, ifup, dev->net, "FCT_TX_CTL set to 0x%08x\n", buf);
1326 1330
1327 ret = smsc75xx_set_rx_max_frame_length(dev, 1514); 1331 ret = smsc75xx_set_rx_max_frame_length(dev, dev->net->mtu + ETH_HLEN);
1328 if (ret < 0) { 1332 if (ret < 0) {
1329 netdev_warn(dev->net, "Failed to set max rx frame length\n"); 1333 netdev_warn(dev->net, "Failed to set max rx frame length\n");
1330 return ret; 1334 return ret;
@@ -2134,8 +2138,8 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
2134 else if (rx_cmd_a & (RX_CMD_A_LONG | RX_CMD_A_RUNT)) 2138 else if (rx_cmd_a & (RX_CMD_A_LONG | RX_CMD_A_RUNT))
2135 dev->net->stats.rx_frame_errors++; 2139 dev->net->stats.rx_frame_errors++;
2136 } else { 2140 } else {
2137 /* ETH_FRAME_LEN + 4(CRC) + 2(COE) + 4(Vlan) */ 2141 /* MAX_SINGLE_PACKET_SIZE + 4(CRC) + 2(COE) + 4(Vlan) */
2138 if (unlikely(size > (ETH_FRAME_LEN + 12))) { 2142 if (unlikely(size > (MAX_SINGLE_PACKET_SIZE + ETH_HLEN + 12))) {
2139 netif_dbg(dev, rx_err, dev->net, 2143 netif_dbg(dev, rx_err, dev->net,
2140 "size err rx_cmd_a=0x%08x\n", 2144 "size err rx_cmd_a=0x%08x\n",
2141 rx_cmd_a); 2145 rx_cmd_a);
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c
index 39c84ecf6a42..7fdac6c7b3ea 100644
--- a/drivers/net/wireless/ath/ath9k/link.c
+++ b/drivers/net/wireless/ath/ath9k/link.c
@@ -170,7 +170,8 @@ void ath_rx_poll(unsigned long data)
170{ 170{
171 struct ath_softc *sc = (struct ath_softc *)data; 171 struct ath_softc *sc = (struct ath_softc *)data;
172 172
173 ieee80211_queue_work(sc->hw, &sc->hw_check_work); 173 if (!test_bit(SC_OP_INVALID, &sc->sc_flags))
174 ieee80211_queue_work(sc->hw, &sc->hw_check_work);
174} 175}
175 176
176/* 177/*
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index f73cbb512f7c..523355b87659 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1482,8 +1482,12 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1482 const struct b43_dma_ops *ops; 1482 const struct b43_dma_ops *ops;
1483 struct b43_dmaring *ring; 1483 struct b43_dmaring *ring;
1484 struct b43_dmadesc_meta *meta; 1484 struct b43_dmadesc_meta *meta;
1485 static const struct b43_txstatus fake; /* filled with 0 */
1486 const struct b43_txstatus *txstat;
1485 int slot, firstused; 1487 int slot, firstused;
1486 bool frame_succeed; 1488 bool frame_succeed;
1489 int skip;
1490 static u8 err_out1, err_out2;
1487 1491
1488 ring = parse_cookie(dev, status->cookie, &slot); 1492 ring = parse_cookie(dev, status->cookie, &slot);
1489 if (unlikely(!ring)) 1493 if (unlikely(!ring))
@@ -1496,13 +1500,36 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1496 firstused = ring->current_slot - ring->used_slots + 1; 1500 firstused = ring->current_slot - ring->used_slots + 1;
1497 if (firstused < 0) 1501 if (firstused < 0)
1498 firstused = ring->nr_slots + firstused; 1502 firstused = ring->nr_slots + firstused;
1503
1504 skip = 0;
1499 if (unlikely(slot != firstused)) { 1505 if (unlikely(slot != firstused)) {
1500 /* This possibly is a firmware bug and will result in 1506 /* This possibly is a firmware bug and will result in
1501 * malfunction, memory leaks and/or stall of DMA functionality. */ 1507 * malfunction, memory leaks and/or stall of DMA functionality.
1502 b43dbg(dev->wl, "Out of order TX status report on DMA ring %d. " 1508 */
1503 "Expected %d, but got %d\n", 1509 if (slot == next_slot(ring, next_slot(ring, firstused))) {
1504 ring->index, firstused, slot); 1510 /* If a single header/data pair was missed, skip over
1505 return; 1511 * the first two slots in an attempt to recover.
1512 */
1513 slot = firstused;
1514 skip = 2;
1515 if (!err_out1) {
1516 /* Report the error once. */
1517 b43dbg(dev->wl,
1518 "Skip on DMA ring %d slot %d.\n",
1519 ring->index, slot);
1520 err_out1 = 1;
1521 }
1522 } else {
1523 /* More than a single header/data pair were missed.
1524 * Report this error once.
1525 */
1526 if (!err_out2)
1527 b43dbg(dev->wl,
1528 "Out of order TX status report on DMA ring %d. Expected %d, but got %d\n",
1529 ring->index, firstused, slot);
1530 err_out2 = 1;
1531 return;
1532 }
1506 } 1533 }
1507 1534
1508 ops = ring->ops; 1535 ops = ring->ops;
@@ -1517,11 +1544,13 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1517 slot, firstused, ring->index); 1544 slot, firstused, ring->index);
1518 break; 1545 break;
1519 } 1546 }
1547
1520 if (meta->skb) { 1548 if (meta->skb) {
1521 struct b43_private_tx_info *priv_info = 1549 struct b43_private_tx_info *priv_info =
1522 b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb)); 1550 b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb));
1523 1551
1524 unmap_descbuffer(ring, meta->dmaaddr, meta->skb->len, 1); 1552 unmap_descbuffer(ring, meta->dmaaddr,
1553 meta->skb->len, 1);
1525 kfree(priv_info->bouncebuffer); 1554 kfree(priv_info->bouncebuffer);
1526 priv_info->bouncebuffer = NULL; 1555 priv_info->bouncebuffer = NULL;
1527 } else { 1556 } else {
@@ -1533,8 +1562,9 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1533 struct ieee80211_tx_info *info; 1562 struct ieee80211_tx_info *info;
1534 1563
1535 if (unlikely(!meta->skb)) { 1564 if (unlikely(!meta->skb)) {
1536 /* This is a scatter-gather fragment of a frame, so 1565 /* This is a scatter-gather fragment of a frame,
1537 * the skb pointer must not be NULL. */ 1566 * so the skb pointer must not be NULL.
1567 */
1538 b43dbg(dev->wl, "TX status unexpected NULL skb " 1568 b43dbg(dev->wl, "TX status unexpected NULL skb "
1539 "at slot %d (first=%d) on ring %d\n", 1569 "at slot %d (first=%d) on ring %d\n",
1540 slot, firstused, ring->index); 1570 slot, firstused, ring->index);
@@ -1545,9 +1575,18 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1545 1575
1546 /* 1576 /*
1547 * Call back to inform the ieee80211 subsystem about 1577 * Call back to inform the ieee80211 subsystem about
1548 * the status of the transmission. 1578 * the status of the transmission. When skipping over
1579 * a missed TX status report, use a status structure
1580 * filled with zeros to indicate that the frame was not
1581 * sent (frame_count 0) and not acknowledged
1549 */ 1582 */
1550 frame_succeed = b43_fill_txstatus_report(dev, info, status); 1583 if (unlikely(skip))
1584 txstat = &fake;
1585 else
1586 txstat = status;
1587
1588 frame_succeed = b43_fill_txstatus_report(dev, info,
1589 txstat);
1551#ifdef CONFIG_B43_DEBUG 1590#ifdef CONFIG_B43_DEBUG
1552 if (frame_succeed) 1591 if (frame_succeed)
1553 ring->nr_succeed_tx_packets++; 1592 ring->nr_succeed_tx_packets++;
@@ -1575,12 +1614,14 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1575 /* Everything unmapped and free'd. So it's not used anymore. */ 1614 /* Everything unmapped and free'd. So it's not used anymore. */
1576 ring->used_slots--; 1615 ring->used_slots--;
1577 1616
1578 if (meta->is_last_fragment) { 1617 if (meta->is_last_fragment && !skip) {
1579 /* This is the last scatter-gather 1618 /* This is the last scatter-gather
1580 * fragment of the frame. We are done. */ 1619 * fragment of the frame. We are done. */
1581 break; 1620 break;
1582 } 1621 }
1583 slot = next_slot(ring, slot); 1622 slot = next_slot(ring, slot);
1623 if (skip > 0)
1624 --skip;
1584 } 1625 }
1585 if (ring->stopped) { 1626 if (ring->stopped) {
1586 B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME); 1627 B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME);
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 3c35382ee6c2..e8486c1e091a 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -1564,7 +1564,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
1564 u16 clip_off[2] = { 0xFFFF, 0xFFFF }; 1564 u16 clip_off[2] = { 0xFFFF, 0xFFFF };
1565 1565
1566 u8 vcm_final = 0; 1566 u8 vcm_final = 0;
1567 s8 offset[4]; 1567 s32 offset[4];
1568 s32 results[8][4] = { }; 1568 s32 results[8][4] = { };
1569 s32 results_min[4] = { }; 1569 s32 results_min[4] = { };
1570 s32 poll_results[4] = { }; 1570 s32 poll_results[4] = { };
@@ -1615,7 +1615,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
1615 } 1615 }
1616 for (i = 0; i < 4; i += 2) { 1616 for (i = 0; i < 4; i += 2) {
1617 s32 curr; 1617 s32 curr;
1618 s32 mind = 40; 1618 s32 mind = 0x100000;
1619 s32 minpoll = 249; 1619 s32 minpoll = 249;
1620 u8 minvcm = 0; 1620 u8 minvcm = 0;
1621 if (2 * core != i) 1621 if (2 * core != i)
@@ -1732,7 +1732,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
1732 u8 regs_save_radio[2]; 1732 u8 regs_save_radio[2];
1733 u16 regs_save_phy[2]; 1733 u16 regs_save_phy[2];
1734 1734
1735 s8 offset[4]; 1735 s32 offset[4];
1736 u8 core; 1736 u8 core;
1737 u8 rail; 1737 u8 rail;
1738 1738
@@ -1799,7 +1799,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
1799 } 1799 }
1800 1800
1801 for (i = 0; i < 4; i++) { 1801 for (i = 0; i < 4; i++) {
1802 s32 mind = 40; 1802 s32 mind = 0x100000;
1803 u8 minvcm = 0; 1803 u8 minvcm = 0;
1804 s32 minpoll = 249; 1804 s32 minpoll = 249;
1805 s32 curr; 1805 s32 curr;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
index 21a824232478..18d37645e2cd 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -1137,9 +1137,8 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi,
1137 gain0_15 = ((biq1 & 0xf) << 12) | 1137 gain0_15 = ((biq1 & 0xf) << 12) |
1138 ((tia & 0xf) << 8) | 1138 ((tia & 0xf) << 8) |
1139 ((lna2 & 0x3) << 6) | 1139 ((lna2 & 0x3) << 6) |
1140 ((lna2 & 0x3) << 4) | 1140 ((lna2 &
1141 ((lna1 & 0x3) << 2) | 1141 0x3) << 4) | ((lna1 & 0x3) << 2) | ((lna1 & 0x3) << 0);
1142 ((lna1 & 0x3) << 0);
1143 1142
1144 mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); 1143 mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0);
1145 mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); 1144 mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0);
@@ -1157,8 +1156,6 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi,
1157 } 1156 }
1158 1157
1159 mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0); 1158 mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0);
1160 mod_phy_reg(pi, 0x4b1, (0x3 << 11), lna1 << 11);
1161 mod_phy_reg(pi, 0x4e6, (0x3 << 3), lna1 << 3);
1162 1159
1163} 1160}
1164 1161
@@ -1331,43 +1328,6 @@ static u32 wlc_lcnphy_measure_digital_power(struct brcms_phy *pi, u16 nsamples)
1331 return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; 1328 return (iq_est.i_pwr + iq_est.q_pwr) / nsamples;
1332} 1329}
1333 1330
1334static bool wlc_lcnphy_rx_iq_cal_gain(struct brcms_phy *pi, u16 biq1_gain,
1335 u16 tia_gain, u16 lna2_gain)
1336{
1337 u32 i_thresh_l, q_thresh_l;
1338 u32 i_thresh_h, q_thresh_h;
1339 struct lcnphy_iq_est iq_est_h, iq_est_l;
1340
1341 wlc_lcnphy_set_rx_gain_by_distribution(pi, 0, 0, 0, biq1_gain, tia_gain,
1342 lna2_gain, 0);
1343
1344 wlc_lcnphy_rx_gain_override_enable(pi, true);
1345 wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0);
1346 udelay(500);
1347 write_radio_reg(pi, RADIO_2064_REG112, 0);
1348 if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l))
1349 return false;
1350
1351 wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0);
1352 udelay(500);
1353 write_radio_reg(pi, RADIO_2064_REG112, 0);
1354 if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h))
1355 return false;
1356
1357 i_thresh_l = (iq_est_l.i_pwr << 1);
1358 i_thresh_h = (iq_est_l.i_pwr << 2) + iq_est_l.i_pwr;
1359
1360 q_thresh_l = (iq_est_l.q_pwr << 1);
1361 q_thresh_h = (iq_est_l.q_pwr << 2) + iq_est_l.q_pwr;
1362 if ((iq_est_h.i_pwr > i_thresh_l) &&
1363 (iq_est_h.i_pwr < i_thresh_h) &&
1364 (iq_est_h.q_pwr > q_thresh_l) &&
1365 (iq_est_h.q_pwr < q_thresh_h))
1366 return true;
1367
1368 return false;
1369}
1370
1371static bool 1331static bool
1372wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, 1332wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
1373 const struct lcnphy_rx_iqcomp *iqcomp, 1333 const struct lcnphy_rx_iqcomp *iqcomp,
@@ -1382,8 +1342,8 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
1382 RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, 1342 RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old,
1383 rfoverride3_old, rfoverride3val_old, rfoverride4_old, 1343 rfoverride3_old, rfoverride3val_old, rfoverride4_old,
1384 rfoverride4val_old, afectrlovr_old, afectrlovrval_old; 1344 rfoverride4val_old, afectrlovr_old, afectrlovrval_old;
1385 int tia_gain, lna2_gain, biq1_gain; 1345 int tia_gain;
1386 bool set_gain; 1346 u32 received_power, rx_pwr_threshold;
1387 u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; 1347 u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl;
1388 u16 values_to_save[11]; 1348 u16 values_to_save[11];
1389 s16 *ptr; 1349 s16 *ptr;
@@ -1408,134 +1368,126 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
1408 goto cal_done; 1368 goto cal_done;
1409 } 1369 }
1410 1370
1411 WARN_ON(module != 1); 1371 if (module == 1) {
1412 tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi);
1413 wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF);
1414
1415 for (i = 0; i < 11; i++)
1416 values_to_save[i] =
1417 read_radio_reg(pi, rxiq_cal_rf_reg[i]);
1418 Core1TxControl_old = read_phy_reg(pi, 0x631);
1419
1420 or_phy_reg(pi, 0x631, 0x0015);
1421
1422 RFOverride0_old = read_phy_reg(pi, 0x44c);
1423 RFOverrideVal0_old = read_phy_reg(pi, 0x44d);
1424 rfoverride2_old = read_phy_reg(pi, 0x4b0);
1425 rfoverride2val_old = read_phy_reg(pi, 0x4b1);
1426 rfoverride3_old = read_phy_reg(pi, 0x4f9);
1427 rfoverride3val_old = read_phy_reg(pi, 0x4fa);
1428 rfoverride4_old = read_phy_reg(pi, 0x938);
1429 rfoverride4val_old = read_phy_reg(pi, 0x939);
1430 afectrlovr_old = read_phy_reg(pi, 0x43b);
1431 afectrlovrval_old = read_phy_reg(pi, 0x43c);
1432 old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da);
1433 old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db);
1434
1435 tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi);
1436 if (tx_gain_override_old) {
1437 wlc_lcnphy_get_tx_gain(pi, &old_gains);
1438 tx_gain_index_old = pi_lcn->lcnphy_current_index;
1439 }
1440
1441 wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx);
1442 1372
1443 mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); 1373 tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi);
1444 mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); 1374 wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF);
1445 1375
1446 mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); 1376 for (i = 0; i < 11; i++)
1447 mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); 1377 values_to_save[i] =
1378 read_radio_reg(pi, rxiq_cal_rf_reg[i]);
1379 Core1TxControl_old = read_phy_reg(pi, 0x631);
1380
1381 or_phy_reg(pi, 0x631, 0x0015);
1382
1383 RFOverride0_old = read_phy_reg(pi, 0x44c);
1384 RFOverrideVal0_old = read_phy_reg(pi, 0x44d);
1385 rfoverride2_old = read_phy_reg(pi, 0x4b0);
1386 rfoverride2val_old = read_phy_reg(pi, 0x4b1);
1387 rfoverride3_old = read_phy_reg(pi, 0x4f9);
1388 rfoverride3val_old = read_phy_reg(pi, 0x4fa);
1389 rfoverride4_old = read_phy_reg(pi, 0x938);
1390 rfoverride4val_old = read_phy_reg(pi, 0x939);
1391 afectrlovr_old = read_phy_reg(pi, 0x43b);
1392 afectrlovrval_old = read_phy_reg(pi, 0x43c);
1393 old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da);
1394 old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db);
1395
1396 tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi);
1397 if (tx_gain_override_old) {
1398 wlc_lcnphy_get_tx_gain(pi, &old_gains);
1399 tx_gain_index_old = pi_lcn->lcnphy_current_index;
1400 }
1448 1401
1449 write_radio_reg(pi, RADIO_2064_REG116, 0x06); 1402 wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx);
1450 write_radio_reg(pi, RADIO_2064_REG12C, 0x07);
1451 write_radio_reg(pi, RADIO_2064_REG06A, 0xd3);
1452 write_radio_reg(pi, RADIO_2064_REG098, 0x03);
1453 write_radio_reg(pi, RADIO_2064_REG00B, 0x7);
1454 mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4);
1455 write_radio_reg(pi, RADIO_2064_REG01D, 0x01);
1456 write_radio_reg(pi, RADIO_2064_REG114, 0x01);
1457 write_radio_reg(pi, RADIO_2064_REG02E, 0x10);
1458 write_radio_reg(pi, RADIO_2064_REG12A, 0x08);
1459
1460 mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0);
1461 mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0);
1462 mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1);
1463 mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1);
1464 mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2);
1465 mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2);
1466 mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3);
1467 mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3);
1468 mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5);
1469 mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5);
1470 1403
1471 mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); 1404 mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0);
1472 mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); 1405 mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0);
1473 1406
1474 write_phy_reg(pi, 0x6da, 0xffff); 1407 mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1);
1475 or_phy_reg(pi, 0x6db, 0x3); 1408 mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1);
1476 1409
1477 wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); 1410 write_radio_reg(pi, RADIO_2064_REG116, 0x06);
1478 set_gain = false; 1411 write_radio_reg(pi, RADIO_2064_REG12C, 0x07);
1479 1412 write_radio_reg(pi, RADIO_2064_REG06A, 0xd3);
1480 lna2_gain = 3; 1413 write_radio_reg(pi, RADIO_2064_REG098, 0x03);
1481 while ((lna2_gain >= 0) && !set_gain) { 1414 write_radio_reg(pi, RADIO_2064_REG00B, 0x7);
1482 tia_gain = 4; 1415 mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4);
1483 1416 write_radio_reg(pi, RADIO_2064_REG01D, 0x01);
1484 while ((tia_gain >= 0) && !set_gain) { 1417 write_radio_reg(pi, RADIO_2064_REG114, 0x01);
1485 biq1_gain = 6; 1418 write_radio_reg(pi, RADIO_2064_REG02E, 0x10);
1486 1419 write_radio_reg(pi, RADIO_2064_REG12A, 0x08);
1487 while ((biq1_gain >= 0) && !set_gain) { 1420
1488 set_gain = wlc_lcnphy_rx_iq_cal_gain(pi, 1421 mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0);
1489 (u16) 1422 mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0);
1490 biq1_gain, 1423 mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1);
1491 (u16) 1424 mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1);
1492 tia_gain, 1425 mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2);
1493 (u16) 1426 mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2);
1494 lna2_gain); 1427 mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3);
1495 biq1_gain -= 1; 1428 mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3);
1496 } 1429 mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5);
1430 mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5);
1431
1432 mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0);
1433 mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0);
1434
1435 wlc_lcnphy_start_tx_tone(pi, 2000, 120, 0);
1436 write_phy_reg(pi, 0x6da, 0xffff);
1437 or_phy_reg(pi, 0x6db, 0x3);
1438 wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch);
1439 wlc_lcnphy_rx_gain_override_enable(pi, true);
1440
1441 tia_gain = 8;
1442 rx_pwr_threshold = 950;
1443 while (tia_gain > 0) {
1497 tia_gain -= 1; 1444 tia_gain -= 1;
1445 wlc_lcnphy_set_rx_gain_by_distribution(pi,
1446 0, 0, 2, 2,
1447 (u16)
1448 tia_gain, 1, 0);
1449 udelay(500);
1450
1451 received_power =
1452 wlc_lcnphy_measure_digital_power(pi, 2000);
1453 if (received_power < rx_pwr_threshold)
1454 break;
1498 } 1455 }
1499 lna2_gain -= 1; 1456 result = wlc_lcnphy_calc_rx_iq_comp(pi, 0xffff);
1500 }
1501 1457
1502 if (set_gain) 1458 wlc_lcnphy_stop_tx_tone(pi);
1503 result = wlc_lcnphy_calc_rx_iq_comp(pi, 1024);
1504 else
1505 result = false;
1506 1459
1507 wlc_lcnphy_stop_tx_tone(pi); 1460 write_phy_reg(pi, 0x631, Core1TxControl_old);
1508 1461
1509 write_phy_reg(pi, 0x631, Core1TxControl_old); 1462 write_phy_reg(pi, 0x44c, RFOverrideVal0_old);
1510 1463 write_phy_reg(pi, 0x44d, RFOverrideVal0_old);
1511 write_phy_reg(pi, 0x44c, RFOverrideVal0_old); 1464 write_phy_reg(pi, 0x4b0, rfoverride2_old);
1512 write_phy_reg(pi, 0x44d, RFOverrideVal0_old); 1465 write_phy_reg(pi, 0x4b1, rfoverride2val_old);
1513 write_phy_reg(pi, 0x4b0, rfoverride2_old); 1466 write_phy_reg(pi, 0x4f9, rfoverride3_old);
1514 write_phy_reg(pi, 0x4b1, rfoverride2val_old); 1467 write_phy_reg(pi, 0x4fa, rfoverride3val_old);
1515 write_phy_reg(pi, 0x4f9, rfoverride3_old); 1468 write_phy_reg(pi, 0x938, rfoverride4_old);
1516 write_phy_reg(pi, 0x4fa, rfoverride3val_old); 1469 write_phy_reg(pi, 0x939, rfoverride4val_old);
1517 write_phy_reg(pi, 0x938, rfoverride4_old); 1470 write_phy_reg(pi, 0x43b, afectrlovr_old);
1518 write_phy_reg(pi, 0x939, rfoverride4val_old); 1471 write_phy_reg(pi, 0x43c, afectrlovrval_old);
1519 write_phy_reg(pi, 0x43b, afectrlovr_old); 1472 write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl);
1520 write_phy_reg(pi, 0x43c, afectrlovrval_old); 1473 write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl);
1521 write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl);
1522 write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl);
1523 1474
1524 wlc_lcnphy_clear_trsw_override(pi); 1475 wlc_lcnphy_clear_trsw_override(pi);
1525 1476
1526 mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); 1477 mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2);
1527 1478
1528 for (i = 0; i < 11; i++) 1479 for (i = 0; i < 11; i++)
1529 write_radio_reg(pi, rxiq_cal_rf_reg[i], 1480 write_radio_reg(pi, rxiq_cal_rf_reg[i],
1530 values_to_save[i]); 1481 values_to_save[i]);
1531 1482
1532 if (tx_gain_override_old) 1483 if (tx_gain_override_old)
1533 wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); 1484 wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old);
1534 else 1485 else
1535 wlc_lcnphy_disable_tx_gain_override(pi); 1486 wlc_lcnphy_disable_tx_gain_override(pi);
1536 1487
1537 wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); 1488 wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl);
1538 wlc_lcnphy_rx_gain_override_enable(pi, false); 1489 wlc_lcnphy_rx_gain_override_enable(pi, false);
1490 }
1539 1491
1540cal_done: 1492cal_done:
1541 kfree(ptr); 1493 kfree(ptr);
@@ -1829,17 +1781,6 @@ wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel)
1829 write_radio_reg(pi, RADIO_2064_REG038, 3); 1781 write_radio_reg(pi, RADIO_2064_REG038, 3);
1830 write_radio_reg(pi, RADIO_2064_REG091, 7); 1782 write_radio_reg(pi, RADIO_2064_REG091, 7);
1831 } 1783 }
1832
1833 if (!(pi->sh->boardflags & BFL_FEM)) {
1834 u8 reg038[14] = {0xd, 0xe, 0xd, 0xd, 0xd, 0xc,
1835 0xa, 0xb, 0xb, 0x3, 0x3, 0x2, 0x0, 0x0};
1836
1837 write_radio_reg(pi, RADIO_2064_REG02A, 0xf);
1838 write_radio_reg(pi, RADIO_2064_REG091, 0x3);
1839 write_radio_reg(pi, RADIO_2064_REG038, 0x3);
1840
1841 write_radio_reg(pi, RADIO_2064_REG038, reg038[channel - 1]);
1842 }
1843} 1784}
1844 1785
1845static int 1786static int
@@ -2034,16 +1975,6 @@ wlc_lcnphy_set_tssi_mux(struct brcms_phy *pi, enum lcnphy_tssi_mode pos)
2034 } else { 1975 } else {
2035 mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); 1976 mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1);
2036 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); 1977 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8);
2037 mod_radio_reg(pi, RADIO_2064_REG028, 0x1, 0x0);
2038 mod_radio_reg(pi, RADIO_2064_REG11A, 0x4, 1<<2);
2039 mod_radio_reg(pi, RADIO_2064_REG036, 0x10, 0x0);
2040 mod_radio_reg(pi, RADIO_2064_REG11A, 0x10, 1<<4);
2041 mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0);
2042 mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x77);
2043 mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, 0xe<<1);
2044 mod_radio_reg(pi, RADIO_2064_REG112, 0x80, 1<<7);
2045 mod_radio_reg(pi, RADIO_2064_REG005, 0x7, 1<<1);
2046 mod_radio_reg(pi, RADIO_2064_REG029, 0xf0, 0<<4);
2047 } 1978 }
2048 } else { 1979 } else {
2049 mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); 1980 mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2);
@@ -2130,14 +2061,12 @@ static void wlc_lcnphy_pwrctrl_rssiparams(struct brcms_phy *pi)
2130 (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); 2061 (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12));
2131 2062
2132 mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); 2063 mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5));
2133 mod_radio_reg(pi, RADIO_2064_REG07C, (1 << 0), (1 << 0));
2134} 2064}
2135 2065
2136static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) 2066static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
2137{ 2067{
2138 struct phytbl_info tab; 2068 struct phytbl_info tab;
2139 u32 rfseq, ind; 2069 u32 rfseq, ind;
2140 u8 tssi_sel;
2141 2070
2142 tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; 2071 tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL;
2143 tab.tbl_width = 32; 2072 tab.tbl_width = 32;
@@ -2159,13 +2088,7 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
2159 2088
2160 mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); 2089 mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4);
2161 2090
2162 if (pi->sh->boardflags & BFL_FEM) { 2091 wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT);
2163 tssi_sel = 0x1;
2164 wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT);
2165 } else {
2166 tssi_sel = 0xe;
2167 wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_POST_PA);
2168 }
2169 mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); 2092 mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14);
2170 2093
2171 mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); 2094 mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15);
@@ -2201,10 +2124,9 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
2201 mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); 2124 mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0);
2202 2125
2203 if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { 2126 if (LCNREV_IS(pi->pubpi.phy_rev, 2)) {
2204 mod_radio_reg(pi, RADIO_2064_REG028, 0xf, tssi_sel); 2127 mod_radio_reg(pi, RADIO_2064_REG028, 0xf, 0xe);
2205 mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); 2128 mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4);
2206 } else { 2129 } else {
2207 mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, tssi_sel << 1);
2208 mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); 2130 mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1);
2209 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); 2131 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3);
2210 } 2132 }
@@ -2251,10 +2173,6 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
2251 2173
2252 mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); 2174 mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8);
2253 2175
2254 mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x0);
2255 mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0);
2256 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8);
2257
2258 wlc_lcnphy_pwrctrl_rssiparams(pi); 2176 wlc_lcnphy_pwrctrl_rssiparams(pi);
2259} 2177}
2260 2178
@@ -2873,8 +2791,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
2873 read_radio_reg(pi, RADIO_2064_REG007) & 1; 2791 read_radio_reg(pi, RADIO_2064_REG007) & 1;
2874 u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; 2792 u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10;
2875 u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; 2793 u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4;
2876 u8 SAVE_bbmult = wlc_lcnphy_get_bbmult(pi);
2877
2878 idleTssi = read_phy_reg(pi, 0x4ab); 2794 idleTssi = read_phy_reg(pi, 0x4ab);
2879 suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & 2795 suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) &
2880 MCTL_EN_MAC)); 2796 MCTL_EN_MAC));
@@ -2892,12 +2808,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
2892 mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); 2808 mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4);
2893 mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); 2809 mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2);
2894 wlc_lcnphy_tssi_setup(pi); 2810 wlc_lcnphy_tssi_setup(pi);
2895
2896 mod_phy_reg(pi, 0x4d7, (0x1 << 0), (1 << 0));
2897 mod_phy_reg(pi, 0x4d7, (0x1 << 6), (1 << 6));
2898
2899 wlc_lcnphy_set_bbmult(pi, 0x0);
2900
2901 wlc_phy_do_dummy_tx(pi, true, OFF); 2811 wlc_phy_do_dummy_tx(pi, true, OFF);
2902 idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) 2812 idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0))
2903 >> 0); 2813 >> 0);
@@ -2919,7 +2829,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
2919 2829
2920 mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); 2830 mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12);
2921 2831
2922 wlc_lcnphy_set_bbmult(pi, SAVE_bbmult);
2923 wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); 2832 wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old);
2924 wlc_lcnphy_set_tx_gain(pi, &old_gains); 2833 wlc_lcnphy_set_tx_gain(pi, &old_gains);
2925 wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); 2834 wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl);
@@ -3133,11 +3042,6 @@ static void wlc_lcnphy_tx_pwr_ctrl_init(struct brcms_phy_pub *ppi)
3133 wlc_lcnphy_write_table(pi, &tab); 3042 wlc_lcnphy_write_table(pi, &tab);
3134 tab.tbl_offset++; 3043 tab.tbl_offset++;
3135 } 3044 }
3136 mod_phy_reg(pi, 0x4d0, (0x1 << 0), (0) << 0);
3137 mod_phy_reg(pi, 0x4d3, (0xff << 0), (0) << 0);
3138 mod_phy_reg(pi, 0x4d3, (0xff << 8), (0) << 8);
3139 mod_phy_reg(pi, 0x4d0, (0x1 << 4), (0) << 4);
3140 mod_phy_reg(pi, 0x4d0, (0x1 << 2), (0) << 2);
3141 3045
3142 mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); 3046 mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7);
3143 3047
@@ -3939,6 +3843,7 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi)
3939 target_gains.pad_gain = 21; 3843 target_gains.pad_gain = 21;
3940 target_gains.dac_gain = 0; 3844 target_gains.dac_gain = 0;
3941 wlc_lcnphy_set_tx_gain(pi, &target_gains); 3845 wlc_lcnphy_set_tx_gain(pi, &target_gains);
3846 wlc_lcnphy_set_tx_pwr_by_index(pi, 16);
3942 3847
3943 if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { 3848 if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) {
3944 3849
@@ -3949,7 +3854,6 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi)
3949 lcnphy_recal ? LCNPHY_CAL_RECAL : 3854 lcnphy_recal ? LCNPHY_CAL_RECAL :
3950 LCNPHY_CAL_FULL), false); 3855 LCNPHY_CAL_FULL), false);
3951 } else { 3856 } else {
3952 wlc_lcnphy_set_tx_pwr_by_index(pi, 16);
3953 wlc_lcnphy_tx_iqlo_soft_cal_full(pi); 3857 wlc_lcnphy_tx_iqlo_soft_cal_full(pi);
3954 } 3858 }
3955 3859
@@ -4374,22 +4278,17 @@ wlc_lcnphy_load_tx_gain_table(struct brcms_phy *pi,
4374 if (CHSPEC_IS5G(pi->radio_chanspec)) 4278 if (CHSPEC_IS5G(pi->radio_chanspec))
4375 pa_gain = 0x70; 4279 pa_gain = 0x70;
4376 else 4280 else
4377 pa_gain = 0x60; 4281 pa_gain = 0x70;
4378 4282
4379 if (pi->sh->boardflags & BFL_FEM) 4283 if (pi->sh->boardflags & BFL_FEM)
4380 pa_gain = 0x10; 4284 pa_gain = 0x10;
4381
4382 tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; 4285 tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL;
4383 tab.tbl_width = 32; 4286 tab.tbl_width = 32;
4384 tab.tbl_len = 1; 4287 tab.tbl_len = 1;
4385 tab.tbl_ptr = &val; 4288 tab.tbl_ptr = &val;
4386 4289
4387 for (j = 0; j < 128; j++) { 4290 for (j = 0; j < 128; j++) {
4388 if (pi->sh->boardflags & BFL_FEM) 4291 gm_gain = gain_table[j].gm;
4389 gm_gain = gain_table[j].gm;
4390 else
4391 gm_gain = 15;
4392
4393 val = (((u32) pa_gain << 24) | 4292 val = (((u32) pa_gain << 24) |
4394 (gain_table[j].pad << 16) | 4293 (gain_table[j].pad << 16) |
4395 (gain_table[j].pga << 8) | gm_gain); 4294 (gain_table[j].pga << 8) | gm_gain);
@@ -4600,10 +4499,7 @@ static void wlc_radio_2064_init(struct brcms_phy *pi)
4600 4499
4601 write_phy_reg(pi, 0x4ea, 0x4688); 4500 write_phy_reg(pi, 0x4ea, 0x4688);
4602 4501
4603 if (pi->sh->boardflags & BFL_FEM) 4502 mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0);
4604 mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0);
4605 else
4606 mod_phy_reg(pi, 0x4eb, (0x7 << 0), 3 << 0);
4607 4503
4608 mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); 4504 mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6);
4609 4505
@@ -4614,13 +4510,6 @@ static void wlc_radio_2064_init(struct brcms_phy *pi)
4614 wlc_lcnphy_rcal(pi); 4510 wlc_lcnphy_rcal(pi);
4615 4511
4616 wlc_lcnphy_rc_cal(pi); 4512 wlc_lcnphy_rc_cal(pi);
4617
4618 if (!(pi->sh->boardflags & BFL_FEM)) {
4619 write_radio_reg(pi, RADIO_2064_REG032, 0x6f);
4620 write_radio_reg(pi, RADIO_2064_REG033, 0x19);
4621 write_radio_reg(pi, RADIO_2064_REG039, 0xe);
4622 }
4623
4624} 4513}
4625 4514
4626static void wlc_lcnphy_radio_init(struct brcms_phy *pi) 4515static void wlc_lcnphy_radio_init(struct brcms_phy *pi)
@@ -4650,20 +4539,22 @@ static void wlc_lcnphy_tbl_init(struct brcms_phy *pi)
4650 wlc_lcnphy_write_table(pi, &tab); 4539 wlc_lcnphy_write_table(pi, &tab);
4651 } 4540 }
4652 4541
4653 if (!(pi->sh->boardflags & BFL_FEM)) { 4542 tab.tbl_id = LCNPHY_TBL_ID_RFSEQ;
4654 tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; 4543 tab.tbl_width = 16;
4655 tab.tbl_width = 16; 4544 tab.tbl_ptr = &val;
4656 tab.tbl_ptr = &val; 4545 tab.tbl_len = 1;
4657 tab.tbl_len = 1;
4658 4546
4659 val = 150; 4547 val = 114;
4660 tab.tbl_offset = 0; 4548 tab.tbl_offset = 0;
4661 wlc_lcnphy_write_table(pi, &tab); 4549 wlc_lcnphy_write_table(pi, &tab);
4662 4550
4663 val = 220; 4551 val = 130;
4664 tab.tbl_offset = 1; 4552 tab.tbl_offset = 1;
4665 wlc_lcnphy_write_table(pi, &tab); 4553 wlc_lcnphy_write_table(pi, &tab);
4666 } 4554
4555 val = 6;
4556 tab.tbl_offset = 8;
4557 wlc_lcnphy_write_table(pi, &tab);
4667 4558
4668 if (CHSPEC_IS2G(pi->radio_chanspec)) { 4559 if (CHSPEC_IS2G(pi->radio_chanspec)) {
4669 if (pi->sh->boardflags & BFL_FEM) 4560 if (pi->sh->boardflags & BFL_FEM)
@@ -5055,7 +4946,6 @@ void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec)
5055 wlc_lcnphy_load_tx_iir_filter(pi, true, 3); 4946 wlc_lcnphy_load_tx_iir_filter(pi, true, 3);
5056 4947
5057 mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); 4948 mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3);
5058 wlc_lcnphy_tssi_setup(pi);
5059} 4949}
5060 4950
5061void wlc_phy_detach_lcnphy(struct brcms_phy *pi) 4951void wlc_phy_detach_lcnphy(struct brcms_phy *pi)
@@ -5094,7 +4984,8 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi)
5094 if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) 4984 if (!wlc_phy_txpwr_srom_read_lcnphy(pi))
5095 return false; 4985 return false;
5096 4986
5097 if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { 4987 if ((pi->sh->boardflags & BFL_FEM) &&
4988 (LCNREV_IS(pi->pubpi.phy_rev, 1))) {
5098 if (pi_lcn->lcnphy_tempsense_option == 3) { 4989 if (pi_lcn->lcnphy_tempsense_option == 3) {
5099 pi->hwpwrctrl = true; 4990 pi->hwpwrctrl = true;
5100 pi->hwpwrctrl_capable = true; 4991 pi->hwpwrctrl_capable = true;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
index b7e95acc2084..622c01ca72c5 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
@@ -1992,70 +1992,70 @@ static const u16 dot11lcn_sw_ctrl_tbl_4313_epa_rev0[] = {
1992}; 1992};
1993 1993
1994static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = { 1994static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = {
1995 0x0009,
1996 0x000a, 1995 0x000a,
1997 0x0005,
1998 0x0006,
1999 0x0009, 1996 0x0009,
2000 0x000a,
2001 0x0005,
2002 0x0006, 1997 0x0006,
2003 0x0009,
2004 0x000a,
2005 0x0005, 1998 0x0005,
2006 0x0006,
2007 0x0009,
2008 0x000a, 1999 0x000a,
2009 0x0005,
2010 0x0006,
2011 0x0009, 2000 0x0009,
2012 0x000a,
2013 0x0005,
2014 0x0006, 2001 0x0006,
2015 0x0009,
2016 0x000a,
2017 0x0005, 2002 0x0005,
2018 0x0006,
2019 0x0009,
2020 0x000a, 2003 0x000a,
2021 0x0005,
2022 0x0006,
2023 0x0009, 2004 0x0009,
2024 0x000a,
2025 0x0005,
2026 0x0006, 2005 0x0006,
2027 0x0009,
2028 0x000a,
2029 0x0005, 2006 0x0005,
2030 0x0006,
2031 0x0009,
2032 0x000a, 2007 0x000a,
2033 0x0005,
2034 0x0006,
2035 0x0009, 2008 0x0009,
2036 0x000a,
2037 0x0005,
2038 0x0006, 2009 0x0006,
2039 0x0009,
2040 0x000a,
2041 0x0005, 2010 0x0005,
2042 0x0006, 2011 0x000a,
2043 0x0009, 2012 0x0009,
2013 0x0006,
2014 0x0005,
2044 0x000a, 2015 0x000a,
2016 0x0009,
2017 0x0006,
2045 0x0005, 2018 0x0005,
2019 0x000a,
2020 0x0009,
2046 0x0006, 2021 0x0006,
2022 0x0005,
2023 0x000a,
2047 0x0009, 2024 0x0009,
2025 0x0006,
2026 0x0005,
2048 0x000a, 2027 0x000a,
2028 0x0009,
2029 0x0006,
2049 0x0005, 2030 0x0005,
2031 0x000a,
2032 0x0009,
2050 0x0006, 2033 0x0006,
2034 0x0005,
2035 0x000a,
2051 0x0009, 2036 0x0009,
2037 0x0006,
2038 0x0005,
2052 0x000a, 2039 0x000a,
2040 0x0009,
2041 0x0006,
2053 0x0005, 2042 0x0005,
2043 0x000a,
2044 0x0009,
2054 0x0006, 2045 0x0006,
2046 0x0005,
2047 0x000a,
2055 0x0009, 2048 0x0009,
2049 0x0006,
2050 0x0005,
2056 0x000a, 2051 0x000a,
2052 0x0009,
2053 0x0006,
2057 0x0005, 2054 0x0005,
2055 0x000a,
2056 0x0009,
2058 0x0006, 2057 0x0006,
2058 0x0005,
2059}; 2059};
2060 2060
2061static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = { 2061static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = {
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c
index e8324b5e5bfe..6c7493c2d698 100644
--- a/drivers/net/wireless/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/4965-rs.c
@@ -2152,7 +2152,7 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf,
2152 int rate_idx; 2152 int rate_idx;
2153 int i; 2153 int i;
2154 u32 rate; 2154 u32 rate;
2155 u8 use_green = il4965_rs_use_green(il, sta); 2155 u8 use_green;
2156 u8 active_tbl = 0; 2156 u8 active_tbl = 0;
2157 u8 valid_tx_ant; 2157 u8 valid_tx_ant;
2158 struct il_station_priv *sta_priv; 2158 struct il_station_priv *sta_priv;
@@ -2160,6 +2160,7 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf,
2160 if (!sta || !lq_sta) 2160 if (!sta || !lq_sta)
2161 return; 2161 return;
2162 2162
2163 use_green = il4965_rs_use_green(il, sta);
2163 sta_priv = (void *)sta->drv_priv; 2164 sta_priv = (void *)sta->drv_priv;
2164 2165
2165 i = lq_sta->last_txrate_idx; 2166 i = lq_sta->last_txrate_idx;
diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c
index cddf77c36b36..87c006c9c573 100644
--- a/drivers/net/wireless/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/iwlwifi/dvm/lib.c
@@ -1262,6 +1262,15 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
1262 } 1262 }
1263 1263
1264 /* 1264 /*
1265 * This can happen upon FW ASSERT: we clear the STATUS_FW_ERROR flag
1266 * in iwl_down but cancel the workers only later.
1267 */
1268 if (!priv->ucode_loaded) {
1269 IWL_ERR(priv, "Fw not loaded - dropping CMD: %x\n", cmd->id);
1270 return -EIO;
1271 }
1272
1273 /*
1265 * Synchronous commands from this op-mode must hold 1274 * Synchronous commands from this op-mode must hold
1266 * the mutex, this ensures we don't try to send two 1275 * the mutex, this ensures we don't try to send two
1267 * (or more) synchronous commands at a time. 1276 * (or more) synchronous commands at a time.
diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c
index 166019afc2d0..0a1cdc5e856b 100644
--- a/drivers/net/wireless/iwlwifi/dvm/ucode.c
+++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c
@@ -367,6 +367,8 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
367 return -EIO; 367 return -EIO;
368 } 368 }
369 369
370 priv->ucode_loaded = true;
371
370 if (ucode_type != IWL_UCODE_WOWLAN) { 372 if (ucode_type != IWL_UCODE_WOWLAN) {
371 /* delay a bit to give rfkill time to run */ 373 /* delay a bit to give rfkill time to run */
372 msleep(5); 374 msleep(5);
@@ -380,8 +382,6 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
380 return ret; 382 return ret;
381 } 383 }
382 384
383 priv->ucode_loaded = true;
384
385 return 0; 385 return 0;
386} 386}
387 387
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 6649e377e9cd..50ba0a468f94 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -475,6 +475,10 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans,
475 475
476 /* If platform's RF_KILL switch is NOT set to KILL */ 476 /* If platform's RF_KILL switch is NOT set to KILL */
477 hw_rfkill = iwl_is_rfkill_set(trans); 477 hw_rfkill = iwl_is_rfkill_set(trans);
478 if (hw_rfkill)
479 set_bit(STATUS_RFKILL, &trans_pcie->status);
480 else
481 clear_bit(STATUS_RFKILL, &trans_pcie->status);
478 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); 482 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
479 if (hw_rfkill && !run_in_rfkill) 483 if (hw_rfkill && !run_in_rfkill)
480 return -ERFKILL; 484 return -ERFKILL;
@@ -641,6 +645,7 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
641 645
642static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) 646static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)
643{ 647{
648 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
644 bool hw_rfkill; 649 bool hw_rfkill;
645 int err; 650 int err;
646 651
@@ -656,6 +661,10 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)
656 iwl_enable_rfkill_int(trans); 661 iwl_enable_rfkill_int(trans);
657 662
658 hw_rfkill = iwl_is_rfkill_set(trans); 663 hw_rfkill = iwl_is_rfkill_set(trans);
664 if (hw_rfkill)
665 set_bit(STATUS_RFKILL, &trans_pcie->status);
666 else
667 clear_bit(STATUS_RFKILL, &trans_pcie->status);
659 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); 668 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
660 669
661 return 0; 670 return 0;
@@ -694,6 +703,10 @@ static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans,
694 * op_mode. 703 * op_mode.
695 */ 704 */
696 hw_rfkill = iwl_is_rfkill_set(trans); 705 hw_rfkill = iwl_is_rfkill_set(trans);
706 if (hw_rfkill)
707 set_bit(STATUS_RFKILL, &trans_pcie->status);
708 else
709 clear_bit(STATUS_RFKILL, &trans_pcie->status);
697 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); 710 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
698 } 711 }
699} 712}
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 005e2cfb2f41..282a5cafa913 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -1262,7 +1262,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
1262 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { 1262 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
1263 int copy = 0; 1263 int copy = 0;
1264 1264
1265 if (!cmd->len) 1265 if (!cmd->len[i])
1266 continue; 1266 continue;
1267 1267
1268 /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ 1268 /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index 6283294398bf..8cd8cdc91a7e 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -1508,6 +1508,7 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)
1508 } 1508 }
1509 memcpy(adapter->upld_buf, skb->data, 1509 memcpy(adapter->upld_buf, skb->data,
1510 min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); 1510 min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len));
1511 skb_push(skb, INTF_HEADER_LEN);
1511 if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, 1512 if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE,
1512 PCI_DMA_FROMDEVICE)) 1513 PCI_DMA_FROMDEVICE))
1513 return -1; 1514 return -1;