aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-08-08 02:20:26 -0400
committerDavid S. Miller <davem@davemloft.net>2011-08-08 02:20:26 -0400
commit19fd61785a580c60cba900c5171bfadb57dd5056 (patch)
tree1e491fb014be0dc03f4b6755bb94e73afd38c455 /drivers/net
parent57569d0e12eaf31717e295960cd2a26f626c8e5b (diff)
parent8028837d71ba9904b17281b40f94b93e947fbe38 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bnx2x/bnx2x_cmn.c10
-rw-r--r--drivers/net/bnx2x/bnx2x_hsi.h2
-rw-r--r--drivers/net/bnx2x/bnx2x_link.c218
-rw-r--r--drivers/net/bnx2x/bnx2x_link.h3
-rw-r--r--drivers/net/bnx2x/bnx2x_reg.h6
-rw-r--r--drivers/net/e1000/e1000_ethtool.c6
-rw-r--r--drivers/net/e1000/e1000_hw.c3
-rw-r--r--drivers/net/e1000e/es2lan.c2
-rw-r--r--drivers/net/e1000e/ethtool.c11
-rw-r--r--drivers/net/e1000e/ich8lan.c7
-rw-r--r--drivers/net/e1000e/lib.c1
-rw-r--r--drivers/net/e1000e/netdev.c2
-rw-r--r--drivers/net/e1000e/phy.c2
-rw-r--r--drivers/net/gianfar_ptp.c9
-rw-r--r--drivers/net/igb/e1000_nvm.c1
-rw-r--r--drivers/net/igb/igb_ethtool.c5
-rw-r--r--drivers/net/igb/igb_main.c4
-rw-r--r--drivers/net/igbvf/netdev.c2
-rw-r--r--drivers/net/irda/smsc-ircc2.c18
-rw-r--r--drivers/net/ixgb/ixgb_ee.c9
-rw-r--r--drivers/net/ixgb/ixgb_hw.c2
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c1
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c1
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c5
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c3
-rw-r--r--drivers/net/ixgbe/ixgbe_phy.c3
-rw-r--r--drivers/net/ixgbe/ixgbe_x540.c1
-rw-r--r--drivers/net/macb.c3
-rw-r--r--drivers/net/mlx4/en_port.c2
-rw-r--r--drivers/net/mlx4/main.c2
-rw-r--r--drivers/net/mlx4/port.c9
-rw-r--r--drivers/net/niu.c4
-rw-r--r--drivers/net/phy/dp83640.c5
-rw-r--r--drivers/net/r8169.c27
-rw-r--r--drivers/net/slip.c2
-rw-r--r--drivers/net/usb/cdc_ncm.c156
-rw-r--r--drivers/net/usb/rtl8150.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_hw.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_hw.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c11
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c27
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945.c6
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-pci.c18
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.c3
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c3
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h3
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c5
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c20
53 files changed, 423 insertions, 249 deletions
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index 5b0dba6d4efa..d724a18b5285 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -1989,14 +1989,20 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
1989 return -EINVAL; 1989 return -EINVAL;
1990 } 1990 }
1991 1991
1992 /*
1993 * It's important to set the bp->state to the value different from
1994 * BNX2X_STATE_OPEN and only then stop the Tx. Otherwise bnx2x_tx_int()
1995 * may restart the Tx from the NAPI context (see bnx2x_tx_int()).
1996 */
1997 bp->state = BNX2X_STATE_CLOSING_WAIT4_HALT;
1998 smp_mb();
1999
1992 /* Stop Tx */ 2000 /* Stop Tx */
1993 bnx2x_tx_disable(bp); 2001 bnx2x_tx_disable(bp);
1994 2002
1995#ifdef BCM_CNIC 2003#ifdef BCM_CNIC
1996 bnx2x_cnic_notify(bp, CNIC_CTL_STOP_CMD); 2004 bnx2x_cnic_notify(bp, CNIC_CTL_STOP_CMD);
1997#endif 2005#endif
1998 bp->state = BNX2X_STATE_CLOSING_WAIT4_HALT;
1999 smp_mb();
2000 2006
2001 bp->rx_mode = BNX2X_RX_MODE_NONE; 2007 bp->rx_mode = BNX2X_RX_MODE_NONE;
2002 2008
diff --git a/drivers/net/bnx2x/bnx2x_hsi.h b/drivers/net/bnx2x/bnx2x_hsi.h
index 06727f32e505..dc24de40e336 100644
--- a/drivers/net/bnx2x/bnx2x_hsi.h
+++ b/drivers/net/bnx2x/bnx2x_hsi.h
@@ -1204,6 +1204,8 @@ struct drv_port_mb {
1204 1204
1205 #define LINK_STATUS_PFC_ENABLED 0x20000000 1205 #define LINK_STATUS_PFC_ENABLED 0x20000000
1206 1206
1207 #define LINK_STATUS_PHYSICAL_LINK_FLAG 0x40000000
1208
1207 u32 port_stx; 1209 u32 port_stx;
1208 1210
1209 u32 stat_nig_timer; 1211 u32 stat_nig_timer;
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c
index bcd8f0038628..d45b1555a602 100644
--- a/drivers/net/bnx2x/bnx2x_link.c
+++ b/drivers/net/bnx2x/bnx2x_link.c
@@ -1546,6 +1546,12 @@ static void bnx2x_umac_enable(struct link_params *params,
1546 vars->line_speed); 1546 vars->line_speed);
1547 break; 1547 break;
1548 } 1548 }
1549 if (!(vars->flow_ctrl & BNX2X_FLOW_CTRL_TX))
1550 val |= UMAC_COMMAND_CONFIG_REG_IGNORE_TX_PAUSE;
1551
1552 if (!(vars->flow_ctrl & BNX2X_FLOW_CTRL_RX))
1553 val |= UMAC_COMMAND_CONFIG_REG_PAUSE_IGNORE;
1554
1549 REG_WR(bp, umac_base + UMAC_REG_COMMAND_CONFIG, val); 1555 REG_WR(bp, umac_base + UMAC_REG_COMMAND_CONFIG, val);
1550 udelay(50); 1556 udelay(50);
1551 1557
@@ -1661,10 +1667,20 @@ static void bnx2x_xmac_disable(struct link_params *params)
1661{ 1667{
1662 u8 port = params->port; 1668 u8 port = params->port;
1663 struct bnx2x *bp = params->bp; 1669 struct bnx2x *bp = params->bp;
1664 u32 xmac_base = (port) ? GRCBASE_XMAC1 : GRCBASE_XMAC0; 1670 u32 pfc_ctrl, xmac_base = (port) ? GRCBASE_XMAC1 : GRCBASE_XMAC0;
1665 1671
1666 if (REG_RD(bp, MISC_REG_RESET_REG_2) & 1672 if (REG_RD(bp, MISC_REG_RESET_REG_2) &
1667 MISC_REGISTERS_RESET_REG_2_XMAC) { 1673 MISC_REGISTERS_RESET_REG_2_XMAC) {
1674 /*
1675 * Send an indication to change the state in the NIG back to XON
1676 * Clearing this bit enables the next set of this bit to get
1677 * rising edge
1678 */
1679 pfc_ctrl = REG_RD(bp, xmac_base + XMAC_REG_PFC_CTRL_HI);
1680 REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI,
1681 (pfc_ctrl & ~(1<<1)));
1682 REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI,
1683 (pfc_ctrl | (1<<1)));
1668 DP(NETIF_MSG_LINK, "Disable XMAC on port %x\n", port); 1684 DP(NETIF_MSG_LINK, "Disable XMAC on port %x\n", port);
1669 REG_WR(bp, xmac_base + XMAC_REG_CTRL, 0); 1685 REG_WR(bp, xmac_base + XMAC_REG_CTRL, 0);
1670 usleep_range(1000, 1000); 1686 usleep_range(1000, 1000);
@@ -1729,6 +1745,10 @@ static int bnx2x_emac_enable(struct link_params *params,
1729 1745
1730 DP(NETIF_MSG_LINK, "enabling EMAC\n"); 1746 DP(NETIF_MSG_LINK, "enabling EMAC\n");
1731 1747
1748 /* Disable BMAC */
1749 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR,
1750 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port));
1751
1732 /* enable emac and not bmac */ 1752 /* enable emac and not bmac */
1733 REG_WR(bp, NIG_REG_EGRESS_EMAC0_PORT + port*4, 1); 1753 REG_WR(bp, NIG_REG_EGRESS_EMAC0_PORT + port*4, 1);
1734 1754
@@ -2583,12 +2603,6 @@ static int bnx2x_bmac1_enable(struct link_params *params,
2583 REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_RX_LLFC_MSG_FLDS, 2603 REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_RX_LLFC_MSG_FLDS,
2584 wb_data, 2); 2604 wb_data, 2);
2585 2605
2586 if (vars->phy_flags & PHY_TX_ERROR_CHECK_FLAG) {
2587 REG_RD_DMAE(bp, bmac_addr + BIGMAC_REGISTER_RX_LSS_STATUS,
2588 wb_data, 2);
2589 if (wb_data[0] > 0)
2590 return -ESRCH;
2591 }
2592 return 0; 2606 return 0;
2593} 2607}
2594 2608
@@ -2654,16 +2668,6 @@ static int bnx2x_bmac2_enable(struct link_params *params,
2654 udelay(30); 2668 udelay(30);
2655 bnx2x_update_pfc_bmac2(params, vars, is_lb); 2669 bnx2x_update_pfc_bmac2(params, vars, is_lb);
2656 2670
2657 if (vars->phy_flags & PHY_TX_ERROR_CHECK_FLAG) {
2658 REG_RD_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_RX_LSS_STAT,
2659 wb_data, 2);
2660 if (wb_data[0] > 0) {
2661 DP(NETIF_MSG_LINK, "Got bad LSS status 0x%x\n",
2662 wb_data[0]);
2663 return -ESRCH;
2664 }
2665 }
2666
2667 return 0; 2671 return 0;
2668} 2672}
2669 2673
@@ -2949,7 +2953,9 @@ static int bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy,
2949 u32 val; 2953 u32 val;
2950 u16 i; 2954 u16 i;
2951 int rc = 0; 2955 int rc = 0;
2952 2956 if (phy->flags & FLAGS_MDC_MDIO_WA_B0)
2957 bnx2x_bits_en(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_STATUS,
2958 EMAC_MDIO_STATUS_10MB);
2953 /* address */ 2959 /* address */
2954 val = ((phy->addr << 21) | (devad << 16) | reg | 2960 val = ((phy->addr << 21) | (devad << 16) | reg |
2955 EMAC_MDIO_COMM_COMMAND_ADDRESS | 2961 EMAC_MDIO_COMM_COMMAND_ADDRESS |
@@ -3003,6 +3009,9 @@ static int bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy,
3003 } 3009 }
3004 } 3010 }
3005 3011
3012 if (phy->flags & FLAGS_MDC_MDIO_WA_B0)
3013 bnx2x_bits_dis(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_STATUS,
3014 EMAC_MDIO_STATUS_10MB);
3006 return rc; 3015 return rc;
3007} 3016}
3008 3017
@@ -3012,6 +3021,9 @@ static int bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy,
3012 u32 tmp; 3021 u32 tmp;
3013 u8 i; 3022 u8 i;
3014 int rc = 0; 3023 int rc = 0;
3024 if (phy->flags & FLAGS_MDC_MDIO_WA_B0)
3025 bnx2x_bits_en(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_STATUS,
3026 EMAC_MDIO_STATUS_10MB);
3015 3027
3016 /* address */ 3028 /* address */
3017 3029
@@ -3065,7 +3077,9 @@ static int bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy,
3065 bnx2x_cl45_read(bp, phy, devad, 0xf, &temp_val); 3077 bnx2x_cl45_read(bp, phy, devad, 0xf, &temp_val);
3066 } 3078 }
3067 } 3079 }
3068 3080 if (phy->flags & FLAGS_MDC_MDIO_WA_B0)
3081 bnx2x_bits_dis(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_STATUS,
3082 EMAC_MDIO_STATUS_10MB);
3069 return rc; 3083 return rc;
3070} 3084}
3071 3085
@@ -4353,6 +4367,9 @@ void bnx2x_link_status_update(struct link_params *params,
4353 4367
4354 vars->link_up = (vars->link_status & LINK_STATUS_LINK_UP); 4368 vars->link_up = (vars->link_status & LINK_STATUS_LINK_UP);
4355 vars->phy_flags = PHY_XGXS_FLAG; 4369 vars->phy_flags = PHY_XGXS_FLAG;
4370 if (vars->link_status & LINK_STATUS_PHYSICAL_LINK_FLAG)
4371 vars->phy_flags |= PHY_PHYSICAL_LINK_FLAG;
4372
4356 if (vars->link_up) { 4373 if (vars->link_up) {
4357 DP(NETIF_MSG_LINK, "phy link up\n"); 4374 DP(NETIF_MSG_LINK, "phy link up\n");
4358 4375
@@ -4444,6 +4461,8 @@ void bnx2x_link_status_update(struct link_params *params,
4444 4461
4445 /* indicate no mac active */ 4462 /* indicate no mac active */
4446 vars->mac_type = MAC_TYPE_NONE; 4463 vars->mac_type = MAC_TYPE_NONE;
4464 if (vars->link_status & LINK_STATUS_PHYSICAL_LINK_FLAG)
4465 vars->phy_flags |= PHY_HALF_OPEN_CONN_FLAG;
4447 } 4466 }
4448 4467
4449 /* Sync media type */ 4468 /* Sync media type */
@@ -5903,20 +5922,30 @@ int bnx2x_set_led(struct link_params *params,
5903 tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); 5922 tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED);
5904 EMAC_WR(bp, EMAC_REG_EMAC_LED, 5923 EMAC_WR(bp, EMAC_REG_EMAC_LED,
5905 (tmp | EMAC_LED_OVERRIDE)); 5924 (tmp | EMAC_LED_OVERRIDE));
5906 return rc; 5925 /*
5926 * return here without enabling traffic
5927 * LED blink andsetting rate in ON mode.
5928 * In oper mode, enabling LED blink
5929 * and setting rate is needed.
5930 */
5931 if (mode == LED_MODE_ON)
5932 return rc;
5907 } 5933 }
5908 } else if (SINGLE_MEDIA_DIRECT(params) && 5934 } else if (SINGLE_MEDIA_DIRECT(params)) {
5909 (CHIP_IS_E1x(bp) ||
5910 CHIP_IS_E2(bp))) {
5911 /* 5935 /*
5912 * This is a work-around for HW issue found when link 5936 * This is a work-around for HW issue found when link
5913 * is up in CL73 5937 * is up in CL73
5914 */ 5938 */
5915 REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0);
5916 REG_WR(bp, NIG_REG_LED_10G_P0 + port*4, 1); 5939 REG_WR(bp, NIG_REG_LED_10G_P0 + port*4, 1);
5917 } else { 5940 if (CHIP_IS_E1x(bp) ||
5941 CHIP_IS_E2(bp) ||
5942 (mode == LED_MODE_ON))
5943 REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0);
5944 else
5945 REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4,
5946 hw_led_mode);
5947 } else
5918 REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, hw_led_mode); 5948 REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, hw_led_mode);
5919 }
5920 5949
5921 REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 + port*4, 0); 5950 REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 + port*4, 0);
5922 /* Set blinking rate to ~15.9Hz */ 5951 /* Set blinking rate to ~15.9Hz */
@@ -6160,6 +6189,7 @@ static int bnx2x_update_link_down(struct link_params *params,
6160 /* update shared memory */ 6189 /* update shared memory */
6161 vars->link_status &= ~(LINK_STATUS_SPEED_AND_DUPLEX_MASK | 6190 vars->link_status &= ~(LINK_STATUS_SPEED_AND_DUPLEX_MASK |
6162 LINK_STATUS_LINK_UP | 6191 LINK_STATUS_LINK_UP |
6192 LINK_STATUS_PHYSICAL_LINK_FLAG |
6163 LINK_STATUS_AUTO_NEGOTIATE_COMPLETE | 6193 LINK_STATUS_AUTO_NEGOTIATE_COMPLETE |
6164 LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK | 6194 LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK |
6165 LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK | 6195 LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK |
@@ -6197,7 +6227,8 @@ static int bnx2x_update_link_up(struct link_params *params,
6197 u8 port = params->port; 6227 u8 port = params->port;
6198 int rc = 0; 6228 int rc = 0;
6199 6229
6200 vars->link_status |= LINK_STATUS_LINK_UP; 6230 vars->link_status |= (LINK_STATUS_LINK_UP |
6231 LINK_STATUS_PHYSICAL_LINK_FLAG);
6201 vars->phy_flags |= PHY_PHYSICAL_LINK_FLAG; 6232 vars->phy_flags |= PHY_PHYSICAL_LINK_FLAG;
6202 6233
6203 if (vars->flow_ctrl & BNX2X_FLOW_CTRL_TX) 6234 if (vars->flow_ctrl & BNX2X_FLOW_CTRL_TX)
@@ -7998,6 +8029,9 @@ static void bnx2x_warpcore_set_limiting_mode(struct link_params *params,
7998 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, 8029 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
7999 MDIO_WC_REG_UC_INFO_B1_FIRMWARE_MODE, &val); 8030 MDIO_WC_REG_UC_INFO_B1_FIRMWARE_MODE, &val);
8000 8031
8032 /* Restart microcode to re-read the new mode */
8033 bnx2x_warpcore_reset_lane(bp, phy, 1);
8034 bnx2x_warpcore_reset_lane(bp, phy, 0);
8001 8035
8002} 8036}
8003 8037
@@ -8116,7 +8150,6 @@ void bnx2x_handle_module_detect_int(struct link_params *params)
8116 offsetof(struct shmem_region, dev_info. 8150 offsetof(struct shmem_region, dev_info.
8117 port_feature_config[params->port]. 8151 port_feature_config[params->port].
8118 config)); 8152 config));
8119
8120 bnx2x_set_gpio_int(bp, gpio_num, 8153 bnx2x_set_gpio_int(bp, gpio_num,
8121 MISC_REGISTERS_GPIO_INT_OUTPUT_SET, 8154 MISC_REGISTERS_GPIO_INT_OUTPUT_SET,
8122 gpio_port); 8155 gpio_port);
@@ -8125,8 +8158,9 @@ void bnx2x_handle_module_detect_int(struct link_params *params)
8125 * Disable transmit for this module 8158 * Disable transmit for this module
8126 */ 8159 */
8127 phy->media_type = ETH_PHY_NOT_PRESENT; 8160 phy->media_type = ETH_PHY_NOT_PRESENT;
8128 if ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == 8161 if (((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) ==
8129 PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER) 8162 PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER) ||
8163 CHIP_IS_E3(bp))
8130 bnx2x_sfp_set_transmitter(params, phy, 0); 8164 bnx2x_sfp_set_transmitter(params, phy, 0);
8131 } 8165 }
8132} 8166}
@@ -8228,9 +8262,6 @@ static u8 bnx2x_8706_config_init(struct bnx2x_phy *phy,
8228 u16 cnt, val, tmp1; 8262 u16 cnt, val, tmp1;
8229 struct bnx2x *bp = params->bp; 8263 struct bnx2x *bp = params->bp;
8230 8264
8231 /* SPF+ PHY: Set flag to check for Tx error */
8232 vars->phy_flags = PHY_TX_ERROR_CHECK_FLAG;
8233
8234 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, 8265 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2,
8235 MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); 8266 MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port);
8236 /* HW reset */ 8267 /* HW reset */
@@ -8414,9 +8445,6 @@ static int bnx2x_8726_config_init(struct bnx2x_phy *phy,
8414 struct bnx2x *bp = params->bp; 8445 struct bnx2x *bp = params->bp;
8415 DP(NETIF_MSG_LINK, "Initializing BCM8726\n"); 8446 DP(NETIF_MSG_LINK, "Initializing BCM8726\n");
8416 8447
8417 /* SPF+ PHY: Set flag to check for Tx error */
8418 vars->phy_flags = PHY_TX_ERROR_CHECK_FLAG;
8419
8420 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15); 8448 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15);
8421 bnx2x_wait_reset_complete(bp, phy, params); 8449 bnx2x_wait_reset_complete(bp, phy, params);
8422 8450
@@ -8585,9 +8613,6 @@ static int bnx2x_8727_config_init(struct bnx2x_phy *phy,
8585 struct bnx2x *bp = params->bp; 8613 struct bnx2x *bp = params->bp;
8586 /* Enable PMD link, MOD_ABS_FLT, and 1G link alarm */ 8614 /* Enable PMD link, MOD_ABS_FLT, and 1G link alarm */
8587 8615
8588 /* SPF+ PHY: Set flag to check for Tx error */
8589 vars->phy_flags = PHY_TX_ERROR_CHECK_FLAG;
8590
8591 bnx2x_wait_reset_complete(bp, phy, params); 8616 bnx2x_wait_reset_complete(bp, phy, params);
8592 rx_alarm_ctrl_val = (1<<2) | (1<<5) ; 8617 rx_alarm_ctrl_val = (1<<2) | (1<<5) ;
8593 /* Should be 0x6 to enable XS on Tx side. */ 8618 /* Should be 0x6 to enable XS on Tx side. */
@@ -9243,7 +9268,13 @@ static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy,
9243 if (phy->req_duplex == DUPLEX_FULL) 9268 if (phy->req_duplex == DUPLEX_FULL)
9244 autoneg_val |= (1<<8); 9269 autoneg_val |= (1<<8);
9245 9270
9246 bnx2x_cl45_write(bp, phy, 9271 /*
9272 * Always write this if this is not 84833.
9273 * For 84833, write it only when it's a forced speed.
9274 */
9275 if ((phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) ||
9276 ((autoneg_val & (1<<12)) == 0))
9277 bnx2x_cl45_write(bp, phy,
9247 MDIO_AN_DEVAD, 9278 MDIO_AN_DEVAD,
9248 MDIO_AN_REG_8481_LEGACY_MII_CTRL, autoneg_val); 9279 MDIO_AN_REG_8481_LEGACY_MII_CTRL, autoneg_val);
9249 9280
@@ -9257,13 +9288,12 @@ static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy,
9257 bnx2x_cl45_write(bp, phy, 9288 bnx2x_cl45_write(bp, phy,
9258 MDIO_AN_DEVAD, MDIO_AN_REG_CTRL, 9289 MDIO_AN_DEVAD, MDIO_AN_REG_CTRL,
9259 0x3200); 9290 0x3200);
9260 } else if (phy->req_line_speed != SPEED_10 && 9291 } else
9261 phy->req_line_speed != SPEED_100) {
9262 bnx2x_cl45_write(bp, phy, 9292 bnx2x_cl45_write(bp, phy,
9263 MDIO_AN_DEVAD, 9293 MDIO_AN_DEVAD,
9264 MDIO_AN_REG_8481_10GBASE_T_AN_CTRL, 9294 MDIO_AN_REG_8481_10GBASE_T_AN_CTRL,
9265 1); 9295 1);
9266 } 9296
9267 /* Save spirom version */ 9297 /* Save spirom version */
9268 bnx2x_save_848xx_spirom_version(phy, params); 9298 bnx2x_save_848xx_spirom_version(phy, params);
9269 9299
@@ -9756,11 +9786,9 @@ static void bnx2x_848x3_link_reset(struct bnx2x_phy *phy,
9756 bnx2x_cl45_read(bp, phy, 9786 bnx2x_cl45_read(bp, phy,
9757 MDIO_CTL_DEVAD, 9787 MDIO_CTL_DEVAD,
9758 0x400f, &val16); 9788 0x400f, &val16);
9759 /* Put to low power mode on newer FW */ 9789 bnx2x_cl45_write(bp, phy,
9760 if ((val16 & 0x303f) > 0x1009) 9790 MDIO_PMA_DEVAD,
9761 bnx2x_cl45_write(bp, phy, 9791 MDIO_PMA_REG_CTRL, 0x800);
9762 MDIO_PMA_DEVAD,
9763 MDIO_PMA_REG_CTRL, 0x800);
9764 } 9792 }
9765} 9793}
9766 9794
@@ -10191,8 +10219,15 @@ static void bnx2x_54618se_link_reset(struct bnx2x_phy *phy,
10191 u32 cfg_pin; 10219 u32 cfg_pin;
10192 u8 port; 10220 u8 port;
10193 10221
10194 /* This works with E3 only, no need to check the chip 10222 /*
10195 before determining the port. */ 10223 * In case of no EPIO routed to reset the GPHY, put it
10224 * in low power mode.
10225 */
10226 bnx2x_cl22_write(bp, phy, MDIO_PMA_REG_CTRL, 0x800);
10227 /*
10228 * This works with E3 only, no need to check the chip
10229 * before determining the port.
10230 */
10196 port = params->port; 10231 port = params->port;
10197 cfg_pin = (REG_RD(bp, params->shmem_base + 10232 cfg_pin = (REG_RD(bp, params->shmem_base +
10198 offsetof(struct shmem_region, 10233 offsetof(struct shmem_region,
@@ -10603,7 +10638,8 @@ static struct bnx2x_phy phy_warpcore = {
10603 .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT, 10638 .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT,
10604 .addr = 0xff, 10639 .addr = 0xff,
10605 .def_md_devad = 0, 10640 .def_md_devad = 0,
10606 .flags = FLAGS_HW_LOCK_REQUIRED, 10641 .flags = (FLAGS_HW_LOCK_REQUIRED |
10642 FLAGS_TX_ERROR_CHECK),
10607 .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, 10643 .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
10608 .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, 10644 .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
10609 .mdio_ctrl = 0, 10645 .mdio_ctrl = 0,
@@ -10729,7 +10765,8 @@ static struct bnx2x_phy phy_8706 = {
10729 .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706, 10765 .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706,
10730 .addr = 0xff, 10766 .addr = 0xff,
10731 .def_md_devad = 0, 10767 .def_md_devad = 0,
10732 .flags = FLAGS_INIT_XGXS_FIRST, 10768 .flags = (FLAGS_INIT_XGXS_FIRST |
10769 FLAGS_TX_ERROR_CHECK),
10733 .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, 10770 .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
10734 .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, 10771 .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
10735 .mdio_ctrl = 0, 10772 .mdio_ctrl = 0,
@@ -10760,7 +10797,8 @@ static struct bnx2x_phy phy_8726 = {
10760 .addr = 0xff, 10797 .addr = 0xff,
10761 .def_md_devad = 0, 10798 .def_md_devad = 0,
10762 .flags = (FLAGS_HW_LOCK_REQUIRED | 10799 .flags = (FLAGS_HW_LOCK_REQUIRED |
10763 FLAGS_INIT_XGXS_FIRST), 10800 FLAGS_INIT_XGXS_FIRST |
10801 FLAGS_TX_ERROR_CHECK),
10764 .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, 10802 .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
10765 .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, 10803 .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
10766 .mdio_ctrl = 0, 10804 .mdio_ctrl = 0,
@@ -10791,7 +10829,8 @@ static struct bnx2x_phy phy_8727 = {
10791 .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727, 10829 .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727,
10792 .addr = 0xff, 10830 .addr = 0xff,
10793 .def_md_devad = 0, 10831 .def_md_devad = 0,
10794 .flags = FLAGS_FAN_FAILURE_DET_REQ, 10832 .flags = (FLAGS_FAN_FAILURE_DET_REQ |
10833 FLAGS_TX_ERROR_CHECK),
10795 .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, 10834 .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
10796 .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, 10835 .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
10797 .mdio_ctrl = 0, 10836 .mdio_ctrl = 0,
@@ -11112,6 +11151,8 @@ static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port,
11112 */ 11151 */
11113 if (CHIP_REV(bp) == CHIP_REV_Ax) 11152 if (CHIP_REV(bp) == CHIP_REV_Ax)
11114 phy->flags |= FLAGS_MDC_MDIO_WA; 11153 phy->flags |= FLAGS_MDC_MDIO_WA;
11154 else
11155 phy->flags |= FLAGS_MDC_MDIO_WA_B0;
11115 } else { 11156 } else {
11116 switch (switch_cfg) { 11157 switch (switch_cfg) {
11117 case SWITCH_CFG_1G: 11158 case SWITCH_CFG_1G:
@@ -11500,13 +11541,12 @@ void bnx2x_init_xmac_loopback(struct link_params *params,
11500 * Set WC to loopback mode since link is required to provide clock 11541 * Set WC to loopback mode since link is required to provide clock
11501 * to the XMAC in 20G mode 11542 * to the XMAC in 20G mode
11502 */ 11543 */
11503 if (vars->line_speed == SPEED_20000) { 11544 bnx2x_set_aer_mmd(params, &params->phy[0]);
11504 bnx2x_set_aer_mmd(params, &params->phy[0]); 11545 bnx2x_warpcore_reset_lane(bp, &params->phy[0], 0);
11505 bnx2x_warpcore_reset_lane(bp, &params->phy[0], 0); 11546 params->phy[INT_PHY].config_loopback(
11506 params->phy[INT_PHY].config_loopback(
11507 &params->phy[INT_PHY], 11547 &params->phy[INT_PHY],
11508 params); 11548 params);
11509 } 11549
11510 bnx2x_xmac_enable(params, vars, 1); 11550 bnx2x_xmac_enable(params, vars, 1);
11511 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); 11551 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0);
11512} 11552}
@@ -11684,12 +11724,16 @@ int bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
11684 bnx2x_set_led(params, vars, LED_MODE_OFF, 0); 11724 bnx2x_set_led(params, vars, LED_MODE_OFF, 0);
11685 11725
11686 if (reset_ext_phy) { 11726 if (reset_ext_phy) {
11727 bnx2x_set_mdio_clk(bp, params->chip_id, port);
11687 for (phy_index = EXT_PHY1; phy_index < params->num_phys; 11728 for (phy_index = EXT_PHY1; phy_index < params->num_phys;
11688 phy_index++) { 11729 phy_index++) {
11689 if (params->phy[phy_index].link_reset) 11730 if (params->phy[phy_index].link_reset) {
11731 bnx2x_set_aer_mmd(params,
11732 &params->phy[phy_index]);
11690 params->phy[phy_index].link_reset( 11733 params->phy[phy_index].link_reset(
11691 &params->phy[phy_index], 11734 &params->phy[phy_index],
11692 params); 11735 params);
11736 }
11693 if (params->phy[phy_index].flags & 11737 if (params->phy[phy_index].flags &
11694 FLAGS_REARM_LATCH_SIGNAL) 11738 FLAGS_REARM_LATCH_SIGNAL)
11695 clear_latch_ind = 1; 11739 clear_latch_ind = 1;
@@ -12178,10 +12222,6 @@ static void bnx2x_analyze_link_error(struct link_params *params,
12178 u8 led_mode; 12222 u8 led_mode;
12179 u32 half_open_conn = (vars->phy_flags & PHY_HALF_OPEN_CONN_FLAG) > 0; 12223 u32 half_open_conn = (vars->phy_flags & PHY_HALF_OPEN_CONN_FLAG) > 0;
12180 12224
12181 /*DP(NETIF_MSG_LINK, "CHECK LINK: %x half_open:%x-> lss:%x\n",
12182 vars->link_up,
12183 half_open_conn, lss_status);*/
12184
12185 if ((lss_status ^ half_open_conn) == 0) 12225 if ((lss_status ^ half_open_conn) == 0)
12186 return; 12226 return;
12187 12227
@@ -12194,6 +12234,7 @@ static void bnx2x_analyze_link_error(struct link_params *params,
12194 * b. Update link_vars->link_up 12234 * b. Update link_vars->link_up
12195 */ 12235 */
12196 if (lss_status) { 12236 if (lss_status) {
12237 DP(NETIF_MSG_LINK, "Remote Fault detected !!!\n");
12197 vars->link_status &= ~LINK_STATUS_LINK_UP; 12238 vars->link_status &= ~LINK_STATUS_LINK_UP;
12198 vars->link_up = 0; 12239 vars->link_up = 0;
12199 vars->phy_flags |= PHY_HALF_OPEN_CONN_FLAG; 12240 vars->phy_flags |= PHY_HALF_OPEN_CONN_FLAG;
@@ -12203,6 +12244,7 @@ static void bnx2x_analyze_link_error(struct link_params *params,
12203 */ 12244 */
12204 led_mode = LED_MODE_OFF; 12245 led_mode = LED_MODE_OFF;
12205 } else { 12246 } else {
12247 DP(NETIF_MSG_LINK, "Remote Fault cleared\n");
12206 vars->link_status |= LINK_STATUS_LINK_UP; 12248 vars->link_status |= LINK_STATUS_LINK_UP;
12207 vars->link_up = 1; 12249 vars->link_up = 1;
12208 vars->phy_flags &= ~PHY_HALF_OPEN_CONN_FLAG; 12250 vars->phy_flags &= ~PHY_HALF_OPEN_CONN_FLAG;
@@ -12219,6 +12261,15 @@ static void bnx2x_analyze_link_error(struct link_params *params,
12219 bnx2x_notify_link_changed(bp); 12261 bnx2x_notify_link_changed(bp);
12220} 12262}
12221 12263
12264/******************************************************************************
12265* Description:
12266* This function checks for half opened connection change indication.
12267* When such change occurs, it calls the bnx2x_analyze_link_error
12268* to check if Remote Fault is set or cleared. Reception of remote fault
12269* status message in the MAC indicates that the peer's MAC has detected
12270* a fault, for example, due to break in the TX side of fiber.
12271*
12272******************************************************************************/
12222static void bnx2x_check_half_open_conn(struct link_params *params, 12273static void bnx2x_check_half_open_conn(struct link_params *params,
12223 struct link_vars *vars) 12274 struct link_vars *vars)
12224{ 12275{
@@ -12229,9 +12280,28 @@ static void bnx2x_check_half_open_conn(struct link_params *params,
12229 if ((vars->phy_flags & PHY_PHYSICAL_LINK_FLAG) == 0) 12280 if ((vars->phy_flags & PHY_PHYSICAL_LINK_FLAG) == 0)
12230 return; 12281 return;
12231 12282
12232 if (!CHIP_IS_E3(bp) && 12283 if (CHIP_IS_E3(bp) &&
12233 (REG_RD(bp, MISC_REG_RESET_REG_2) & 12284 (REG_RD(bp, MISC_REG_RESET_REG_2) &
12234 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << params->port))) { 12285 (MISC_REGISTERS_RESET_REG_2_XMAC))) {
12286 /* Check E3 XMAC */
12287 /*
12288 * Note that link speed cannot be queried here, since it may be
12289 * zero while link is down. In case UMAC is active, LSS will
12290 * simply not be set
12291 */
12292 mac_base = (params->port) ? GRCBASE_XMAC1 : GRCBASE_XMAC0;
12293
12294 /* Clear stick bits (Requires rising edge) */
12295 REG_WR(bp, mac_base + XMAC_REG_CLEAR_RX_LSS_STATUS, 0);
12296 REG_WR(bp, mac_base + XMAC_REG_CLEAR_RX_LSS_STATUS,
12297 XMAC_CLEAR_RX_LSS_STATUS_REG_CLEAR_LOCAL_FAULT_STATUS |
12298 XMAC_CLEAR_RX_LSS_STATUS_REG_CLEAR_REMOTE_FAULT_STATUS);
12299 if (REG_RD(bp, mac_base + XMAC_REG_RX_LSS_STATUS))
12300 lss_status = 1;
12301
12302 bnx2x_analyze_link_error(params, vars, lss_status);
12303 } else if (REG_RD(bp, MISC_REG_RESET_REG_2) &
12304 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << params->port)) {
12235 /* Check E1X / E2 BMAC */ 12305 /* Check E1X / E2 BMAC */
12236 u32 lss_status_reg; 12306 u32 lss_status_reg;
12237 u32 wb_data[2]; 12307 u32 wb_data[2];
@@ -12253,14 +12323,20 @@ static void bnx2x_check_half_open_conn(struct link_params *params,
12253void bnx2x_period_func(struct link_params *params, struct link_vars *vars) 12323void bnx2x_period_func(struct link_params *params, struct link_vars *vars)
12254{ 12324{
12255 struct bnx2x *bp = params->bp; 12325 struct bnx2x *bp = params->bp;
12326 u16 phy_idx;
12256 if (!params) { 12327 if (!params) {
12257 DP(NETIF_MSG_LINK, "Ininitliazed params !\n"); 12328 DP(NETIF_MSG_LINK, "Uninitialized params !\n");
12258 return; 12329 return;
12259 } 12330 }
12260 /* DP(NETIF_MSG_LINK, "Periodic called vars->phy_flags 0x%x speed 0x%x 12331
12261 RESET_REG_2 0x%x\n", vars->phy_flags, vars->line_speed, 12332 for (phy_idx = INT_PHY; phy_idx < MAX_PHYS; phy_idx++) {
12262 REG_RD(bp, MISC_REG_RESET_REG_2)); */ 12333 if (params->phy[phy_idx].flags & FLAGS_TX_ERROR_CHECK) {
12263 bnx2x_check_half_open_conn(params, vars); 12334 bnx2x_set_aer_mmd(params, &params->phy[phy_idx]);
12335 bnx2x_check_half_open_conn(params, vars);
12336 break;
12337 }
12338 }
12339
12264 if (CHIP_IS_E3(bp)) 12340 if (CHIP_IS_E3(bp))
12265 bnx2x_check_over_curr(params, vars); 12341 bnx2x_check_over_curr(params, vars);
12266} 12342}
diff --git a/drivers/net/bnx2x/bnx2x_link.h b/drivers/net/bnx2x/bnx2x_link.h
index 6a7708d5da37..c12db6da213e 100644
--- a/drivers/net/bnx2x/bnx2x_link.h
+++ b/drivers/net/bnx2x/bnx2x_link.h
@@ -145,6 +145,8 @@ struct bnx2x_phy {
145#define FLAGS_SFP_NOT_APPROVED (1<<7) 145#define FLAGS_SFP_NOT_APPROVED (1<<7)
146#define FLAGS_MDC_MDIO_WA (1<<8) 146#define FLAGS_MDC_MDIO_WA (1<<8)
147#define FLAGS_DUMMY_READ (1<<9) 147#define FLAGS_DUMMY_READ (1<<9)
148#define FLAGS_MDC_MDIO_WA_B0 (1<<10)
149#define FLAGS_TX_ERROR_CHECK (1<<12)
148 150
149 /* preemphasis values for the rx side */ 151 /* preemphasis values for the rx side */
150 u16 rx_preemphasis[4]; 152 u16 rx_preemphasis[4];
@@ -276,7 +278,6 @@ struct link_vars {
276#define PHY_PHYSICAL_LINK_FLAG (1<<2) 278#define PHY_PHYSICAL_LINK_FLAG (1<<2)
277#define PHY_HALF_OPEN_CONN_FLAG (1<<3) 279#define PHY_HALF_OPEN_CONN_FLAG (1<<3)
278#define PHY_OVER_CURRENT_FLAG (1<<4) 280#define PHY_OVER_CURRENT_FLAG (1<<4)
279#define PHY_TX_ERROR_CHECK_FLAG (1<<5)
280 281
281 u8 mac_type; 282 u8 mac_type;
282#define MAC_TYPE_NONE 0 283#define MAC_TYPE_NONE 0
diff --git a/drivers/net/bnx2x/bnx2x_reg.h b/drivers/net/bnx2x/bnx2x_reg.h
index 02461fef8751..27b5ecb11830 100644
--- a/drivers/net/bnx2x/bnx2x_reg.h
+++ b/drivers/net/bnx2x/bnx2x_reg.h
@@ -4771,9 +4771,11 @@
4771 The fields are: [4:0] - tail pointer; 10:5] - Link List size; 15:11] - 4771 The fields are: [4:0] - tail pointer; 10:5] - Link List size; 15:11] -
4772 header pointer. */ 4772 header pointer. */
4773#define UCM_REG_XX_TABLE 0xe0300 4773#define UCM_REG_XX_TABLE 0xe0300
4774#define UMAC_COMMAND_CONFIG_REG_IGNORE_TX_PAUSE (0x1<<28)
4774#define UMAC_COMMAND_CONFIG_REG_LOOP_ENA (0x1<<15) 4775#define UMAC_COMMAND_CONFIG_REG_LOOP_ENA (0x1<<15)
4775#define UMAC_COMMAND_CONFIG_REG_NO_LGTH_CHECK (0x1<<24) 4776#define UMAC_COMMAND_CONFIG_REG_NO_LGTH_CHECK (0x1<<24)
4776#define UMAC_COMMAND_CONFIG_REG_PAD_EN (0x1<<5) 4777#define UMAC_COMMAND_CONFIG_REG_PAD_EN (0x1<<5)
4778#define UMAC_COMMAND_CONFIG_REG_PAUSE_IGNORE (0x1<<8)
4777#define UMAC_COMMAND_CONFIG_REG_PROMIS_EN (0x1<<4) 4779#define UMAC_COMMAND_CONFIG_REG_PROMIS_EN (0x1<<4)
4778#define UMAC_COMMAND_CONFIG_REG_RX_ENA (0x1<<1) 4780#define UMAC_COMMAND_CONFIG_REG_RX_ENA (0x1<<1)
4779#define UMAC_COMMAND_CONFIG_REG_SW_RESET (0x1<<13) 4781#define UMAC_COMMAND_CONFIG_REG_SW_RESET (0x1<<13)
@@ -5622,8 +5624,9 @@
5622#define EMAC_MDIO_COMM_START_BUSY (1L<<29) 5624#define EMAC_MDIO_COMM_START_BUSY (1L<<29)
5623#define EMAC_MDIO_MODE_AUTO_POLL (1L<<4) 5625#define EMAC_MDIO_MODE_AUTO_POLL (1L<<4)
5624#define EMAC_MDIO_MODE_CLAUSE_45 (1L<<31) 5626#define EMAC_MDIO_MODE_CLAUSE_45 (1L<<31)
5625#define EMAC_MDIO_MODE_CLOCK_CNT (0x3fL<<16) 5627#define EMAC_MDIO_MODE_CLOCK_CNT (0x3ffL<<16)
5626#define EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT 16 5628#define EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT 16
5629#define EMAC_MDIO_STATUS_10MB (1L<<1)
5627#define EMAC_MODE_25G_MODE (1L<<5) 5630#define EMAC_MODE_25G_MODE (1L<<5)
5628#define EMAC_MODE_HALF_DUPLEX (1L<<1) 5631#define EMAC_MODE_HALF_DUPLEX (1L<<1)
5629#define EMAC_MODE_PORT_GMII (2L<<2) 5632#define EMAC_MODE_PORT_GMII (2L<<2)
@@ -5634,6 +5637,7 @@
5634#define EMAC_REG_EMAC_MAC_MATCH 0x10 5637#define EMAC_REG_EMAC_MAC_MATCH 0x10
5635#define EMAC_REG_EMAC_MDIO_COMM 0xac 5638#define EMAC_REG_EMAC_MDIO_COMM 0xac
5636#define EMAC_REG_EMAC_MDIO_MODE 0xb4 5639#define EMAC_REG_EMAC_MDIO_MODE 0xb4
5640#define EMAC_REG_EMAC_MDIO_STATUS 0xb0
5637#define EMAC_REG_EMAC_MODE 0x0 5641#define EMAC_REG_EMAC_MODE 0x0
5638#define EMAC_REG_EMAC_RX_MODE 0xc8 5642#define EMAC_REG_EMAC_RX_MODE 0xc8
5639#define EMAC_REG_EMAC_RX_MTU_SIZE 0x9c 5643#define EMAC_REG_EMAC_RX_MTU_SIZE 0x9c
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index c5f0f04219f3..5548d464261a 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -838,6 +838,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
838 838
839 /* Disable all the interrupts */ 839 /* Disable all the interrupts */
840 ew32(IMC, 0xFFFFFFFF); 840 ew32(IMC, 0xFFFFFFFF);
841 E1000_WRITE_FLUSH();
841 msleep(10); 842 msleep(10);
842 843
843 /* Test each interrupt */ 844 /* Test each interrupt */
@@ -856,6 +857,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
856 adapter->test_icr = 0; 857 adapter->test_icr = 0;
857 ew32(IMC, mask); 858 ew32(IMC, mask);
858 ew32(ICS, mask); 859 ew32(ICS, mask);
860 E1000_WRITE_FLUSH();
859 msleep(10); 861 msleep(10);
860 862
861 if (adapter->test_icr & mask) { 863 if (adapter->test_icr & mask) {
@@ -873,6 +875,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
873 adapter->test_icr = 0; 875 adapter->test_icr = 0;
874 ew32(IMS, mask); 876 ew32(IMS, mask);
875 ew32(ICS, mask); 877 ew32(ICS, mask);
878 E1000_WRITE_FLUSH();
876 msleep(10); 879 msleep(10);
877 880
878 if (!(adapter->test_icr & mask)) { 881 if (!(adapter->test_icr & mask)) {
@@ -890,6 +893,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
890 adapter->test_icr = 0; 893 adapter->test_icr = 0;
891 ew32(IMC, ~mask & 0x00007FFF); 894 ew32(IMC, ~mask & 0x00007FFF);
892 ew32(ICS, ~mask & 0x00007FFF); 895 ew32(ICS, ~mask & 0x00007FFF);
896 E1000_WRITE_FLUSH();
893 msleep(10); 897 msleep(10);
894 898
895 if (adapter->test_icr) { 899 if (adapter->test_icr) {
@@ -901,6 +905,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
901 905
902 /* Disable all the interrupts */ 906 /* Disable all the interrupts */
903 ew32(IMC, 0xFFFFFFFF); 907 ew32(IMC, 0xFFFFFFFF);
908 E1000_WRITE_FLUSH();
904 msleep(10); 909 msleep(10);
905 910
906 /* Unhook test interrupt handler */ 911 /* Unhook test interrupt handler */
@@ -1394,6 +1399,7 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
1394 if (unlikely(++k == txdr->count)) k = 0; 1399 if (unlikely(++k == txdr->count)) k = 0;
1395 } 1400 }
1396 ew32(TDT, k); 1401 ew32(TDT, k);
1402 E1000_WRITE_FLUSH();
1397 msleep(200); 1403 msleep(200);
1398 time = jiffies; /* set the start time for the receive */ 1404 time = jiffies; /* set the start time for the receive */
1399 good_cnt = 0; 1405 good_cnt = 0;
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 1698622af434..8545c7aa93eb 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -446,6 +446,7 @@ s32 e1000_reset_hw(struct e1000_hw *hw)
446 /* Must reset the PHY before resetting the MAC */ 446 /* Must reset the PHY before resetting the MAC */
447 if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { 447 if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) {
448 ew32(CTRL, (ctrl | E1000_CTRL_PHY_RST)); 448 ew32(CTRL, (ctrl | E1000_CTRL_PHY_RST));
449 E1000_WRITE_FLUSH();
449 msleep(5); 450 msleep(5);
450 } 451 }
451 452
@@ -3752,6 +3753,7 @@ static s32 e1000_acquire_eeprom(struct e1000_hw *hw)
3752 /* Clear SK and CS */ 3753 /* Clear SK and CS */
3753 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); 3754 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
3754 ew32(EECD, eecd); 3755 ew32(EECD, eecd);
3756 E1000_WRITE_FLUSH();
3755 udelay(1); 3757 udelay(1);
3756 } 3758 }
3757 3759
@@ -3824,6 +3826,7 @@ static void e1000_release_eeprom(struct e1000_hw *hw)
3824 eecd &= ~E1000_EECD_SK; /* Lower SCK */ 3826 eecd &= ~E1000_EECD_SK; /* Lower SCK */
3825 3827
3826 ew32(EECD, eecd); 3828 ew32(EECD, eecd);
3829 E1000_WRITE_FLUSH();
3827 3830
3828 udelay(hw->eeprom.delay_usec); 3831 udelay(hw->eeprom.delay_usec);
3829 } else if (hw->eeprom.type == e1000_eeprom_microwire) { 3832 } else if (hw->eeprom.type == e1000_eeprom_microwire) {
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index c0ecb2d9fdb7..e4f42257c24c 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -1313,6 +1313,7 @@ static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
1313 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & 1313 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
1314 E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; 1314 E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
1315 ew32(KMRNCTRLSTA, kmrnctrlsta); 1315 ew32(KMRNCTRLSTA, kmrnctrlsta);
1316 e1e_flush();
1316 1317
1317 udelay(2); 1318 udelay(2);
1318 1319
@@ -1347,6 +1348,7 @@ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
1347 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & 1348 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
1348 E1000_KMRNCTRLSTA_OFFSET) | data; 1349 E1000_KMRNCTRLSTA_OFFSET) | data;
1349 ew32(KMRNCTRLSTA, kmrnctrlsta); 1350 ew32(KMRNCTRLSTA, kmrnctrlsta);
1351 e1e_flush();
1350 1352
1351 udelay(2); 1353 udelay(2);
1352 1354
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index cb1a3623253e..06d88f316dce 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -28,8 +28,8 @@
28 28
29/* ethtool support for e1000 */ 29/* ethtool support for e1000 */
30 30
31#include <linux/interrupt.h>
32#include <linux/netdevice.h> 31#include <linux/netdevice.h>
32#include <linux/interrupt.h>
33#include <linux/ethtool.h> 33#include <linux/ethtool.h>
34#include <linux/pci.h> 34#include <linux/pci.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
@@ -964,6 +964,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
964 964
965 /* Disable all the interrupts */ 965 /* Disable all the interrupts */
966 ew32(IMC, 0xFFFFFFFF); 966 ew32(IMC, 0xFFFFFFFF);
967 e1e_flush();
967 usleep_range(10000, 20000); 968 usleep_range(10000, 20000);
968 969
969 /* Test each interrupt */ 970 /* Test each interrupt */
@@ -996,6 +997,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
996 adapter->test_icr = 0; 997 adapter->test_icr = 0;
997 ew32(IMC, mask); 998 ew32(IMC, mask);
998 ew32(ICS, mask); 999 ew32(ICS, mask);
1000 e1e_flush();
999 usleep_range(10000, 20000); 1001 usleep_range(10000, 20000);
1000 1002
1001 if (adapter->test_icr & mask) { 1003 if (adapter->test_icr & mask) {
@@ -1014,6 +1016,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
1014 adapter->test_icr = 0; 1016 adapter->test_icr = 0;
1015 ew32(IMS, mask); 1017 ew32(IMS, mask);
1016 ew32(ICS, mask); 1018 ew32(ICS, mask);
1019 e1e_flush();
1017 usleep_range(10000, 20000); 1020 usleep_range(10000, 20000);
1018 1021
1019 if (!(adapter->test_icr & mask)) { 1022 if (!(adapter->test_icr & mask)) {
@@ -1032,6 +1035,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
1032 adapter->test_icr = 0; 1035 adapter->test_icr = 0;
1033 ew32(IMC, ~mask & 0x00007FFF); 1036 ew32(IMC, ~mask & 0x00007FFF);
1034 ew32(ICS, ~mask & 0x00007FFF); 1037 ew32(ICS, ~mask & 0x00007FFF);
1038 e1e_flush();
1035 usleep_range(10000, 20000); 1039 usleep_range(10000, 20000);
1036 1040
1037 if (adapter->test_icr) { 1041 if (adapter->test_icr) {
@@ -1043,6 +1047,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
1043 1047
1044 /* Disable all the interrupts */ 1048 /* Disable all the interrupts */
1045 ew32(IMC, 0xFFFFFFFF); 1049 ew32(IMC, 0xFFFFFFFF);
1050 e1e_flush();
1046 usleep_range(10000, 20000); 1051 usleep_range(10000, 20000);
1047 1052
1048 /* Unhook test interrupt handler */ 1053 /* Unhook test interrupt handler */
@@ -1276,6 +1281,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1276 E1000_CTRL_FD); /* Force Duplex to FULL */ 1281 E1000_CTRL_FD); /* Force Duplex to FULL */
1277 1282
1278 ew32(CTRL, ctrl_reg); 1283 ew32(CTRL, ctrl_reg);
1284 e1e_flush();
1279 udelay(500); 1285 udelay(500);
1280 1286
1281 return 0; 1287 return 0;
@@ -1418,6 +1424,7 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter)
1418 */ 1424 */
1419#define E1000_SERDES_LB_ON 0x410 1425#define E1000_SERDES_LB_ON 0x410
1420 ew32(SCTL, E1000_SERDES_LB_ON); 1426 ew32(SCTL, E1000_SERDES_LB_ON);
1427 e1e_flush();
1421 usleep_range(10000, 20000); 1428 usleep_range(10000, 20000);
1422 1429
1423 return 0; 1430 return 0;
@@ -1513,6 +1520,7 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
1513 hw->phy.media_type == e1000_media_type_internal_serdes) { 1520 hw->phy.media_type == e1000_media_type_internal_serdes) {
1514#define E1000_SERDES_LB_OFF 0x400 1521#define E1000_SERDES_LB_OFF 0x400
1515 ew32(SCTL, E1000_SERDES_LB_OFF); 1522 ew32(SCTL, E1000_SERDES_LB_OFF);
1523 e1e_flush();
1516 usleep_range(10000, 20000); 1524 usleep_range(10000, 20000);
1517 break; 1525 break;
1518 } 1526 }
@@ -1592,6 +1600,7 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
1592 k = 0; 1600 k = 0;
1593 } 1601 }
1594 ew32(TDT, k); 1602 ew32(TDT, k);
1603 e1e_flush();
1595 msleep(200); 1604 msleep(200);
1596 time = jiffies; /* set the start time for the receive */ 1605 time = jiffies; /* set the start time for the receive */
1597 good_cnt = 0; 1606 good_cnt = 0;
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index c1752124f3cd..4e36978b8fd8 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -283,6 +283,7 @@ static void e1000_toggle_lanphypc_value_ich8lan(struct e1000_hw *hw)
283 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; 283 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE;
284 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; 284 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE;
285 ew32(CTRL, ctrl); 285 ew32(CTRL, ctrl);
286 e1e_flush();
286 udelay(10); 287 udelay(10);
287 ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE; 288 ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE;
288 ew32(CTRL, ctrl); 289 ew32(CTRL, ctrl);
@@ -1230,9 +1231,11 @@ s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable)
1230 ew32(CTRL, reg); 1231 ew32(CTRL, reg);
1231 1232
1232 ew32(CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_SPD_BYPS); 1233 ew32(CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_SPD_BYPS);
1234 e1e_flush();
1233 udelay(20); 1235 udelay(20);
1234 ew32(CTRL, ctrl_reg); 1236 ew32(CTRL, ctrl_reg);
1235 ew32(CTRL_EXT, ctrl_ext); 1237 ew32(CTRL_EXT, ctrl_ext);
1238 e1e_flush();
1236 udelay(20); 1239 udelay(20);
1237 1240
1238out: 1241out:
@@ -2134,8 +2137,7 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
2134 2137
2135 ret_val = 0; 2138 ret_val = 0;
2136 for (i = 0; i < words; i++) { 2139 for (i = 0; i < words; i++) {
2137 if ((dev_spec->shadow_ram) && 2140 if (dev_spec->shadow_ram[offset+i].modified) {
2138 (dev_spec->shadow_ram[offset+i].modified)) {
2139 data[i] = dev_spec->shadow_ram[offset+i].value; 2141 data[i] = dev_spec->shadow_ram[offset+i].value;
2140 } else { 2142 } else {
2141 ret_val = e1000_read_flash_word_ich8lan(hw, 2143 ret_val = e1000_read_flash_word_ich8lan(hw,
@@ -3090,6 +3092,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
3090 ret_val = e1000_acquire_swflag_ich8lan(hw); 3092 ret_val = e1000_acquire_swflag_ich8lan(hw);
3091 e_dbg("Issuing a global reset to ich8lan\n"); 3093 e_dbg("Issuing a global reset to ich8lan\n");
3092 ew32(CTRL, (ctrl | E1000_CTRL_RST)); 3094 ew32(CTRL, (ctrl | E1000_CTRL_RST));
3095 /* cannot issue a flush here because it hangs the hardware */
3093 msleep(20); 3096 msleep(20);
3094 3097
3095 if (!ret_val) 3098 if (!ret_val)
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index 65580b405942..7898a67d6505 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -1986,6 +1986,7 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
1986 /* Clear SK and CS */ 1986 /* Clear SK and CS */
1987 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); 1987 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
1988 ew32(EECD, eecd); 1988 ew32(EECD, eecd);
1989 e1e_flush();
1989 udelay(1); 1990 udelay(1);
1990 1991
1991 /* 1992 /*
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4353ad56cf16..ab4be80f7ab5 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -31,12 +31,12 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/types.h> 32#include <linux/types.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/interrupt.h>
35#include <linux/pci.h> 34#include <linux/pci.h>
36#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
37#include <linux/pagemap.h> 36#include <linux/pagemap.h>
38#include <linux/delay.h> 37#include <linux/delay.h>
39#include <linux/netdevice.h> 38#include <linux/netdevice.h>
39#include <linux/interrupt.h>
40#include <linux/tcp.h> 40#include <linux/tcp.h>
41#include <linux/ipv6.h> 41#include <linux/ipv6.h>
42#include <linux/slab.h> 42#include <linux/slab.h>
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 2a6ee13285b1..8666476cb9be 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -537,6 +537,7 @@ static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data,
537 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & 537 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
538 E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; 538 E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
539 ew32(KMRNCTRLSTA, kmrnctrlsta); 539 ew32(KMRNCTRLSTA, kmrnctrlsta);
540 e1e_flush();
540 541
541 udelay(2); 542 udelay(2);
542 543
@@ -609,6 +610,7 @@ static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data,
609 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & 610 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
610 E1000_KMRNCTRLSTA_OFFSET) | data; 611 E1000_KMRNCTRLSTA_OFFSET) | data;
611 ew32(KMRNCTRLSTA, kmrnctrlsta); 612 ew32(KMRNCTRLSTA, kmrnctrlsta);
613 e1e_flush();
612 614
613 udelay(2); 615 udelay(2);
614 616
diff --git a/drivers/net/gianfar_ptp.c b/drivers/net/gianfar_ptp.c
index 1c97861596f0..f67b8aebc89c 100644
--- a/drivers/net/gianfar_ptp.c
+++ b/drivers/net/gianfar_ptp.c
@@ -193,14 +193,9 @@ static void set_alarm(struct etsects *etsects)
193/* Caller must hold etsects->lock. */ 193/* Caller must hold etsects->lock. */
194static void set_fipers(struct etsects *etsects) 194static void set_fipers(struct etsects *etsects)
195{ 195{
196 u32 tmr_ctrl = gfar_read(&etsects->regs->tmr_ctrl); 196 set_alarm(etsects);
197
198 gfar_write(&etsects->regs->tmr_ctrl, tmr_ctrl & (~TE));
199 gfar_write(&etsects->regs->tmr_prsc, etsects->tmr_prsc);
200 gfar_write(&etsects->regs->tmr_fiper1, etsects->tmr_fiper1); 197 gfar_write(&etsects->regs->tmr_fiper1, etsects->tmr_fiper1);
201 gfar_write(&etsects->regs->tmr_fiper2, etsects->tmr_fiper2); 198 gfar_write(&etsects->regs->tmr_fiper2, etsects->tmr_fiper2);
202 set_alarm(etsects);
203 gfar_write(&etsects->regs->tmr_ctrl, tmr_ctrl|TE);
204} 199}
205 200
206/* 201/*
@@ -511,7 +506,7 @@ static int gianfar_ptp_probe(struct platform_device *dev)
511 gfar_write(&etsects->regs->tmr_fiper1, etsects->tmr_fiper1); 506 gfar_write(&etsects->regs->tmr_fiper1, etsects->tmr_fiper1);
512 gfar_write(&etsects->regs->tmr_fiper2, etsects->tmr_fiper2); 507 gfar_write(&etsects->regs->tmr_fiper2, etsects->tmr_fiper2);
513 set_alarm(etsects); 508 set_alarm(etsects);
514 gfar_write(&etsects->regs->tmr_ctrl, tmr_ctrl|FS|RTPE|TE); 509 gfar_write(&etsects->regs->tmr_ctrl, tmr_ctrl|FS|RTPE|TE|FRD);
515 510
516 spin_unlock_irqrestore(&etsects->lock, flags); 511 spin_unlock_irqrestore(&etsects->lock, flags);
517 512
diff --git a/drivers/net/igb/e1000_nvm.c b/drivers/net/igb/e1000_nvm.c
index 7dcd65cede56..40407124e722 100644
--- a/drivers/net/igb/e1000_nvm.c
+++ b/drivers/net/igb/e1000_nvm.c
@@ -285,6 +285,7 @@ static s32 igb_ready_nvm_eeprom(struct e1000_hw *hw)
285 /* Clear SK and CS */ 285 /* Clear SK and CS */
286 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); 286 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
287 wr32(E1000_EECD, eecd); 287 wr32(E1000_EECD, eecd);
288 wrfl();
288 udelay(1); 289 udelay(1);
289 timeout = NVM_MAX_RETRY_SPI; 290 timeout = NVM_MAX_RETRY_SPI;
290 291
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index ff244ce803ce..414b0225be89 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -1225,6 +1225,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
1225 1225
1226 /* Disable all the interrupts */ 1226 /* Disable all the interrupts */
1227 wr32(E1000_IMC, ~0); 1227 wr32(E1000_IMC, ~0);
1228 wrfl();
1228 msleep(10); 1229 msleep(10);
1229 1230
1230 /* Define all writable bits for ICS */ 1231 /* Define all writable bits for ICS */
@@ -1268,6 +1269,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
1268 1269
1269 wr32(E1000_IMC, mask); 1270 wr32(E1000_IMC, mask);
1270 wr32(E1000_ICS, mask); 1271 wr32(E1000_ICS, mask);
1272 wrfl();
1271 msleep(10); 1273 msleep(10);
1272 1274
1273 if (adapter->test_icr & mask) { 1275 if (adapter->test_icr & mask) {
@@ -1289,6 +1291,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
1289 1291
1290 wr32(E1000_IMS, mask); 1292 wr32(E1000_IMS, mask);
1291 wr32(E1000_ICS, mask); 1293 wr32(E1000_ICS, mask);
1294 wrfl();
1292 msleep(10); 1295 msleep(10);
1293 1296
1294 if (!(adapter->test_icr & mask)) { 1297 if (!(adapter->test_icr & mask)) {
@@ -1310,6 +1313,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
1310 1313
1311 wr32(E1000_IMC, ~mask); 1314 wr32(E1000_IMC, ~mask);
1312 wr32(E1000_ICS, ~mask); 1315 wr32(E1000_ICS, ~mask);
1316 wrfl();
1313 msleep(10); 1317 msleep(10);
1314 1318
1315 if (adapter->test_icr & mask) { 1319 if (adapter->test_icr & mask) {
@@ -1321,6 +1325,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
1321 1325
1322 /* Disable all the interrupts */ 1326 /* Disable all the interrupts */
1323 wr32(E1000_IMC, ~0); 1327 wr32(E1000_IMC, ~0);
1328 wrfl();
1324 msleep(10); 1329 msleep(10);
1325 1330
1326 /* Unhook test interrupt handler */ 1331 /* Unhook test interrupt handler */
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index dc599059512a..40d4c405fd7e 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -1052,6 +1052,7 @@ msi_only:
1052 kfree(adapter->vf_data); 1052 kfree(adapter->vf_data);
1053 adapter->vf_data = NULL; 1053 adapter->vf_data = NULL;
1054 wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ); 1054 wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
1055 wrfl();
1055 msleep(100); 1056 msleep(100);
1056 dev_info(&adapter->pdev->dev, "IOV Disabled\n"); 1057 dev_info(&adapter->pdev->dev, "IOV Disabled\n");
1057 } 1058 }
@@ -2022,7 +2023,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
2022 2023
2023 if (hw->bus.func == 0) 2024 if (hw->bus.func == 0)
2024 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); 2025 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
2025 else if (hw->mac.type == e1000_82580) 2026 else if (hw->mac.type >= e1000_82580)
2026 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A + 2027 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A +
2027 NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1, 2028 NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1,
2028 &eeprom_data); 2029 &eeprom_data);
@@ -2198,6 +2199,7 @@ static void __devexit igb_remove(struct pci_dev *pdev)
2198 kfree(adapter->vf_data); 2199 kfree(adapter->vf_data);
2199 adapter->vf_data = NULL; 2200 adapter->vf_data = NULL;
2200 wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ); 2201 wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
2202 wrfl();
2201 msleep(100); 2203 msleep(100);
2202 dev_info(&pdev->dev, "IOV Disabled\n"); 2204 dev_info(&pdev->dev, "IOV Disabled\n");
2203 } 2205 }
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
index 1330c8e932da..40ed066e3ef4 100644
--- a/drivers/net/igbvf/netdev.c
+++ b/drivers/net/igbvf/netdev.c
@@ -1226,6 +1226,7 @@ static void igbvf_configure_tx(struct igbvf_adapter *adapter)
1226 /* disable transmits */ 1226 /* disable transmits */
1227 txdctl = er32(TXDCTL(0)); 1227 txdctl = er32(TXDCTL(0));
1228 ew32(TXDCTL(0), txdctl & ~E1000_TXDCTL_QUEUE_ENABLE); 1228 ew32(TXDCTL(0), txdctl & ~E1000_TXDCTL_QUEUE_ENABLE);
1229 e1e_flush();
1229 msleep(10); 1230 msleep(10);
1230 1231
1231 /* Setup the HW Tx Head and Tail descriptor pointers */ 1232 /* Setup the HW Tx Head and Tail descriptor pointers */
@@ -1306,6 +1307,7 @@ static void igbvf_configure_rx(struct igbvf_adapter *adapter)
1306 /* disable receives */ 1307 /* disable receives */
1307 rxdctl = er32(RXDCTL(0)); 1308 rxdctl = er32(RXDCTL(0));
1308 ew32(RXDCTL(0), rxdctl & ~E1000_RXDCTL_QUEUE_ENABLE); 1309 ew32(RXDCTL(0), rxdctl & ~E1000_RXDCTL_QUEUE_ENABLE);
1310 e1e_flush();
1309 msleep(10); 1311 msleep(10);
1310 1312
1311 rdlen = rx_ring->count * sizeof(union e1000_adv_rx_desc); 1313 rdlen = rx_ring->count * sizeof(union e1000_adv_rx_desc);
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 954f6e938fb7..8b1c3484d271 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -2405,8 +2405,6 @@ static int __init smsc_superio_lpc(unsigned short cfg_base)
2405 * addresses making a subsystem device table necessary. 2405 * addresses making a subsystem device table necessary.
2406 */ 2406 */
2407#ifdef CONFIG_PCI 2407#ifdef CONFIG_PCI
2408#define PCIID_VENDOR_INTEL 0x8086
2409#define PCIID_VENDOR_ALI 0x10b9
2410static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __initdata = { 2408static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __initdata = {
2411 /* 2409 /*
2412 * Subsystems needing entries: 2410 * Subsystems needing entries:
@@ -2416,7 +2414,7 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __ini
2416 */ 2414 */
2417 { 2415 {
2418 /* Guessed entry */ 2416 /* Guessed entry */
2419 .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */ 2417 .vendor = PCI_VENDOR_ID_INTEL, /* Intel 82801DBM LPC bridge */
2420 .device = 0x24cc, 2418 .device = 0x24cc,
2421 .subvendor = 0x103c, 2419 .subvendor = 0x103c,
2422 .subdevice = 0x08bc, 2420 .subdevice = 0x08bc,
@@ -2429,7 +2427,7 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __ini
2429 .name = "HP nx5000 family", 2427 .name = "HP nx5000 family",
2430 }, 2428 },
2431 { 2429 {
2432 .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */ 2430 .vendor = PCI_VENDOR_ID_INTEL, /* Intel 82801DBM LPC bridge */
2433 .device = 0x24cc, 2431 .device = 0x24cc,
2434 .subvendor = 0x103c, 2432 .subvendor = 0x103c,
2435 .subdevice = 0x088c, 2433 .subdevice = 0x088c,
@@ -2443,7 +2441,7 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __ini
2443 .name = "HP nc8000 family", 2441 .name = "HP nc8000 family",
2444 }, 2442 },
2445 { 2443 {
2446 .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */ 2444 .vendor = PCI_VENDOR_ID_INTEL, /* Intel 82801DBM LPC bridge */
2447 .device = 0x24cc, 2445 .device = 0x24cc,
2448 .subvendor = 0x103c, 2446 .subvendor = 0x103c,
2449 .subdevice = 0x0890, 2447 .subdevice = 0x0890,
@@ -2456,7 +2454,7 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __ini
2456 .name = "HP nc6000 family", 2454 .name = "HP nc6000 family",
2457 }, 2455 },
2458 { 2456 {
2459 .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */ 2457 .vendor = PCI_VENDOR_ID_INTEL, /* Intel 82801DBM LPC bridge */
2460 .device = 0x24cc, 2458 .device = 0x24cc,
2461 .subvendor = 0x0e11, 2459 .subvendor = 0x0e11,
2462 .subdevice = 0x0860, 2460 .subdevice = 0x0860,
@@ -2471,7 +2469,7 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __ini
2471 }, 2469 },
2472 { 2470 {
2473 /* Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge */ 2471 /* Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge */
2474 .vendor = PCIID_VENDOR_INTEL, 2472 .vendor = PCI_VENDOR_ID_INTEL,
2475 .device = 0x24c0, 2473 .device = 0x24c0,
2476 .subvendor = 0x1179, 2474 .subvendor = 0x1179,
2477 .subdevice = 0xffff, /* 0xffff is "any" */ 2475 .subdevice = 0xffff, /* 0xffff is "any" */
@@ -2484,7 +2482,7 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __ini
2484 .name = "Toshiba laptop with Intel 82801DB/DBL LPC bridge", 2482 .name = "Toshiba laptop with Intel 82801DB/DBL LPC bridge",
2485 }, 2483 },
2486 { 2484 {
2487 .vendor = PCIID_VENDOR_INTEL, /* Intel 82801CAM ISA bridge */ 2485 .vendor = PCI_VENDOR_ID_INTEL, /* Intel 82801CAM ISA bridge */
2488 .device = 0x248c, 2486 .device = 0x248c,
2489 .subvendor = 0x1179, 2487 .subvendor = 0x1179,
2490 .subdevice = 0xffff, /* 0xffff is "any" */ 2488 .subdevice = 0xffff, /* 0xffff is "any" */
@@ -2498,7 +2496,7 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __ini
2498 }, 2496 },
2499 { 2497 {
2500 /* 82801DBM (ICH4-M) LPC Interface Bridge */ 2498 /* 82801DBM (ICH4-M) LPC Interface Bridge */
2501 .vendor = PCIID_VENDOR_INTEL, 2499 .vendor = PCI_VENDOR_ID_INTEL,
2502 .device = 0x24cc, 2500 .device = 0x24cc,
2503 .subvendor = 0x1179, 2501 .subvendor = 0x1179,
2504 .subdevice = 0xffff, /* 0xffff is "any" */ 2502 .subdevice = 0xffff, /* 0xffff is "any" */
@@ -2512,7 +2510,7 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __ini
2512 }, 2510 },
2513 { 2511 {
2514 /* ALi M1533/M1535 PCI to ISA Bridge [Aladdin IV/V/V+] */ 2512 /* ALi M1533/M1535 PCI to ISA Bridge [Aladdin IV/V/V+] */
2515 .vendor = PCIID_VENDOR_ALI, 2513 .vendor = PCI_VENDOR_ID_AL,
2516 .device = 0x1533, 2514 .device = 0x1533,
2517 .subvendor = 0x1179, 2515 .subvendor = 0x1179,
2518 .subdevice = 0xffff, /* 0xffff is "any" */ 2516 .subdevice = 0xffff, /* 0xffff is "any" */
diff --git a/drivers/net/ixgb/ixgb_ee.c b/drivers/net/ixgb/ixgb_ee.c
index c982ab9f9005..38b362b67857 100644
--- a/drivers/net/ixgb/ixgb_ee.c
+++ b/drivers/net/ixgb/ixgb_ee.c
@@ -57,6 +57,7 @@ ixgb_raise_clock(struct ixgb_hw *hw,
57 */ 57 */
58 *eecd_reg = *eecd_reg | IXGB_EECD_SK; 58 *eecd_reg = *eecd_reg | IXGB_EECD_SK;
59 IXGB_WRITE_REG(hw, EECD, *eecd_reg); 59 IXGB_WRITE_REG(hw, EECD, *eecd_reg);
60 IXGB_WRITE_FLUSH(hw);
60 udelay(50); 61 udelay(50);
61} 62}
62 63
@@ -75,6 +76,7 @@ ixgb_lower_clock(struct ixgb_hw *hw,
75 */ 76 */
76 *eecd_reg = *eecd_reg & ~IXGB_EECD_SK; 77 *eecd_reg = *eecd_reg & ~IXGB_EECD_SK;
77 IXGB_WRITE_REG(hw, EECD, *eecd_reg); 78 IXGB_WRITE_REG(hw, EECD, *eecd_reg);
79 IXGB_WRITE_FLUSH(hw);
78 udelay(50); 80 udelay(50);
79} 81}
80 82
@@ -112,6 +114,7 @@ ixgb_shift_out_bits(struct ixgb_hw *hw,
112 eecd_reg |= IXGB_EECD_DI; 114 eecd_reg |= IXGB_EECD_DI;
113 115
114 IXGB_WRITE_REG(hw, EECD, eecd_reg); 116 IXGB_WRITE_REG(hw, EECD, eecd_reg);
117 IXGB_WRITE_FLUSH(hw);
115 118
116 udelay(50); 119 udelay(50);
117 120
@@ -206,21 +209,25 @@ ixgb_standby_eeprom(struct ixgb_hw *hw)
206 /* Deselect EEPROM */ 209 /* Deselect EEPROM */
207 eecd_reg &= ~(IXGB_EECD_CS | IXGB_EECD_SK); 210 eecd_reg &= ~(IXGB_EECD_CS | IXGB_EECD_SK);
208 IXGB_WRITE_REG(hw, EECD, eecd_reg); 211 IXGB_WRITE_REG(hw, EECD, eecd_reg);
212 IXGB_WRITE_FLUSH(hw);
209 udelay(50); 213 udelay(50);
210 214
211 /* Clock high */ 215 /* Clock high */
212 eecd_reg |= IXGB_EECD_SK; 216 eecd_reg |= IXGB_EECD_SK;
213 IXGB_WRITE_REG(hw, EECD, eecd_reg); 217 IXGB_WRITE_REG(hw, EECD, eecd_reg);
218 IXGB_WRITE_FLUSH(hw);
214 udelay(50); 219 udelay(50);
215 220
216 /* Select EEPROM */ 221 /* Select EEPROM */
217 eecd_reg |= IXGB_EECD_CS; 222 eecd_reg |= IXGB_EECD_CS;
218 IXGB_WRITE_REG(hw, EECD, eecd_reg); 223 IXGB_WRITE_REG(hw, EECD, eecd_reg);
224 IXGB_WRITE_FLUSH(hw);
219 udelay(50); 225 udelay(50);
220 226
221 /* Clock low */ 227 /* Clock low */
222 eecd_reg &= ~IXGB_EECD_SK; 228 eecd_reg &= ~IXGB_EECD_SK;
223 IXGB_WRITE_REG(hw, EECD, eecd_reg); 229 IXGB_WRITE_REG(hw, EECD, eecd_reg);
230 IXGB_WRITE_FLUSH(hw);
224 udelay(50); 231 udelay(50);
225} 232}
226 233
@@ -239,11 +246,13 @@ ixgb_clock_eeprom(struct ixgb_hw *hw)
239 /* Rising edge of clock */ 246 /* Rising edge of clock */
240 eecd_reg |= IXGB_EECD_SK; 247 eecd_reg |= IXGB_EECD_SK;
241 IXGB_WRITE_REG(hw, EECD, eecd_reg); 248 IXGB_WRITE_REG(hw, EECD, eecd_reg);
249 IXGB_WRITE_FLUSH(hw);
242 udelay(50); 250 udelay(50);
243 251
244 /* Falling edge of clock */ 252 /* Falling edge of clock */
245 eecd_reg &= ~IXGB_EECD_SK; 253 eecd_reg &= ~IXGB_EECD_SK;
246 IXGB_WRITE_REG(hw, EECD, eecd_reg); 254 IXGB_WRITE_REG(hw, EECD, eecd_reg);
255 IXGB_WRITE_FLUSH(hw);
247 udelay(50); 256 udelay(50);
248} 257}
249 258
diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index 6cb2e42ff4c1..3d61a9e4faf7 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -149,6 +149,7 @@ ixgb_adapter_stop(struct ixgb_hw *hw)
149 */ 149 */
150 IXGB_WRITE_REG(hw, RCTL, IXGB_READ_REG(hw, RCTL) & ~IXGB_RCTL_RXEN); 150 IXGB_WRITE_REG(hw, RCTL, IXGB_READ_REG(hw, RCTL) & ~IXGB_RCTL_RXEN);
151 IXGB_WRITE_REG(hw, TCTL, IXGB_READ_REG(hw, TCTL) & ~IXGB_TCTL_TXEN); 151 IXGB_WRITE_REG(hw, TCTL, IXGB_READ_REG(hw, TCTL) & ~IXGB_TCTL_TXEN);
152 IXGB_WRITE_FLUSH(hw);
152 msleep(IXGB_DELAY_BEFORE_RESET); 153 msleep(IXGB_DELAY_BEFORE_RESET);
153 154
154 /* Issue a global reset to the MAC. This will reset the chip's 155 /* Issue a global reset to the MAC. This will reset the chip's
@@ -1220,6 +1221,7 @@ ixgb_optics_reset_bcm(struct ixgb_hw *hw)
1220 ctrl &= ~IXGB_CTRL0_SDP2; 1221 ctrl &= ~IXGB_CTRL0_SDP2;
1221 ctrl |= IXGB_CTRL0_SDP3; 1222 ctrl |= IXGB_CTRL0_SDP3;
1222 IXGB_WRITE_REG(hw, CTRL0, ctrl); 1223 IXGB_WRITE_REG(hw, CTRL0, ctrl);
1224 IXGB_WRITE_FLUSH(hw);
1223 1225
1224 /* SerDes needs extra delay */ 1226 /* SerDes needs extra delay */
1225 msleep(IXGB_SUN_PHY_RESET_DELAY); 1227 msleep(IXGB_SUN_PHY_RESET_DELAY);
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index 3b3dd4df4c5c..34f30ec79c2e 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -213,6 +213,7 @@ static s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw)
213 switch (hw->phy.type) { 213 switch (hw->phy.type) {
214 case ixgbe_phy_tn: 214 case ixgbe_phy_tn:
215 phy->ops.check_link = &ixgbe_check_phy_link_tnx; 215 phy->ops.check_link = &ixgbe_check_phy_link_tnx;
216 phy->ops.setup_link = &ixgbe_setup_phy_link_tnx;
216 phy->ops.get_firmware_version = 217 phy->ops.get_firmware_version =
217 &ixgbe_get_phy_firmware_version_tnx; 218 &ixgbe_get_phy_firmware_version_tnx;
218 break; 219 break;
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 777051f54e53..fc1375f26fe5 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -2632,6 +2632,7 @@ s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
2632 autoc_reg |= IXGBE_AUTOC_AN_RESTART; 2632 autoc_reg |= IXGBE_AUTOC_AN_RESTART;
2633 autoc_reg |= IXGBE_AUTOC_FLU; 2633 autoc_reg |= IXGBE_AUTOC_FLU;
2634 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); 2634 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
2635 IXGBE_WRITE_FLUSH(hw);
2635 usleep_range(10000, 20000); 2636 usleep_range(10000, 20000);
2636 } 2637 }
2637 2638
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index dc649553a0a6..82d4244c6e10 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -1378,6 +1378,7 @@ static int ixgbe_intr_test(struct ixgbe_adapter *adapter, u64 *data)
1378 1378
1379 /* Disable all the interrupts */ 1379 /* Disable all the interrupts */
1380 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF); 1380 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF);
1381 IXGBE_WRITE_FLUSH(&adapter->hw);
1381 usleep_range(10000, 20000); 1382 usleep_range(10000, 20000);
1382 1383
1383 /* Test each interrupt */ 1384 /* Test each interrupt */
@@ -1398,6 +1399,7 @@ static int ixgbe_intr_test(struct ixgbe_adapter *adapter, u64 *data)
1398 ~mask & 0x00007FFF); 1399 ~mask & 0x00007FFF);
1399 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, 1400 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS,
1400 ~mask & 0x00007FFF); 1401 ~mask & 0x00007FFF);
1402 IXGBE_WRITE_FLUSH(&adapter->hw);
1401 usleep_range(10000, 20000); 1403 usleep_range(10000, 20000);
1402 1404
1403 if (adapter->test_icr & mask) { 1405 if (adapter->test_icr & mask) {
@@ -1415,6 +1417,7 @@ static int ixgbe_intr_test(struct ixgbe_adapter *adapter, u64 *data)
1415 adapter->test_icr = 0; 1417 adapter->test_icr = 0;
1416 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, mask); 1418 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, mask);
1417 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, mask); 1419 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, mask);
1420 IXGBE_WRITE_FLUSH(&adapter->hw);
1418 usleep_range(10000, 20000); 1421 usleep_range(10000, 20000);
1419 1422
1420 if (!(adapter->test_icr &mask)) { 1423 if (!(adapter->test_icr &mask)) {
@@ -1435,6 +1438,7 @@ static int ixgbe_intr_test(struct ixgbe_adapter *adapter, u64 *data)
1435 ~mask & 0x00007FFF); 1438 ~mask & 0x00007FFF);
1436 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, 1439 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS,
1437 ~mask & 0x00007FFF); 1440 ~mask & 0x00007FFF);
1441 IXGBE_WRITE_FLUSH(&adapter->hw);
1438 usleep_range(10000, 20000); 1442 usleep_range(10000, 20000);
1439 1443
1440 if (adapter->test_icr) { 1444 if (adapter->test_icr) {
@@ -1446,6 +1450,7 @@ static int ixgbe_intr_test(struct ixgbe_adapter *adapter, u64 *data)
1446 1450
1447 /* Disable all the interrupts */ 1451 /* Disable all the interrupts */
1448 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF); 1452 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF);
1453 IXGBE_WRITE_FLUSH(&adapter->hw);
1449 usleep_range(10000, 20000); 1454 usleep_range(10000, 20000);
1450 1455
1451 /* Unhook test interrupt handler */ 1456 /* Unhook test interrupt handler */
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 1be617545dc9..e86297b32733 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -184,6 +184,7 @@ static inline void ixgbe_disable_sriov(struct ixgbe_adapter *adapter)
184 vmdctl = IXGBE_READ_REG(hw, IXGBE_VT_CTL); 184 vmdctl = IXGBE_READ_REG(hw, IXGBE_VT_CTL);
185 vmdctl &= ~IXGBE_VT_CTL_POOL_MASK; 185 vmdctl &= ~IXGBE_VT_CTL_POOL_MASK;
186 IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vmdctl); 186 IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vmdctl);
187 IXGBE_WRITE_FLUSH(hw);
187 188
188 /* take a breather then clean up driver data */ 189 /* take a breather then clean up driver data */
189 msleep(100); 190 msleep(100);
@@ -1005,7 +1006,7 @@ static int __ixgbe_notify_dca(struct device *dev, void *data)
1005 struct ixgbe_adapter *adapter = dev_get_drvdata(dev); 1006 struct ixgbe_adapter *adapter = dev_get_drvdata(dev);
1006 unsigned long event = *(unsigned long *)data; 1007 unsigned long event = *(unsigned long *)data;
1007 1008
1008 if (!(adapter->flags & IXGBE_FLAG_DCA_ENABLED)) 1009 if (!(adapter->flags & IXGBE_FLAG_DCA_CAPABLE))
1009 return 0; 1010 return 0;
1010 1011
1011 switch (event) { 1012 switch (event) {
diff --git a/drivers/net/ixgbe/ixgbe_phy.c b/drivers/net/ixgbe/ixgbe_phy.c
index 735f686c3b36..f7ca3511b9fe 100644
--- a/drivers/net/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ixgbe/ixgbe_phy.c
@@ -1585,6 +1585,7 @@ static s32 ixgbe_raise_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl)
1585 *i2cctl |= IXGBE_I2C_CLK_OUT; 1585 *i2cctl |= IXGBE_I2C_CLK_OUT;
1586 1586
1587 IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl); 1587 IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl);
1588 IXGBE_WRITE_FLUSH(hw);
1588 1589
1589 /* SCL rise time (1000ns) */ 1590 /* SCL rise time (1000ns) */
1590 udelay(IXGBE_I2C_T_RISE); 1591 udelay(IXGBE_I2C_T_RISE);
@@ -1605,6 +1606,7 @@ static void ixgbe_lower_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl)
1605 *i2cctl &= ~IXGBE_I2C_CLK_OUT; 1606 *i2cctl &= ~IXGBE_I2C_CLK_OUT;
1606 1607
1607 IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl); 1608 IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl);
1609 IXGBE_WRITE_FLUSH(hw);
1608 1610
1609 /* SCL fall time (300ns) */ 1611 /* SCL fall time (300ns) */
1610 udelay(IXGBE_I2C_T_FALL); 1612 udelay(IXGBE_I2C_T_FALL);
@@ -1628,6 +1630,7 @@ static s32 ixgbe_set_i2c_data(struct ixgbe_hw *hw, u32 *i2cctl, bool data)
1628 *i2cctl &= ~IXGBE_I2C_DATA_OUT; 1630 *i2cctl &= ~IXGBE_I2C_DATA_OUT;
1629 1631
1630 IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl); 1632 IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl);
1633 IXGBE_WRITE_FLUSH(hw);
1631 1634
1632 /* Data rise/fall (1000ns/300ns) and set-up time (250ns) */ 1635 /* Data rise/fall (1000ns/300ns) and set-up time (250ns) */
1633 udelay(IXGBE_I2C_T_RISE + IXGBE_I2C_T_FALL + IXGBE_I2C_T_SU_DATA); 1636 udelay(IXGBE_I2C_T_RISE + IXGBE_I2C_T_FALL + IXGBE_I2C_T_SU_DATA);
diff --git a/drivers/net/ixgbe/ixgbe_x540.c b/drivers/net/ixgbe/ixgbe_x540.c
index bec30ed91adc..2696c78e9f46 100644
--- a/drivers/net/ixgbe/ixgbe_x540.c
+++ b/drivers/net/ixgbe/ixgbe_x540.c
@@ -162,6 +162,7 @@ mac_reset_top:
162 ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); 162 ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT);
163 ctrl_ext |= IXGBE_CTRL_EXT_PFRSTD; 163 ctrl_ext |= IXGBE_CTRL_EXT_PFRSTD;
164 IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext); 164 IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext);
165 IXGBE_WRITE_FLUSH(hw);
165 166
166 msleep(50); 167 msleep(50);
167 168
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 0fcdc25699d8..dc4e305a1087 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -322,6 +322,9 @@ static void macb_tx(struct macb *bp)
322 for (i = 0; i < TX_RING_SIZE; i++) 322 for (i = 0; i < TX_RING_SIZE; i++)
323 bp->tx_ring[i].ctrl = MACB_BIT(TX_USED); 323 bp->tx_ring[i].ctrl = MACB_BIT(TX_USED);
324 324
325 /* Add wrap bit */
326 bp->tx_ring[TX_RING_SIZE - 1].ctrl |= MACB_BIT(TX_WRAP);
327
325 /* free transmit buffer in upper layer*/ 328 /* free transmit buffer in upper layer*/
326 for (tail = bp->tx_tail; tail != head; tail = NEXT_TX(tail)) { 329 for (tail = bp->tx_tail; tail != head; tail = NEXT_TX(tail)) {
327 struct ring_info *rp = &bp->tx_skb[tail]; 330 struct ring_info *rp = &bp->tx_skb[tail];
diff --git a/drivers/net/mlx4/en_port.c b/drivers/net/mlx4/en_port.c
index 5e7109178061..5ada5b469112 100644
--- a/drivers/net/mlx4/en_port.c
+++ b/drivers/net/mlx4/en_port.c
@@ -128,7 +128,7 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
128 memset(context, 0, sizeof *context); 128 memset(context, 0, sizeof *context);
129 129
130 context->base_qpn = cpu_to_be32(base_qpn); 130 context->base_qpn = cpu_to_be32(base_qpn);
131 context->n_mac = 0x7; 131 context->n_mac = 0x2;
132 context->promisc = cpu_to_be32(promisc << SET_PORT_PROMISC_SHIFT | 132 context->promisc = cpu_to_be32(promisc << SET_PORT_PROMISC_SHIFT |
133 base_qpn); 133 base_qpn);
134 context->mcast = cpu_to_be32(m_promisc << SET_PORT_MC_PROMISC_SHIFT | 134 context->mcast = cpu_to_be32(m_promisc << SET_PORT_MC_PROMISC_SHIFT |
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index c94b3426d355..f0ee35df4dd7 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -1117,6 +1117,8 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port)
1117 info->port = port; 1117 info->port = port;
1118 mlx4_init_mac_table(dev, &info->mac_table); 1118 mlx4_init_mac_table(dev, &info->mac_table);
1119 mlx4_init_vlan_table(dev, &info->vlan_table); 1119 mlx4_init_vlan_table(dev, &info->vlan_table);
1120 info->base_qpn = dev->caps.reserved_qps_base[MLX4_QP_REGION_ETH_ADDR] +
1121 (port - 1) * (1 << log_num_mac);
1120 1122
1121 sprintf(info->dev_name, "mlx4_port%d", port); 1123 sprintf(info->dev_name, "mlx4_port%d", port);
1122 info->port_attr.attr.name = info->dev_name; 1124 info->port_attr.attr.name = info->dev_name;
diff --git a/drivers/net/mlx4/port.c b/drivers/net/mlx4/port.c
index 1f95afda6841..609e0ec14cee 100644
--- a/drivers/net/mlx4/port.c
+++ b/drivers/net/mlx4/port.c
@@ -258,9 +258,12 @@ void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int qpn)
258 if (validate_index(dev, table, index)) 258 if (validate_index(dev, table, index))
259 goto out; 259 goto out;
260 260
261 table->entries[index] = 0; 261 /* Check whether this address has reference count */
262 mlx4_set_port_mac_table(dev, port, table->entries); 262 if (!(--table->refs[index])) {
263 --table->total; 263 table->entries[index] = 0;
264 mlx4_set_port_mac_table(dev, port, table->entries);
265 --table->total;
266 }
264out: 267out:
265 mutex_unlock(&table->mutex); 268 mutex_unlock(&table->mutex);
266} 269}
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index cd6c2317e29e..ed47585a6862 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -9201,7 +9201,7 @@ static int __devinit niu_ldg_init(struct niu *np)
9201 9201
9202 first_chan = 0; 9202 first_chan = 0;
9203 for (i = 0; i < port; i++) 9203 for (i = 0; i < port; i++)
9204 first_chan += parent->rxchan_per_port[port]; 9204 first_chan += parent->rxchan_per_port[i];
9205 num_chan = parent->rxchan_per_port[port]; 9205 num_chan = parent->rxchan_per_port[port];
9206 9206
9207 for (i = first_chan; i < (first_chan + num_chan); i++) { 9207 for (i = first_chan; i < (first_chan + num_chan); i++) {
@@ -9217,7 +9217,7 @@ static int __devinit niu_ldg_init(struct niu *np)
9217 9217
9218 first_chan = 0; 9218 first_chan = 0;
9219 for (i = 0; i < port; i++) 9219 for (i = 0; i < port; i++)
9220 first_chan += parent->txchan_per_port[port]; 9220 first_chan += parent->txchan_per_port[i];
9221 num_chan = parent->txchan_per_port[port]; 9221 num_chan = parent->txchan_per_port[port];
9222 for (i = first_chan; i < (first_chan + num_chan); i++) { 9222 for (i = first_chan; i < (first_chan + num_chan); i++) {
9223 err = niu_ldg_assign_ldn(np, parent, 9223 err = niu_ldg_assign_ldn(np, parent,
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index 2cd8dc5847b4..cb6e0b486b1e 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -34,8 +34,7 @@
34#define PAGESEL 0x13 34#define PAGESEL 0x13
35#define LAYER4 0x02 35#define LAYER4 0x02
36#define LAYER2 0x01 36#define LAYER2 0x01
37#define MAX_RXTS 4 37#define MAX_RXTS 64
38#define MAX_TXTS 4
39#define N_EXT_TS 1 38#define N_EXT_TS 1
40#define PSF_PTPVER 2 39#define PSF_PTPVER 2
41#define PSF_EVNT 0x4000 40#define PSF_EVNT 0x4000
@@ -218,7 +217,7 @@ static void phy2rxts(struct phy_rxts *p, struct rxts *rxts)
218 rxts->seqid = p->seqid; 217 rxts->seqid = p->seqid;
219 rxts->msgtype = (p->msgtype >> 12) & 0xf; 218 rxts->msgtype = (p->msgtype >> 12) & 0xf;
220 rxts->hash = p->msgtype & 0x0fff; 219 rxts->hash = p->msgtype & 0x0fff;
221 rxts->tmo = jiffies + HZ; 220 rxts->tmo = jiffies + 2;
222} 221}
223 222
224static u64 phy2txts(struct phy_txts *p) 223static u64 phy2txts(struct phy_txts *p)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index c77286edba4d..02339b3352e7 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1092,6 +1092,21 @@ rtl_w1w0_eri(void __iomem *ioaddr, int addr, u32 mask, u32 p, u32 m, int type)
1092 rtl_eri_write(ioaddr, addr, mask, (val & ~m) | p, type); 1092 rtl_eri_write(ioaddr, addr, mask, (val & ~m) | p, type);
1093} 1093}
1094 1094
1095struct exgmac_reg {
1096 u16 addr;
1097 u16 mask;
1098 u32 val;
1099};
1100
1101static void rtl_write_exgmac_batch(void __iomem *ioaddr,
1102 const struct exgmac_reg *r, int len)
1103{
1104 while (len-- > 0) {
1105 rtl_eri_write(ioaddr, r->addr, r->mask, r->val, ERIAR_EXGMAC);
1106 r++;
1107 }
1108}
1109
1095static u8 rtl8168d_efuse_read(void __iomem *ioaddr, int reg_addr) 1110static u8 rtl8168d_efuse_read(void __iomem *ioaddr, int reg_addr)
1096{ 1111{
1097 u8 value = 0xff; 1112 u8 value = 0xff;
@@ -3117,6 +3132,18 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
3117 RTL_W32(MAC0, low); 3132 RTL_W32(MAC0, low);
3118 RTL_R32(MAC0); 3133 RTL_R32(MAC0);
3119 3134
3135 if (tp->mac_version == RTL_GIGA_MAC_VER_34) {
3136 const struct exgmac_reg e[] = {
3137 { .addr = 0xe0, ERIAR_MASK_1111, .val = low },
3138 { .addr = 0xe4, ERIAR_MASK_1111, .val = high },
3139 { .addr = 0xf0, ERIAR_MASK_1111, .val = low << 16 },
3140 { .addr = 0xf4, ERIAR_MASK_1111, .val = high << 16 |
3141 low >> 16 },
3142 };
3143
3144 rtl_write_exgmac_batch(ioaddr, e, ARRAY_SIZE(e));
3145 }
3146
3120 RTL_W8(Cfg9346, Cfg9346_Lock); 3147 RTL_W8(Cfg9346, Cfg9346_Lock);
3121 3148
3122 spin_unlock_irq(&tp->lock); 3149 spin_unlock_irq(&tp->lock);
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index cbe8865e322a..ba08341fb92c 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -367,7 +367,7 @@ static void sl_bump(struct slip *sl)
367 memcpy(skb_put(skb, count), sl->rbuff, count); 367 memcpy(skb_put(skb, count), sl->rbuff, count);
368 skb_reset_mac_header(skb); 368 skb_reset_mac_header(skb);
369 skb->protocol = htons(ETH_P_IP); 369 skb->protocol = htons(ETH_P_IP);
370 netif_rx(skb); 370 netif_rx_ni(skb);
371 dev->stats.rx_packets++; 371 dev->stats.rx_packets++;
372} 372}
373 373
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index fd622a66ebbf..a03336e086d5 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -53,7 +53,7 @@
53#include <linux/usb/usbnet.h> 53#include <linux/usb/usbnet.h>
54#include <linux/usb/cdc.h> 54#include <linux/usb/cdc.h>
55 55
56#define DRIVER_VERSION "01-June-2011" 56#define DRIVER_VERSION "04-Aug-2011"
57 57
58/* CDC NCM subclass 3.2.1 */ 58/* CDC NCM subclass 3.2.1 */
59#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10 59#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10
@@ -163,35 +163,8 @@ cdc_ncm_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info)
163 usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info)); 163 usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info));
164} 164}
165 165
166static int
167cdc_ncm_do_request(struct cdc_ncm_ctx *ctx, struct usb_cdc_notification *req,
168 void *data, u16 flags, u16 *actlen, u16 timeout)
169{
170 int err;
171
172 err = usb_control_msg(ctx->udev, (req->bmRequestType & USB_DIR_IN) ?
173 usb_rcvctrlpipe(ctx->udev, 0) :
174 usb_sndctrlpipe(ctx->udev, 0),
175 req->bNotificationType, req->bmRequestType,
176 req->wValue,
177 req->wIndex, data,
178 req->wLength, timeout);
179
180 if (err < 0) {
181 if (actlen)
182 *actlen = 0;
183 return err;
184 }
185
186 if (actlen)
187 *actlen = err;
188
189 return 0;
190}
191
192static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx) 166static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx)
193{ 167{
194 struct usb_cdc_notification req;
195 u32 val; 168 u32 val;
196 u8 flags; 169 u8 flags;
197 u8 iface_no; 170 u8 iface_no;
@@ -200,14 +173,14 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx)
200 173
201 iface_no = ctx->control->cur_altsetting->desc.bInterfaceNumber; 174 iface_no = ctx->control->cur_altsetting->desc.bInterfaceNumber;
202 175
203 req.bmRequestType = USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE; 176 err = usb_control_msg(ctx->udev,
204 req.bNotificationType = USB_CDC_GET_NTB_PARAMETERS; 177 usb_rcvctrlpipe(ctx->udev, 0),
205 req.wValue = 0; 178 USB_CDC_GET_NTB_PARAMETERS,
206 req.wIndex = cpu_to_le16(iface_no); 179 USB_TYPE_CLASS | USB_DIR_IN
207 req.wLength = cpu_to_le16(sizeof(ctx->ncm_parm)); 180 | USB_RECIP_INTERFACE,
208 181 0, iface_no, &ctx->ncm_parm,
209 err = cdc_ncm_do_request(ctx, &req, &ctx->ncm_parm, 0, NULL, 1000); 182 sizeof(ctx->ncm_parm), 10000);
210 if (err) { 183 if (err < 0) {
211 pr_debug("failed GET_NTB_PARAMETERS\n"); 184 pr_debug("failed GET_NTB_PARAMETERS\n");
212 return 1; 185 return 1;
213 } 186 }
@@ -253,31 +226,26 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx)
253 226
254 /* inform device about NTB input size changes */ 227 /* inform device about NTB input size changes */
255 if (ctx->rx_max != le32_to_cpu(ctx->ncm_parm.dwNtbInMaxSize)) { 228 if (ctx->rx_max != le32_to_cpu(ctx->ncm_parm.dwNtbInMaxSize)) {
256 req.bmRequestType = USB_TYPE_CLASS | USB_DIR_OUT |
257 USB_RECIP_INTERFACE;
258 req.bNotificationType = USB_CDC_SET_NTB_INPUT_SIZE;
259 req.wValue = 0;
260 req.wIndex = cpu_to_le16(iface_no);
261 229
262 if (flags & USB_CDC_NCM_NCAP_NTB_INPUT_SIZE) { 230 if (flags & USB_CDC_NCM_NCAP_NTB_INPUT_SIZE) {
263 struct usb_cdc_ncm_ndp_input_size ndp_in_sz; 231 struct usb_cdc_ncm_ndp_input_size ndp_in_sz;
264 232 err = usb_control_msg(ctx->udev,
265 req.wLength = 8; 233 usb_sndctrlpipe(ctx->udev, 0),
266 ndp_in_sz.dwNtbInMaxSize = cpu_to_le32(ctx->rx_max); 234 USB_CDC_SET_NTB_INPUT_SIZE,
267 ndp_in_sz.wNtbInMaxDatagrams = 235 USB_TYPE_CLASS | USB_DIR_OUT
268 cpu_to_le16(CDC_NCM_DPT_DATAGRAMS_MAX); 236 | USB_RECIP_INTERFACE,
269 ndp_in_sz.wReserved = 0; 237 0, iface_no, &ndp_in_sz, 8, 1000);
270 err = cdc_ncm_do_request(ctx, &req, &ndp_in_sz, 0, NULL,
271 1000);
272 } else { 238 } else {
273 __le32 dwNtbInMaxSize = cpu_to_le32(ctx->rx_max); 239 __le32 dwNtbInMaxSize = cpu_to_le32(ctx->rx_max);
274 240 err = usb_control_msg(ctx->udev,
275 req.wLength = 4; 241 usb_sndctrlpipe(ctx->udev, 0),
276 err = cdc_ncm_do_request(ctx, &req, &dwNtbInMaxSize, 0, 242 USB_CDC_SET_NTB_INPUT_SIZE,
277 NULL, 1000); 243 USB_TYPE_CLASS | USB_DIR_OUT
244 | USB_RECIP_INTERFACE,
245 0, iface_no, &dwNtbInMaxSize, 4, 1000);
278 } 246 }
279 247
280 if (err) 248 if (err < 0)
281 pr_debug("Setting NTB Input Size failed\n"); 249 pr_debug("Setting NTB Input Size failed\n");
282 } 250 }
283 251
@@ -332,29 +300,24 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx)
332 300
333 /* set CRC Mode */ 301 /* set CRC Mode */
334 if (flags & USB_CDC_NCM_NCAP_CRC_MODE) { 302 if (flags & USB_CDC_NCM_NCAP_CRC_MODE) {
335 req.bmRequestType = USB_TYPE_CLASS | USB_DIR_OUT | 303 err = usb_control_msg(ctx->udev, usb_sndctrlpipe(ctx->udev, 0),
336 USB_RECIP_INTERFACE; 304 USB_CDC_SET_CRC_MODE,
337 req.bNotificationType = USB_CDC_SET_CRC_MODE; 305 USB_TYPE_CLASS | USB_DIR_OUT
338 req.wValue = cpu_to_le16(USB_CDC_NCM_CRC_NOT_APPENDED); 306 | USB_RECIP_INTERFACE,
339 req.wIndex = cpu_to_le16(iface_no); 307 USB_CDC_NCM_CRC_NOT_APPENDED,
340 req.wLength = 0; 308 iface_no, NULL, 0, 1000);
341 309 if (err < 0)
342 err = cdc_ncm_do_request(ctx, &req, NULL, 0, NULL, 1000);
343 if (err)
344 pr_debug("Setting CRC mode off failed\n"); 310 pr_debug("Setting CRC mode off failed\n");
345 } 311 }
346 312
347 /* set NTB format, if both formats are supported */ 313 /* set NTB format, if both formats are supported */
348 if (ntb_fmt_supported & USB_CDC_NCM_NTH32_SIGN) { 314 if (ntb_fmt_supported & USB_CDC_NCM_NTH32_SIGN) {
349 req.bmRequestType = USB_TYPE_CLASS | USB_DIR_OUT | 315 err = usb_control_msg(ctx->udev, usb_sndctrlpipe(ctx->udev, 0),
350 USB_RECIP_INTERFACE; 316 USB_CDC_SET_NTB_FORMAT, USB_TYPE_CLASS
351 req.bNotificationType = USB_CDC_SET_NTB_FORMAT; 317 | USB_DIR_OUT | USB_RECIP_INTERFACE,
352 req.wValue = cpu_to_le16(USB_CDC_NCM_NTB16_FORMAT); 318 USB_CDC_NCM_NTB16_FORMAT,
353 req.wIndex = cpu_to_le16(iface_no); 319 iface_no, NULL, 0, 1000);
354 req.wLength = 0; 320 if (err < 0)
355
356 err = cdc_ncm_do_request(ctx, &req, NULL, 0, NULL, 1000);
357 if (err)
358 pr_debug("Setting NTB format to 16-bit failed\n"); 321 pr_debug("Setting NTB format to 16-bit failed\n");
359 } 322 }
360 323
@@ -364,17 +327,13 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx)
364 if (flags & USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE) { 327 if (flags & USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE) {
365 __le16 max_datagram_size; 328 __le16 max_datagram_size;
366 u16 eth_max_sz = le16_to_cpu(ctx->ether_desc->wMaxSegmentSize); 329 u16 eth_max_sz = le16_to_cpu(ctx->ether_desc->wMaxSegmentSize);
367 330 err = usb_control_msg(ctx->udev, usb_rcvctrlpipe(ctx->udev, 0),
368 req.bmRequestType = USB_TYPE_CLASS | USB_DIR_IN | 331 USB_CDC_GET_MAX_DATAGRAM_SIZE,
369 USB_RECIP_INTERFACE; 332 USB_TYPE_CLASS | USB_DIR_IN
370 req.bNotificationType = USB_CDC_GET_MAX_DATAGRAM_SIZE; 333 | USB_RECIP_INTERFACE,
371 req.wValue = 0; 334 0, iface_no, &max_datagram_size,
372 req.wIndex = cpu_to_le16(iface_no); 335 2, 1000);
373 req.wLength = cpu_to_le16(2); 336 if (err < 0) {
374
375 err = cdc_ncm_do_request(ctx, &req, &max_datagram_size, 0, NULL,
376 1000);
377 if (err) {
378 pr_debug("GET_MAX_DATAGRAM_SIZE failed, use size=%u\n", 337 pr_debug("GET_MAX_DATAGRAM_SIZE failed, use size=%u\n",
379 CDC_NCM_MIN_DATAGRAM_SIZE); 338 CDC_NCM_MIN_DATAGRAM_SIZE);
380 } else { 339 } else {
@@ -395,17 +354,15 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx)
395 CDC_NCM_MIN_DATAGRAM_SIZE; 354 CDC_NCM_MIN_DATAGRAM_SIZE;
396 355
397 /* if value changed, update device */ 356 /* if value changed, update device */
398 req.bmRequestType = USB_TYPE_CLASS | USB_DIR_OUT | 357 err = usb_control_msg(ctx->udev,
399 USB_RECIP_INTERFACE; 358 usb_sndctrlpipe(ctx->udev, 0),
400 req.bNotificationType = USB_CDC_SET_MAX_DATAGRAM_SIZE; 359 USB_CDC_SET_MAX_DATAGRAM_SIZE,
401 req.wValue = 0; 360 USB_TYPE_CLASS | USB_DIR_OUT
402 req.wIndex = cpu_to_le16(iface_no); 361 | USB_RECIP_INTERFACE,
403 req.wLength = 2; 362 0,
404 max_datagram_size = cpu_to_le16(ctx->max_datagram_size); 363 iface_no, &max_datagram_size,
405 364 2, 1000);
406 err = cdc_ncm_do_request(ctx, &req, &max_datagram_size, 365 if (err < 0)
407 0, NULL, 1000);
408 if (err)
409 pr_debug("SET_MAX_DATAGRAM_SIZE failed\n"); 366 pr_debug("SET_MAX_DATAGRAM_SIZE failed\n");
410 } 367 }
411 368
@@ -671,7 +628,7 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb)
671 u32 rem; 628 u32 rem;
672 u32 offset; 629 u32 offset;
673 u32 last_offset; 630 u32 last_offset;
674 u16 n = 0; 631 u16 n = 0, index;
675 u8 ready2send = 0; 632 u8 ready2send = 0;
676 633
677 /* if there is a remaining skb, it gets priority */ 634 /* if there is a remaining skb, it gets priority */
@@ -859,8 +816,8 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb)
859 cpu_to_le16(sizeof(ctx->tx_ncm.nth16)); 816 cpu_to_le16(sizeof(ctx->tx_ncm.nth16));
860 ctx->tx_ncm.nth16.wSequence = cpu_to_le16(ctx->tx_seq); 817 ctx->tx_ncm.nth16.wSequence = cpu_to_le16(ctx->tx_seq);
861 ctx->tx_ncm.nth16.wBlockLength = cpu_to_le16(last_offset); 818 ctx->tx_ncm.nth16.wBlockLength = cpu_to_le16(last_offset);
862 ctx->tx_ncm.nth16.wNdpIndex = ALIGN(sizeof(struct usb_cdc_ncm_nth16), 819 index = ALIGN(sizeof(struct usb_cdc_ncm_nth16), ctx->tx_ndp_modulus);
863 ctx->tx_ndp_modulus); 820 ctx->tx_ncm.nth16.wNdpIndex = cpu_to_le16(index);
864 821
865 memcpy(skb_out->data, &(ctx->tx_ncm.nth16), sizeof(ctx->tx_ncm.nth16)); 822 memcpy(skb_out->data, &(ctx->tx_ncm.nth16), sizeof(ctx->tx_ncm.nth16));
866 ctx->tx_seq++; 823 ctx->tx_seq++;
@@ -873,12 +830,11 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb)
873 ctx->tx_ncm.ndp16.wLength = cpu_to_le16(rem); 830 ctx->tx_ncm.ndp16.wLength = cpu_to_le16(rem);
874 ctx->tx_ncm.ndp16.wNextNdpIndex = 0; /* reserved */ 831 ctx->tx_ncm.ndp16.wNextNdpIndex = 0; /* reserved */
875 832
876 memcpy(((u8 *)skb_out->data) + ctx->tx_ncm.nth16.wNdpIndex, 833 memcpy(((u8 *)skb_out->data) + index,
877 &(ctx->tx_ncm.ndp16), 834 &(ctx->tx_ncm.ndp16),
878 sizeof(ctx->tx_ncm.ndp16)); 835 sizeof(ctx->tx_ncm.ndp16));
879 836
880 memcpy(((u8 *)skb_out->data) + ctx->tx_ncm.nth16.wNdpIndex + 837 memcpy(((u8 *)skb_out->data) + index + sizeof(ctx->tx_ncm.ndp16),
881 sizeof(ctx->tx_ncm.ndp16),
882 &(ctx->tx_ncm.dpe16), 838 &(ctx->tx_ncm.dpe16),
883 (ctx->tx_curr_frame_num + 1) * 839 (ctx->tx_curr_frame_num + 1) *
884 sizeof(struct usb_cdc_ncm_dpe16)); 840 sizeof(struct usb_cdc_ncm_dpe16));
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index 041fb7d43c4f..ef3b236b5145 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -977,7 +977,6 @@ static void rtl8150_disconnect(struct usb_interface *intf)
977 usb_set_intfdata(intf, NULL); 977 usb_set_intfdata(intf, NULL);
978 if (dev) { 978 if (dev) {
979 set_bit(RTL8150_UNPLUG, &dev->flags); 979 set_bit(RTL8150_UNPLUG, &dev->flags);
980 tasklet_disable(&dev->tl);
981 tasklet_kill(&dev->tl); 980 tasklet_kill(&dev->tl);
982 unregister_netdev(dev->netdev); 981 unregister_netdev(dev->netdev);
983 unlink_all_urbs(dev); 982 unlink_all_urbs(dev);
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
index 9ff7c30573b8..44d9d8d56490 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
@@ -309,11 +309,7 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah,
309 u8 i; 309 u8 i;
310 u32 val; 310 u32 val;
311 311
312 if (ah->is_pciexpress != true) 312 if (ah->is_pciexpress != true || ah->aspm_enabled != true)
313 return;
314
315 /* Do not touch SerDes registers */
316 if (ah->config.pcie_powersave_enable == 2)
317 return; 313 return;
318 314
319 /* Nothing to do on restore for 11N */ 315 /* Nothing to do on restore for 11N */
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
index 8efdec247c02..ad2bb2bf4e8a 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
@@ -519,11 +519,7 @@ static void ar9003_hw_configpcipowersave(struct ath_hw *ah,
519 int restore, 519 int restore,
520 int power_off) 520 int power_off)
521{ 521{
522 if (ah->is_pciexpress != true) 522 if (ah->is_pciexpress != true || ah->aspm_enabled != true)
523 return;
524
525 /* Do not touch SerDes registers */
526 if (ah->config.pcie_powersave_enable == 2)
527 return; 523 return;
528 524
529 /* Nothing to do on restore for 11N */ 525 /* Nothing to do on restore for 11N */
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 8006ce0c7357..8dcefe74f4c3 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -318,6 +318,14 @@ static void ath9k_hw_disablepcie(struct ath_hw *ah)
318 REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000); 318 REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000);
319} 319}
320 320
321static void ath9k_hw_aspm_init(struct ath_hw *ah)
322{
323 struct ath_common *common = ath9k_hw_common(ah);
324
325 if (common->bus_ops->aspm_init)
326 common->bus_ops->aspm_init(common);
327}
328
321/* This should work for all families including legacy */ 329/* This should work for all families including legacy */
322static bool ath9k_hw_chip_test(struct ath_hw *ah) 330static bool ath9k_hw_chip_test(struct ath_hw *ah)
323{ 331{
@@ -378,7 +386,6 @@ static void ath9k_hw_init_config(struct ath_hw *ah)
378 ah->config.additional_swba_backoff = 0; 386 ah->config.additional_swba_backoff = 0;
379 ah->config.ack_6mb = 0x0; 387 ah->config.ack_6mb = 0x0;
380 ah->config.cwm_ignore_extcca = 0; 388 ah->config.cwm_ignore_extcca = 0;
381 ah->config.pcie_powersave_enable = 0;
382 ah->config.pcie_clock_req = 0; 389 ah->config.pcie_clock_req = 0;
383 ah->config.pcie_waen = 0; 390 ah->config.pcie_waen = 0;
384 ah->config.analog_shiftreg = 1; 391 ah->config.analog_shiftreg = 1;
@@ -598,7 +605,7 @@ static int __ath9k_hw_init(struct ath_hw *ah)
598 605
599 606
600 if (ah->is_pciexpress) 607 if (ah->is_pciexpress)
601 ath9k_hw_configpcipowersave(ah, 0, 0); 608 ath9k_hw_aspm_init(ah);
602 else 609 else
603 ath9k_hw_disablepcie(ah); 610 ath9k_hw_disablepcie(ah);
604 611
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 6acd0f975ae1..c79889036ec4 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -219,7 +219,6 @@ struct ath9k_ops_config {
219 int additional_swba_backoff; 219 int additional_swba_backoff;
220 int ack_6mb; 220 int ack_6mb;
221 u32 cwm_ignore_extcca; 221 u32 cwm_ignore_extcca;
222 u8 pcie_powersave_enable;
223 bool pcieSerDesWrite; 222 bool pcieSerDesWrite;
224 u8 pcie_clock_req; 223 u8 pcie_clock_req;
225 u32 pcie_waen; 224 u32 pcie_waen;
@@ -673,6 +672,7 @@ struct ath_hw {
673 672
674 bool sw_mgmt_crypto; 673 bool sw_mgmt_crypto;
675 bool is_pciexpress; 674 bool is_pciexpress;
675 bool aspm_enabled;
676 bool is_monitoring; 676 bool is_monitoring;
677 bool need_an_top2_fixup; 677 bool need_an_top2_fixup;
678 u16 tx_trig_level; 678 u16 tx_trig_level;
@@ -874,6 +874,7 @@ struct ath_bus_ops {
874 bool (*eeprom_read)(struct ath_common *common, u32 off, u16 *data); 874 bool (*eeprom_read)(struct ath_common *common, u32 off, u16 *data);
875 void (*bt_coex_prep)(struct ath_common *common); 875 void (*bt_coex_prep)(struct ath_common *common);
876 void (*extn_synch_en)(struct ath_common *common); 876 void (*extn_synch_en)(struct ath_common *common);
877 void (*aspm_init)(struct ath_common *common);
877}; 878};
878 879
879static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah) 880static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah)
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index ac5107172f94..aa0ff7e2c922 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -670,8 +670,10 @@ static void ath9k_init_band_txpower(struct ath_softc *sc, int band)
670static void ath9k_init_txpower_limits(struct ath_softc *sc) 670static void ath9k_init_txpower_limits(struct ath_softc *sc)
671{ 671{
672 struct ath_hw *ah = sc->sc_ah; 672 struct ath_hw *ah = sc->sc_ah;
673 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
673 struct ath9k_channel *curchan = ah->curchan; 674 struct ath9k_channel *curchan = ah->curchan;
674 675
676 ah->txchainmask = common->tx_chainmask;
675 if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) 677 if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
676 ath9k_init_band_txpower(sc, IEEE80211_BAND_2GHZ); 678 ath9k_init_band_txpower(sc, IEEE80211_BAND_2GHZ);
677 if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) 679 if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 3bad0b2cf9a3..be4ea1329813 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/nl80211.h> 17#include <linux/nl80211.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/pci-aspm.h>
19#include <linux/ath9k_platform.h> 20#include <linux/ath9k_platform.h>
20#include "ath9k.h" 21#include "ath9k.h"
21 22
@@ -115,12 +116,38 @@ static void ath_pci_extn_synch_enable(struct ath_common *common)
115 pci_write_config_byte(pdev, sc->sc_ah->caps.pcie_lcr_offset, lnkctl); 116 pci_write_config_byte(pdev, sc->sc_ah->caps.pcie_lcr_offset, lnkctl);
116} 117}
117 118
119static void ath_pci_aspm_init(struct ath_common *common)
120{
121 struct ath_softc *sc = (struct ath_softc *) common->priv;
122 struct ath_hw *ah = sc->sc_ah;
123 struct pci_dev *pdev = to_pci_dev(sc->dev);
124 struct pci_dev *parent;
125 int pos;
126 u8 aspm;
127
128 if (!pci_is_pcie(pdev))
129 return;
130
131 parent = pdev->bus->self;
132 if (WARN_ON(!parent))
133 return;
134
135 pos = pci_pcie_cap(parent);
136 pci_read_config_byte(parent, pos + PCI_EXP_LNKCTL, &aspm);
137 if (aspm & (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1)) {
138 ah->aspm_enabled = true;
139 /* Initialize PCIe PM and SERDES registers. */
140 ath9k_hw_configpcipowersave(ah, 0, 0);
141 }
142}
143
118static const struct ath_bus_ops ath_pci_bus_ops = { 144static const struct ath_bus_ops ath_pci_bus_ops = {
119 .ath_bus_type = ATH_PCI, 145 .ath_bus_type = ATH_PCI,
120 .read_cachesize = ath_pci_read_cachesize, 146 .read_cachesize = ath_pci_read_cachesize,
121 .eeprom_read = ath_pci_eeprom_read, 147 .eeprom_read = ath_pci_eeprom_read,
122 .bt_coex_prep = ath_pci_bt_coex_prep, 148 .bt_coex_prep = ath_pci_bt_coex_prep,
123 .extn_synch_en = ath_pci_extn_synch_enable, 149 .extn_synch_en = ath_pci_extn_synch_enable,
150 .aspm_init = ath_pci_aspm_init,
124}; 151};
125 152
126static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 153static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c
index dab67a12d73b..73fe3cdf796b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.c
@@ -1746,7 +1746,11 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1746 } 1746 }
1747 1747
1748 memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); 1748 memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));
1749 1749 /*
1750 * We do not commit tx power settings while channel changing,
1751 * do it now if tx power changed.
1752 */
1753 iwl_legacy_set_tx_power(priv, priv->tx_power_next, false);
1750 return 0; 1754 return 0;
1751 } 1755 }
1752 1756
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index bd4b000733f7..ecdc6e557428 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -1235,7 +1235,12 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
1235 1235
1236 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); 1236 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon));
1237 iwl_legacy_print_rx_config_cmd(priv, ctx); 1237 iwl_legacy_print_rx_config_cmd(priv, ctx);
1238 goto set_tx_power; 1238 /*
1239 * We do not commit tx power settings while channel changing,
1240 * do it now if tx power changed.
1241 */
1242 iwl_legacy_set_tx_power(priv, priv->tx_power_next, false);
1243 return 0;
1239 } 1244 }
1240 1245
1241 /* If we are currently associated and the new config requires 1246 /* If we are currently associated and the new config requires
@@ -1315,7 +1320,6 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
1315 1320
1316 iwl4965_init_sensitivity(priv); 1321 iwl4965_init_sensitivity(priv);
1317 1322
1318set_tx_power:
1319 /* If we issue a new RXON command which required a tune then we must 1323 /* If we issue a new RXON command which required a tune then we must
1320 * send a new TXPOWER command or we won't be able to Tx any frames */ 1324 * send a new TXPOWER command or we won't be able to Tx any frames */
1321 ret = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true); 1325 ret = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true);
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 3eeb12ebe6e9..c95cefd529dc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -365,6 +365,7 @@ static struct iwl_base_params iwl5000_base_params = {
365 .chain_noise_scale = 1000, 365 .chain_noise_scale = 1000,
366 .wd_timeout = IWL_LONG_WD_TIMEOUT, 366 .wd_timeout = IWL_LONG_WD_TIMEOUT,
367 .max_event_log_size = 512, 367 .max_event_log_size = 512,
368 .no_idle_support = true,
368}; 369};
369static struct iwl_ht_params iwl5000_ht_params = { 370static struct iwl_ht_params iwl5000_ht_params = {
370 .ht_greenfield_support = true, 371 .ht_greenfield_support = true,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 3e6bb734dcb7..02817a438550 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -135,6 +135,7 @@ struct iwl_mod_params {
135 * @temperature_kelvin: temperature report by uCode in kelvin 135 * @temperature_kelvin: temperature report by uCode in kelvin
136 * @max_event_log_size: size of event log buffer size for ucode event logging 136 * @max_event_log_size: size of event log buffer size for ucode event logging
137 * @shadow_reg_enable: HW shadhow register bit 137 * @shadow_reg_enable: HW shadhow register bit
138 * @no_idle_support: do not support idle mode
138 */ 139 */
139struct iwl_base_params { 140struct iwl_base_params {
140 int eeprom_size; 141 int eeprom_size;
@@ -156,6 +157,7 @@ struct iwl_base_params {
156 bool temperature_kelvin; 157 bool temperature_kelvin;
157 u32 max_event_log_size; 158 u32 max_event_log_size;
158 const bool shadow_reg_enable; 159 const bool shadow_reg_enable;
160 const bool no_idle_support;
159}; 161};
160/* 162/*
161 * @advanced_bt_coexist: support advanced bt coexist 163 * @advanced_bt_coexist: support advanced bt coexist
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c
index fb7e436b40c7..69d4ec467dca 100644
--- a/drivers/net/wireless/iwlwifi/iwl-pci.c
+++ b/drivers/net/wireless/iwlwifi/iwl-pci.c
@@ -134,6 +134,7 @@ static void iwl_pci_apm_config(struct iwl_bus *bus)
134static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_data) 134static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_data)
135{ 135{
136 bus->drv_data = drv_data; 136 bus->drv_data = drv_data;
137 pci_set_drvdata(IWL_BUS_GET_PCI_DEV(bus), drv_data);
137} 138}
138 139
139static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[], 140static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[],
@@ -454,8 +455,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
454 pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); 455 pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
455 } 456 }
456 457
457 pci_set_drvdata(pdev, bus);
458
459 bus->dev = &pdev->dev; 458 bus->dev = &pdev->dev;
460 bus->irq = pdev->irq; 459 bus->irq = pdev->irq;
461 bus->ops = &pci_ops; 460 bus->ops = &pci_ops;
@@ -494,11 +493,12 @@ static void iwl_pci_down(struct iwl_bus *bus)
494 493
495static void __devexit iwl_pci_remove(struct pci_dev *pdev) 494static void __devexit iwl_pci_remove(struct pci_dev *pdev)
496{ 495{
497 struct iwl_bus *bus = pci_get_drvdata(pdev); 496 struct iwl_priv *priv = pci_get_drvdata(pdev);
497 void *bus_specific = priv->bus->bus_specific;
498 498
499 iwl_remove(bus->drv_data); 499 iwl_remove(priv);
500 500
501 iwl_pci_down(bus); 501 iwl_pci_down(bus_specific);
502} 502}
503 503
504#ifdef CONFIG_PM 504#ifdef CONFIG_PM
@@ -506,20 +506,20 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
506static int iwl_pci_suspend(struct device *device) 506static int iwl_pci_suspend(struct device *device)
507{ 507{
508 struct pci_dev *pdev = to_pci_dev(device); 508 struct pci_dev *pdev = to_pci_dev(device);
509 struct iwl_bus *bus = pci_get_drvdata(pdev); 509 struct iwl_priv *priv = pci_get_drvdata(pdev);
510 510
511 /* Before you put code here, think about WoWLAN. You cannot check here 511 /* Before you put code here, think about WoWLAN. You cannot check here
512 * whether WoWLAN is enabled or not, and your code will run even if 512 * whether WoWLAN is enabled or not, and your code will run even if
513 * WoWLAN is enabled - don't kill the NIC, someone may need it in Sx. 513 * WoWLAN is enabled - don't kill the NIC, someone may need it in Sx.
514 */ 514 */
515 515
516 return iwl_suspend(bus->drv_data); 516 return iwl_suspend(priv);
517} 517}
518 518
519static int iwl_pci_resume(struct device *device) 519static int iwl_pci_resume(struct device *device)
520{ 520{
521 struct pci_dev *pdev = to_pci_dev(device); 521 struct pci_dev *pdev = to_pci_dev(device);
522 struct iwl_bus *bus = pci_get_drvdata(pdev); 522 struct iwl_priv *priv = pci_get_drvdata(pdev);
523 523
524 /* Before you put code here, think about WoWLAN. You cannot check here 524 /* Before you put code here, think about WoWLAN. You cannot check here
525 * whether WoWLAN is enabled or not, and your code will run even if 525 * whether WoWLAN is enabled or not, and your code will run even if
@@ -532,7 +532,7 @@ static int iwl_pci_resume(struct device *device)
532 */ 532 */
533 pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); 533 pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);
534 534
535 return iwl_resume(bus->drv_data); 535 return iwl_resume(priv);
536} 536}
537 537
538static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume); 538static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume);
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 3ec619c6881c..cd64df05f9ed 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -349,7 +349,8 @@ static void iwl_power_build_cmd(struct iwl_priv *priv,
349 349
350 if (priv->wowlan) 350 if (priv->wowlan)
351 iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, dtimper); 351 iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, dtimper);
352 else if (priv->hw->conf.flags & IEEE80211_CONF_IDLE) 352 else if (!priv->cfg->base_params->no_idle_support &&
353 priv->hw->conf.flags & IEEE80211_CONF_IDLE)
353 iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, 20); 354 iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, 20);
354 else if (iwl_tt_is_low_power_state(priv)) { 355 else if (iwl_tt_is_low_power_state(priv)) {
355 /* in thermal throttling low power state */ 356 /* in thermal throttling low power state */
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 84ab7d1acb6a..ef67f6786a84 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -703,8 +703,7 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)
703 /* 703 /*
704 * Add space for the TXWI in front of the skb. 704 * Add space for the TXWI in front of the skb.
705 */ 705 */
706 skb_push(entry->skb, TXWI_DESC_SIZE); 706 memset(skb_push(entry->skb, TXWI_DESC_SIZE), 0, TXWI_DESC_SIZE);
707 memset(entry->skb, 0, TXWI_DESC_SIZE);
708 707
709 /* 708 /*
710 * Register descriptor details in skb frame descriptor. 709 * Register descriptor details in skb frame descriptor.
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index 15cdc7e57fc4..4cdf247a870d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -355,7 +355,8 @@ static inline enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *
355 return CIPHER_NONE; 355 return CIPHER_NONE;
356} 356}
357 357
358static inline void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry, 358static inline void rt2x00crypto_create_tx_descriptor(struct rt2x00_dev *rt2x00dev,
359 struct sk_buff *skb,
359 struct txentry_desc *txdesc) 360 struct txentry_desc *txdesc)
360{ 361{
361} 362}
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 8efab3983528..4ccf23805973 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -113,7 +113,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
113 * due to possible race conditions in mac80211. 113 * due to possible race conditions in mac80211.
114 */ 114 */
115 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) 115 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
116 goto exit_fail; 116 goto exit_free_skb;
117 117
118 /* 118 /*
119 * Use the ATIM queue if appropriate and present. 119 * Use the ATIM queue if appropriate and present.
@@ -127,7 +127,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
127 ERROR(rt2x00dev, 127 ERROR(rt2x00dev,
128 "Attempt to send packet over invalid queue %d.\n" 128 "Attempt to send packet over invalid queue %d.\n"
129 "Please file bug report to %s.\n", qid, DRV_PROJECT); 129 "Please file bug report to %s.\n", qid, DRV_PROJECT);
130 goto exit_fail; 130 goto exit_free_skb;
131 } 131 }
132 132
133 /* 133 /*
@@ -159,6 +159,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
159 159
160 exit_fail: 160 exit_fail:
161 rt2x00queue_pause_queue(queue); 161 rt2x00queue_pause_queue(queue);
162 exit_free_skb:
162 dev_kfree_skb_any(skb); 163 dev_kfree_skb_any(skb);
163} 164}
164EXPORT_SYMBOL_GPL(rt2x00mac_tx); 165EXPORT_SYMBOL_GPL(rt2x00mac_tx);
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 5efd57833489..56f12358389d 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -1696,15 +1696,17 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
1696 pcipriv->ndis_adapter.devnumber = PCI_SLOT(pdev->devfn); 1696 pcipriv->ndis_adapter.devnumber = PCI_SLOT(pdev->devfn);
1697 pcipriv->ndis_adapter.funcnumber = PCI_FUNC(pdev->devfn); 1697 pcipriv->ndis_adapter.funcnumber = PCI_FUNC(pdev->devfn);
1698 1698
1699 /*find bridge info */ 1699 if (bridge_pdev) {
1700 pcipriv->ndis_adapter.pcibridge_vendorid = bridge_pdev->vendor; 1700 /*find bridge info if available */
1701 for (tmp = 0; tmp < PCI_BRIDGE_VENDOR_MAX; tmp++) { 1701 pcipriv->ndis_adapter.pcibridge_vendorid = bridge_pdev->vendor;
1702 if (bridge_pdev->vendor == pcibridge_vendors[tmp]) { 1702 for (tmp = 0; tmp < PCI_BRIDGE_VENDOR_MAX; tmp++) {
1703 pcipriv->ndis_adapter.pcibridge_vendor = tmp; 1703 if (bridge_pdev->vendor == pcibridge_vendors[tmp]) {
1704 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1704 pcipriv->ndis_adapter.pcibridge_vendor = tmp;
1705 ("Pci Bridge Vendor is found index: %d\n", 1705 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1706 tmp)); 1706 ("Pci Bridge Vendor is found index:"
1707 break; 1707 " %d\n", tmp));
1708 break;
1709 }
1708 } 1710 }
1709 } 1711 }
1710 1712