aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-01-12 23:53:29 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-01-12 23:53:29 -0500
commit597d8c717856f6094837850f3eb4850820b36451 (patch)
tree44c1b1115df6a80f6cee3684a01cdbc18b034134 /drivers
parent682137f7e6bc78e3c324874c0c213123ddc5e261 (diff)
parent9db2f1bec36805e57a003f7bb90e003815d96de8 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (56 commits) sky2: Fix oops in sky2_xmit_frame() after TX timeout Documentation/3c509: document ethtool support af_packet: Don't use skb after dev_queue_xmit() vxge: use pci_dma_mapping_error to test return value netfilter: ebtables: enforce CAP_NET_ADMIN e1000e: fix and commonize code for setting the receive address registers e1000e: e1000e_enable_tx_pkt_filtering() returns wrong value e1000e: perform 10/100 adaptive IFS only on parts that support it e1000e: don't accumulate PHY statistics on PHY read failure e1000e: call pci_save_state() after pci_restore_state() netxen: update version to 4.0.72 netxen: fix set mac addr netxen: fix smatch warning netxen: fix tx ring memory leak tcp: update the netstamp_needed counter when cloning sockets TI DaVinci EMAC: Handle emac module clock correctly. dmfe/tulip: Let dmfe handle DM910x except for SPARC on-board chips ixgbe: Fix compiler warning about variable being used uninitialized netfilter: nf_ct_ftp: fix out of bounds read in update_nl_seq() mv643xx_eth: don't include cache padding in rx desc buffer size ... Fix trivial conflict in drivers/scsi/cxgb3i/cxgb3i_offload.c
Diffstat (limited to 'drivers')
-rw-r--r--drivers/isdn/hardware/mISDN/hfcmulti.c2
-rw-r--r--drivers/net/atarilance.c2
-rw-r--r--drivers/net/atlx/atl2.c7
-rw-r--r--drivers/net/can/mcp251x.c2
-rw-r--r--drivers/net/cs89x0.c3
-rw-r--r--drivers/net/davinci_emac.c4
-rw-r--r--drivers/net/e1000e/82571.c2
-rw-r--r--drivers/net/e1000e/es2lan.c2
-rw-r--r--drivers/net/e1000e/hw.h1
-rw-r--r--drivers/net/e1000e/ich8lan.c2
-rw-r--r--drivers/net/e1000e/lib.c54
-rw-r--r--drivers/net/e1000e/netdev.c30
-rw-r--r--drivers/net/fsl_pq_mdio.c30
-rw-r--r--drivers/net/hamradio/bpqether.c4
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c9
-rw-r--r--drivers/net/ll_temac_main.c2
-rw-r--r--drivers/net/mv643xx_eth.c6
-rw-r--r--drivers/net/netxen/netxen_nic.h4
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c193
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c6
-rw-r--r--drivers/net/netxen/netxen_nic_init.c4
-rw-r--r--drivers/net/netxen/netxen_nic_main.c10
-rw-r--r--drivers/net/niu.c2
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c1
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c4
-rw-r--r--drivers/net/phy/broadcom.c4
-rw-r--r--drivers/net/phy/mdio_bus.c72
-rw-r--r--drivers/net/phy/phy_device.c30
-rw-r--r--drivers/net/rrunner.c2
-rw-r--r--drivers/net/sh_eth.c2
-rw-r--r--drivers/net/sky2.c3
-rw-r--r--drivers/net/tulip/Kconfig4
-rw-r--r--drivers/net/tulip/dmfe.c21
-rw-r--r--drivers/net/tulip/tulip_core.c32
-rw-r--r--drivers/net/ucc_geth.c3
-rw-r--r--drivers/net/ucc_geth.h13
-rw-r--r--drivers/net/usb/hso.c105
-rw-r--r--drivers/net/usb/rtl8150.c4
-rw-r--r--drivers/net/via-velocity.c8
-rw-r--r--drivers/net/vxge/vxge-main.c2
-rw-r--r--drivers/s390/net/claw.c2
-rw-r--r--drivers/serial/serial_cs.c15
42 files changed, 436 insertions, 272 deletions
diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
index a6624ad252c5..1a1420d7a828 100644
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -3152,7 +3152,7 @@ static void
3152hfcmulti_pcm(struct hfc_multi *hc, int ch, int slot_tx, int bank_tx, 3152hfcmulti_pcm(struct hfc_multi *hc, int ch, int slot_tx, int bank_tx,
3153 int slot_rx, int bank_rx) 3153 int slot_rx, int bank_rx)
3154{ 3154{
3155 if (slot_rx < 0 || slot_rx < 0 || bank_tx < 0 || bank_rx < 0) { 3155 if (slot_tx < 0 || slot_rx < 0 || bank_tx < 0 || bank_rx < 0) {
3156 /* disable PCM */ 3156 /* disable PCM */
3157 mode_hfcmulti(hc, ch, hc->chan[ch].protocol, -1, 0, -1, 0); 3157 mode_hfcmulti(hc, ch, hc->chan[ch].protocol, -1, 0, -1, 0);
3158 return; 3158 return;
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c
index c5721cb38265..cc9ed8643910 100644
--- a/drivers/net/atarilance.c
+++ b/drivers/net/atarilance.c
@@ -663,7 +663,7 @@ static int lance_open( struct net_device *dev )
663 while (--i > 0) 663 while (--i > 0)
664 if (DREG & CSR0_IDON) 664 if (DREG & CSR0_IDON)
665 break; 665 break;
666 if (i < 0 || (DREG & CSR0_ERR)) { 666 if (i <= 0 || (DREG & CSR0_ERR)) {
667 DPRINTK( 2, ( "lance_open(): opening %s failed, i=%d, csr0=%04x\n", 667 DPRINTK( 2, ( "lance_open(): opening %s failed, i=%d, csr0=%04x\n",
668 dev->name, i, DREG )); 668 dev->name, i, DREG ));
669 DREG = CSR0_STOP; 669 DREG = CSR0_STOP;
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index c0451d75cdcf..ec52529394ad 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -1959,12 +1959,15 @@ static int atl2_get_eeprom(struct net_device *netdev,
1959 return -ENOMEM; 1959 return -ENOMEM;
1960 1960
1961 for (i = first_dword; i < last_dword; i++) { 1961 for (i = first_dword; i < last_dword; i++) {
1962 if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) 1962 if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) {
1963 return -EIO; 1963 ret_val = -EIO;
1964 goto free;
1965 }
1964 } 1966 }
1965 1967
1966 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3), 1968 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3),
1967 eeprom->len); 1969 eeprom->len);
1970free:
1968 kfree(eeprom_buff); 1971 kfree(eeprom_buff);
1969 1972
1970 return ret_val; 1973 return ret_val;
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 9c5a1537939c..1a72ca066a17 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -990,7 +990,7 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi)
990 goto error_tx_buf; 990 goto error_tx_buf;
991 } 991 }
992 priv->spi_rx_buf = kmalloc(SPI_TRANSFER_BUF_LEN, GFP_KERNEL); 992 priv->spi_rx_buf = kmalloc(SPI_TRANSFER_BUF_LEN, GFP_KERNEL);
993 if (!priv->spi_tx_buf) { 993 if (!priv->spi_rx_buf) {
994 ret = -ENOMEM; 994 ret = -ENOMEM;
995 goto error_rx_buf; 995 goto error_rx_buf;
996 } 996 }
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index af9321617ce4..0e79cef95c0a 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -1325,8 +1325,7 @@ net_open(struct net_device *dev)
1325 write_irq(dev, lp->chip_type, dev->irq); 1325 write_irq(dev, lp->chip_type, dev->irq);
1326 ret = request_irq(dev->irq, net_interrupt, 0, dev->name, dev); 1326 ret = request_irq(dev->irq, net_interrupt, 0, dev->name, dev);
1327 if (ret) { 1327 if (ret) {
1328 if (net_debug) 1328 printk(KERN_ERR "cs89x0: request_irq(%d) failed\n", dev->irq);
1329 printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq);
1330 goto bad_out; 1329 goto bad_out;
1331 } 1330 }
1332 } 1331 }
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 34e03104c3c1..33c4fe26178c 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2711,6 +2711,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
2711 SET_ETHTOOL_OPS(ndev, &ethtool_ops); 2711 SET_ETHTOOL_OPS(ndev, &ethtool_ops);
2712 netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT); 2712 netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT);
2713 2713
2714 clk_enable(emac_clk);
2715
2714 /* register the network device */ 2716 /* register the network device */
2715 SET_NETDEV_DEV(ndev, &pdev->dev); 2717 SET_NETDEV_DEV(ndev, &pdev->dev);
2716 rc = register_netdev(ndev); 2718 rc = register_netdev(ndev);
@@ -2720,7 +2722,6 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
2720 goto netdev_reg_err; 2722 goto netdev_reg_err;
2721 } 2723 }
2722 2724
2723 clk_enable(emac_clk);
2724 2725
2725 /* MII/Phy intialisation, mdio bus registration */ 2726 /* MII/Phy intialisation, mdio bus registration */
2726 emac_mii = mdiobus_alloc(); 2727 emac_mii = mdiobus_alloc();
@@ -2760,6 +2761,7 @@ mdiobus_quit:
2760 2761
2761netdev_reg_err: 2762netdev_reg_err:
2762mdio_alloc_err: 2763mdio_alloc_err:
2764 clk_disable(emac_clk);
2763no_irq_res: 2765no_irq_res:
2764 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2766 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2765 release_mem_region(res->start, res->end - res->start + 1); 2767 release_mem_region(res->start, res->end - res->start + 1);
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index b979464091bb..02d67d047d96 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -237,6 +237,8 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
237 /* Set if manageability features are enabled. */ 237 /* Set if manageability features are enabled. */
238 mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) 238 mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK)
239 ? true : false; 239 ? true : false;
240 /* Adaptive IFS supported */
241 mac->adaptive_ifs = true;
240 242
241 /* check for link */ 243 /* check for link */
242 switch (hw->phy.media_type) { 244 switch (hw->phy.media_type) {
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index 3028f23da891..e2aa3b788564 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -224,6 +224,8 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)
224 /* Set if manageability features are enabled. */ 224 /* Set if manageability features are enabled. */
225 mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) 225 mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK)
226 ? true : false; 226 ? true : false;
227 /* Adaptive IFS not supported */
228 mac->adaptive_ifs = false;
227 229
228 /* check for link */ 230 /* check for link */
229 switch (hw->phy.media_type) { 231 switch (hw->phy.media_type) {
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index 2784cf44a6f3..eccf29b75c41 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -818,6 +818,7 @@ struct e1000_mac_info {
818 818
819 u8 forced_speed_duplex; 819 u8 forced_speed_duplex;
820 820
821 bool adaptive_ifs;
821 bool arc_subsystem_valid; 822 bool arc_subsystem_valid;
822 bool autoneg; 823 bool autoneg;
823 bool autoneg_failed; 824 bool autoneg_failed;
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 9b09246af064..ad08cf3f40c0 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -454,6 +454,8 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
454 mac->rar_entry_count--; 454 mac->rar_entry_count--;
455 /* Set if manageability features are enabled. */ 455 /* Set if manageability features are enabled. */
456 mac->arc_subsystem_valid = true; 456 mac->arc_subsystem_valid = true;
457 /* Adaptive IFS supported */
458 mac->adaptive_ifs = true;
457 459
458 /* LED operations */ 460 /* LED operations */
459 switch (mac->type) { 461 switch (mac->type) {
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index a86c17548c1e..2fa9b36a2c5a 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -125,6 +125,7 @@ void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value)
125void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count) 125void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
126{ 126{
127 u32 i; 127 u32 i;
128 u8 mac_addr[ETH_ALEN] = {0};
128 129
129 /* Setup the receive address */ 130 /* Setup the receive address */
130 e_dbg("Programming MAC Address into RAR[0]\n"); 131 e_dbg("Programming MAC Address into RAR[0]\n");
@@ -133,12 +134,8 @@ void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
133 134
134 /* Zero out the other (rar_entry_count - 1) receive addresses */ 135 /* Zero out the other (rar_entry_count - 1) receive addresses */
135 e_dbg("Clearing RAR[1-%u]\n", rar_count-1); 136 e_dbg("Clearing RAR[1-%u]\n", rar_count-1);
136 for (i = 1; i < rar_count; i++) { 137 for (i = 1; i < rar_count; i++)
137 E1000_WRITE_REG_ARRAY(hw, E1000_RA, (i << 1), 0); 138 e1000e_rar_set(hw, mac_addr, i);
138 e1e_flush();
139 E1000_WRITE_REG_ARRAY(hw, E1000_RA, ((i << 1) + 1), 0);
140 e1e_flush();
141 }
142} 139}
143 140
144/** 141/**
@@ -164,10 +161,19 @@ void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
164 161
165 rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); 162 rar_high = ((u32) addr[4] | ((u32) addr[5] << 8));
166 163
167 rar_high |= E1000_RAH_AV; 164 /* If MAC address zero, no need to set the AV bit */
165 if (rar_low || rar_high)
166 rar_high |= E1000_RAH_AV;
168 167
169 E1000_WRITE_REG_ARRAY(hw, E1000_RA, (index << 1), rar_low); 168 /*
170 E1000_WRITE_REG_ARRAY(hw, E1000_RA, ((index << 1) + 1), rar_high); 169 * Some bridges will combine consecutive 32-bit writes into
170 * a single burst write, which will malfunction on some parts.
171 * The flushes avoid this.
172 */
173 ew32(RAL(index), rar_low);
174 e1e_flush();
175 ew32(RAH(index), rar_high);
176 e1e_flush();
171} 177}
172 178
173/** 179/**
@@ -1609,6 +1615,11 @@ void e1000e_reset_adaptive(struct e1000_hw *hw)
1609{ 1615{
1610 struct e1000_mac_info *mac = &hw->mac; 1616 struct e1000_mac_info *mac = &hw->mac;
1611 1617
1618 if (!mac->adaptive_ifs) {
1619 e_dbg("Not in Adaptive IFS mode!\n");
1620 goto out;
1621 }
1622
1612 mac->current_ifs_val = 0; 1623 mac->current_ifs_val = 0;
1613 mac->ifs_min_val = IFS_MIN; 1624 mac->ifs_min_val = IFS_MIN;
1614 mac->ifs_max_val = IFS_MAX; 1625 mac->ifs_max_val = IFS_MAX;
@@ -1617,6 +1628,8 @@ void e1000e_reset_adaptive(struct e1000_hw *hw)
1617 1628
1618 mac->in_ifs_mode = false; 1629 mac->in_ifs_mode = false;
1619 ew32(AIT, 0); 1630 ew32(AIT, 0);
1631out:
1632 return;
1620} 1633}
1621 1634
1622/** 1635/**
@@ -1630,6 +1643,11 @@ void e1000e_update_adaptive(struct e1000_hw *hw)
1630{ 1643{
1631 struct e1000_mac_info *mac = &hw->mac; 1644 struct e1000_mac_info *mac = &hw->mac;
1632 1645
1646 if (!mac->adaptive_ifs) {
1647 e_dbg("Not in Adaptive IFS mode!\n");
1648 goto out;
1649 }
1650
1633 if ((mac->collision_delta * mac->ifs_ratio) > mac->tx_packet_delta) { 1651 if ((mac->collision_delta * mac->ifs_ratio) > mac->tx_packet_delta) {
1634 if (mac->tx_packet_delta > MIN_NUM_XMITS) { 1652 if (mac->tx_packet_delta > MIN_NUM_XMITS) {
1635 mac->in_ifs_mode = true; 1653 mac->in_ifs_mode = true;
@@ -1650,6 +1668,8 @@ void e1000e_update_adaptive(struct e1000_hw *hw)
1650 ew32(AIT, 0); 1668 ew32(AIT, 0);
1651 } 1669 }
1652 } 1670 }
1671out:
1672 return;
1653} 1673}
1654 1674
1655/** 1675/**
@@ -2287,10 +2307,12 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
2287 s32 ret_val, hdr_csum, csum; 2307 s32 ret_val, hdr_csum, csum;
2288 u8 i, len; 2308 u8 i, len;
2289 2309
2310 hw->mac.tx_pkt_filtering = true;
2311
2290 /* No manageability, no filtering */ 2312 /* No manageability, no filtering */
2291 if (!e1000e_check_mng_mode(hw)) { 2313 if (!e1000e_check_mng_mode(hw)) {
2292 hw->mac.tx_pkt_filtering = false; 2314 hw->mac.tx_pkt_filtering = false;
2293 return 0; 2315 goto out;
2294 } 2316 }
2295 2317
2296 /* 2318 /*
@@ -2298,9 +2320,9 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
2298 * reason, disable filtering. 2320 * reason, disable filtering.
2299 */ 2321 */
2300 ret_val = e1000_mng_enable_host_if(hw); 2322 ret_val = e1000_mng_enable_host_if(hw);
2301 if (ret_val != 0) { 2323 if (ret_val) {
2302 hw->mac.tx_pkt_filtering = false; 2324 hw->mac.tx_pkt_filtering = false;
2303 return ret_val; 2325 goto out;
2304 } 2326 }
2305 2327
2306 /* Read in the header. Length and offset are in dwords. */ 2328 /* Read in the header. Length and offset are in dwords. */
@@ -2319,17 +2341,17 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
2319 */ 2341 */
2320 if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) { 2342 if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) {
2321 hw->mac.tx_pkt_filtering = true; 2343 hw->mac.tx_pkt_filtering = true;
2322 return 1; 2344 goto out;
2323 } 2345 }
2324 2346
2325 /* Cookie area is valid, make the final check for filtering. */ 2347 /* Cookie area is valid, make the final check for filtering. */
2326 if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) { 2348 if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) {
2327 hw->mac.tx_pkt_filtering = false; 2349 hw->mac.tx_pkt_filtering = false;
2328 return 0; 2350 goto out;
2329 } 2351 }
2330 2352
2331 hw->mac.tx_pkt_filtering = true; 2353out:
2332 return 1; 2354 return hw->mac.tx_pkt_filtering;
2333} 2355}
2334 2356
2335/** 2357/**
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 762b697ce731..c45965a256b6 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -3315,24 +3315,24 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3315 if ((hw->phy.type == e1000_phy_82578) || 3315 if ((hw->phy.type == e1000_phy_82578) ||
3316 (hw->phy.type == e1000_phy_82577)) { 3316 (hw->phy.type == e1000_phy_82577)) {
3317 e1e_rphy(hw, HV_SCC_UPPER, &phy_data); 3317 e1e_rphy(hw, HV_SCC_UPPER, &phy_data);
3318 e1e_rphy(hw, HV_SCC_LOWER, &phy_data); 3318 if (!e1e_rphy(hw, HV_SCC_LOWER, &phy_data))
3319 adapter->stats.scc += phy_data; 3319 adapter->stats.scc += phy_data;
3320 3320
3321 e1e_rphy(hw, HV_ECOL_UPPER, &phy_data); 3321 e1e_rphy(hw, HV_ECOL_UPPER, &phy_data);
3322 e1e_rphy(hw, HV_ECOL_LOWER, &phy_data); 3322 if (!e1e_rphy(hw, HV_ECOL_LOWER, &phy_data))
3323 adapter->stats.ecol += phy_data; 3323 adapter->stats.ecol += phy_data;
3324 3324
3325 e1e_rphy(hw, HV_MCC_UPPER, &phy_data); 3325 e1e_rphy(hw, HV_MCC_UPPER, &phy_data);
3326 e1e_rphy(hw, HV_MCC_LOWER, &phy_data); 3326 if (!e1e_rphy(hw, HV_MCC_LOWER, &phy_data))
3327 adapter->stats.mcc += phy_data; 3327 adapter->stats.mcc += phy_data;
3328 3328
3329 e1e_rphy(hw, HV_LATECOL_UPPER, &phy_data); 3329 e1e_rphy(hw, HV_LATECOL_UPPER, &phy_data);
3330 e1e_rphy(hw, HV_LATECOL_LOWER, &phy_data); 3330 if (!e1e_rphy(hw, HV_LATECOL_LOWER, &phy_data))
3331 adapter->stats.latecol += phy_data; 3331 adapter->stats.latecol += phy_data;
3332 3332
3333 e1e_rphy(hw, HV_DC_UPPER, &phy_data); 3333 e1e_rphy(hw, HV_DC_UPPER, &phy_data);
3334 e1e_rphy(hw, HV_DC_LOWER, &phy_data); 3334 if (!e1e_rphy(hw, HV_DC_LOWER, &phy_data))
3335 adapter->stats.dc += phy_data; 3335 adapter->stats.dc += phy_data;
3336 } else { 3336 } else {
3337 adapter->stats.scc += er32(SCC); 3337 adapter->stats.scc += er32(SCC);
3338 adapter->stats.ecol += er32(ECOL); 3338 adapter->stats.ecol += er32(ECOL);
@@ -3360,8 +3360,8 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3360 if ((hw->phy.type == e1000_phy_82578) || 3360 if ((hw->phy.type == e1000_phy_82578) ||
3361 (hw->phy.type == e1000_phy_82577)) { 3361 (hw->phy.type == e1000_phy_82577)) {
3362 e1e_rphy(hw, HV_COLC_UPPER, &phy_data); 3362 e1e_rphy(hw, HV_COLC_UPPER, &phy_data);
3363 e1e_rphy(hw, HV_COLC_LOWER, &phy_data); 3363 if (!e1e_rphy(hw, HV_COLC_LOWER, &phy_data))
3364 hw->mac.collision_delta = phy_data; 3364 hw->mac.collision_delta = phy_data;
3365 } else { 3365 } else {
3366 hw->mac.collision_delta = er32(COLC); 3366 hw->mac.collision_delta = er32(COLC);
3367 } 3367 }
@@ -3372,8 +3372,8 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3372 if ((hw->phy.type == e1000_phy_82578) || 3372 if ((hw->phy.type == e1000_phy_82578) ||
3373 (hw->phy.type == e1000_phy_82577)) { 3373 (hw->phy.type == e1000_phy_82577)) {
3374 e1e_rphy(hw, HV_TNCRS_UPPER, &phy_data); 3374 e1e_rphy(hw, HV_TNCRS_UPPER, &phy_data);
3375 e1e_rphy(hw, HV_TNCRS_LOWER, &phy_data); 3375 if (!e1e_rphy(hw, HV_TNCRS_LOWER, &phy_data))
3376 adapter->stats.tncrs += phy_data; 3376 adapter->stats.tncrs += phy_data;
3377 } else { 3377 } else {
3378 if ((hw->mac.type != e1000_82574) && 3378 if ((hw->mac.type != e1000_82574) &&
3379 (hw->mac.type != e1000_82583)) 3379 (hw->mac.type != e1000_82583))
@@ -4674,6 +4674,7 @@ static int e1000_resume(struct pci_dev *pdev)
4674 4674
4675 pci_set_power_state(pdev, PCI_D0); 4675 pci_set_power_state(pdev, PCI_D0);
4676 pci_restore_state(pdev); 4676 pci_restore_state(pdev);
4677 pci_save_state(pdev);
4677 e1000e_disable_l1aspm(pdev); 4678 e1000e_disable_l1aspm(pdev);
4678 4679
4679 err = pci_enable_device_mem(pdev); 4680 err = pci_enable_device_mem(pdev);
@@ -4825,6 +4826,7 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
4825 } else { 4826 } else {
4826 pci_set_master(pdev); 4827 pci_set_master(pdev);
4827 pci_restore_state(pdev); 4828 pci_restore_state(pdev);
4829 pci_save_state(pdev);
4828 4830
4829 pci_enable_wake(pdev, PCI_D3hot, 0); 4831 pci_enable_wake(pdev, PCI_D3hot, 0);
4830 pci_enable_wake(pdev, PCI_D3cold, 0); 4832 pci_enable_wake(pdev, PCI_D3cold, 0);
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index 25fabb3eedc5..d5160edf2fcf 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -46,6 +46,11 @@
46#include "gianfar.h" 46#include "gianfar.h"
47#include "fsl_pq_mdio.h" 47#include "fsl_pq_mdio.h"
48 48
49struct fsl_pq_mdio_priv {
50 void __iomem *map;
51 struct fsl_pq_mdio __iomem *regs;
52};
53
49/* 54/*
50 * Write value to the PHY at mii_id at register regnum, 55 * Write value to the PHY at mii_id at register regnum,
51 * on the bus attached to the local interface, which may be different from the 56 * on the bus attached to the local interface, which may be different from the
@@ -105,7 +110,9 @@ int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs,
105 110
106static struct fsl_pq_mdio __iomem *fsl_pq_mdio_get_regs(struct mii_bus *bus) 111static struct fsl_pq_mdio __iomem *fsl_pq_mdio_get_regs(struct mii_bus *bus)
107{ 112{
108 return (void __iomem __force *)bus->priv; 113 struct fsl_pq_mdio_priv *priv = bus->priv;
114
115 return priv->regs;
109} 116}
110 117
111/* 118/*
@@ -266,6 +273,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
266{ 273{
267 struct device_node *np = ofdev->node; 274 struct device_node *np = ofdev->node;
268 struct device_node *tbi; 275 struct device_node *tbi;
276 struct fsl_pq_mdio_priv *priv;
269 struct fsl_pq_mdio __iomem *regs = NULL; 277 struct fsl_pq_mdio __iomem *regs = NULL;
270 void __iomem *map; 278 void __iomem *map;
271 u32 __iomem *tbipa; 279 u32 __iomem *tbipa;
@@ -274,14 +282,19 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
274 u64 addr = 0, size = 0; 282 u64 addr = 0, size = 0;
275 int err = 0; 283 int err = 0;
276 284
285 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
286 if (!priv)
287 return -ENOMEM;
288
277 new_bus = mdiobus_alloc(); 289 new_bus = mdiobus_alloc();
278 if (NULL == new_bus) 290 if (NULL == new_bus)
279 return -ENOMEM; 291 goto err_free_priv;
280 292
281 new_bus->name = "Freescale PowerQUICC MII Bus", 293 new_bus->name = "Freescale PowerQUICC MII Bus",
282 new_bus->read = &fsl_pq_mdio_read, 294 new_bus->read = &fsl_pq_mdio_read,
283 new_bus->write = &fsl_pq_mdio_write, 295 new_bus->write = &fsl_pq_mdio_write,
284 new_bus->reset = &fsl_pq_mdio_reset, 296 new_bus->reset = &fsl_pq_mdio_reset,
297 new_bus->priv = priv;
285 fsl_pq_mdio_bus_name(new_bus->id, np); 298 fsl_pq_mdio_bus_name(new_bus->id, np);
286 299
287 /* Set the PHY base address */ 300 /* Set the PHY base address */
@@ -291,6 +304,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
291 err = -ENOMEM; 304 err = -ENOMEM;
292 goto err_free_bus; 305 goto err_free_bus;
293 } 306 }
307 priv->map = map;
294 308
295 if (of_device_is_compatible(np, "fsl,gianfar-mdio") || 309 if (of_device_is_compatible(np, "fsl,gianfar-mdio") ||
296 of_device_is_compatible(np, "fsl,gianfar-tbi") || 310 of_device_is_compatible(np, "fsl,gianfar-tbi") ||
@@ -298,8 +312,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
298 of_device_is_compatible(np, "ucc_geth_phy")) 312 of_device_is_compatible(np, "ucc_geth_phy"))
299 map -= offsetof(struct fsl_pq_mdio, miimcfg); 313 map -= offsetof(struct fsl_pq_mdio, miimcfg);
300 regs = map; 314 regs = map;
301 315 priv->regs = regs;
302 new_bus->priv = (void __force *)regs;
303 316
304 new_bus->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL); 317 new_bus->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
305 318
@@ -392,10 +405,11 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
392err_free_irqs: 405err_free_irqs:
393 kfree(new_bus->irq); 406 kfree(new_bus->irq);
394err_unmap_regs: 407err_unmap_regs:
395 iounmap(regs); 408 iounmap(priv->map);
396err_free_bus: 409err_free_bus:
397 kfree(new_bus); 410 kfree(new_bus);
398 411err_free_priv:
412 kfree(priv);
399 return err; 413 return err;
400} 414}
401 415
@@ -404,14 +418,16 @@ static int fsl_pq_mdio_remove(struct of_device *ofdev)
404{ 418{
405 struct device *device = &ofdev->dev; 419 struct device *device = &ofdev->dev;
406 struct mii_bus *bus = dev_get_drvdata(device); 420 struct mii_bus *bus = dev_get_drvdata(device);
421 struct fsl_pq_mdio_priv *priv = bus->priv;
407 422
408 mdiobus_unregister(bus); 423 mdiobus_unregister(bus);
409 424
410 dev_set_drvdata(device, NULL); 425 dev_set_drvdata(device, NULL);
411 426
412 iounmap(fsl_pq_mdio_get_regs(bus)); 427 iounmap(priv->map);
413 bus->priv = NULL; 428 bus->priv = NULL;
414 mdiobus_free(bus); 429 mdiobus_free(bus);
430 kfree(priv);
415 431
416 return 0; 432 return 0;
417} 433}
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index ae5f11c8fc13..bdadf3e23c94 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -248,6 +248,7 @@ static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev)
248{ 248{
249 unsigned char *ptr; 249 unsigned char *ptr;
250 struct bpqdev *bpq; 250 struct bpqdev *bpq;
251 struct net_device *orig_dev;
251 int size; 252 int size;
252 253
253 /* 254 /*
@@ -282,8 +283,9 @@ static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev)
282 283
283 bpq = netdev_priv(dev); 284 bpq = netdev_priv(dev);
284 285
286 orig_dev = dev;
285 if ((dev = bpq_get_ether_dev(dev)) == NULL) { 287 if ((dev = bpq_get_ether_dev(dev)) == NULL) {
286 dev->stats.tx_dropped++; 288 orig_dev->stats.tx_dropped++;
287 kfree_skb(skb); 289 kfree_skb(skb);
288 return NETDEV_TX_OK; 290 return NETDEV_TX_OK;
289 } 291 }
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 1a2ea621e371..2ad754c864cf 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -262,10 +262,12 @@ static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter,
262 int reg_idx = tx_ring->reg_idx; 262 int reg_idx = tx_ring->reg_idx;
263 int dcb_i = adapter->ring_feature[RING_F_DCB].indices; 263 int dcb_i = adapter->ring_feature[RING_F_DCB].indices;
264 264
265 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { 265 switch (adapter->hw.mac.type) {
266 case ixgbe_mac_82598EB:
266 tc = reg_idx >> 2; 267 tc = reg_idx >> 2;
267 txoff = IXGBE_TFCS_TXOFF0; 268 txoff = IXGBE_TFCS_TXOFF0;
268 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { 269 break;
270 case ixgbe_mac_82599EB:
269 tc = 0; 271 tc = 0;
270 txoff = IXGBE_TFCS_TXOFF; 272 txoff = IXGBE_TFCS_TXOFF;
271 if (dcb_i == 8) { 273 if (dcb_i == 8) {
@@ -284,6 +286,9 @@ static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter,
284 tc += (reg_idx - 96) >> 4; 286 tc += (reg_idx - 96) >> 4;
285 } 287 }
286 } 288 }
289 break;
290 default:
291 tc = 0;
287 } 292 }
288 txoff <<= tc; 293 txoff <<= tc;
289 } 294 }
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
index 336e7c7a9275..a8522bd73ae7 100644
--- a/drivers/net/ll_temac_main.c
+++ b/drivers/net/ll_temac_main.c
@@ -134,7 +134,7 @@ static int temac_dma_bd_init(struct net_device *ndev)
134 struct sk_buff *skb; 134 struct sk_buff *skb;
135 int i; 135 int i;
136 136
137 lp->rx_skb = kzalloc(sizeof(struct sk_buff)*RX_BD_NUM, GFP_KERNEL); 137 lp->rx_skb = kzalloc(sizeof(*lp->rx_skb) * RX_BD_NUM, GFP_KERNEL);
138 /* allocate the tx and rx ring buffer descriptors. */ 138 /* allocate the tx and rx ring buffer descriptors. */
139 /* returns a virtual addres and a physical address. */ 139 /* returns a virtual addres and a physical address. */
140 lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent, 140 lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent,
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 1405a170bb43..af67af55efe7 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -656,6 +656,7 @@ static int rxq_refill(struct rx_queue *rxq, int budget)
656 struct sk_buff *skb; 656 struct sk_buff *skb;
657 int rx; 657 int rx;
658 struct rx_desc *rx_desc; 658 struct rx_desc *rx_desc;
659 int size;
659 660
660 skb = __skb_dequeue(&mp->rx_recycle); 661 skb = __skb_dequeue(&mp->rx_recycle);
661 if (skb == NULL) 662 if (skb == NULL)
@@ -678,10 +679,11 @@ static int rxq_refill(struct rx_queue *rxq, int budget)
678 679
679 rx_desc = rxq->rx_desc_area + rx; 680 rx_desc = rxq->rx_desc_area + rx;
680 681
682 size = skb->end - skb->data;
681 rx_desc->buf_ptr = dma_map_single(mp->dev->dev.parent, 683 rx_desc->buf_ptr = dma_map_single(mp->dev->dev.parent,
682 skb->data, mp->skb_size, 684 skb->data, size,
683 DMA_FROM_DEVICE); 685 DMA_FROM_DEVICE);
684 rx_desc->buf_size = mp->skb_size; 686 rx_desc->buf_size = size;
685 rxq->rx_skb[rx] = skb; 687 rxq->rx_skb[rx] = skb;
686 wmb(); 688 wmb();
687 rx_desc->cmd_sts = BUFFER_OWNED_BY_DMA | RX_ENABLE_INTERRUPT; 689 rx_desc->cmd_sts = BUFFER_OWNED_BY_DMA | RX_ENABLE_INTERRUPT;
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 76cd1f3e9fc8..9bc5bd1d538a 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -53,8 +53,8 @@
53 53
54#define _NETXEN_NIC_LINUX_MAJOR 4 54#define _NETXEN_NIC_LINUX_MAJOR 4
55#define _NETXEN_NIC_LINUX_MINOR 0 55#define _NETXEN_NIC_LINUX_MINOR 0
56#define _NETXEN_NIC_LINUX_SUBVERSION 65 56#define _NETXEN_NIC_LINUX_SUBVERSION 72
57#define NETXEN_NIC_LINUX_VERSIONID "4.0.65" 57#define NETXEN_NIC_LINUX_VERSIONID "4.0.72"
58 58
59#define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) 59#define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c))
60#define _major(v) (((v) >> 24) & 0xff) 60#define _major(v) (((v) >> 24) & 0xff)
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index ddd704ae0188..542f408333ff 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -66,7 +66,7 @@ static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = {
66 66
67#define NETXEN_NIC_TEST_LEN ARRAY_SIZE(netxen_nic_gstrings_test) 67#define NETXEN_NIC_TEST_LEN ARRAY_SIZE(netxen_nic_gstrings_test)
68 68
69#define NETXEN_NIC_REGS_COUNT 42 69#define NETXEN_NIC_REGS_COUNT 30
70#define NETXEN_NIC_REGS_LEN (NETXEN_NIC_REGS_COUNT * sizeof(__le32)) 70#define NETXEN_NIC_REGS_LEN (NETXEN_NIC_REGS_COUNT * sizeof(__le32))
71#define NETXEN_MAX_EEPROM_LEN 1024 71#define NETXEN_MAX_EEPROM_LEN 1024
72 72
@@ -312,150 +312,91 @@ static int netxen_nic_get_regs_len(struct net_device *dev)
312 return NETXEN_NIC_REGS_LEN; 312 return NETXEN_NIC_REGS_LEN;
313} 313}
314 314
315struct netxen_niu_regs {
316 __u32 reg[NETXEN_NIC_REGS_COUNT];
317};
318
319static struct netxen_niu_regs niu_registers[] = {
320 {
321 /* GB Mode */
322 {
323 NETXEN_NIU_GB_SERDES_RESET,
324 NETXEN_NIU_GB0_MII_MODE,
325 NETXEN_NIU_GB1_MII_MODE,
326 NETXEN_NIU_GB2_MII_MODE,
327 NETXEN_NIU_GB3_MII_MODE,
328 NETXEN_NIU_GB0_GMII_MODE,
329 NETXEN_NIU_GB1_GMII_MODE,
330 NETXEN_NIU_GB2_GMII_MODE,
331 NETXEN_NIU_GB3_GMII_MODE,
332 NETXEN_NIU_REMOTE_LOOPBACK,
333 NETXEN_NIU_GB0_HALF_DUPLEX,
334 NETXEN_NIU_GB1_HALF_DUPLEX,
335 NETXEN_NIU_RESET_SYS_FIFOS,
336 NETXEN_NIU_GB_CRC_DROP,
337 NETXEN_NIU_GB_DROP_WRONGADDR,
338 NETXEN_NIU_TEST_MUX_CTL,
339
340 NETXEN_NIU_GB_MAC_CONFIG_0(0),
341 NETXEN_NIU_GB_MAC_CONFIG_1(0),
342 NETXEN_NIU_GB_HALF_DUPLEX_CTRL(0),
343 NETXEN_NIU_GB_MAX_FRAME_SIZE(0),
344 NETXEN_NIU_GB_TEST_REG(0),
345 NETXEN_NIU_GB_MII_MGMT_CONFIG(0),
346 NETXEN_NIU_GB_MII_MGMT_COMMAND(0),
347 NETXEN_NIU_GB_MII_MGMT_ADDR(0),
348 NETXEN_NIU_GB_MII_MGMT_CTRL(0),
349 NETXEN_NIU_GB_MII_MGMT_STATUS(0),
350 NETXEN_NIU_GB_MII_MGMT_INDICATE(0),
351 NETXEN_NIU_GB_INTERFACE_CTRL(0),
352 NETXEN_NIU_GB_INTERFACE_STATUS(0),
353 NETXEN_NIU_GB_STATION_ADDR_0(0),
354 NETXEN_NIU_GB_STATION_ADDR_1(0),
355 -1,
356 }
357 },
358 {
359 /* XG Mode */
360 {
361 NETXEN_NIU_XG_SINGLE_TERM,
362 NETXEN_NIU_XG_DRIVE_HI,
363 NETXEN_NIU_XG_DRIVE_LO,
364 NETXEN_NIU_XG_DTX,
365 NETXEN_NIU_XG_DEQ,
366 NETXEN_NIU_XG_WORD_ALIGN,
367 NETXEN_NIU_XG_RESET,
368 NETXEN_NIU_XG_POWER_DOWN,
369 NETXEN_NIU_XG_RESET_PLL,
370 NETXEN_NIU_XG_SERDES_LOOPBACK,
371 NETXEN_NIU_XG_DO_BYTE_ALIGN,
372 NETXEN_NIU_XG_TX_ENABLE,
373 NETXEN_NIU_XG_RX_ENABLE,
374 NETXEN_NIU_XG_STATUS,
375 NETXEN_NIU_XG_PAUSE_THRESHOLD,
376 NETXEN_NIU_XGE_CONFIG_0,
377 NETXEN_NIU_XGE_CONFIG_1,
378 NETXEN_NIU_XGE_IPG,
379 NETXEN_NIU_XGE_STATION_ADDR_0_HI,
380 NETXEN_NIU_XGE_STATION_ADDR_0_1,
381 NETXEN_NIU_XGE_STATION_ADDR_1_LO,
382 NETXEN_NIU_XGE_STATUS,
383 NETXEN_NIU_XGE_MAX_FRAME_SIZE,
384 NETXEN_NIU_XGE_PAUSE_FRAME_VALUE,
385 NETXEN_NIU_XGE_TX_BYTE_CNT,
386 NETXEN_NIU_XGE_TX_FRAME_CNT,
387 NETXEN_NIU_XGE_RX_BYTE_CNT,
388 NETXEN_NIU_XGE_RX_FRAME_CNT,
389 NETXEN_NIU_XGE_AGGR_ERROR_CNT,
390 NETXEN_NIU_XGE_MULTICAST_FRAME_CNT,
391 NETXEN_NIU_XGE_UNICAST_FRAME_CNT,
392 NETXEN_NIU_XGE_CRC_ERROR_CNT,
393 NETXEN_NIU_XGE_OVERSIZE_FRAME_ERR,
394 NETXEN_NIU_XGE_UNDERSIZE_FRAME_ERR,
395 NETXEN_NIU_XGE_LOCAL_ERROR_CNT,
396 NETXEN_NIU_XGE_REMOTE_ERROR_CNT,
397 NETXEN_NIU_XGE_CONTROL_CHAR_CNT,
398 NETXEN_NIU_XGE_PAUSE_FRAME_CNT,
399 -1,
400 }
401 }
402};
403
404static void 315static void
405netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) 316netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
406{ 317{
407 struct netxen_adapter *adapter = netdev_priv(dev); 318 struct netxen_adapter *adapter = netdev_priv(dev);
408 __u32 mode, *regs_buff = p; 319 struct netxen_recv_context *recv_ctx = &adapter->recv_ctx;
409 int i, window; 320 struct nx_host_sds_ring *sds_ring;
321 u32 *regs_buff = p;
322 int ring, i = 0;
323 int port = adapter->physical_port;
410 324
411 memset(p, 0, NETXEN_NIC_REGS_LEN); 325 memset(p, 0, NETXEN_NIC_REGS_LEN);
326
412 regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) | 327 regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) |
413 (adapter->pdev)->device; 328 (adapter->pdev)->device;
414 /* which mode */
415 regs_buff[0] = NXRD32(adapter, NETXEN_NIU_MODE);
416 mode = regs_buff[0];
417
418 /* Common registers to all the modes */
419 regs_buff[2] = NXRD32(adapter, NETXEN_NIU_STRAP_VALUE_SAVE_HIGHER);
420 /* GB/XGB Mode */
421 mode = (mode / 2) - 1;
422 window = 0;
423 if (mode <= 1) {
424 for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) {
425 /* GB: port specific registers */
426 if (mode == 0 && i >= 19)
427 window = adapter->physical_port *
428 NETXEN_NIC_PORT_WINDOW;
429
430 regs_buff[i] = NXRD32(adapter,
431 niu_registers[mode].reg[i - 3] + window);
432 }
433 329
330 if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
331 return;
332
333 regs_buff[i++] = NXRD32(adapter, CRB_CMDPEG_STATE);
334 regs_buff[i++] = NXRD32(adapter, CRB_RCVPEG_STATE);
335 regs_buff[i++] = NXRD32(adapter, CRB_FW_CAPABILITIES_1);
336 regs_buff[i++] = NXRDIO(adapter, adapter->crb_int_state_reg);
337 regs_buff[i++] = NXRD32(adapter, NX_CRB_DEV_REF_COUNT);
338 regs_buff[i++] = NXRD32(adapter, NX_CRB_DEV_STATE);
339 regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER);
340 regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_HALT_STATUS1);
341 regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_HALT_STATUS2);
342
343 regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_0+0x3c);
344 regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_1+0x3c);
345 regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_2+0x3c);
346 regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_3+0x3c);
347
348 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
349
350 regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_4+0x3c);
351 i += 2;
352
353 regs_buff[i++] = NXRD32(adapter, CRB_XG_STATE_P3);
354 regs_buff[i++] = le32_to_cpu(*(adapter->tx_ring->hw_consumer));
355
356 } else {
357 i++;
358
359 regs_buff[i++] = NXRD32(adapter,
360 NETXEN_NIU_XGE_CONFIG_0+(0x10000*port));
361 regs_buff[i++] = NXRD32(adapter,
362 NETXEN_NIU_XGE_CONFIG_1+(0x10000*port));
363
364 regs_buff[i++] = NXRD32(adapter, CRB_XG_STATE);
365 regs_buff[i++] = NXRDIO(adapter,
366 adapter->tx_ring->crb_cmd_consumer);
367 }
368
369 regs_buff[i++] = NXRDIO(adapter, adapter->tx_ring->crb_cmd_producer);
370
371 regs_buff[i++] = NXRDIO(adapter,
372 recv_ctx->rds_rings[0].crb_rcv_producer);
373 regs_buff[i++] = NXRDIO(adapter,
374 recv_ctx->rds_rings[1].crb_rcv_producer);
375
376 regs_buff[i++] = adapter->max_sds_rings;
377
378 for (ring = 0; ring < adapter->max_sds_rings; ring++) {
379 sds_ring = &(recv_ctx->sds_rings[ring]);
380 regs_buff[i++] = NXRDIO(adapter,
381 sds_ring->crb_sts_consumer);
434 } 382 }
435} 383}
436 384
437static u32 netxen_nic_test_link(struct net_device *dev) 385static u32 netxen_nic_test_link(struct net_device *dev)
438{ 386{
439 struct netxen_adapter *adapter = netdev_priv(dev); 387 struct netxen_adapter *adapter = netdev_priv(dev);
440 __u32 status; 388 u32 val, port;
441 int val;
442 389
443 /* read which mode */ 390 port = adapter->physical_port;
444 if (adapter->ahw.port_type == NETXEN_NIC_GBE) { 391 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
445 if (adapter->phy_read && 392 val = NXRD32(adapter, CRB_XG_STATE_P3);
446 adapter->phy_read(adapter, 393 val = XG_LINK_STATE_P3(adapter->ahw.pci_func, val);
447 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 394 return (val == XG_LINK_UP_P3) ? 0 : 1;
448 &status) != 0) 395 } else {
449 return -EIO;
450 else {
451 val = netxen_get_phy_link(status);
452 return !val;
453 }
454 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
455 val = NXRD32(adapter, CRB_XG_STATE); 396 val = NXRD32(adapter, CRB_XG_STATE);
397 val = (val >> port*8) & 0xff;
456 return (val == XG_LINK_UP) ? 0 : 1; 398 return (val == XG_LINK_UP) ? 0 : 1;
457 } 399 }
458 return -EIO;
459} 400}
460 401
461static int 402static int
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 2e364fee3cbb..85e28e60ecf1 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -345,8 +345,7 @@ netxen_pcie_sem_lock(struct netxen_adapter *adapter, int sem, u32 id_reg)
345void 345void
346netxen_pcie_sem_unlock(struct netxen_adapter *adapter, int sem) 346netxen_pcie_sem_unlock(struct netxen_adapter *adapter, int sem)
347{ 347{
348 int val; 348 NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_UNLOCK(sem)));
349 val = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_UNLOCK(sem)));
350} 349}
351 350
352int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) 351int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port)
@@ -691,6 +690,9 @@ void netxen_p3_nic_set_multi(struct net_device *netdev)
691 struct list_head *head; 690 struct list_head *head;
692 nx_mac_list_t *cur; 691 nx_mac_list_t *cur;
693 692
693 if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
694 return;
695
694 list_splice_tail_init(&adapter->mac_list, &del_list); 696 list_splice_tail_init(&adapter->mac_list, &del_list);
695 697
696 nx_p3_nic_add_mac(adapter, adapter->mac_addr, &del_list); 698 nx_p3_nic_add_mac(adapter, adapter->mac_addr, &del_list);
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 02f8d4b4db63..64cff68d372c 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -184,6 +184,8 @@ skip_rds:
184 184
185 tx_ring = adapter->tx_ring; 185 tx_ring = adapter->tx_ring;
186 vfree(tx_ring->cmd_buf_arr); 186 vfree(tx_ring->cmd_buf_arr);
187 kfree(tx_ring);
188 adapter->tx_ring = NULL;
187} 189}
188 190
189int netxen_alloc_sw_resources(struct netxen_adapter *adapter) 191int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
@@ -782,7 +784,7 @@ netxen_need_fw_reset(struct netxen_adapter *adapter)
782 if (NXRD32(adapter, CRB_CMDPEG_STATE) == PHAN_INITIALIZE_FAILED) 784 if (NXRD32(adapter, CRB_CMDPEG_STATE) == PHAN_INITIALIZE_FAILED)
783 return 1; 785 return 1;
784 786
785 old_count = count = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER); 787 old_count = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER);
786 788
787 for (i = 0; i < 10; i++) { 789 for (i = 0; i < 10; i++) {
788 790
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 6cae26a5bd67..9f9d6081959b 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -340,7 +340,7 @@ netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot)
340 if (!(first_boot & 0x4)) { 340 if (!(first_boot & 0x4)) {
341 first_boot |= 0x4; 341 first_boot |= 0x4;
342 NXWR32(adapter, NETXEN_PCIE_REG(0x4), first_boot); 342 NXWR32(adapter, NETXEN_PCIE_REG(0x4), first_boot);
343 first_boot = NXRD32(adapter, NETXEN_PCIE_REG(0x4)); 343 NXRD32(adapter, NETXEN_PCIE_REG(0x4));
344 } 344 }
345 345
346 /* This is the first boot after power up */ 346 /* This is the first boot after power up */
@@ -1898,12 +1898,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter)
1898 linkup = (val == XG_LINK_UP_P3); 1898 linkup = (val == XG_LINK_UP_P3);
1899 } else { 1899 } else {
1900 val = NXRD32(adapter, CRB_XG_STATE); 1900 val = NXRD32(adapter, CRB_XG_STATE);
1901 if (adapter->ahw.port_type == NETXEN_NIC_GBE) 1901 val = (val >> port*8) & 0xff;
1902 linkup = (val >> port) & 1; 1902 linkup = (val == XG_LINK_UP);
1903 else {
1904 val = (val >> port*8) & 0xff;
1905 linkup = (val == XG_LINK_UP);
1906 }
1907 } 1903 }
1908 1904
1909 netxen_advert_link_change(adapter, linkup); 1905 netxen_advert_link_change(adapter, linkup);
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 8ce58c4c7dd3..2aed2b382c40 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -2844,7 +2844,7 @@ static int tcam_wait_bit(struct niu *np, u64 bit)
2844 break; 2844 break;
2845 udelay(1); 2845 udelay(1);
2846 } 2846 }
2847 if (limit < 0) 2847 if (limit <= 0)
2848 return -ENODEV; 2848 return -ENODEV;
2849 2849
2850 return 0; 2850 return 0;
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 8a5ae3b182ed..12e3233868e9 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -1402,7 +1402,6 @@ static void BuildLAF(int *ladrf, int *adr)
1402 for (i = 0; i < 8; i++) 1402 for (i = 0; i < 8; i++)
1403 printk(KERN_CONT " %02X", ladrf[i]); 1403 printk(KERN_CONT " %02X", ladrf[i]);
1404 printk(KERN_CONT "\n"); 1404 printk(KERN_CONT "\n");
1405 }
1406#endif 1405#endif
1407} /* BuildLAF */ 1406} /* BuildLAF */
1408 1407
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 92ed3fbf89a5..776cad2f5715 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1741,7 +1741,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1741 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"), 1741 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"),
1742 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "cis/DP83903.cis"), 1742 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "cis/DP83903.cis"),
1743 PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "cis/LA-PCM.cis"), 1743 PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "cis/LA-PCM.cis"),
1744 PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"), 1744 PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "cis/PE520.cis"),
1745 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "cis/NE2K.cis"), 1745 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "cis/NE2K.cis"),
1746 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "cis/PE-200.cis"), 1746 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "cis/PE-200.cis"),
1747 PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "cis/tamarack.cis"), 1747 PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "cis/tamarack.cis"),
@@ -1754,7 +1754,7 @@ MODULE_DEVICE_TABLE(pcmcia, pcnet_ids);
1754MODULE_FIRMWARE("cis/PCMLM28.cis"); 1754MODULE_FIRMWARE("cis/PCMLM28.cis");
1755MODULE_FIRMWARE("cis/DP83903.cis"); 1755MODULE_FIRMWARE("cis/DP83903.cis");
1756MODULE_FIRMWARE("cis/LA-PCM.cis"); 1756MODULE_FIRMWARE("cis/LA-PCM.cis");
1757MODULE_FIRMWARE("PE520.cis"); 1757MODULE_FIRMWARE("cis/PE520.cis");
1758MODULE_FIRMWARE("cis/NE2K.cis"); 1758MODULE_FIRMWARE("cis/NE2K.cis");
1759MODULE_FIRMWARE("cis/PE-200.cis"); 1759MODULE_FIRMWARE("cis/PE-200.cis");
1760MODULE_FIRMWARE("cis/tamarack.cis"); 1760MODULE_FIRMWARE("cis/tamarack.cis");
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index c13cf64095b6..33c4b12a63ba 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -331,8 +331,8 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
331 bool clk125en = true; 331 bool clk125en = true;
332 332
333 /* Abort if we are using an untested phy. */ 333 /* Abort if we are using an untested phy. */
334 if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 || 334 if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 &&
335 BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 || 335 BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 &&
336 BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M) 336 BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M)
337 return; 337 return;
338 338
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index bd4e8d72dc08..e17b70291bbc 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -264,6 +264,8 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
264 (phydev->phy_id & phydrv->phy_id_mask)); 264 (phydev->phy_id & phydrv->phy_id_mask));
265} 265}
266 266
267#ifdef CONFIG_PM
268
267static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) 269static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
268{ 270{
269 struct device_driver *drv = phydev->dev.driver; 271 struct device_driver *drv = phydev->dev.driver;
@@ -295,34 +297,88 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
295 return true; 297 return true;
296} 298}
297 299
298/* Suspend and resume. Copied from platform_suspend and 300static int mdio_bus_suspend(struct device *dev)
299 * platform_resume
300 */
301static int mdio_bus_suspend(struct device * dev, pm_message_t state)
302{ 301{
303 struct phy_driver *phydrv = to_phy_driver(dev->driver); 302 struct phy_driver *phydrv = to_phy_driver(dev->driver);
304 struct phy_device *phydev = to_phy_device(dev); 303 struct phy_device *phydev = to_phy_device(dev);
305 304
305 /*
306 * We must stop the state machine manually, otherwise it stops out of
307 * control, possibly with the phydev->lock held. Upon resume, netdev
308 * may call phy routines that try to grab the same lock, and that may
309 * lead to a deadlock.
310 */
311 if (phydev->attached_dev)
312 phy_stop_machine(phydev);
313
306 if (!mdio_bus_phy_may_suspend(phydev)) 314 if (!mdio_bus_phy_may_suspend(phydev))
307 return 0; 315 return 0;
316
308 return phydrv->suspend(phydev); 317 return phydrv->suspend(phydev);
309} 318}
310 319
311static int mdio_bus_resume(struct device * dev) 320static int mdio_bus_resume(struct device *dev)
312{ 321{
313 struct phy_driver *phydrv = to_phy_driver(dev->driver); 322 struct phy_driver *phydrv = to_phy_driver(dev->driver);
314 struct phy_device *phydev = to_phy_device(dev); 323 struct phy_device *phydev = to_phy_device(dev);
324 int ret;
315 325
316 if (!mdio_bus_phy_may_suspend(phydev)) 326 if (!mdio_bus_phy_may_suspend(phydev))
327 goto no_resume;
328
329 ret = phydrv->resume(phydev);
330 if (ret < 0)
331 return ret;
332
333no_resume:
334 if (phydev->attached_dev)
335 phy_start_machine(phydev, NULL);
336
337 return 0;
338}
339
340static int mdio_bus_restore(struct device *dev)
341{
342 struct phy_device *phydev = to_phy_device(dev);
343 struct net_device *netdev = phydev->attached_dev;
344 int ret;
345
346 if (!netdev)
317 return 0; 347 return 0;
318 return phydrv->resume(phydev); 348
349 ret = phy_init_hw(phydev);
350 if (ret < 0)
351 return ret;
352
353 /* The PHY needs to renegotiate. */
354 phydev->link = 0;
355 phydev->state = PHY_UP;
356
357 phy_start_machine(phydev, NULL);
358
359 return 0;
319} 360}
320 361
362static struct dev_pm_ops mdio_bus_pm_ops = {
363 .suspend = mdio_bus_suspend,
364 .resume = mdio_bus_resume,
365 .freeze = mdio_bus_suspend,
366 .thaw = mdio_bus_resume,
367 .restore = mdio_bus_restore,
368};
369
370#define MDIO_BUS_PM_OPS (&mdio_bus_pm_ops)
371
372#else
373
374#define MDIO_BUS_PM_OPS NULL
375
376#endif /* CONFIG_PM */
377
321struct bus_type mdio_bus_type = { 378struct bus_type mdio_bus_type = {
322 .name = "mdio_bus", 379 .name = "mdio_bus",
323 .match = mdio_bus_match, 380 .match = mdio_bus_match,
324 .suspend = mdio_bus_suspend, 381 .pm = MDIO_BUS_PM_OPS,
325 .resume = mdio_bus_resume,
326}; 382};
327EXPORT_SYMBOL(mdio_bus_type); 383EXPORT_SYMBOL(mdio_bus_type);
328 384
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index b10fedd82143..8212b2b93422 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -378,6 +378,20 @@ void phy_disconnect(struct phy_device *phydev)
378} 378}
379EXPORT_SYMBOL(phy_disconnect); 379EXPORT_SYMBOL(phy_disconnect);
380 380
381int phy_init_hw(struct phy_device *phydev)
382{
383 int ret;
384
385 if (!phydev->drv || !phydev->drv->config_init)
386 return 0;
387
388 ret = phy_scan_fixups(phydev);
389 if (ret < 0)
390 return ret;
391
392 return phydev->drv->config_init(phydev);
393}
394
381/** 395/**
382 * phy_attach_direct - attach a network device to a given PHY device pointer 396 * phy_attach_direct - attach a network device to a given PHY device pointer
383 * @dev: network device to attach 397 * @dev: network device to attach
@@ -425,21 +439,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
425 /* Do initial configuration here, now that 439 /* Do initial configuration here, now that
426 * we have certain key parameters 440 * we have certain key parameters
427 * (dev_flags and interface) */ 441 * (dev_flags and interface) */
428 if (phydev->drv->config_init) { 442 return phy_init_hw(phydev);
429 int err;
430
431 err = phy_scan_fixups(phydev);
432
433 if (err < 0)
434 return err;
435
436 err = phydev->drv->config_init(phydev);
437
438 if (err < 0)
439 return err;
440 }
441
442 return 0;
443} 443}
444EXPORT_SYMBOL(phy_attach_direct); 444EXPORT_SYMBOL(phy_attach_direct);
445 445
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c
index 20a71749154a..1c257098d0a6 100644
--- a/drivers/net/rrunner.c
+++ b/drivers/net/rrunner.c
@@ -1293,7 +1293,7 @@ static void rr_dump(struct net_device *dev)
1293 1293
1294 printk("Error code 0x%x\n", readl(&regs->Fail1)); 1294 printk("Error code 0x%x\n", readl(&regs->Fail1));
1295 1295
1296 index = (((readl(&regs->EvtPrd) >> 8) & 0xff ) - 1) % EVT_RING_ENTRIES; 1296 index = (((readl(&regs->EvtPrd) >> 8) & 0xff) - 1) % TX_RING_ENTRIES;
1297 cons = rrpriv->dirty_tx; 1297 cons = rrpriv->dirty_tx;
1298 printk("TX ring index %i, TX consumer %i\n", 1298 printk("TX ring index %i, TX consumer %i\n",
1299 index, cons); 1299 index, cons);
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index ca6285016dfd..7402b858cab7 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -110,7 +110,7 @@ static void sh_eth_reset(struct net_device *ndev)
110 mdelay(1); 110 mdelay(1);
111 cnt--; 111 cnt--;
112 } 112 }
113 if (cnt < 0) 113 if (cnt == 0)
114 printk(KERN_ERR "Device reset fail\n"); 114 printk(KERN_ERR "Device reset fail\n");
115 115
116 /* Table Init */ 116 /* Table Init */
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 2d28d58200d0..37f486b65f63 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1844,7 +1844,8 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
1844 sky2->tx_cons = idx; 1844 sky2->tx_cons = idx;
1845 smp_mb(); 1845 smp_mb();
1846 1846
1847 if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) 1847 /* Wake unless it's detached, and called e.g. from sky2_down() */
1848 if (tx_avail(sky2) > MAX_SKB_TX_LE + 4 && netif_device_present(dev))
1848 netif_wake_queue(dev); 1849 netif_wake_queue(dev);
1849} 1850}
1850 1851
diff --git a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig
index 1cc8cf4425d1..516713fa0a05 100644
--- a/drivers/net/tulip/Kconfig
+++ b/drivers/net/tulip/Kconfig
@@ -101,6 +101,10 @@ config TULIP_NAPI_HW_MITIGATION
101 101
102 If in doubt, say Y. 102 If in doubt, say Y.
103 103
104config TULIP_DM910X
105 def_bool y
106 depends on TULIP && SPARC
107
104config DE4X5 108config DE4X5
105 tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" 109 tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA"
106 depends on PCI || EISA 110 depends on PCI || EISA
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index ad63621913c3..6f44ebf58910 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -92,6 +92,10 @@
92#include <asm/uaccess.h> 92#include <asm/uaccess.h>
93#include <asm/irq.h> 93#include <asm/irq.h>
94 94
95#ifdef CONFIG_TULIP_DM910X
96#include <linux/of.h>
97#endif
98
95 99
96/* Board/System/Debug information/definition ---------------- */ 100/* Board/System/Debug information/definition ---------------- */
97#define PCI_DM9132_ID 0x91321282 /* Davicom DM9132 ID */ 101#define PCI_DM9132_ID 0x91321282 /* Davicom DM9132 ID */
@@ -377,6 +381,23 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
377 if (!printed_version++) 381 if (!printed_version++)
378 printk(version); 382 printk(version);
379 383
384 /*
385 * SPARC on-board DM910x chips should be handled by the main
386 * tulip driver, except for early DM9100s.
387 */
388#ifdef CONFIG_TULIP_DM910X
389 if ((ent->driver_data == PCI_DM9100_ID && pdev->revision >= 0x30) ||
390 ent->driver_data == PCI_DM9102_ID) {
391 struct device_node *dp = pci_device_to_OF_node(pdev);
392
393 if (dp && of_get_property(dp, "local-mac-address", NULL)) {
394 printk(KERN_INFO DRV_NAME
395 ": skipping on-board DM910x (use tulip)\n");
396 return -ENODEV;
397 }
398 }
399#endif
400
380 /* Init network device */ 401 /* Init network device */
381 dev = alloc_etherdev(sizeof(*db)); 402 dev = alloc_etherdev(sizeof(*db));
382 if (dev == NULL) 403 if (dev == NULL)
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 0fa3140d65bf..595777dcadb1 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -196,9 +196,13 @@ struct tulip_chip_table tulip_tbl[] = {
196 | HAS_NWAY | HAS_PCI_MWI, tulip_timer, tulip_media_task }, 196 | HAS_NWAY | HAS_PCI_MWI, tulip_timer, tulip_media_task },
197 197
198 /* DM910X */ 198 /* DM910X */
199#ifdef CONFIG_TULIP_DM910X
199 { "Davicom DM9102/DM9102A", 128, 0x0001ebef, 200 { "Davicom DM9102/DM9102A", 128, 0x0001ebef,
200 HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_ACPI, 201 HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_ACPI,
201 tulip_timer, tulip_media_task }, 202 tulip_timer, tulip_media_task },
203#else
204 { NULL },
205#endif
202 206
203 /* RS7112 */ 207 /* RS7112 */
204 { "Conexant LANfinity", 256, 0x0001ebef, 208 { "Conexant LANfinity", 256, 0x0001ebef,
@@ -228,8 +232,10 @@ static struct pci_device_id tulip_pci_tbl[] = {
228 { 0x1259, 0xa120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 232 { 0x1259, 0xa120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
229 { 0x11F6, 0x9881, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMPEX9881 }, 233 { 0x11F6, 0x9881, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMPEX9881 },
230 { 0x8086, 0x0039, PCI_ANY_ID, PCI_ANY_ID, 0, 0, I21145 }, 234 { 0x8086, 0x0039, PCI_ANY_ID, PCI_ANY_ID, 0, 0, I21145 },
235#ifdef CONFIG_TULIP_DM910X
231 { 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, 236 { 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X },
232 { 0x1282, 0x9102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, 237 { 0x1282, 0x9102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X },
238#endif
233 { 0x1113, 0x1216, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 239 { 0x1113, 0x1216, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
234 { 0x1113, 0x1217, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 }, 240 { 0x1113, 0x1217, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 },
235 { 0x1113, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 241 { 0x1113, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
@@ -1299,18 +1305,30 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1299 } 1305 }
1300 1306
1301 /* 1307 /*
1302 * Early DM9100's need software CRC and the DMFE driver 1308 * DM910x chips should be handled by the dmfe driver, except
1309 * on-board chips on SPARC systems. Also, early DM9100s need
1310 * software CRC which only the dmfe driver supports.
1303 */ 1311 */
1304 1312
1305 if (pdev->vendor == 0x1282 && pdev->device == 0x9100) 1313#ifdef CONFIG_TULIP_DM910X
1306 { 1314 if (chip_idx == DM910X) {
1307 /* Read Chip revision */ 1315 struct device_node *dp;
1308 if (pdev->revision < 0x30) 1316
1309 { 1317 if (pdev->vendor == 0x1282 && pdev->device == 0x9100 &&
1310 printk(KERN_ERR PFX "skipping early DM9100 with Crc bug (use dmfe)\n"); 1318 pdev->revision < 0x30) {
1319 printk(KERN_INFO PFX
1320 "skipping early DM9100 with Crc bug (use dmfe)\n");
1321 return -ENODEV;
1322 }
1323
1324 dp = pci_device_to_OF_node(pdev);
1325 if (!(dp && of_get_property(dp, "local-mac-address", NULL))) {
1326 printk(KERN_INFO PFX
1327 "skipping DM910x expansion card (use dmfe)\n");
1311 return -ENODEV; 1328 return -ENODEV;
1312 } 1329 }
1313 } 1330 }
1331#endif
1314 1332
1315 /* 1333 /*
1316 * Looks for early PCI chipsets where people report hangs 1334 * Looks for early PCI chipsets where people report hangs
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 41ad2f3697c7..96bdc0b43889 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3607,6 +3607,7 @@ static int ucc_geth_suspend(struct of_device *ofdev, pm_message_t state)
3607 if (!netif_running(ndev)) 3607 if (!netif_running(ndev))
3608 return 0; 3608 return 0;
3609 3609
3610 netif_device_detach(ndev);
3610 napi_disable(&ugeth->napi); 3611 napi_disable(&ugeth->napi);
3611 3612
3612 /* 3613 /*
@@ -3665,7 +3666,7 @@ static int ucc_geth_resume(struct of_device *ofdev)
3665 phy_start(ugeth->phydev); 3666 phy_start(ugeth->phydev);
3666 3667
3667 napi_enable(&ugeth->napi); 3668 napi_enable(&ugeth->napi);
3668 netif_start_queue(ndev); 3669 netif_device_attach(ndev);
3669 3670
3670 return 0; 3671 return 0;
3671} 3672}
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index a007e2acf651..ef1fbeb11c6e 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -838,13 +838,13 @@ struct ucc_geth_hardware_statistics {
838 using the maximum is 838 using the maximum is
839 easier */ 839 easier */
840#define UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT 32 840#define UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT 32
841#define UCC_GETH_SCHEDULER_ALIGNMENT 4 /* This is a guess */ 841#define UCC_GETH_SCHEDULER_ALIGNMENT 8 /* This is a guess */
842#define UCC_GETH_TX_STATISTICS_ALIGNMENT 4 /* This is a guess */ 842#define UCC_GETH_TX_STATISTICS_ALIGNMENT 4 /* This is a guess */
843#define UCC_GETH_RX_STATISTICS_ALIGNMENT 4 /* This is a guess */ 843#define UCC_GETH_RX_STATISTICS_ALIGNMENT 4 /* This is a guess */
844#define UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT 64 844#define UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT 64
845#define UCC_GETH_RX_BD_QUEUES_ALIGNMENT 8 /* This is a guess */ 845#define UCC_GETH_RX_BD_QUEUES_ALIGNMENT 8 /* This is a guess */
846#define UCC_GETH_RX_PREFETCHED_BDS_ALIGNMENT 128 /* This is a guess */ 846#define UCC_GETH_RX_PREFETCHED_BDS_ALIGNMENT 128 /* This is a guess */
847#define UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT 4 /* This 847#define UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT 8 /* This
848 is a 848 is a
849 guess 849 guess
850 */ 850 */
@@ -899,16 +899,17 @@ struct ucc_geth_hardware_statistics {
899#define UCC_GETH_UTFS_INIT 512 /* Tx virtual FIFO size 899#define UCC_GETH_UTFS_INIT 512 /* Tx virtual FIFO size
900 */ 900 */
901#define UCC_GETH_UTFET_INIT 256 /* 1/2 utfs */ 901#define UCC_GETH_UTFET_INIT 256 /* 1/2 utfs */
902#define UCC_GETH_UTFTT_INIT 128 902#define UCC_GETH_UTFTT_INIT 512
903/* Gigabit Ethernet (1000 Mbps) */ 903/* Gigabit Ethernet (1000 Mbps) */
904#define UCC_GETH_URFS_GIGA_INIT 4096/*2048*/ /* Rx virtual 904#define UCC_GETH_URFS_GIGA_INIT 4096/*2048*/ /* Rx virtual
905 FIFO size */ 905 FIFO size */
906#define UCC_GETH_URFET_GIGA_INIT 2048/*1024*/ /* 1/2 urfs */ 906#define UCC_GETH_URFET_GIGA_INIT 2048/*1024*/ /* 1/2 urfs */
907#define UCC_GETH_URFSET_GIGA_INIT 3072/*1536*/ /* 3/4 urfs */ 907#define UCC_GETH_URFSET_GIGA_INIT 3072/*1536*/ /* 3/4 urfs */
908#define UCC_GETH_UTFS_GIGA_INIT 8192/*2048*/ /* Tx virtual 908#define UCC_GETH_UTFS_GIGA_INIT 4096/*2048*/ /* Tx virtual
909 FIFO size */
910#define UCC_GETH_UTFET_GIGA_INIT 2048/*1024*/ /* 1/2 utfs */
911#define UCC_GETH_UTFTT_GIGA_INIT 4096/*0x40*/ /* Tx virtual
909 FIFO size */ 912 FIFO size */
910#define UCC_GETH_UTFET_GIGA_INIT 4096/*1024*/ /* 1/2 utfs */
911#define UCC_GETH_UTFTT_GIGA_INIT 0x400/*0x40*/ /* */
912 913
913#define UCC_GETH_REMODER_INIT 0 /* bits that must be 914#define UCC_GETH_REMODER_INIT 0 /* bits that must be
914 set */ 915 set */
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index f78f0903b073..6895f1531238 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -286,6 +286,7 @@ struct hso_device {
286 u8 usb_gone; 286 u8 usb_gone;
287 struct work_struct async_get_intf; 287 struct work_struct async_get_intf;
288 struct work_struct async_put_intf; 288 struct work_struct async_put_intf;
289 struct work_struct reset_device;
289 290
290 struct usb_device *usb; 291 struct usb_device *usb;
291 struct usb_interface *interface; 292 struct usb_interface *interface;
@@ -332,7 +333,8 @@ static void hso_kick_transmit(struct hso_serial *serial);
332/* Helper functions */ 333/* Helper functions */
333static int hso_mux_submit_intr_urb(struct hso_shared_int *mux_int, 334static int hso_mux_submit_intr_urb(struct hso_shared_int *mux_int,
334 struct usb_device *usb, gfp_t gfp); 335 struct usb_device *usb, gfp_t gfp);
335static void log_usb_status(int status, const char *function); 336static void handle_usb_error(int status, const char *function,
337 struct hso_device *hso_dev);
336static struct usb_endpoint_descriptor *hso_get_ep(struct usb_interface *intf, 338static struct usb_endpoint_descriptor *hso_get_ep(struct usb_interface *intf,
337 int type, int dir); 339 int type, int dir);
338static int hso_get_mux_ports(struct usb_interface *intf, unsigned char *ports); 340static int hso_get_mux_ports(struct usb_interface *intf, unsigned char *ports);
@@ -350,6 +352,7 @@ static void async_put_intf(struct work_struct *data);
350static int hso_put_activity(struct hso_device *hso_dev); 352static int hso_put_activity(struct hso_device *hso_dev);
351static int hso_get_activity(struct hso_device *hso_dev); 353static int hso_get_activity(struct hso_device *hso_dev);
352static void tiocmget_intr_callback(struct urb *urb); 354static void tiocmget_intr_callback(struct urb *urb);
355static void reset_device(struct work_struct *data);
353/*****************************************************************************/ 356/*****************************************************************************/
354/* Helping functions */ 357/* Helping functions */
355/*****************************************************************************/ 358/*****************************************************************************/
@@ -461,10 +464,17 @@ static const struct usb_device_id hso_ids[] = {
461 {USB_DEVICE(0x0af0, 0x7501)}, /* GTM 382 */ 464 {USB_DEVICE(0x0af0, 0x7501)}, /* GTM 382 */
462 {USB_DEVICE(0x0af0, 0x7601)}, /* GE40x */ 465 {USB_DEVICE(0x0af0, 0x7601)}, /* GE40x */
463 {USB_DEVICE(0x0af0, 0x7701)}, 466 {USB_DEVICE(0x0af0, 0x7701)},
467 {USB_DEVICE(0x0af0, 0x7706)},
464 {USB_DEVICE(0x0af0, 0x7801)}, 468 {USB_DEVICE(0x0af0, 0x7801)},
465 {USB_DEVICE(0x0af0, 0x7901)}, 469 {USB_DEVICE(0x0af0, 0x7901)},
470 {USB_DEVICE(0x0af0, 0x7A01)},
471 {USB_DEVICE(0x0af0, 0x7A05)},
466 {USB_DEVICE(0x0af0, 0x8200)}, 472 {USB_DEVICE(0x0af0, 0x8200)},
467 {USB_DEVICE(0x0af0, 0x8201)}, 473 {USB_DEVICE(0x0af0, 0x8201)},
474 {USB_DEVICE(0x0af0, 0x8300)},
475 {USB_DEVICE(0x0af0, 0x8302)},
476 {USB_DEVICE(0x0af0, 0x8304)},
477 {USB_DEVICE(0x0af0, 0x8400)},
468 {USB_DEVICE(0x0af0, 0xd035)}, 478 {USB_DEVICE(0x0af0, 0xd035)},
469 {USB_DEVICE(0x0af0, 0xd055)}, 479 {USB_DEVICE(0x0af0, 0xd055)},
470 {USB_DEVICE(0x0af0, 0xd155)}, 480 {USB_DEVICE(0x0af0, 0xd155)},
@@ -473,6 +483,8 @@ static const struct usb_device_id hso_ids[] = {
473 {USB_DEVICE(0x0af0, 0xd157)}, 483 {USB_DEVICE(0x0af0, 0xd157)},
474 {USB_DEVICE(0x0af0, 0xd257)}, 484 {USB_DEVICE(0x0af0, 0xd257)},
475 {USB_DEVICE(0x0af0, 0xd357)}, 485 {USB_DEVICE(0x0af0, 0xd357)},
486 {USB_DEVICE(0x0af0, 0xd058)},
487 {USB_DEVICE(0x0af0, 0xc100)},
476 {} 488 {}
477}; 489};
478MODULE_DEVICE_TABLE(usb, hso_ids); 490MODULE_DEVICE_TABLE(usb, hso_ids);
@@ -655,8 +667,8 @@ static void set_serial_by_index(unsigned index, struct hso_serial *serial)
655 spin_unlock_irqrestore(&serial_table_lock, flags); 667 spin_unlock_irqrestore(&serial_table_lock, flags);
656} 668}
657 669
658/* log a meaningful explanation of an USB status */ 670static void handle_usb_error(int status, const char *function,
659static void log_usb_status(int status, const char *function) 671 struct hso_device *hso_dev)
660{ 672{
661 char *explanation; 673 char *explanation;
662 674
@@ -685,10 +697,20 @@ static void log_usb_status(int status, const char *function)
685 case -EMSGSIZE: 697 case -EMSGSIZE:
686 explanation = "internal error"; 698 explanation = "internal error";
687 break; 699 break;
700 case -EILSEQ:
701 case -EPROTO:
702 case -ETIME:
703 case -ETIMEDOUT:
704 explanation = "protocol error";
705 if (hso_dev)
706 schedule_work(&hso_dev->reset_device);
707 break;
688 default: 708 default:
689 explanation = "unknown status"; 709 explanation = "unknown status";
690 break; 710 break;
691 } 711 }
712
713 /* log a meaningful explanation of an USB status */
692 D1("%s: received USB status - %s (%d)", function, explanation, status); 714 D1("%s: received USB status - %s (%d)", function, explanation, status);
693} 715}
694 716
@@ -762,7 +784,7 @@ static void write_bulk_callback(struct urb *urb)
762 /* log status, but don't act on it, we don't need to resubmit anything 784 /* log status, but don't act on it, we don't need to resubmit anything
763 * anyhow */ 785 * anyhow */
764 if (status) 786 if (status)
765 log_usb_status(status, __func__); 787 handle_usb_error(status, __func__, odev->parent);
766 788
767 hso_put_activity(odev->parent); 789 hso_put_activity(odev->parent);
768 790
@@ -806,7 +828,7 @@ static netdev_tx_t hso_net_start_xmit(struct sk_buff *skb,
806 result = usb_submit_urb(odev->mux_bulk_tx_urb, GFP_ATOMIC); 828 result = usb_submit_urb(odev->mux_bulk_tx_urb, GFP_ATOMIC);
807 if (result) { 829 if (result) {
808 dev_warn(&odev->parent->interface->dev, 830 dev_warn(&odev->parent->interface->dev,
809 "failed mux_bulk_tx_urb %d", result); 831 "failed mux_bulk_tx_urb %d\n", result);
810 net->stats.tx_errors++; 832 net->stats.tx_errors++;
811 netif_start_queue(net); 833 netif_start_queue(net);
812 } else { 834 } else {
@@ -998,7 +1020,7 @@ static void read_bulk_callback(struct urb *urb)
998 1020
999 /* is al ok? (Filip: Who's Al ?) */ 1021 /* is al ok? (Filip: Who's Al ?) */
1000 if (status) { 1022 if (status) {
1001 log_usb_status(status, __func__); 1023 handle_usb_error(status, __func__, odev->parent);
1002 return; 1024 return;
1003 } 1025 }
1004 1026
@@ -1019,7 +1041,8 @@ static void read_bulk_callback(struct urb *urb)
1019 if (odev->parent->port_spec & HSO_INFO_CRC_BUG) { 1041 if (odev->parent->port_spec & HSO_INFO_CRC_BUG) {
1020 u32 rest; 1042 u32 rest;
1021 u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF }; 1043 u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
1022 rest = urb->actual_length % odev->in_endp->wMaxPacketSize; 1044 rest = urb->actual_length %
1045 le16_to_cpu(odev->in_endp->wMaxPacketSize);
1023 if (((rest == 5) || (rest == 6)) && 1046 if (((rest == 5) || (rest == 6)) &&
1024 !memcmp(((u8 *) urb->transfer_buffer) + 1047 !memcmp(((u8 *) urb->transfer_buffer) +
1025 urb->actual_length - 4, crc_check, 4)) { 1048 urb->actual_length - 4, crc_check, 4)) {
@@ -1053,7 +1076,7 @@ static void read_bulk_callback(struct urb *urb)
1053 result = usb_submit_urb(urb, GFP_ATOMIC); 1076 result = usb_submit_urb(urb, GFP_ATOMIC);
1054 if (result) 1077 if (result)
1055 dev_warn(&odev->parent->interface->dev, 1078 dev_warn(&odev->parent->interface->dev,
1056 "%s failed submit mux_bulk_rx_urb %d", __func__, 1079 "%s failed submit mux_bulk_rx_urb %d\n", __func__,
1057 result); 1080 result);
1058} 1081}
1059 1082
@@ -1207,7 +1230,7 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
1207 D1("serial == NULL"); 1230 D1("serial == NULL");
1208 return; 1231 return;
1209 } else if (status) { 1232 } else if (status) {
1210 log_usb_status(status, __func__); 1233 handle_usb_error(status, __func__, serial->parent);
1211 return; 1234 return;
1212 } 1235 }
1213 1236
@@ -1225,7 +1248,7 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
1225 u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF }; 1248 u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
1226 rest = 1249 rest =
1227 urb->actual_length % 1250 urb->actual_length %
1228 serial->in_endp->wMaxPacketSize; 1251 le16_to_cpu(serial->in_endp->wMaxPacketSize);
1229 if (((rest == 5) || (rest == 6)) && 1252 if (((rest == 5) || (rest == 6)) &&
1230 !memcmp(((u8 *) urb->transfer_buffer) + 1253 !memcmp(((u8 *) urb->transfer_buffer) +
1231 urb->actual_length - 4, crc_check, 4)) { 1254 urb->actual_length - 4, crc_check, 4)) {
@@ -1513,7 +1536,7 @@ static void tiocmget_intr_callback(struct urb *urb)
1513 if (!serial) 1536 if (!serial)
1514 return; 1537 return;
1515 if (status) { 1538 if (status) {
1516 log_usb_status(status, __func__); 1539 handle_usb_error(status, __func__, serial->parent);
1517 return; 1540 return;
1518 } 1541 }
1519 tiocmget = serial->tiocmget; 1542 tiocmget = serial->tiocmget;
@@ -1700,6 +1723,10 @@ static int hso_serial_tiocmset(struct tty_struct *tty, struct file *file,
1700 D1("no tty structures"); 1723 D1("no tty structures");
1701 return -EINVAL; 1724 return -EINVAL;
1702 } 1725 }
1726
1727 if ((serial->parent->port_spec & HSO_PORT_MASK) != HSO_PORT_MODEM)
1728 return -EINVAL;
1729
1703 if_num = serial->parent->interface->altsetting->desc.bInterfaceNumber; 1730 if_num = serial->parent->interface->altsetting->desc.bInterfaceNumber;
1704 1731
1705 spin_lock_irqsave(&serial->serial_lock, flags); 1732 spin_lock_irqsave(&serial->serial_lock, flags);
@@ -1838,7 +1865,7 @@ static int mux_device_request(struct hso_serial *serial, u8 type, u16 port,
1838 result = usb_submit_urb(ctrl_urb, GFP_ATOMIC); 1865 result = usb_submit_urb(ctrl_urb, GFP_ATOMIC);
1839 if (result) { 1866 if (result) {
1840 dev_err(&ctrl_urb->dev->dev, 1867 dev_err(&ctrl_urb->dev->dev,
1841 "%s failed submit ctrl_urb %d type %d", __func__, 1868 "%s failed submit ctrl_urb %d type %d\n", __func__,
1842 result, type); 1869 result, type);
1843 return result; 1870 return result;
1844 } 1871 }
@@ -1888,7 +1915,7 @@ static void intr_callback(struct urb *urb)
1888 1915
1889 /* status check */ 1916 /* status check */
1890 if (status) { 1917 if (status) {
1891 log_usb_status(status, __func__); 1918 handle_usb_error(status, __func__, NULL);
1892 return; 1919 return;
1893 } 1920 }
1894 D4("\n--- Got intr callback 0x%02X ---", status); 1921 D4("\n--- Got intr callback 0x%02X ---", status);
@@ -1905,18 +1932,18 @@ static void intr_callback(struct urb *urb)
1905 if (serial != NULL) { 1932 if (serial != NULL) {
1906 D1("Pending read interrupt on port %d\n", i); 1933 D1("Pending read interrupt on port %d\n", i);
1907 spin_lock(&serial->serial_lock); 1934 spin_lock(&serial->serial_lock);
1908 if (serial->rx_state == RX_IDLE) { 1935 if (serial->rx_state == RX_IDLE &&
1936 serial->open_count > 0) {
1909 /* Setup and send a ctrl req read on 1937 /* Setup and send a ctrl req read on
1910 * port i */ 1938 * port i */
1911 if (!serial->rx_urb_filled[0]) { 1939 if (!serial->rx_urb_filled[0]) {
1912 serial->rx_state = RX_SENT; 1940 serial->rx_state = RX_SENT;
1913 hso_mux_serial_read(serial); 1941 hso_mux_serial_read(serial);
1914 } else 1942 } else
1915 serial->rx_state = RX_PENDING; 1943 serial->rx_state = RX_PENDING;
1916
1917 } else { 1944 } else {
1918 D1("Already pending a read on " 1945 D1("Already a read pending on "
1919 "port %d\n", i); 1946 "port %d or port not open\n", i);
1920 } 1947 }
1921 spin_unlock(&serial->serial_lock); 1948 spin_unlock(&serial->serial_lock);
1922 } 1949 }
@@ -1958,7 +1985,7 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
1958 tty = tty_kref_get(serial->tty); 1985 tty = tty_kref_get(serial->tty);
1959 spin_unlock(&serial->serial_lock); 1986 spin_unlock(&serial->serial_lock);
1960 if (status) { 1987 if (status) {
1961 log_usb_status(status, __func__); 1988 handle_usb_error(status, __func__, serial->parent);
1962 tty_kref_put(tty); 1989 tty_kref_put(tty);
1963 return; 1990 return;
1964 } 1991 }
@@ -2014,7 +2041,7 @@ static void ctrl_callback(struct urb *urb)
2014 tty = tty_kref_get(serial->tty); 2041 tty = tty_kref_get(serial->tty);
2015 spin_unlock(&serial->serial_lock); 2042 spin_unlock(&serial->serial_lock);
2016 if (status) { 2043 if (status) {
2017 log_usb_status(status, __func__); 2044 handle_usb_error(status, __func__, serial->parent);
2018 tty_kref_put(tty); 2045 tty_kref_put(tty);
2019 return; 2046 return;
2020 } 2047 }
@@ -2358,12 +2385,12 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
2358 serial->tx_data_length = tx_size; 2385 serial->tx_data_length = tx_size;
2359 serial->tx_data = kzalloc(serial->tx_data_length, GFP_KERNEL); 2386 serial->tx_data = kzalloc(serial->tx_data_length, GFP_KERNEL);
2360 if (!serial->tx_data) { 2387 if (!serial->tx_data) {
2361 dev_err(dev, "%s - Out of memory", __func__); 2388 dev_err(dev, "%s - Out of memory\n", __func__);
2362 goto exit; 2389 goto exit;
2363 } 2390 }
2364 serial->tx_buffer = kzalloc(serial->tx_data_length, GFP_KERNEL); 2391 serial->tx_buffer = kzalloc(serial->tx_data_length, GFP_KERNEL);
2365 if (!serial->tx_buffer) { 2392 if (!serial->tx_buffer) {
2366 dev_err(dev, "%s - Out of memory", __func__); 2393 dev_err(dev, "%s - Out of memory\n", __func__);
2367 goto exit; 2394 goto exit;
2368 } 2395 }
2369 2396
@@ -2391,6 +2418,7 @@ static struct hso_device *hso_create_device(struct usb_interface *intf,
2391 2418
2392 INIT_WORK(&hso_dev->async_get_intf, async_get_intf); 2419 INIT_WORK(&hso_dev->async_get_intf, async_get_intf);
2393 INIT_WORK(&hso_dev->async_put_intf, async_put_intf); 2420 INIT_WORK(&hso_dev->async_put_intf, async_put_intf);
2421 INIT_WORK(&hso_dev->reset_device, reset_device);
2394 2422
2395 return hso_dev; 2423 return hso_dev;
2396} 2424}
@@ -2831,13 +2859,14 @@ struct hso_shared_int *hso_create_shared_int(struct usb_interface *interface)
2831 2859
2832 mux->shared_intr_urb = usb_alloc_urb(0, GFP_KERNEL); 2860 mux->shared_intr_urb = usb_alloc_urb(0, GFP_KERNEL);
2833 if (!mux->shared_intr_urb) { 2861 if (!mux->shared_intr_urb) {
2834 dev_err(&interface->dev, "Could not allocate intr urb?"); 2862 dev_err(&interface->dev, "Could not allocate intr urb?\n");
2835 goto exit; 2863 goto exit;
2836 } 2864 }
2837 mux->shared_intr_buf = kzalloc(mux->intr_endp->wMaxPacketSize, 2865 mux->shared_intr_buf =
2838 GFP_KERNEL); 2866 kzalloc(le16_to_cpu(mux->intr_endp->wMaxPacketSize),
2867 GFP_KERNEL);
2839 if (!mux->shared_intr_buf) { 2868 if (!mux->shared_intr_buf) {
2840 dev_err(&interface->dev, "Could not allocate intr buf?"); 2869 dev_err(&interface->dev, "Could not allocate intr buf?\n");
2841 goto exit; 2870 goto exit;
2842 } 2871 }
2843 2872
@@ -3132,6 +3161,26 @@ out:
3132 return result; 3161 return result;
3133} 3162}
3134 3163
3164static void reset_device(struct work_struct *data)
3165{
3166 struct hso_device *hso_dev =
3167 container_of(data, struct hso_device, reset_device);
3168 struct usb_device *usb = hso_dev->usb;
3169 int result;
3170
3171 if (hso_dev->usb_gone) {
3172 D1("No reset during disconnect\n");
3173 } else {
3174 result = usb_lock_device_for_reset(usb, hso_dev->interface);
3175 if (result < 0)
3176 D1("unable to lock device for reset: %d\n", result);
3177 else {
3178 usb_reset_device(usb);
3179 usb_unlock_device(usb);
3180 }
3181 }
3182}
3183
3135static void hso_serial_ref_free(struct kref *ref) 3184static void hso_serial_ref_free(struct kref *ref)
3136{ 3185{
3137 struct hso_device *hso_dev = container_of(ref, struct hso_device, ref); 3186 struct hso_device *hso_dev = container_of(ref, struct hso_device, ref);
@@ -3232,13 +3281,13 @@ static int hso_mux_submit_intr_urb(struct hso_shared_int *shared_int,
3232 usb_rcvintpipe(usb, 3281 usb_rcvintpipe(usb,
3233 shared_int->intr_endp->bEndpointAddress & 0x7F), 3282 shared_int->intr_endp->bEndpointAddress & 0x7F),
3234 shared_int->shared_intr_buf, 3283 shared_int->shared_intr_buf,
3235 shared_int->intr_endp->wMaxPacketSize, 3284 1,
3236 intr_callback, shared_int, 3285 intr_callback, shared_int,
3237 shared_int->intr_endp->bInterval); 3286 shared_int->intr_endp->bInterval);
3238 3287
3239 result = usb_submit_urb(shared_int->shared_intr_urb, gfp); 3288 result = usb_submit_urb(shared_int->shared_intr_urb, gfp);
3240 if (result) 3289 if (result)
3241 dev_warn(&usb->dev, "%s failed mux_intr_urb %d", __func__, 3290 dev_warn(&usb->dev, "%s failed mux_intr_urb %d\n", __func__,
3242 result); 3291 result);
3243 3292
3244 return result; 3293 return result;
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index f14d225404da..fd19db0d2504 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -270,7 +270,7 @@ static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg)
270 get_registers(dev, PHYCNT, 1, data); 270 get_registers(dev, PHYCNT, 1, data);
271 } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT)); 271 } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT));
272 272
273 if (i < MII_TIMEOUT) { 273 if (i <= MII_TIMEOUT) {
274 get_registers(dev, PHYDAT, 2, data); 274 get_registers(dev, PHYDAT, 2, data);
275 *reg = data[0] | (data[1] << 8); 275 *reg = data[0] | (data[1] << 8);
276 return 0; 276 return 0;
@@ -295,7 +295,7 @@ static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg)
295 get_registers(dev, PHYCNT, 1, data); 295 get_registers(dev, PHYCNT, 1, data);
296 } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT)); 296 } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT));
297 297
298 if (i < MII_TIMEOUT) 298 if (i <= MII_TIMEOUT)
299 return 0; 299 return 0;
300 else 300 else
301 return 1; 301 return 1;
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 4ceb441f2687..c93f58f5c6f2 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -2237,8 +2237,6 @@ static int velocity_open(struct net_device *dev)
2237 /* Ensure chip is running */ 2237 /* Ensure chip is running */
2238 pci_set_power_state(vptr->pdev, PCI_D0); 2238 pci_set_power_state(vptr->pdev, PCI_D0);
2239 2239
2240 velocity_give_many_rx_descs(vptr);
2241
2242 velocity_init_registers(vptr, VELOCITY_INIT_COLD); 2240 velocity_init_registers(vptr, VELOCITY_INIT_COLD);
2243 2241
2244 ret = request_irq(vptr->pdev->irq, velocity_intr, IRQF_SHARED, 2242 ret = request_irq(vptr->pdev->irq, velocity_intr, IRQF_SHARED,
@@ -2250,6 +2248,8 @@ static int velocity_open(struct net_device *dev)
2250 goto out; 2248 goto out;
2251 } 2249 }
2252 2250
2251 velocity_give_many_rx_descs(vptr);
2252
2253 mac_enable_int(vptr->mac_regs); 2253 mac_enable_int(vptr->mac_regs);
2254 netif_start_queue(dev); 2254 netif_start_queue(dev);
2255 napi_enable(&vptr->napi); 2255 napi_enable(&vptr->napi);
@@ -2339,10 +2339,10 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
2339 2339
2340 dev->mtu = new_mtu; 2340 dev->mtu = new_mtu;
2341 2341
2342 velocity_give_many_rx_descs(vptr);
2343
2344 velocity_init_registers(vptr, VELOCITY_INIT_COLD); 2342 velocity_init_registers(vptr, VELOCITY_INIT_COLD);
2345 2343
2344 velocity_give_many_rx_descs(vptr);
2345
2346 mac_enable_int(vptr->mac_regs); 2346 mac_enable_int(vptr->mac_regs);
2347 netif_start_queue(dev); 2347 netif_start_queue(dev);
2348 2348
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index 0fdfd58a35a1..b9685e82f7b6 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -310,7 +310,7 @@ static int vxge_rx_map(void *dtrh, struct vxge_ring *ring)
310 dma_addr = pci_map_single(ring->pdev, rx_priv->skb_data, 310 dma_addr = pci_map_single(ring->pdev, rx_priv->skb_data,
311 rx_priv->data_size, PCI_DMA_FROMDEVICE); 311 rx_priv->data_size, PCI_DMA_FROMDEVICE);
312 312
313 if (dma_addr == 0) { 313 if (unlikely(pci_dma_mapping_error(ring->pdev, dma_addr))) {
314 ring->stats.pci_map_fail++; 314 ring->stats.pci_map_fail++;
315 return -EIO; 315 return -EIO;
316 } 316 }
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index 3c77bfe0764c..147bb1a69aba 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -3398,7 +3398,7 @@ claw_init(void)
3398 goto out_err; 3398 goto out_err;
3399 } 3399 }
3400 CLAW_DBF_TEXT(2, setup, "init_mod"); 3400 CLAW_DBF_TEXT(2, setup, "init_mod");
3401 claw_root_dev = root_device_register("qeth"); 3401 claw_root_dev = root_device_register("claw");
3402 ret = IS_ERR(claw_root_dev) ? PTR_ERR(claw_root_dev) : 0; 3402 ret = IS_ERR(claw_root_dev) ? PTR_ERR(claw_root_dev) : 0;
3403 if (ret) 3403 if (ret)
3404 goto register_err; 3404 goto register_err;
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index fc413f0f8dd2..0ee7239c5d69 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -819,6 +819,7 @@ static struct pcmcia_device_id serial_ids[] = {
819 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "cis/3CXEM556.cis"), 819 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "cis/3CXEM556.cis"),
820 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "cis/3CXEM556.cis"), 820 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "cis/3CXEM556.cis"),
821 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC850", 0xd85f6206, 0x42a2c018, "cis/SW_8xx_SER.cis"), /* Sierra Wireless AC850 3G Network Adapter R1 */ 821 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC850", 0xd85f6206, 0x42a2c018, "cis/SW_8xx_SER.cis"), /* Sierra Wireless AC850 3G Network Adapter R1 */
822 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC860", 0xd85f6206, 0x698f93db, "cis/SW_8xx_SER.cis"), /* Sierra Wireless AC860 3G Network Adapter R1 */
822 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC710/AC750", 0xd85f6206, 0x761b11e0, "cis/SW_7xx_SER.cis"), /* Sierra Wireless AC710/AC750 GPRS Network Adapter R1 */ 823 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC710/AC750", 0xd85f6206, 0x761b11e0, "cis/SW_7xx_SER.cis"), /* Sierra Wireless AC710/AC750 GPRS Network Adapter R1 */
823 PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0xa555, "cis/SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- pre update */ 824 PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0xa555, "cis/SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- pre update */
824 PCMCIA_DEVICE_CIS_MANF_CARD(0x013f, 0xa555, "cis/SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- post update */ 825 PCMCIA_DEVICE_CIS_MANF_CARD(0x013f, 0xa555, "cis/SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- post update */
@@ -827,7 +828,7 @@ static struct pcmcia_device_id serial_ids[] = {
827 PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "cis/COMpad4.cis"), 828 PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "cis/COMpad4.cis"),
828 PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "cis/COMpad2.cis"), 829 PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "cis/COMpad2.cis"),
829 PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "cis/RS-COM-2P.cis"), 830 PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "cis/RS-COM-2P.cis"),
830 PCMCIA_DEVICE_CIS_MANF_CARD(0x0013, 0x0000, "GLOBETROTTER.cis"), 831 PCMCIA_DEVICE_CIS_MANF_CARD(0x0013, 0x0000, "cis/GLOBETROTTER.cis"),
831 PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100 1.00.",0x19ca78af,0xf964f42b), 832 PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100 1.00.",0x19ca78af,0xf964f42b),
832 PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100",0x19ca78af,0x71d98e83), 833 PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100",0x19ca78af,0x71d98e83),
833 PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL232 1.00.",0x19ca78af,0x69fb7490), 834 PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL232 1.00.",0x19ca78af,0x69fb7490),
@@ -861,6 +862,18 @@ static struct pcmcia_device_id serial_ids[] = {
861}; 862};
862MODULE_DEVICE_TABLE(pcmcia, serial_ids); 863MODULE_DEVICE_TABLE(pcmcia, serial_ids);
863 864
865MODULE_FIRMWARE("cis/PCMLM28.cis");
866MODULE_FIRMWARE("cis/DP83903.cis");
867MODULE_FIRMWARE("cis/3CCFEM556.cis");
868MODULE_FIRMWARE("cis/3CXEM556.cis");
869MODULE_FIRMWARE("cis/SW_8xx_SER.cis");
870MODULE_FIRMWARE("cis/SW_7xx_SER.cis");
871MODULE_FIRMWARE("cis/SW_555_SER.cis");
872MODULE_FIRMWARE("cis/MT5634ZLX.cis");
873MODULE_FIRMWARE("cis/COMpad2.cis");
874MODULE_FIRMWARE("cis/COMpad4.cis");
875MODULE_FIRMWARE("cis/RS-COM-2P.cis");
876
864static struct pcmcia_driver serial_cs_driver = { 877static struct pcmcia_driver serial_cs_driver = {
865 .owner = THIS_MODULE, 878 .owner = THIS_MODULE,
866 .drv = { 879 .drv = {