aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/au1000_eth.c441
-rw-r--r--drivers/net/au1000_eth.h9
-rw-r--r--drivers/net/benet/be_cmds.c1
-rw-r--r--drivers/net/cpmac.c10
-rw-r--r--drivers/net/e1000/e1000_main.c19
-rw-r--r--drivers/net/irda/au1k_ir.c14
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c22
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c4
-rw-r--r--drivers/net/mace.c2
-rw-r--r--drivers/net/macmace.c33
-rw-r--r--drivers/net/macsonic.c33
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c6
-rw-r--r--drivers/net/sfc/efx.c1
-rw-r--r--drivers/net/sfc/falcon_boards.c45
-rw-r--r--drivers/net/sfc/mcdi.c2
-rw-r--r--drivers/net/sfc/qt202x_phy.c2
-rw-r--r--drivers/net/tc35815.c1
-rw-r--r--drivers/net/usb/cdc_ether.c5
-rw-r--r--drivers/net/via-velocity.c41
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c4
-rw-r--r--drivers/net/wireless/b43/b43.h1
-rw-r--r--drivers/net/wireless/b43/main.c13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c22
-rw-r--r--drivers/net/wireless/iwmc3200wifi/rx.c2
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_dev.c1
30 files changed, 403 insertions, 349 deletions
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 6bac04603a88..6e5a68ecde09 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -55,6 +55,7 @@
55#include <linux/delay.h> 55#include <linux/delay.h>
56#include <linux/crc32.h> 56#include <linux/crc32.h>
57#include <linux/phy.h> 57#include <linux/phy.h>
58#include <linux/platform_device.h>
58 59
59#include <asm/cpu.h> 60#include <asm/cpu.h>
60#include <asm/mipsregs.h> 61#include <asm/mipsregs.h>
@@ -63,6 +64,7 @@
63#include <asm/processor.h> 64#include <asm/processor.h>
64 65
65#include <au1000.h> 66#include <au1000.h>
67#include <au1xxx_eth.h>
66#include <prom.h> 68#include <prom.h>
67 69
68#include "au1000_eth.h" 70#include "au1000_eth.h"
@@ -112,15 +114,15 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES];
112 * 114 *
113 * PHY detection algorithm 115 * PHY detection algorithm
114 * 116 *
115 * If AU1XXX_PHY_STATIC_CONFIG is undefined, the PHY setup is 117 * If phy_static_config is undefined, the PHY setup is
116 * autodetected: 118 * autodetected:
117 * 119 *
118 * mii_probe() first searches the current MAC's MII bus for a PHY, 120 * mii_probe() first searches the current MAC's MII bus for a PHY,
119 * selecting the first (or last, if AU1XXX_PHY_SEARCH_HIGHEST_ADDR is 121 * selecting the first (or last, if phy_search_highest_addr is
120 * defined) PHY address not already claimed by another netdev. 122 * defined) PHY address not already claimed by another netdev.
121 * 123 *
122 * If nothing was found that way when searching for the 2nd ethernet 124 * If nothing was found that way when searching for the 2nd ethernet
123 * controller's PHY and AU1XXX_PHY1_SEARCH_ON_MAC0 is defined, then 125 * controller's PHY and phy1_search_mac0 is defined, then
124 * the first MII bus is searched as well for an unclaimed PHY; this is 126 * the first MII bus is searched as well for an unclaimed PHY; this is
125 * needed in case of a dual-PHY accessible only through the MAC0's MII 127 * needed in case of a dual-PHY accessible only through the MAC0's MII
126 * bus. 128 * bus.
@@ -129,9 +131,7 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES];
129 * controller is not registered to the network subsystem. 131 * controller is not registered to the network subsystem.
130 */ 132 */
131 133
132/* autodetection defaults */ 134/* autodetection defaults: phy1_search_mac0 */
133#undef AU1XXX_PHY_SEARCH_HIGHEST_ADDR
134#define AU1XXX_PHY1_SEARCH_ON_MAC0
135 135
136/* static PHY setup 136/* static PHY setup
137 * 137 *
@@ -148,29 +148,6 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES];
148 * specific irq-map 148 * specific irq-map
149 */ 149 */
150 150
151#if defined(CONFIG_MIPS_BOSPORUS)
152/*
153 * Micrel/Kendin 5 port switch attached to MAC0,
154 * MAC0 is associated with PHY address 5 (== WAN port)
155 * MAC1 is not associated with any PHY, since it's connected directly
156 * to the switch.
157 * no interrupts are used
158 */
159# define AU1XXX_PHY_STATIC_CONFIG
160
161# define AU1XXX_PHY0_ADDR 5
162# define AU1XXX_PHY0_BUSID 0
163# undef AU1XXX_PHY0_IRQ
164
165# undef AU1XXX_PHY1_ADDR
166# undef AU1XXX_PHY1_BUSID
167# undef AU1XXX_PHY1_IRQ
168#endif
169
170#if defined(AU1XXX_PHY0_BUSID) && (AU1XXX_PHY0_BUSID > 0)
171# error MAC0-associated PHY attached 2nd MACs MII bus not supported yet
172#endif
173
174static void enable_mac(struct net_device *dev, int force_reset) 151static void enable_mac(struct net_device *dev, int force_reset)
175{ 152{
176 unsigned long flags; 153 unsigned long flags;
@@ -390,67 +367,55 @@ static int mii_probe (struct net_device *dev)
390 struct au1000_private *const aup = netdev_priv(dev); 367 struct au1000_private *const aup = netdev_priv(dev);
391 struct phy_device *phydev = NULL; 368 struct phy_device *phydev = NULL;
392 369
393#if defined(AU1XXX_PHY_STATIC_CONFIG) 370 if (aup->phy_static_config) {
394 BUG_ON(aup->mac_id < 0 || aup->mac_id > 1); 371 BUG_ON(aup->mac_id < 0 || aup->mac_id > 1);
395 372
396 if(aup->mac_id == 0) { /* get PHY0 */ 373 if (aup->phy_addr)
397# if defined(AU1XXX_PHY0_ADDR) 374 phydev = aup->mii_bus->phy_map[aup->phy_addr];
398 phydev = au_macs[AU1XXX_PHY0_BUSID]->mii_bus->phy_map[AU1XXX_PHY0_ADDR]; 375 else
399# else 376 printk (KERN_INFO DRV_NAME ":%s: using PHY-less setup\n",
400 printk (KERN_INFO DRV_NAME ":%s: using PHY-less setup\n", 377 dev->name);
401 dev->name);
402 return 0;
403# endif /* defined(AU1XXX_PHY0_ADDR) */
404 } else if (aup->mac_id == 1) { /* get PHY1 */
405# if defined(AU1XXX_PHY1_ADDR)
406 phydev = au_macs[AU1XXX_PHY1_BUSID]->mii_bus->phy_map[AU1XXX_PHY1_ADDR];
407# else
408 printk (KERN_INFO DRV_NAME ":%s: using PHY-less setup\n",
409 dev->name);
410 return 0; 378 return 0;
411# endif /* defined(AU1XXX_PHY1_ADDR) */ 379 } else {
412 } 380 int phy_addr;
413 381
414#else /* defined(AU1XXX_PHY_STATIC_CONFIG) */ 382 /* find the first (lowest address) PHY on the current MAC's MII bus */
415 int phy_addr; 383 for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++)
416 384 if (aup->mii_bus->phy_map[phy_addr]) {
417 /* find the first (lowest address) PHY on the current MAC's MII bus */ 385 phydev = aup->mii_bus->phy_map[phy_addr];
418 for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) 386 if (!aup->phy_search_highest_addr)
419 if (aup->mii_bus->phy_map[phy_addr]) { 387 break; /* break out with first one found */
420 phydev = aup->mii_bus->phy_map[phy_addr]; 388 }
421# if !defined(AU1XXX_PHY_SEARCH_HIGHEST_ADDR)
422 break; /* break out with first one found */
423# endif
424 }
425 389
426# if defined(AU1XXX_PHY1_SEARCH_ON_MAC0) 390 if (aup->phy1_search_mac0) {
427 /* try harder to find a PHY */ 391 /* try harder to find a PHY */
428 if (!phydev && (aup->mac_id == 1)) { 392 if (!phydev && (aup->mac_id == 1)) {
429 /* no PHY found, maybe we have a dual PHY? */ 393 /* no PHY found, maybe we have a dual PHY? */
430 printk (KERN_INFO DRV_NAME ": no PHY found on MAC1, " 394 printk (KERN_INFO DRV_NAME ": no PHY found on MAC1, "
431 "let's see if it's attached to MAC0...\n"); 395 "let's see if it's attached to MAC0...\n");
432 396
433 BUG_ON(!au_macs[0]); 397 /* find the first (lowest address) non-attached PHY on
398 * the MAC0 MII bus */
399 for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
400 struct phy_device *const tmp_phydev =
401 aup->mii_bus->phy_map[phy_addr];
434 402
435 /* find the first (lowest address) non-attached PHY on 403 if (aup->mac_id == 1)
436 * the MAC0 MII bus */ 404 break;
437 for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
438 struct phy_device *const tmp_phydev =
439 au_macs[0]->mii_bus->phy_map[phy_addr];
440 405
441 if (!tmp_phydev) 406 if (!tmp_phydev)
442 continue; /* no PHY here... */ 407 continue; /* no PHY here... */
443 408
444 if (tmp_phydev->attached_dev) 409 if (tmp_phydev->attached_dev)
445 continue; /* already claimed by MAC0 */ 410 continue; /* already claimed by MAC0 */
446 411
447 phydev = tmp_phydev; 412 phydev = tmp_phydev;
448 break; /* found it */ 413 break; /* found it */
414 }
415 }
449 } 416 }
450 } 417 }
451# endif /* defined(AU1XXX_PHY1_SEARCH_OTHER_BUS) */
452 418
453#endif /* defined(AU1XXX_PHY_STATIC_CONFIG) */
454 if (!phydev) { 419 if (!phydev) {
455 printk (KERN_ERR DRV_NAME ":%s: no PHY found\n", dev->name); 420 printk (KERN_ERR DRV_NAME ":%s: no PHY found\n", dev->name);
456 return -1; 421 return -1;
@@ -578,31 +543,6 @@ setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base)
578 } 543 }
579} 544}
580 545
581static struct {
582 u32 base_addr;
583 u32 macen_addr;
584 int irq;
585 struct net_device *dev;
586} iflist[2] = {
587#ifdef CONFIG_SOC_AU1000
588 {AU1000_ETH0_BASE, AU1000_MAC0_ENABLE, AU1000_MAC0_DMA_INT},
589 {AU1000_ETH1_BASE, AU1000_MAC1_ENABLE, AU1000_MAC1_DMA_INT}
590#endif
591#ifdef CONFIG_SOC_AU1100
592 {AU1100_ETH0_BASE, AU1100_MAC0_ENABLE, AU1100_MAC0_DMA_INT}
593#endif
594#ifdef CONFIG_SOC_AU1500
595 {AU1500_ETH0_BASE, AU1500_MAC0_ENABLE, AU1500_MAC0_DMA_INT},
596 {AU1500_ETH1_BASE, AU1500_MAC1_ENABLE, AU1500_MAC1_DMA_INT}
597#endif
598#ifdef CONFIG_SOC_AU1550
599 {AU1550_ETH0_BASE, AU1550_MAC0_ENABLE, AU1550_MAC0_DMA_INT},
600 {AU1550_ETH1_BASE, AU1550_MAC1_ENABLE, AU1550_MAC1_DMA_INT}
601#endif
602};
603
604static int num_ifs;
605
606/* 546/*
607 * ethtool operations 547 * ethtool operations
608 */ 548 */
@@ -711,7 +651,6 @@ static int au1000_init(struct net_device *dev)
711 651
712static inline void update_rx_stats(struct net_device *dev, u32 status) 652static inline void update_rx_stats(struct net_device *dev, u32 status)
713{ 653{
714 struct au1000_private *aup = netdev_priv(dev);
715 struct net_device_stats *ps = &dev->stats; 654 struct net_device_stats *ps = &dev->stats;
716 655
717 ps->rx_packets++; 656 ps->rx_packets++;
@@ -969,7 +908,7 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
969 } 908 }
970 909
971 pDB = aup->tx_db_inuse[aup->tx_head]; 910 pDB = aup->tx_db_inuse[aup->tx_head];
972 skb_copy_from_linear_data(skb, pDB->vaddr, skb->len); 911 skb_copy_from_linear_data(skb, (void *)pDB->vaddr, skb->len);
973 if (skb->len < ETH_ZLEN) { 912 if (skb->len < ETH_ZLEN) {
974 for (i=skb->len; i<ETH_ZLEN; i++) { 913 for (i=skb->len; i<ETH_ZLEN; i++) {
975 ((char *)pDB->vaddr)[i] = 0; 914 ((char *)pDB->vaddr)[i] = 0;
@@ -1058,53 +997,59 @@ static const struct net_device_ops au1000_netdev_ops = {
1058 .ndo_change_mtu = eth_change_mtu, 997 .ndo_change_mtu = eth_change_mtu,
1059}; 998};
1060 999
1061static struct net_device * au1000_probe(int port_num) 1000static int __devinit au1000_probe(struct platform_device *pdev)
1062{ 1001{
1063 static unsigned version_printed = 0; 1002 static unsigned version_printed = 0;
1064 struct au1000_private *aup = NULL; 1003 struct au1000_private *aup = NULL;
1004 struct au1000_eth_platform_data *pd;
1065 struct net_device *dev = NULL; 1005 struct net_device *dev = NULL;
1066 db_dest_t *pDB, *pDBfree; 1006 db_dest_t *pDB, *pDBfree;
1007 int irq, i, err = 0;
1008 struct resource *base, *macen;
1067 char ethaddr[6]; 1009 char ethaddr[6];
1068 int irq, i, err;
1069 u32 base, macen;
1070 1010
1071 if (port_num >= NUM_ETH_INTERFACES) 1011 base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1072 return NULL; 1012 if (!base) {
1013 printk(KERN_ERR DRV_NAME ": failed to retrieve base register\n");
1014 err = -ENODEV;
1015 goto out;
1016 }
1073 1017
1074 base = CPHYSADDR(iflist[port_num].base_addr ); 1018 macen = platform_get_resource(pdev, IORESOURCE_MEM, 1);
1075 macen = CPHYSADDR(iflist[port_num].macen_addr); 1019 if (!macen) {
1076 irq = iflist[port_num].irq; 1020 printk(KERN_ERR DRV_NAME ": failed to retrieve MAC Enable register\n");
1021 err = -ENODEV;
1022 goto out;
1023 }
1077 1024
1078 if (!request_mem_region( base, MAC_IOSIZE, "Au1x00 ENET") || 1025 irq = platform_get_irq(pdev, 0);
1079 !request_mem_region(macen, 4, "Au1x00 ENET")) 1026 if (irq < 0) {
1080 return NULL; 1027 printk(KERN_ERR DRV_NAME ": failed to retrieve IRQ\n");
1028 err = -ENODEV;
1029 goto out;
1030 }
1081 1031
1082 if (version_printed++ == 0) 1032 if (!request_mem_region(base->start, resource_size(base), pdev->name)) {
1083 printk("%s version %s %s\n", DRV_NAME, DRV_VERSION, DRV_AUTHOR); 1033 printk(KERN_ERR DRV_NAME ": failed to request memory region for base registers\n");
1034 err = -ENXIO;
1035 goto out;
1036 }
1037
1038 if (!request_mem_region(macen->start, resource_size(macen), pdev->name)) {
1039 printk(KERN_ERR DRV_NAME ": failed to request memory region for MAC enable register\n");
1040 err = -ENXIO;
1041 goto err_request;
1042 }
1084 1043
1085 dev = alloc_etherdev(sizeof(struct au1000_private)); 1044 dev = alloc_etherdev(sizeof(struct au1000_private));
1086 if (!dev) { 1045 if (!dev) {
1087 printk(KERN_ERR "%s: alloc_etherdev failed\n", DRV_NAME); 1046 printk(KERN_ERR "%s: alloc_etherdev failed\n", DRV_NAME);
1088 return NULL; 1047 err = -ENOMEM;
1048 goto err_alloc;
1089 } 1049 }
1090 1050
1091 dev->base_addr = base; 1051 SET_NETDEV_DEV(dev, &pdev->dev);
1092 dev->irq = irq; 1052 platform_set_drvdata(pdev, dev);
1093 dev->netdev_ops = &au1000_netdev_ops;
1094 SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
1095 dev->watchdog_timeo = ETH_TX_TIMEOUT;
1096
1097 err = register_netdev(dev);
1098 if (err != 0) {
1099 printk(KERN_ERR "%s: Cannot register net device, error %d\n",
1100 DRV_NAME, err);
1101 free_netdev(dev);
1102 return NULL;
1103 }
1104
1105 printk("%s: Au1xx0 Ethernet found at 0x%x, irq %d\n",
1106 dev->name, base, irq);
1107
1108 aup = netdev_priv(dev); 1053 aup = netdev_priv(dev);
1109 1054
1110 spin_lock_init(&aup->lock); 1055 spin_lock_init(&aup->lock);
@@ -1115,21 +1060,29 @@ static struct net_device * au1000_probe(int port_num)
1115 (NUM_TX_BUFFS + NUM_RX_BUFFS), 1060 (NUM_TX_BUFFS + NUM_RX_BUFFS),
1116 &aup->dma_addr, 0); 1061 &aup->dma_addr, 0);
1117 if (!aup->vaddr) { 1062 if (!aup->vaddr) {
1118 free_netdev(dev); 1063 printk(KERN_ERR DRV_NAME ": failed to allocate data buffers\n");
1119 release_mem_region( base, MAC_IOSIZE); 1064 err = -ENOMEM;
1120 release_mem_region(macen, 4); 1065 goto err_vaddr;
1121 return NULL;
1122 } 1066 }
1123 1067
1124 /* aup->mac is the base address of the MAC's registers */ 1068 /* aup->mac is the base address of the MAC's registers */
1125 aup->mac = (volatile mac_reg_t *)iflist[port_num].base_addr; 1069 aup->mac = (volatile mac_reg_t *)ioremap_nocache(base->start, resource_size(base));
1070 if (!aup->mac) {
1071 printk(KERN_ERR DRV_NAME ": failed to ioremap MAC registers\n");
1072 err = -ENXIO;
1073 goto err_remap1;
1074 }
1126 1075
1127 /* Setup some variables for quick register address access */ 1076 /* Setup some variables for quick register address access */
1128 aup->enable = (volatile u32 *)iflist[port_num].macen_addr; 1077 aup->enable = (volatile u32 *)ioremap_nocache(macen->start, resource_size(macen));
1129 aup->mac_id = port_num; 1078 if (!aup->enable) {
1130 au_macs[port_num] = aup; 1079 printk(KERN_ERR DRV_NAME ": failed to ioremap MAC enable register\n");
1080 err = -ENXIO;
1081 goto err_remap2;
1082 }
1083 aup->mac_id = pdev->id;
1131 1084
1132 if (port_num == 0) { 1085 if (pdev->id == 0) {
1133 if (prom_get_ethernet_addr(ethaddr) == 0) 1086 if (prom_get_ethernet_addr(ethaddr) == 0)
1134 memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr)); 1087 memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
1135 else { 1088 else {
@@ -1139,7 +1092,7 @@ static struct net_device * au1000_probe(int port_num)
1139 } 1092 }
1140 1093
1141 setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR); 1094 setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
1142 } else if (port_num == 1) 1095 } else if (pdev->id == 1)
1143 setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR); 1096 setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR);
1144 1097
1145 /* 1098 /*
@@ -1147,14 +1100,37 @@ static struct net_device * au1000_probe(int port_num)
1147 * to match those that are printed on their stickers 1100 * to match those that are printed on their stickers
1148 */ 1101 */
1149 memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr)); 1102 memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
1150 dev->dev_addr[5] += port_num; 1103 dev->dev_addr[5] += pdev->id;
1151 1104
1152 *aup->enable = 0; 1105 *aup->enable = 0;
1153 aup->mac_enabled = 0; 1106 aup->mac_enabled = 0;
1154 1107
1108 pd = pdev->dev.platform_data;
1109 if (!pd) {
1110 printk(KERN_INFO DRV_NAME ": no platform_data passed, PHY search on MAC0\n");
1111 aup->phy1_search_mac0 = 1;
1112 } else {
1113 aup->phy_static_config = pd->phy_static_config;
1114 aup->phy_search_highest_addr = pd->phy_search_highest_addr;
1115 aup->phy1_search_mac0 = pd->phy1_search_mac0;
1116 aup->phy_addr = pd->phy_addr;
1117 aup->phy_busid = pd->phy_busid;
1118 aup->phy_irq = pd->phy_irq;
1119 }
1120
1121 if (aup->phy_busid && aup->phy_busid > 0) {
1122 printk(KERN_ERR DRV_NAME ": MAC0-associated PHY attached 2nd MACs MII"
1123 "bus not supported yet\n");
1124 err = -ENODEV;
1125 goto err_mdiobus_alloc;
1126 }
1127
1155 aup->mii_bus = mdiobus_alloc(); 1128 aup->mii_bus = mdiobus_alloc();
1156 if (aup->mii_bus == NULL) 1129 if (aup->mii_bus == NULL) {
1157 goto err_out; 1130 printk(KERN_ERR DRV_NAME ": failed to allocate mdiobus structure\n");
1131 err = -ENOMEM;
1132 goto err_mdiobus_alloc;
1133 }
1158 1134
1159 aup->mii_bus->priv = dev; 1135 aup->mii_bus->priv = dev;
1160 aup->mii_bus->read = au1000_mdiobus_read; 1136 aup->mii_bus->read = au1000_mdiobus_read;
@@ -1168,23 +1144,19 @@ static struct net_device * au1000_probe(int port_num)
1168 1144
1169 for(i = 0; i < PHY_MAX_ADDR; ++i) 1145 for(i = 0; i < PHY_MAX_ADDR; ++i)
1170 aup->mii_bus->irq[i] = PHY_POLL; 1146 aup->mii_bus->irq[i] = PHY_POLL;
1171
1172 /* if known, set corresponding PHY IRQs */ 1147 /* if known, set corresponding PHY IRQs */
1173#if defined(AU1XXX_PHY_STATIC_CONFIG) 1148 if (aup->phy_static_config)
1174# if defined(AU1XXX_PHY0_IRQ) 1149 if (aup->phy_irq && aup->phy_busid == aup->mac_id)
1175 if (AU1XXX_PHY0_BUSID == aup->mac_id) 1150 aup->mii_bus->irq[aup->phy_addr] = aup->phy_irq;
1176 aup->mii_bus->irq[AU1XXX_PHY0_ADDR] = AU1XXX_PHY0_IRQ; 1151
1177# endif 1152 err = mdiobus_register(aup->mii_bus);
1178# if defined(AU1XXX_PHY1_IRQ) 1153 if (err) {
1179 if (AU1XXX_PHY1_BUSID == aup->mac_id) 1154 printk(KERN_ERR DRV_NAME " failed to register MDIO bus\n");
1180 aup->mii_bus->irq[AU1XXX_PHY1_ADDR] = AU1XXX_PHY1_IRQ; 1155 goto err_mdiobus_reg;
1181# endif 1156 }
1182#endif
1183 mdiobus_register(aup->mii_bus);
1184 1157
1185 if (mii_probe(dev) != 0) { 1158 if (mii_probe(dev) != 0)
1186 goto err_out; 1159 goto err_out;
1187 }
1188 1160
1189 pDBfree = NULL; 1161 pDBfree = NULL;
1190 /* setup the data buffer descriptors and attach a buffer to each one */ 1162 /* setup the data buffer descriptors and attach a buffer to each one */
@@ -1216,19 +1188,35 @@ static struct net_device * au1000_probe(int port_num)
1216 aup->tx_db_inuse[i] = pDB; 1188 aup->tx_db_inuse[i] = pDB;
1217 } 1189 }
1218 1190
1191 dev->base_addr = base->start;
1192 dev->irq = irq;
1193 dev->netdev_ops = &au1000_netdev_ops;
1194 SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
1195 dev->watchdog_timeo = ETH_TX_TIMEOUT;
1196
1219 /* 1197 /*
1220 * The boot code uses the ethernet controller, so reset it to start 1198 * The boot code uses the ethernet controller, so reset it to start
1221 * fresh. au1000_init() expects that the device is in reset state. 1199 * fresh. au1000_init() expects that the device is in reset state.
1222 */ 1200 */
1223 reset_mac(dev); 1201 reset_mac(dev);
1224 1202
1225 return dev; 1203 err = register_netdev(dev);
1204 if (err) {
1205 printk(KERN_ERR DRV_NAME "%s: Cannot register net device, aborting.\n",
1206 dev->name);
1207 goto err_out;
1208 }
1209
1210 printk("%s: Au1xx0 Ethernet found at 0x%lx, irq %d\n",
1211 dev->name, (unsigned long)base->start, irq);
1212 if (version_printed++ == 0)
1213 printk("%s version %s %s\n", DRV_NAME, DRV_VERSION, DRV_AUTHOR);
1214
1215 return 0;
1226 1216
1227err_out: 1217err_out:
1228 if (aup->mii_bus != NULL) { 1218 if (aup->mii_bus != NULL)
1229 mdiobus_unregister(aup->mii_bus); 1219 mdiobus_unregister(aup->mii_bus);
1230 mdiobus_free(aup->mii_bus);
1231 }
1232 1220
1233 /* here we should have a valid dev plus aup-> register addresses 1221 /* here we should have a valid dev plus aup-> register addresses
1234 * so we can reset the mac properly.*/ 1222 * so we can reset the mac properly.*/
@@ -1242,67 +1230,84 @@ err_out:
1242 if (aup->tx_db_inuse[i]) 1230 if (aup->tx_db_inuse[i])
1243 ReleaseDB(aup, aup->tx_db_inuse[i]); 1231 ReleaseDB(aup, aup->tx_db_inuse[i]);
1244 } 1232 }
1233err_mdiobus_reg:
1234 mdiobus_free(aup->mii_bus);
1235err_mdiobus_alloc:
1236 iounmap(aup->enable);
1237err_remap2:
1238 iounmap(aup->mac);
1239err_remap1:
1245 dma_free_noncoherent(NULL, MAX_BUF_SIZE * (NUM_TX_BUFFS + NUM_RX_BUFFS), 1240 dma_free_noncoherent(NULL, MAX_BUF_SIZE * (NUM_TX_BUFFS + NUM_RX_BUFFS),
1246 (void *)aup->vaddr, aup->dma_addr); 1241 (void *)aup->vaddr, aup->dma_addr);
1247 unregister_netdev(dev); 1242err_vaddr:
1248 free_netdev(dev); 1243 free_netdev(dev);
1249 release_mem_region( base, MAC_IOSIZE); 1244err_alloc:
1250 release_mem_region(macen, 4); 1245 release_mem_region(macen->start, resource_size(macen));
1251 return NULL; 1246err_request:
1247 release_mem_region(base->start, resource_size(base));
1248out:
1249 return err;
1252} 1250}
1253 1251
1254/* 1252static int __devexit au1000_remove(struct platform_device *pdev)
1255 * Setup the base address and interrupt of the Au1xxx ethernet macs
1256 * based on cpu type and whether the interface is enabled in sys_pinfunc
1257 * register. The last interface is enabled if SYS_PF_NI2 (bit 4) is 0.
1258 */
1259static int __init au1000_init_module(void)
1260{ 1253{
1261 int ni = (int)((au_readl(SYS_PINFUNC) & (u32)(SYS_PF_NI2)) >> 4); 1254 struct net_device *dev = platform_get_drvdata(pdev);
1262 struct net_device *dev; 1255 struct au1000_private *aup = netdev_priv(dev);
1263 int i, found_one = 0; 1256 int i;
1257 struct resource *base, *macen;
1264 1258
1265 num_ifs = NUM_ETH_INTERFACES - ni; 1259 platform_set_drvdata(pdev, NULL);
1260
1261 unregister_netdev(dev);
1262 mdiobus_unregister(aup->mii_bus);
1263 mdiobus_free(aup->mii_bus);
1264
1265 for (i = 0; i < NUM_RX_DMA; i++)
1266 if (aup->rx_db_inuse[i])
1267 ReleaseDB(aup, aup->rx_db_inuse[i]);
1268
1269 for (i = 0; i < NUM_TX_DMA; i++)
1270 if (aup->tx_db_inuse[i])
1271 ReleaseDB(aup, aup->tx_db_inuse[i]);
1272
1273 dma_free_noncoherent(NULL, MAX_BUF_SIZE *
1274 (NUM_TX_BUFFS + NUM_RX_BUFFS),
1275 (void *)aup->vaddr, aup->dma_addr);
1276
1277 iounmap(aup->mac);
1278 iounmap(aup->enable);
1279
1280 base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1281 release_mem_region(base->start, resource_size(base));
1282
1283 macen = platform_get_resource(pdev, IORESOURCE_MEM, 1);
1284 release_mem_region(macen->start, resource_size(macen));
1285
1286 free_netdev(dev);
1266 1287
1267 for(i = 0; i < num_ifs; i++) {
1268 dev = au1000_probe(i);
1269 iflist[i].dev = dev;
1270 if (dev)
1271 found_one++;
1272 }
1273 if (!found_one)
1274 return -ENODEV;
1275 return 0; 1288 return 0;
1276} 1289}
1277 1290
1278static void __exit au1000_cleanup_module(void) 1291static struct platform_driver au1000_eth_driver = {
1292 .probe = au1000_probe,
1293 .remove = __devexit_p(au1000_remove),
1294 .driver = {
1295 .name = "au1000-eth",
1296 .owner = THIS_MODULE,
1297 },
1298};
1299MODULE_ALIAS("platform:au1000-eth");
1300
1301
1302static int __init au1000_init_module(void)
1303{
1304 return platform_driver_register(&au1000_eth_driver);
1305}
1306
1307static void __exit au1000_exit_module(void)
1279{ 1308{
1280 int i, j; 1309 platform_driver_unregister(&au1000_eth_driver);
1281 struct net_device *dev;
1282 struct au1000_private *aup;
1283
1284 for (i = 0; i < num_ifs; i++) {
1285 dev = iflist[i].dev;
1286 if (dev) {
1287 aup = netdev_priv(dev);
1288 unregister_netdev(dev);
1289 mdiobus_unregister(aup->mii_bus);
1290 mdiobus_free(aup->mii_bus);
1291 for (j = 0; j < NUM_RX_DMA; j++)
1292 if (aup->rx_db_inuse[j])
1293 ReleaseDB(aup, aup->rx_db_inuse[j]);
1294 for (j = 0; j < NUM_TX_DMA; j++)
1295 if (aup->tx_db_inuse[j])
1296 ReleaseDB(aup, aup->tx_db_inuse[j]);
1297 dma_free_noncoherent(NULL, MAX_BUF_SIZE *
1298 (NUM_TX_BUFFS + NUM_RX_BUFFS),
1299 (void *)aup->vaddr, aup->dma_addr);
1300 release_mem_region(dev->base_addr, MAC_IOSIZE);
1301 release_mem_region(CPHYSADDR(iflist[i].macen_addr), 4);
1302 free_netdev(dev);
1303 }
1304 }
1305} 1310}
1306 1311
1307module_init(au1000_init_module); 1312module_init(au1000_init_module);
1308module_exit(au1000_cleanup_module); 1313module_exit(au1000_exit_module);
diff --git a/drivers/net/au1000_eth.h b/drivers/net/au1000_eth.h
index 824ecd5ff3a8..f9d29a29b8fd 100644
--- a/drivers/net/au1000_eth.h
+++ b/drivers/net/au1000_eth.h
@@ -108,6 +108,15 @@ struct au1000_private {
108 struct phy_device *phy_dev; 108 struct phy_device *phy_dev;
109 struct mii_bus *mii_bus; 109 struct mii_bus *mii_bus;
110 110
111 /* PHY configuration */
112 int phy_static_config;
113 int phy_search_highest_addr;
114 int phy1_search_mac0;
115
116 int phy_addr;
117 int phy_busid;
118 int phy_irq;
119
111 /* These variables are just for quick access to certain regs addresses. */ 120 /* These variables are just for quick access to certain regs addresses. */
112 volatile mac_reg_t *mac; /* mac registers */ 121 volatile mac_reg_t *mac; /* mac registers */
113 volatile u32 *enable; /* address of MAC Enable Register */ 122 volatile u32 *enable; /* address of MAC Enable Register */
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index fee6eee7ae5b..006cb2efcd22 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -296,6 +296,7 @@ static void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
296 req_hdr->opcode = opcode; 296 req_hdr->opcode = opcode;
297 req_hdr->subsystem = subsystem; 297 req_hdr->subsystem = subsystem;
298 req_hdr->request_length = cpu_to_le32(cmd_len - sizeof(*req_hdr)); 298 req_hdr->request_length = cpu_to_le32(cmd_len - sizeof(*req_hdr));
299 req_hdr->version = 0;
299} 300}
300 301
301static void be_cmd_page_addrs_prepare(struct phys_addr *pages, u32 max_pages, 302static void be_cmd_page_addrs_prepare(struct phys_addr *pages, u32 max_pages,
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 8d0be26f94e3..bf2072e54200 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -36,6 +36,7 @@
36#include <linux/phy_fixed.h> 36#include <linux/phy_fixed.h>
37#include <linux/platform_device.h> 37#include <linux/platform_device.h>
38#include <linux/dma-mapping.h> 38#include <linux/dma-mapping.h>
39#include <linux/clk.h>
39#include <asm/gpio.h> 40#include <asm/gpio.h>
40#include <asm/atomic.h> 41#include <asm/atomic.h>
41 42
@@ -294,9 +295,16 @@ static int cpmac_mdio_write(struct mii_bus *bus, int phy_id,
294 295
295static int cpmac_mdio_reset(struct mii_bus *bus) 296static int cpmac_mdio_reset(struct mii_bus *bus)
296{ 297{
298 struct clk *cpmac_clk;
299
300 cpmac_clk = clk_get(&bus->dev, "cpmac");
301 if (IS_ERR(cpmac_clk)) {
302 printk(KERN_ERR "unable to get cpmac clock\n");
303 return -1;
304 }
297 ar7_device_reset(AR7_RESET_BIT_MDIO); 305 ar7_device_reset(AR7_RESET_BIT_MDIO);
298 cpmac_write(bus->priv, CPMAC_MDIO_CONTROL, MDIOC_ENABLE | 306 cpmac_write(bus->priv, CPMAC_MDIO_CONTROL, MDIOC_ENABLE |
299 MDIOC_CLKDIV(ar7_cpmac_freq() / 2200000 - 1)); 307 MDIOC_CLKDIV(clk_get_rate(cpmac_clk) / 2200000 - 1));
300 return 0; 308 return 0;
301} 309}
302 310
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index d29bb532eccf..765543663a4f 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -4006,11 +4006,21 @@ check_page:
4006 } 4006 }
4007 } 4007 }
4008 4008
4009 if (!buffer_info->dma) 4009 if (!buffer_info->dma) {
4010 buffer_info->dma = pci_map_page(pdev, 4010 buffer_info->dma = pci_map_page(pdev,
4011 buffer_info->page, 0, 4011 buffer_info->page, 0,
4012 buffer_info->length, 4012 buffer_info->length,
4013 PCI_DMA_FROMDEVICE); 4013 PCI_DMA_FROMDEVICE);
4014 if (pci_dma_mapping_error(pdev, buffer_info->dma)) {
4015 put_page(buffer_info->page);
4016 dev_kfree_skb(skb);
4017 buffer_info->page = NULL;
4018 buffer_info->skb = NULL;
4019 buffer_info->dma = 0;
4020 adapter->alloc_rx_buff_failed++;
4021 break; /* while !buffer_info->skb */
4022 }
4023 }
4014 4024
4015 rx_desc = E1000_RX_DESC(*rx_ring, i); 4025 rx_desc = E1000_RX_DESC(*rx_ring, i);
4016 rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); 4026 rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
@@ -4101,6 +4111,13 @@ map_skb:
4101 skb->data, 4111 skb->data,
4102 buffer_info->length, 4112 buffer_info->length,
4103 PCI_DMA_FROMDEVICE); 4113 PCI_DMA_FROMDEVICE);
4114 if (pci_dma_mapping_error(pdev, buffer_info->dma)) {
4115 dev_kfree_skb(skb);
4116 buffer_info->skb = NULL;
4117 buffer_info->dma = 0;
4118 adapter->alloc_rx_buff_failed++;
4119 break; /* while !buffer_info->skb */
4120 }
4104 4121
4105 /* 4122 /*
4106 * XXX if it was allocated cleanly it will never map to a 4123 * XXX if it was allocated cleanly it will never map to a
diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c
index 9b2eebdbb25b..b5cbd39d0685 100644
--- a/drivers/net/irda/au1k_ir.c
+++ b/drivers/net/irda/au1k_ir.c
@@ -36,6 +36,7 @@
36#include <asm/pb1000.h> 36#include <asm/pb1000.h>
37#elif defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) 37#elif defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
38#include <asm/db1x00.h> 38#include <asm/db1x00.h>
39#include <asm/mach-db1x00/bcsr.h>
39#else 40#else
40#error au1k_ir: unsupported board 41#error au1k_ir: unsupported board
41#endif 42#endif
@@ -66,10 +67,6 @@ static char version[] __devinitdata =
66 67
67#define RUN_AT(x) (jiffies + (x)) 68#define RUN_AT(x) (jiffies + (x))
68 69
69#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
70static BCSR * const bcsr = (BCSR *)0xAE000000;
71#endif
72
73static DEFINE_SPINLOCK(ir_lock); 70static DEFINE_SPINLOCK(ir_lock);
74 71
75/* 72/*
@@ -282,9 +279,8 @@ static int au1k_irda_net_init(struct net_device *dev)
282 279
283#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) 280#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
284 /* power on */ 281 /* power on */
285 bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK; 282 bcsr_mod(BCSR_RESETS, BCSR_RESETS_IRDA_MODE_MASK,
286 bcsr->resets |= BCSR_RESETS_IRDA_MODE_FULL; 283 BCSR_RESETS_IRDA_MODE_FULL);
287 au_sync();
288#endif 284#endif
289 285
290 return 0; 286 return 0;
@@ -720,14 +716,14 @@ au1k_irda_set_speed(struct net_device *dev, int speed)
720 716
721 if (speed == 4000000) { 717 if (speed == 4000000) {
722#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) 718#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
723 bcsr->resets |= BCSR_RESETS_FIR_SEL; 719 bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_FIR_SEL);
724#else /* Pb1000 and Pb1100 */ 720#else /* Pb1000 and Pb1100 */
725 writel(1<<13, CPLD_AUX1); 721 writel(1<<13, CPLD_AUX1);
726#endif 722#endif
727 } 723 }
728 else { 724 else {
729#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) 725#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
730 bcsr->resets &= ~BCSR_RESETS_FIR_SEL; 726 bcsr_mod(BCSR_RESETS, BCSR_RESETS_FIR_SEL, 0);
731#else /* Pb1000 and Pb1100 */ 727#else /* Pb1000 and Pb1100 */
732 writel(readl(CPLD_AUX1) & ~(1<<13), CPLD_AUX1); 728 writel(readl(CPLD_AUX1) & ~(1<<13), CPLD_AUX1);
733#endif 729#endif
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index 3103f4165311..35a06b47587b 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -357,12 +357,34 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
357 u32 fctrl_reg; 357 u32 fctrl_reg;
358 u32 rmcs_reg; 358 u32 rmcs_reg;
359 u32 reg; 359 u32 reg;
360 u32 link_speed = 0;
361 bool link_up;
360 362
361#ifdef CONFIG_DCB 363#ifdef CONFIG_DCB
362 if (hw->fc.requested_mode == ixgbe_fc_pfc) 364 if (hw->fc.requested_mode == ixgbe_fc_pfc)
363 goto out; 365 goto out;
364 366
365#endif /* CONFIG_DCB */ 367#endif /* CONFIG_DCB */
368 /*
369 * On 82598 having Rx FC on causes resets while doing 1G
370 * so if it's on turn it off once we know link_speed. For
371 * more details see 82598 Specification update.
372 */
373 hw->mac.ops.check_link(hw, &link_speed, &link_up, false);
374 if (link_up && link_speed == IXGBE_LINK_SPEED_1GB_FULL) {
375 switch (hw->fc.requested_mode) {
376 case ixgbe_fc_full:
377 hw->fc.requested_mode = ixgbe_fc_tx_pause;
378 break;
379 case ixgbe_fc_rx_pause:
380 hw->fc.requested_mode = ixgbe_fc_none;
381 break;
382 default:
383 /* no change */
384 break;
385 }
386 }
387
366 /* Negotiate the fc mode to use */ 388 /* Negotiate the fc mode to use */
367 ret_val = ixgbe_fc_autoneg(hw); 389 ret_val = ixgbe_fc_autoneg(hw);
368 if (ret_val) 390 if (ret_val)
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 7b7c8486c0bf..951b73cf5ca2 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -5763,6 +5763,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
5763 if (err) 5763 if (err)
5764 goto err_sw_init; 5764 goto err_sw_init;
5765 5765
5766 /* Make it possible the adapter to be woken up via WOL */
5767 if (adapter->hw.mac.type == ixgbe_mac_82599EB)
5768 IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0);
5769
5766 /* 5770 /*
5767 * If there is a fan on this device and it has failed log the 5771 * If there is a fan on this device and it has failed log the
5768 * failure. 5772 * failure.
diff --git a/drivers/net/mace.c b/drivers/net/mace.c
index d9fbad386389..43aea91e3369 100644
--- a/drivers/net/mace.c
+++ b/drivers/net/mace.c
@@ -206,7 +206,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
206 mp->port_aaui = port_aaui; 206 mp->port_aaui = port_aaui;
207 else { 207 else {
208 /* Apple Network Server uses the AAUI port */ 208 /* Apple Network Server uses the AAUI port */
209 if (machine_is_compatible("AAPL,ShinerESB")) 209 if (of_machine_is_compatible("AAPL,ShinerESB"))
210 mp->port_aaui = 1; 210 mp->port_aaui = 1;
211 else { 211 else {
212#ifdef CONFIG_MACE_AAUI_PORT 212#ifdef CONFIG_MACE_AAUI_PORT
diff --git a/drivers/net/macmace.c b/drivers/net/macmace.c
index 44f3c2896f20..79408c377875 100644
--- a/drivers/net/macmace.c
+++ b/drivers/net/macmace.c
@@ -39,7 +39,6 @@
39#include "mace.h" 39#include "mace.h"
40 40
41static char mac_mace_string[] = "macmace"; 41static char mac_mace_string[] = "macmace";
42static struct platform_device *mac_mace_device;
43 42
44#define N_TX_BUFF_ORDER 0 43#define N_TX_BUFF_ORDER 0
45#define N_TX_RING (1 << N_TX_BUFF_ORDER) 44#define N_TX_RING (1 << N_TX_BUFF_ORDER)
@@ -752,6 +751,7 @@ static irqreturn_t mace_dma_intr(int irq, void *dev_id)
752 751
753MODULE_LICENSE("GPL"); 752MODULE_LICENSE("GPL");
754MODULE_DESCRIPTION("Macintosh MACE ethernet driver"); 753MODULE_DESCRIPTION("Macintosh MACE ethernet driver");
754MODULE_ALIAS("platform:macmace");
755 755
756static int __devexit mac_mace_device_remove (struct platform_device *pdev) 756static int __devexit mac_mace_device_remove (struct platform_device *pdev)
757{ 757{
@@ -777,47 +777,22 @@ static struct platform_driver mac_mace_driver = {
777 .probe = mace_probe, 777 .probe = mace_probe,
778 .remove = __devexit_p(mac_mace_device_remove), 778 .remove = __devexit_p(mac_mace_device_remove),
779 .driver = { 779 .driver = {
780 .name = mac_mace_string, 780 .name = mac_mace_string,
781 .owner = THIS_MODULE,
781 }, 782 },
782}; 783};
783 784
784static int __init mac_mace_init_module(void) 785static int __init mac_mace_init_module(void)
785{ 786{
786 int err;
787
788 if (!MACH_IS_MAC) 787 if (!MACH_IS_MAC)
789 return -ENODEV; 788 return -ENODEV;
790 789
791 if ((err = platform_driver_register(&mac_mace_driver))) { 790 return platform_driver_register(&mac_mace_driver);
792 printk(KERN_ERR "Driver registration failed\n");
793 return err;
794 }
795
796 mac_mace_device = platform_device_alloc(mac_mace_string, 0);
797 if (!mac_mace_device)
798 goto out_unregister;
799
800 if (platform_device_add(mac_mace_device)) {
801 platform_device_put(mac_mace_device);
802 mac_mace_device = NULL;
803 }
804
805 return 0;
806
807out_unregister:
808 platform_driver_unregister(&mac_mace_driver);
809
810 return -ENOMEM;
811} 791}
812 792
813static void __exit mac_mace_cleanup_module(void) 793static void __exit mac_mace_cleanup_module(void)
814{ 794{
815 platform_driver_unregister(&mac_mace_driver); 795 platform_driver_unregister(&mac_mace_driver);
816
817 if (mac_mace_device) {
818 platform_device_unregister(mac_mace_device);
819 mac_mace_device = NULL;
820 }
821} 796}
822 797
823module_init(mac_mace_init_module); 798module_init(mac_mace_init_module);
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c
index 875d361fb79d..24109c288108 100644
--- a/drivers/net/macsonic.c
+++ b/drivers/net/macsonic.c
@@ -62,7 +62,6 @@
62#include <asm/mac_via.h> 62#include <asm/mac_via.h>
63 63
64static char mac_sonic_string[] = "macsonic"; 64static char mac_sonic_string[] = "macsonic";
65static struct platform_device *mac_sonic_device;
66 65
67#include "sonic.h" 66#include "sonic.h"
68 67
@@ -607,6 +606,7 @@ out:
607MODULE_DESCRIPTION("Macintosh SONIC ethernet driver"); 606MODULE_DESCRIPTION("Macintosh SONIC ethernet driver");
608module_param(sonic_debug, int, 0); 607module_param(sonic_debug, int, 0);
609MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)"); 608MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)");
609MODULE_ALIAS("platform:macsonic");
610 610
611#include "sonic.c" 611#include "sonic.c"
612 612
@@ -627,44 +627,19 @@ static struct platform_driver mac_sonic_driver = {
627 .probe = mac_sonic_probe, 627 .probe = mac_sonic_probe,
628 .remove = __devexit_p(mac_sonic_device_remove), 628 .remove = __devexit_p(mac_sonic_device_remove),
629 .driver = { 629 .driver = {
630 .name = mac_sonic_string, 630 .name = mac_sonic_string,
631 .owner = THIS_MODULE,
631 }, 632 },
632}; 633};
633 634
634static int __init mac_sonic_init_module(void) 635static int __init mac_sonic_init_module(void)
635{ 636{
636 int err; 637 return platform_driver_register(&mac_sonic_driver);
637
638 if ((err = platform_driver_register(&mac_sonic_driver))) {
639 printk(KERN_ERR "Driver registration failed\n");
640 return err;
641 }
642
643 mac_sonic_device = platform_device_alloc(mac_sonic_string, 0);
644 if (!mac_sonic_device)
645 goto out_unregister;
646
647 if (platform_device_add(mac_sonic_device)) {
648 platform_device_put(mac_sonic_device);
649 mac_sonic_device = NULL;
650 }
651
652 return 0;
653
654out_unregister:
655 platform_driver_unregister(&mac_sonic_driver);
656
657 return -ENOMEM;
658} 638}
659 639
660static void __exit mac_sonic_cleanup_module(void) 640static void __exit mac_sonic_cleanup_module(void)
661{ 641{
662 platform_driver_unregister(&mac_sonic_driver); 642 platform_driver_unregister(&mac_sonic_driver);
663
664 if (mac_sonic_device) {
665 platform_device_unregister(mac_sonic_device);
666 mac_sonic_device = NULL;
667 }
668} 643}
669 644
670module_init(mac_sonic_init_module); 645module_init(mac_sonic_init_module);
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 6dd486d2977b..aa57cfd1e3fb 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -453,8 +453,7 @@ static int mhz_mfc_config(struct pcmcia_device *link)
453 453
454 link->conf.Attributes |= CONF_ENABLE_SPKR; 454 link->conf.Attributes |= CONF_ENABLE_SPKR;
455 link->conf.Status = CCSR_AUDIO_ENA; 455 link->conf.Status = CCSR_AUDIO_ENA;
456 link->irq.Attributes = 456 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
457 IRQ_TYPE_DYNAMIC_SHARING;
458 link->io.IOAddrLines = 16; 457 link->io.IOAddrLines = 16;
459 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 458 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
460 link->io.NumPorts2 = 8; 459 link->io.NumPorts2 = 8;
@@ -652,8 +651,7 @@ static int osi_config(struct pcmcia_device *link)
652 651
653 link->conf.Attributes |= CONF_ENABLE_SPKR; 652 link->conf.Attributes |= CONF_ENABLE_SPKR;
654 link->conf.Status = CCSR_AUDIO_ENA; 653 link->conf.Status = CCSR_AUDIO_ENA;
655 link->irq.Attributes = 654 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
656 IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
657 link->io.NumPorts1 = 64; 655 link->io.NumPorts1 = 64;
658 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 656 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
659 link->io.NumPorts2 = 8; 657 link->io.NumPorts2 = 8;
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 103e8b0e2a0d..46997e177ee3 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -2284,6 +2284,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
2284 fail2: 2284 fail2:
2285 efx_fini_struct(efx); 2285 efx_fini_struct(efx);
2286 fail1: 2286 fail1:
2287 WARN_ON(rc > 0);
2287 EFX_LOG(efx, "initialisation failed. rc=%d\n", rc); 2288 EFX_LOG(efx, "initialisation failed. rc=%d\n", rc);
2288 free_netdev(net_dev); 2289 free_netdev(net_dev);
2289 return rc; 2290 return rc;
diff --git a/drivers/net/sfc/falcon_boards.c b/drivers/net/sfc/falcon_boards.c
index bf0b96af5334..5712fddd72f2 100644
--- a/drivers/net/sfc/falcon_boards.c
+++ b/drivers/net/sfc/falcon_boards.c
@@ -29,6 +29,15 @@
29#define FALCON_BOARD_SFN4111T 0x51 29#define FALCON_BOARD_SFN4111T 0x51
30#define FALCON_BOARD_SFN4112F 0x52 30#define FALCON_BOARD_SFN4112F 0x52
31 31
32/* Board temperature is about 15°C above ambient when air flow is
33 * limited. */
34#define FALCON_BOARD_TEMP_BIAS 15
35
36/* SFC4000 datasheet says: 'The maximum permitted junction temperature
37 * is 125°C; the thermal design of the environment for the SFC4000
38 * should aim to keep this well below 100°C.' */
39#define FALCON_JUNC_TEMP_MAX 90
40
32/***************************************************************************** 41/*****************************************************************************
33 * Support for LM87 sensor chip used on several boards 42 * Support for LM87 sensor chip used on several boards
34 */ 43 */
@@ -548,16 +557,16 @@ fail_hwmon:
548static u8 sfe4002_lm87_channel = 0x03; /* use AIN not FAN inputs */ 557static u8 sfe4002_lm87_channel = 0x03; /* use AIN not FAN inputs */
549 558
550static const u8 sfe4002_lm87_regs[] = { 559static const u8 sfe4002_lm87_regs[] = {
551 LM87_IN_LIMITS(0, 0x83, 0x91), /* 2.5V: 1.8V +/- 5% */ 560 LM87_IN_LIMITS(0, 0x7c, 0x99), /* 2.5V: 1.8V +/- 10% */
552 LM87_IN_LIMITS(1, 0x51, 0x5a), /* Vccp1: 1.2V +/- 5% */ 561 LM87_IN_LIMITS(1, 0x4c, 0x5e), /* Vccp1: 1.2V +/- 10% */
553 LM87_IN_LIMITS(2, 0xb6, 0xca), /* 3.3V: 3.3V +/- 5% */ 562 LM87_IN_LIMITS(2, 0xac, 0xd4), /* 3.3V: 3.3V +/- 10% */
554 LM87_IN_LIMITS(3, 0xb0, 0xc9), /* 5V: 4.6-5.2V */ 563 LM87_IN_LIMITS(3, 0xac, 0xd4), /* 5V: 5.0V +/- 10% */
555 LM87_IN_LIMITS(4, 0xb0, 0xe0), /* 12V: 11-14V */ 564 LM87_IN_LIMITS(4, 0xac, 0xe0), /* 12V: 10.8-14V */
556 LM87_IN_LIMITS(5, 0x44, 0x4b), /* Vccp2: 1.0V +/- 5% */ 565 LM87_IN_LIMITS(5, 0x3f, 0x4f), /* Vccp2: 1.0V +/- 10% */
557 LM87_AIN_LIMITS(0, 0xa0, 0xb2), /* AIN1: 1.66V +/- 5% */ 566 LM87_AIN_LIMITS(0, 0x98, 0xbb), /* AIN1: 1.66V +/- 10% */
558 LM87_AIN_LIMITS(1, 0x91, 0xa1), /* AIN2: 1.5V +/- 5% */ 567 LM87_AIN_LIMITS(1, 0x8a, 0xa9), /* AIN2: 1.5V +/- 10% */
559 LM87_TEMP_INT_LIMITS(10, 60), /* board */ 568 LM87_TEMP_INT_LIMITS(0, 80 + FALCON_BOARD_TEMP_BIAS),
560 LM87_TEMP_EXT1_LIMITS(10, 70), /* Falcon */ 569 LM87_TEMP_EXT1_LIMITS(0, FALCON_JUNC_TEMP_MAX),
561 0 570 0
562}; 571};
563 572
@@ -619,14 +628,14 @@ static int sfe4002_init(struct efx_nic *efx)
619static u8 sfn4112f_lm87_channel = 0x03; /* use AIN not FAN inputs */ 628static u8 sfn4112f_lm87_channel = 0x03; /* use AIN not FAN inputs */
620 629
621static const u8 sfn4112f_lm87_regs[] = { 630static const u8 sfn4112f_lm87_regs[] = {
622 LM87_IN_LIMITS(0, 0x83, 0x91), /* 2.5V: 1.8V +/- 5% */ 631 LM87_IN_LIMITS(0, 0x7c, 0x99), /* 2.5V: 1.8V +/- 10% */
623 LM87_IN_LIMITS(1, 0x51, 0x5a), /* Vccp1: 1.2V +/- 5% */ 632 LM87_IN_LIMITS(1, 0x4c, 0x5e), /* Vccp1: 1.2V +/- 10% */
624 LM87_IN_LIMITS(2, 0xb6, 0xca), /* 3.3V: 3.3V +/- 5% */ 633 LM87_IN_LIMITS(2, 0xac, 0xd4), /* 3.3V: 3.3V +/- 10% */
625 LM87_IN_LIMITS(4, 0xb0, 0xe0), /* 12V: 11-14V */ 634 LM87_IN_LIMITS(4, 0xac, 0xe0), /* 12V: 10.8-14V */
626 LM87_IN_LIMITS(5, 0x44, 0x4b), /* Vccp2: 1.0V +/- 5% */ 635 LM87_IN_LIMITS(5, 0x3f, 0x4f), /* Vccp2: 1.0V +/- 10% */
627 LM87_AIN_LIMITS(1, 0x91, 0xa1), /* AIN2: 1.5V +/- 5% */ 636 LM87_AIN_LIMITS(1, 0x8a, 0xa9), /* AIN2: 1.5V +/- 10% */
628 LM87_TEMP_INT_LIMITS(10, 60), /* board */ 637 LM87_TEMP_INT_LIMITS(0, 60 + FALCON_BOARD_TEMP_BIAS),
629 LM87_TEMP_EXT1_LIMITS(10, 70), /* Falcon */ 638 LM87_TEMP_EXT1_LIMITS(0, FALCON_JUNC_TEMP_MAX),
630 0 639 0
631}; 640};
632 641
diff --git a/drivers/net/sfc/mcdi.c b/drivers/net/sfc/mcdi.c
index 9f035b9f0350..f66b3da6ddff 100644
--- a/drivers/net/sfc/mcdi.c
+++ b/drivers/net/sfc/mcdi.c
@@ -127,7 +127,7 @@ static int efx_mcdi_poll(struct efx_nic *efx)
127 efx_dword_t reg; 127 efx_dword_t reg;
128 128
129 /* Check for a reboot atomically with respect to efx_mcdi_copyout() */ 129 /* Check for a reboot atomically with respect to efx_mcdi_copyout() */
130 rc = efx_mcdi_poll_reboot(efx); 130 rc = -efx_mcdi_poll_reboot(efx);
131 if (rc) 131 if (rc)
132 goto out; 132 goto out;
133 133
diff --git a/drivers/net/sfc/qt202x_phy.c b/drivers/net/sfc/qt202x_phy.c
index e0d13a451019..67eec7a6e487 100644
--- a/drivers/net/sfc/qt202x_phy.c
+++ b/drivers/net/sfc/qt202x_phy.c
@@ -320,7 +320,7 @@ static int qt202x_reset_phy(struct efx_nic *efx)
320 320
321 falcon_board(efx)->type->init_phy(efx); 321 falcon_board(efx)->type->init_phy(efx);
322 322
323 return rc; 323 return 0;
324 324
325 fail: 325 fail:
326 EFX_ERR(efx, "PHY reset timed out\n"); 326 EFX_ERR(efx, "PHY reset timed out\n");
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index 75a669d48e5e..d71c1976072e 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -1437,7 +1437,6 @@ static int tc35815_do_interrupt(struct net_device *dev, u32 status, int limit)
1437 /* Transmit complete. */ 1437 /* Transmit complete. */
1438 lp->lstats.tx_ints++; 1438 lp->lstats.tx_ints++;
1439 tc35815_txdone(dev); 1439 tc35815_txdone(dev);
1440 netif_wake_queue(dev);
1441 if (ret < 0) 1440 if (ret < 0)
1442 ret = 0; 1441 ret = 0;
1443 } 1442 }
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 4f27f022fbf7..5f3b9eaeb04f 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -584,6 +584,11 @@ static const struct usb_device_id products [] = {
584 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 584 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
585 .driver_info = (unsigned long) &mbm_info, 585 .driver_info = (unsigned long) &mbm_info,
586}, { 586}, {
587 /* Ericsson C3607w ver 2 */
588 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190b, USB_CLASS_COMM,
589 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
590 .driver_info = (unsigned long) &mbm_info,
591}, {
587 /* Toshiba F3507g */ 592 /* Toshiba F3507g */
588 USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM, 593 USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM,
589 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 594 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index c93f58f5c6f2..317aa34b21cf 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1877,13 +1877,12 @@ static void velocity_error(struct velocity_info *vptr, int status)
1877/** 1877/**
1878 * tx_srv - transmit interrupt service 1878 * tx_srv - transmit interrupt service
1879 * @vptr; Velocity 1879 * @vptr; Velocity
1880 * @status:
1881 * 1880 *
1882 * Scan the queues looking for transmitted packets that 1881 * Scan the queues looking for transmitted packets that
1883 * we can complete and clean up. Update any statistics as 1882 * we can complete and clean up. Update any statistics as
1884 * necessary/ 1883 * necessary/
1885 */ 1884 */
1886static int velocity_tx_srv(struct velocity_info *vptr, u32 status) 1885static int velocity_tx_srv(struct velocity_info *vptr)
1887{ 1886{
1888 struct tx_desc *td; 1887 struct tx_desc *td;
1889 int qnum; 1888 int qnum;
@@ -2090,14 +2089,12 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx)
2090/** 2089/**
2091 * velocity_rx_srv - service RX interrupt 2090 * velocity_rx_srv - service RX interrupt
2092 * @vptr: velocity 2091 * @vptr: velocity
2093 * @status: adapter status (unused)
2094 * 2092 *
2095 * Walk the receive ring of the velocity adapter and remove 2093 * Walk the receive ring of the velocity adapter and remove
2096 * any received packets from the receive queue. Hand the ring 2094 * any received packets from the receive queue. Hand the ring
2097 * slots back to the adapter for reuse. 2095 * slots back to the adapter for reuse.
2098 */ 2096 */
2099static int velocity_rx_srv(struct velocity_info *vptr, int status, 2097static int velocity_rx_srv(struct velocity_info *vptr, int budget_left)
2100 int budget_left)
2101{ 2098{
2102 struct net_device_stats *stats = &vptr->dev->stats; 2099 struct net_device_stats *stats = &vptr->dev->stats;
2103 int rd_curr = vptr->rx.curr; 2100 int rd_curr = vptr->rx.curr;
@@ -2151,32 +2148,24 @@ static int velocity_poll(struct napi_struct *napi, int budget)
2151 struct velocity_info *vptr = container_of(napi, 2148 struct velocity_info *vptr = container_of(napi,
2152 struct velocity_info, napi); 2149 struct velocity_info, napi);
2153 unsigned int rx_done; 2150 unsigned int rx_done;
2154 u32 isr_status; 2151 unsigned long flags;
2155
2156 spin_lock(&vptr->lock);
2157 isr_status = mac_read_isr(vptr->mac_regs);
2158
2159 /* Ack the interrupt */
2160 mac_write_isr(vptr->mac_regs, isr_status);
2161 if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI)))
2162 velocity_error(vptr, isr_status);
2163 2152
2153 spin_lock_irqsave(&vptr->lock, flags);
2164 /* 2154 /*
2165 * Do rx and tx twice for performance (taken from the VIA 2155 * Do rx and tx twice for performance (taken from the VIA
2166 * out-of-tree driver). 2156 * out-of-tree driver).
2167 */ 2157 */
2168 rx_done = velocity_rx_srv(vptr, isr_status, budget / 2); 2158 rx_done = velocity_rx_srv(vptr, budget / 2);
2169 velocity_tx_srv(vptr, isr_status); 2159 velocity_tx_srv(vptr);
2170 rx_done += velocity_rx_srv(vptr, isr_status, budget - rx_done); 2160 rx_done += velocity_rx_srv(vptr, budget - rx_done);
2171 velocity_tx_srv(vptr, isr_status); 2161 velocity_tx_srv(vptr);
2172
2173 spin_unlock(&vptr->lock);
2174 2162
2175 /* If budget not fully consumed, exit the polling mode */ 2163 /* If budget not fully consumed, exit the polling mode */
2176 if (rx_done < budget) { 2164 if (rx_done < budget) {
2177 napi_complete(napi); 2165 napi_complete(napi);
2178 mac_enable_int(vptr->mac_regs); 2166 mac_enable_int(vptr->mac_regs);
2179 } 2167 }
2168 spin_unlock_irqrestore(&vptr->lock, flags);
2180 2169
2181 return rx_done; 2170 return rx_done;
2182} 2171}
@@ -2206,10 +2195,17 @@ static irqreturn_t velocity_intr(int irq, void *dev_instance)
2206 return IRQ_NONE; 2195 return IRQ_NONE;
2207 } 2196 }
2208 2197
2198 /* Ack the interrupt */
2199 mac_write_isr(vptr->mac_regs, isr_status);
2200
2209 if (likely(napi_schedule_prep(&vptr->napi))) { 2201 if (likely(napi_schedule_prep(&vptr->napi))) {
2210 mac_disable_int(vptr->mac_regs); 2202 mac_disable_int(vptr->mac_regs);
2211 __napi_schedule(&vptr->napi); 2203 __napi_schedule(&vptr->napi);
2212 } 2204 }
2205
2206 if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI)))
2207 velocity_error(vptr, isr_status);
2208
2213 spin_unlock(&vptr->lock); 2209 spin_unlock(&vptr->lock);
2214 2210
2215 return IRQ_HANDLED; 2211 return IRQ_HANDLED;
@@ -3100,7 +3096,7 @@ static int velocity_resume(struct pci_dev *pdev)
3100 velocity_init_registers(vptr, VELOCITY_INIT_WOL); 3096 velocity_init_registers(vptr, VELOCITY_INIT_WOL);
3101 mac_disable_int(vptr->mac_regs); 3097 mac_disable_int(vptr->mac_regs);
3102 3098
3103 velocity_tx_srv(vptr, 0); 3099 velocity_tx_srv(vptr);
3104 3100
3105 for (i = 0; i < vptr->tx.numq; i++) { 3101 for (i = 0; i < vptr->tx.numq; i++) {
3106 if (vptr->tx.used[i]) 3102 if (vptr->tx.used[i])
@@ -3344,6 +3340,7 @@ static int velocity_set_coalesce(struct net_device *dev,
3344{ 3340{
3345 struct velocity_info *vptr = netdev_priv(dev); 3341 struct velocity_info *vptr = netdev_priv(dev);
3346 int max_us = 0x3f * 64; 3342 int max_us = 0x3f * 64;
3343 unsigned long flags;
3347 3344
3348 /* 6 bits of */ 3345 /* 6 bits of */
3349 if (ecmd->tx_coalesce_usecs > max_us) 3346 if (ecmd->tx_coalesce_usecs > max_us)
@@ -3365,6 +3362,7 @@ static int velocity_set_coalesce(struct net_device *dev,
3365 ecmd->tx_coalesce_usecs); 3362 ecmd->tx_coalesce_usecs);
3366 3363
3367 /* Setup the interrupt suppression and queue timers */ 3364 /* Setup the interrupt suppression and queue timers */
3365 spin_lock_irqsave(&vptr->lock, flags);
3368 mac_disable_int(vptr->mac_regs); 3366 mac_disable_int(vptr->mac_regs);
3369 setup_adaptive_interrupts(vptr); 3367 setup_adaptive_interrupts(vptr);
3370 setup_queue_timers(vptr); 3368 setup_queue_timers(vptr);
@@ -3372,6 +3370,7 @@ static int velocity_set_coalesce(struct net_device *dev,
3372 mac_write_int_mask(vptr->int_mask, vptr->mac_regs); 3370 mac_write_int_mask(vptr->int_mask, vptr->mac_regs);
3373 mac_clear_isr(vptr->mac_regs); 3371 mac_clear_isr(vptr->mac_regs);
3374 mac_enable_int(vptr->mac_regs); 3372 mac_enable_int(vptr->mac_regs);
3373 spin_unlock_irqrestore(&vptr->lock, flags);
3375 3374
3376 return 0; 3375 return 0;
3377} 3376}
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index fa12b9060b0b..29bf33692f71 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1615,7 +1615,7 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf,
1615 bf->bf_frmlen -= padsize; 1615 bf->bf_frmlen -= padsize;
1616 } 1616 }
1617 1617
1618 if (conf_is_ht(&hw->conf) && !is_pae(skb)) 1618 if (conf_is_ht(&hw->conf))
1619 bf->bf_state.bf_type |= BUF_HT; 1619 bf->bf_state.bf_type |= BUF_HT;
1620 1620
1621 bf->bf_flags = setup_tx_flags(sc, skb, txctl->txq); 1621 bf->bf_flags = setup_tx_flags(sc, skb, txctl->txq);
@@ -1701,7 +1701,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
1701 goto tx_done; 1701 goto tx_done;
1702 } 1702 }
1703 1703
1704 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { 1704 if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && !is_pae(skb)) {
1705 /* 1705 /*
1706 * Try aggregation if it's a unicast data frame 1706 * Try aggregation if it's a unicast data frame
1707 * and the destination is HT capable. 1707 * and the destination is HT capable.
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index fe3bf9491997..c484cc253892 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -115,6 +115,7 @@
115#define B43_MMIO_TSF_2 0x636 /* core rev < 3 only */ 115#define B43_MMIO_TSF_2 0x636 /* core rev < 3 only */
116#define B43_MMIO_TSF_3 0x638 /* core rev < 3 only */ 116#define B43_MMIO_TSF_3 0x638 /* core rev < 3 only */
117#define B43_MMIO_RNG 0x65A 117#define B43_MMIO_RNG 0x65A
118#define B43_MMIO_IFSSLOT 0x684 /* Interframe slot time */
118#define B43_MMIO_IFSCTL 0x688 /* Interframe space control */ 119#define B43_MMIO_IFSCTL 0x688 /* Interframe space control */
119#define B43_MMIO_IFSCTL_USE_EDCF 0x0004 120#define B43_MMIO_IFSCTL_USE_EDCF 0x0004
120#define B43_MMIO_POWERUP_DELAY 0x6A8 121#define B43_MMIO_POWERUP_DELAY 0x6A8
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 4c41cfe44f26..490fb45d1d05 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -628,10 +628,17 @@ static void b43_upload_card_macaddress(struct b43_wldev *dev)
628static void b43_set_slot_time(struct b43_wldev *dev, u16 slot_time) 628static void b43_set_slot_time(struct b43_wldev *dev, u16 slot_time)
629{ 629{
630 /* slot_time is in usec. */ 630 /* slot_time is in usec. */
631 if (dev->phy.type != B43_PHYTYPE_G) 631 /* This test used to exit for all but a G PHY. */
632 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
632 return; 633 return;
633 b43_write16(dev, 0x684, 510 + slot_time); 634 b43_write16(dev, B43_MMIO_IFSSLOT, 510 + slot_time);
634 b43_shm_write16(dev, B43_SHM_SHARED, 0x0010, slot_time); 635 /* Shared memory location 0x0010 is the slot time and should be
636 * set to slot_time; however, this register is initially 0 and changing
637 * the value adversely affects the transmit rate for BCM4311
638 * devices. Until this behavior is unterstood, delete this step
639 *
640 * b43_shm_write16(dev, B43_SHM_SHARED, 0x0010, slot_time);
641 */
635} 642}
636 643
637static void b43_short_slot_timing_enable(struct b43_wldev *dev) 644static void b43_short_slot_timing_enable(struct b43_wldev *dev)
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 9b4b8b5c7574..31462813bac0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2008,7 +2008,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
2008 IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn " 2008 IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn "
2009 "%d index %d\n", scd_ssn , index); 2009 "%d index %d\n", scd_ssn , index);
2010 freed = iwl_tx_queue_reclaim(priv, txq_id, index); 2010 freed = iwl_tx_queue_reclaim(priv, txq_id, index);
2011 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; 2011 iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
2012 2012
2013 if (priv->mac80211_registered && 2013 if (priv->mac80211_registered &&
2014 (iwl_queue_space(&txq->q) > txq->q.low_mark) && 2014 (iwl_queue_space(&txq->q) > txq->q.low_mark) &&
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index de45f308b744..cffaae772d51 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1125,7 +1125,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
1125 scd_ssn , index, txq_id, txq->swq_id); 1125 scd_ssn , index, txq_id, txq->swq_id);
1126 1126
1127 freed = iwl_tx_queue_reclaim(priv, txq_id, index); 1127 freed = iwl_tx_queue_reclaim(priv, txq_id, index);
1128 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; 1128 iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
1129 1129
1130 if (priv->mac80211_registered && 1130 if (priv->mac80211_registered &&
1131 (iwl_queue_space(&txq->q) > txq->q.low_mark) && 1131 (iwl_queue_space(&txq->q) > txq->q.low_mark) &&
@@ -1153,16 +1153,14 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
1153 tx_resp->failure_frame); 1153 tx_resp->failure_frame);
1154 1154
1155 freed = iwl_tx_queue_reclaim(priv, txq_id, index); 1155 freed = iwl_tx_queue_reclaim(priv, txq_id, index);
1156 if (ieee80211_is_data_qos(tx_resp->frame_ctrl)) 1156 iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
1157 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
1158 1157
1159 if (priv->mac80211_registered && 1158 if (priv->mac80211_registered &&
1160 (iwl_queue_space(&txq->q) > txq->q.low_mark)) 1159 (iwl_queue_space(&txq->q) > txq->q.low_mark))
1161 iwl_wake_queue(priv, txq_id); 1160 iwl_wake_queue(priv, txq_id);
1162 } 1161 }
1163 1162
1164 if (ieee80211_is_data_qos(tx_resp->frame_ctrl)) 1163 iwl_txq_check_empty(priv, sta_id, tid, txq_id);
1165 iwl_txq_check_empty(priv, sta_id, tid, txq_id);
1166 1164
1167 if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) 1165 if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK))
1168 IWL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n"); 1166 IWL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 5461f105bd2d..f36f804804fc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -2745,6 +2745,7 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
2745 priv->staging_rxon.flags = 0; 2745 priv->staging_rxon.flags = 0;
2746 2746
2747 iwl_set_rxon_channel(priv, conf->channel); 2747 iwl_set_rxon_channel(priv, conf->channel);
2748 iwl_set_rxon_ht(priv, ht_conf);
2748 2749
2749 iwl_set_flags_for_band(priv, conf->channel->band); 2750 iwl_set_flags_for_band(priv, conf->channel->band);
2750 spin_unlock_irqrestore(&priv->lock, flags); 2751 spin_unlock_irqrestore(&priv->lock, flags);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 27ca859e7453..b69e972671b2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -446,6 +446,8 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv);
446int iwl_hw_tx_queue_init(struct iwl_priv *priv, 446int iwl_hw_tx_queue_init(struct iwl_priv *priv,
447 struct iwl_tx_queue *txq); 447 struct iwl_tx_queue *txq);
448int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq); 448int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq);
449void iwl_free_tfds_in_queue(struct iwl_priv *priv,
450 int sta_id, int tid, int freed);
449int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, 451int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
450 int slots_num, u32 txq_id); 452 int slots_num, u32 txq_id);
451void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id); 453void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id);
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 6f36b6e79f5e..2dbce85404aa 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -928,7 +928,10 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv,
928 if (ieee80211_is_mgmt(fc) || 928 if (ieee80211_is_mgmt(fc) ||
929 ieee80211_has_protected(fc) || 929 ieee80211_has_protected(fc) ||
930 ieee80211_has_morefrags(fc) || 930 ieee80211_has_morefrags(fc) ||
931 le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) 931 le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG ||
932 (ieee80211_is_data_qos(fc) &&
933 *ieee80211_get_qos_ctl(hdr) &
934 IEEE80211_QOS_CONTROL_A_MSDU_PRESENT))
932 ret = skb_linearize(skb); 935 ret = skb_linearize(skb);
933 else 936 else
934 ret = __pskb_pull_tail(skb, min_t(u16, IWL_LINK_HDR_MAX, len)) ? 937 ret = __pskb_pull_tail(skb, min_t(u16, IWL_LINK_HDR_MAX, len)) ?
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 87ce2bd292c7..8f4071562857 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -120,6 +120,20 @@ int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq)
120EXPORT_SYMBOL(iwl_txq_update_write_ptr); 120EXPORT_SYMBOL(iwl_txq_update_write_ptr);
121 121
122 122
123void iwl_free_tfds_in_queue(struct iwl_priv *priv,
124 int sta_id, int tid, int freed)
125{
126 if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed)
127 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
128 else {
129 IWL_ERR(priv, "free more than tfds_in_queue (%u:%d)\n",
130 priv->stations[sta_id].tid[tid].tfds_in_queue,
131 freed);
132 priv->stations[sta_id].tid[tid].tfds_in_queue = 0;
133 }
134}
135EXPORT_SYMBOL(iwl_free_tfds_in_queue);
136
123/** 137/**
124 * iwl_tx_queue_free - Deallocate DMA queue. 138 * iwl_tx_queue_free - Deallocate DMA queue.
125 * @txq: Transmit queue to deallocate. 139 * @txq: Transmit queue to deallocate.
@@ -1131,6 +1145,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
1131 struct iwl_queue *q = &txq->q; 1145 struct iwl_queue *q = &txq->q;
1132 struct iwl_tx_info *tx_info; 1146 struct iwl_tx_info *tx_info;
1133 int nfreed = 0; 1147 int nfreed = 0;
1148 struct ieee80211_hdr *hdr;
1134 1149
1135 if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) { 1150 if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) {
1136 IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " 1151 IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, "
@@ -1145,13 +1160,16 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
1145 1160
1146 tx_info = &txq->txb[txq->q.read_ptr]; 1161 tx_info = &txq->txb[txq->q.read_ptr];
1147 iwl_tx_status(priv, tx_info->skb[0]); 1162 iwl_tx_status(priv, tx_info->skb[0]);
1163
1164 hdr = (struct ieee80211_hdr *)tx_info->skb[0]->data;
1165 if (hdr && ieee80211_is_data_qos(hdr->frame_control))
1166 nfreed++;
1148 tx_info->skb[0] = NULL; 1167 tx_info->skb[0] = NULL;
1149 1168
1150 if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl) 1169 if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl)
1151 priv->cfg->ops->lib->txq_inval_byte_cnt_tbl(priv, txq); 1170 priv->cfg->ops->lib->txq_inval_byte_cnt_tbl(priv, txq);
1152 1171
1153 priv->cfg->ops->lib->txq_free_tfd(priv, txq); 1172 priv->cfg->ops->lib->txq_free_tfd(priv, txq);
1154 nfreed++;
1155 } 1173 }
1156 return nfreed; 1174 return nfreed;
1157} 1175}
@@ -1559,7 +1577,7 @@ void iwl_rx_reply_compressed_ba(struct iwl_priv *priv,
1559 if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { 1577 if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) {
1560 /* calculate mac80211 ampdu sw queue to wake */ 1578 /* calculate mac80211 ampdu sw queue to wake */
1561 int freed = iwl_tx_queue_reclaim(priv, scd_flow, index); 1579 int freed = iwl_tx_queue_reclaim(priv, scd_flow, index);
1562 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; 1580 iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
1563 1581
1564 if ((iwl_queue_space(&txq->q) > txq->q.low_mark) && 1582 if ((iwl_queue_space(&txq->q) > txq->q.low_mark) &&
1565 priv->mac80211_registered && 1583 priv->mac80211_registered &&
diff --git a/drivers/net/wireless/iwmc3200wifi/rx.c b/drivers/net/wireless/iwmc3200wifi/rx.c
index 6d6ed7485175..f727b4a83196 100644
--- a/drivers/net/wireless/iwmc3200wifi/rx.c
+++ b/drivers/net/wireless/iwmc3200wifi/rx.c
@@ -794,7 +794,7 @@ static int iwm_mlme_update_bss_table(struct iwm_priv *iwm, u8 *buf,
794 } 794 }
795 795
796 bss->bss = kzalloc(bss_len, GFP_KERNEL); 796 bss->bss = kzalloc(bss_len, GFP_KERNEL);
797 if (!bss) { 797 if (!bss->bss) {
798 kfree(bss); 798 kfree(bss);
799 IWM_ERR(iwm, "Couldn't allocate bss\n"); 799 IWM_ERR(iwm, "Couldn't allocate bss\n");
800 return -ENOMEM; 800 return -ENOMEM;
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index bc5726dd5fe4..7ba3052b0708 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -65,6 +65,7 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
65 /* Sitecom */ 65 /* Sitecom */
66 {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187}, 66 {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187},
67 {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B}, 67 {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B},
68 {USB_DEVICE(0x0df6, 0x0029), .driver_info = DEVICE_RTL8187B},
68 /* Sphairon Access Systems GmbH */ 69 /* Sphairon Access Systems GmbH */
69 {USB_DEVICE(0x114B, 0x0150), .driver_info = DEVICE_RTL8187}, 70 {USB_DEVICE(0x114B, 0x0150), .driver_info = DEVICE_RTL8187},
70 /* Dick Smith Electronics */ 71 /* Dick Smith Electronics */