- }
--
- static inline void ath_debug_stat_tx(struct ath_softc *sc,
- struct ath_buf *bf,
- struct ath_tx_status *ts,
-@@ -310,11 +324,16 @@ static inline void ath_debug_stat_tx(str
- unsigned int flags)
- {
- }
--
- static inline void ath_debug_stat_rx(struct ath_softc *sc,
- struct ath_rx_status *rs)
- {
- }
-+static inline void ath9k_debug_stat_ant(struct ath_softc *sc,
-+ struct ath_hw_antcomb_conf *div_ant_conf,
-+ int main_rssi_avg, int alt_rssi_avg)
-+{
-+
-+}
-
- #endif /* CPTCFG_ATH9K_DEBUGFS */
-
---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
-+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
-@@ -812,6 +812,7 @@ static void ath9k_hw_4k_set_gain(struct
- static void ath9k_hw_4k_set_board_values(struct ath_hw *ah,
- struct ath9k_channel *chan)
- {
-+ struct ath9k_hw_capabilities *pCap = &ah->caps;
- struct modal_eep_4k_header *pModal;
- struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
- struct base_eep_header_4k *pBase = &eep->baseEepHeader;
-@@ -858,6 +859,24 @@ static void ath9k_hw_4k_set_board_values
-
- REG_WRITE(ah, AR_PHY_CCK_DETECT, regVal);
- regVal = REG_READ(ah, AR_PHY_CCK_DETECT);
-+
-+ if (pCap->hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) {
-+ /*
-+ * If diversity combining is enabled,
-+ * set MAIN to LNA1 and ALT to LNA2 initially.
-+ */
-+ regVal = REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL);
-+ regVal &= (~(AR_PHY_9285_ANT_DIV_MAIN_LNACONF |
-+ AR_PHY_9285_ANT_DIV_ALT_LNACONF));
-+
-+ regVal |= (ATH_ANT_DIV_COMB_LNA1 <<
-+ AR_PHY_9285_ANT_DIV_MAIN_LNACONF_S);
-+ regVal |= (ATH_ANT_DIV_COMB_LNA2 <<
-+ AR_PHY_9285_ANT_DIV_ALT_LNACONF_S);
-+ regVal &= (~(AR_PHY_9285_FAST_DIV_BIAS));
-+ regVal |= (0 << AR_PHY_9285_FAST_DIV_BIAS_S);
-+ REG_WRITE(ah, AR_PHY_MULTICHAIN_GAIN_CTL, regVal);
-+ }
- }
-
- if (pModal->version >= 2) {
---- a/drivers/net/wireless/ath/ath9k/hw-ops.h
-+++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
-@@ -78,13 +78,16 @@ static inline void ath9k_hw_antdiv_comb_
- ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf);
- }
-
--static inline void ath9k_hw_antctrl_shared_chain_lnadiv(struct ath_hw *ah,
-- bool enable)
-+#ifdef CPTCFG_ATH9K_BTCOEX_SUPPORT
-+
-+static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
- {
-- if (ath9k_hw_ops(ah)->antctrl_shared_chain_lnadiv)
-- ath9k_hw_ops(ah)->antctrl_shared_chain_lnadiv(ah, enable);
-+ if (ath9k_hw_ops(ah)->set_bt_ant_diversity)
-+ ath9k_hw_ops(ah)->set_bt_ant_diversity(ah, enable);
- }
-
-+#endif
-+
- /* Private hardware call ops */
-
- /* PHY ops */
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -450,7 +450,6 @@ static void ath9k_hw_init_config(struct
- ah->config.ack_6mb = 0x0;
- ah->config.cwm_ignore_extcca = 0;
- ah->config.pcie_clock_req = 0;
-- ah->config.pcie_waen = 0;
- ah->config.analog_shiftreg = 1;
-
- for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
-@@ -1069,7 +1068,7 @@ void ath9k_hw_init_global_settings(struc
- if (IS_CHAN_A_FAST_CLOCK(ah, chan))
- tx_lat += 11;
-
-- sifstime *= 2;
-+ sifstime = 32;
- ack_offset = 16;
- slottime = 13;
- } else if (IS_CHAN_QUARTER_RATE(chan)) {
-@@ -1079,7 +1078,7 @@ void ath9k_hw_init_global_settings(struc
- if (IS_CHAN_A_FAST_CLOCK(ah, chan))
- tx_lat += 22;
-
-- sifstime *= 4;
-+ sifstime = 64;
- ack_offset = 32;
- slottime = 21;
- } else {
-@@ -1116,7 +1115,6 @@ void ath9k_hw_init_global_settings(struc
- ctstimeout += 48 - sifstime - ah->slottime;
- }
-
--
- ath9k_hw_set_sifs_time(ah, sifstime);
- ath9k_hw_setslottime(ah, slottime);
- ath9k_hw_set_ack_timeout(ah, acktimeout);
-@@ -1496,16 +1494,18 @@ static bool ath9k_hw_channel_change(stru
- struct ath9k_channel *chan)
- {
- struct ath_common *common = ath9k_hw_common(ah);
-+ struct ath9k_hw_capabilities *pCap = &ah->caps;
-+ bool band_switch = false, mode_diff = false;
-+ u8 ini_reloaded = 0;
- u32 qnum;
- int r;
-- bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
-- bool band_switch, mode_diff;
-- u8 ini_reloaded;
--
-- band_switch = (chan->channelFlags & (CHANNEL_2GHZ | CHANNEL_5GHZ)) !=
-- (ah->curchan->channelFlags & (CHANNEL_2GHZ |
-- CHANNEL_5GHZ));
-- mode_diff = (chan->chanmode != ah->curchan->chanmode);
-+
-+ if (pCap->hw_caps & ATH9K_HW_CAP_FCC_BAND_SWITCH) {
-+ u32 cur = ah->curchan->channelFlags & (CHANNEL_2GHZ | CHANNEL_5GHZ);
-+ u32 new = chan->channelFlags & (CHANNEL_2GHZ | CHANNEL_5GHZ);
-+ band_switch = (cur != new);
-+ mode_diff = (chan->chanmode != ah->curchan->chanmode);
-+ }
-
- for (qnum = 0; qnum < AR_NUM_QCU; qnum++) {
- if (ath9k_hw_numtxpending(ah, qnum)) {
-@@ -1520,11 +1520,12 @@ static bool ath9k_hw_channel_change(stru
- return false;
- }
-
-- if (edma && (band_switch || mode_diff)) {
-+ if (band_switch || mode_diff) {
- ath9k_hw_mark_phy_inactive(ah);
- udelay(5);
-
-- ath9k_hw_init_pll(ah, NULL);
-+ if (band_switch)
-+ ath9k_hw_init_pll(ah, chan);
-
- if (ath9k_hw_fast_chan_change(ah, chan, &ini_reloaded)) {
- ath_err(common, "Failed to do fast channel change\n");
-@@ -1541,22 +1542,21 @@ static bool ath9k_hw_channel_change(stru
- }
- ath9k_hw_set_clockrate(ah);
- ath9k_hw_apply_txpower(ah, chan, false);
-- ath9k_hw_rfbus_done(ah);
-
- if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan))
- ath9k_hw_set_delta_slope(ah, chan);
-
- ath9k_hw_spur_mitigate_freq(ah, chan);
-
-- if (edma && (band_switch || mode_diff)) {
-- ah->ah_flags |= AH_FASTCC;
-- if (band_switch || ini_reloaded)
-- ah->eep_ops->set_board_values(ah, chan);
-+ if (band_switch || ini_reloaded)
-+ ah->eep_ops->set_board_values(ah, chan);
-
-- ath9k_hw_init_bb(ah, chan);
-+ ath9k_hw_init_bb(ah, chan);
-+ ath9k_hw_rfbus_done(ah);
-
-- if (band_switch || ini_reloaded)
-- ath9k_hw_init_cal(ah, chan);
-+ if (band_switch || ini_reloaded) {
-+ ah->ah_flags |= AH_FASTCC;
-+ ath9k_hw_init_cal(ah, chan);
- ah->ah_flags &= ~AH_FASTCC;
- }
-
-@@ -1778,16 +1778,11 @@ static void ath9k_hw_init_desc(struct at
- /*
- * Fast channel change:
- * (Change synthesizer based on channel freq without resetting chip)
-- *
-- * Don't do FCC when
-- * - Flag is not set
-- * - Chip is just coming out of full sleep
-- * - Channel to be set is same as current channel
-- * - Channel flags are different, (eg.,moving from 2GHz to 5GHz channel)
- */
- static int ath9k_hw_do_fastcc(struct ath_hw *ah, struct ath9k_channel *chan)
- {
- struct ath_common *common = ath9k_hw_common(ah);
-+ struct ath9k_hw_capabilities *pCap = &ah->caps;
- int ret;
-
- if (AR_SREV_9280(ah) && common->bus_ops->ath_bus_type == ATH_PCI)
-@@ -1806,9 +1801,21 @@ static int ath9k_hw_do_fastcc(struct ath
- (CHANNEL_HALF | CHANNEL_QUARTER))
- goto fail;
-
-- if ((chan->channelFlags & CHANNEL_ALL) !=
-- (ah->curchan->channelFlags & CHANNEL_ALL))
-- goto fail;
-+ /*
-+ * If cross-band fcc is not supoprted, bail out if
-+ * either channelFlags or chanmode differ.
-+ *
-+ * chanmode will be different if the HT operating mode
-+ * changes because of CSA.
-+ */
-+ if (!(pCap->hw_caps & ATH9K_HW_CAP_FCC_BAND_SWITCH)) {
-+ if ((chan->channelFlags & CHANNEL_ALL) !=
-+ (ah->curchan->channelFlags & CHANNEL_ALL))
-+ goto fail;
-+
-+ if (chan->chanmode != ah->curchan->chanmode)
-+ goto fail;
-+ }
-
- if (!ath9k_hw_check_alive(ah))
- goto fail;
-@@ -2047,7 +2054,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
-
- ath9k_hw_apply_gpio_override(ah);
-
-- if (AR_SREV_9565(ah) && ah->shared_chain_lnadiv)
-+ if (AR_SREV_9565(ah) && common->bt_ant_diversity)
- REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON);
-
- return 0;
-@@ -2550,34 +2557,28 @@ int ath9k_hw_fill_cap_info(struct ath_hw
- if (AR_SREV_9287_11_OR_LATER(ah) || AR_SREV_9271(ah))
- pCap->hw_caps |= ATH9K_HW_CAP_SGI_20;
-
-- if (AR_SREV_9285(ah))
-+ if (AR_SREV_9285(ah)) {
- if (ah->eep_ops->get_eeprom(ah, EEP_MODAL_VER) >= 3) {
- ant_div_ctl1 =
- ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1);
-- if ((ant_div_ctl1 & 0x1) && ((ant_div_ctl1 >> 3) & 0x1))
-+ if ((ant_div_ctl1 & 0x1) && ((ant_div_ctl1 >> 3) & 0x1)) {
- pCap->hw_caps |= ATH9K_HW_CAP_ANT_DIV_COMB;
-+ ath_info(common, "Enable LNA combining\n");
-+ }
- }
-+ }
-+
- if (AR_SREV_9300_20_OR_LATER(ah)) {
- if (ah->eep_ops->get_eeprom(ah, EEP_CHAIN_MASK_REDUCE))
- pCap->hw_caps |= ATH9K_HW_CAP_APM;
- }
-
--
- if (AR_SREV_9330(ah) || AR_SREV_9485(ah) || AR_SREV_9565(ah)) {
- ant_div_ctl1 = ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1);
-- /*
-- * enable the diversity-combining algorithm only when
-- * both enable_lna_div and enable_fast_div are set
-- * Table for Diversity
-- * ant_div_alt_lnaconf bit 0-1
-- * ant_div_main_lnaconf bit 2-3
-- * ant_div_alt_gaintb bit 4
-- * ant_div_main_gaintb bit 5
-- * enable_ant_div_lnadiv bit 6
-- * enable_ant_fast_div bit 7
-- */
-- if ((ant_div_ctl1 >> 0x6) == 0x3)
-+ if ((ant_div_ctl1 >> 0x6) == 0x3) {
- pCap->hw_caps |= ATH9K_HW_CAP_ANT_DIV_COMB;
-+ ath_info(common, "Enable LNA combining\n");
-+ }
- }
-
- if (ath9k_hw_dfs_tested(ah))
-@@ -2610,6 +2611,13 @@ int ath9k_hw_fill_cap_info(struct ath_hw
- ah->eep_ops->get_eeprom(ah, EEP_PAPRD))
- pCap->hw_caps |= ATH9K_HW_CAP_PAPRD;
-
-+ /*
-+ * Fast channel change across bands is available
-+ * only for AR9462 and AR9565.
-+ */
-+ if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
-+ pCap->hw_caps |= ATH9K_HW_CAP_FCC_BAND_SWITCH;
-+
- return 0;
- }
-
---- a/drivers/net/wireless/ath/ath9k/hw.h
-+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -247,6 +247,8 @@ enum ath9k_hw_caps {
- ATH9K_HW_CAP_DFS = BIT(16),
- ATH9K_HW_WOW_DEVICE_CAPABLE = BIT(17),
- ATH9K_HW_CAP_PAPRD = BIT(18),
-+ ATH9K_HW_CAP_FCC_BAND_SWITCH = BIT(19),
-+ ATH9K_HW_CAP_BT_ANT_DIV = BIT(20),
- };
-
- /*
-@@ -309,8 +311,11 @@ struct ath9k_ops_config {
- u16 ani_poll_interval; /* ANI poll interval in ms */
-
- /* Platform specific config */
-+ u32 aspm_l1_fix;
- u32 xlna_gpio;
-+ u32 ant_ctrl_comm2g_switch_enable;
- bool xatten_margin_cfg;
-+ bool alt_mingainidx;
- };
-
- enum ath9k_int {
-@@ -716,11 +721,14 @@ struct ath_hw_ops {
- struct ath_hw_antcomb_conf *antconf);
- void (*antdiv_comb_conf_set)(struct ath_hw *ah,
- struct ath_hw_antcomb_conf *antconf);
-- void (*antctrl_shared_chain_lnadiv)(struct ath_hw *hw, bool enable);
- void (*spectral_scan_config)(struct ath_hw *ah,
- struct ath_spec_scan *param);
- void (*spectral_scan_trigger)(struct ath_hw *ah);
- void (*spectral_scan_wait)(struct ath_hw *ah);
-+
-+#ifdef CPTCFG_ATH9K_BTCOEX_SUPPORT
-+ void (*set_bt_ant_diversity)(struct ath_hw *hw, bool enable);
-+#endif
- };
-
- struct ath_nf_limits {
-@@ -765,7 +773,6 @@ struct ath_hw {
- bool aspm_enabled;
- bool is_monitoring;
- bool need_an_top2_fixup;
-- bool shared_chain_lnadiv;
- u16 tx_trig_level;
-
- u32 nf_regs[6];
---- a/drivers/net/wireless/ath/ath9k/pci.c
-+++ b/drivers/net/wireless/ath/ath9k/pci.c
-@@ -29,6 +29,60 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
- { PCI_VDEVICE(ATHEROS, 0x0027) }, /* PCI */
- { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI */
- { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */
-+
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x002A,
-+ PCI_VENDOR_ID_AZWAVE,
-+ 0x1C71),
-+ .driver_data = ATH9K_PCI_D3_L1_WAR },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x002A,
-+ PCI_VENDOR_ID_FOXCONN,
-+ 0xE01F),
-+ .driver_data = ATH9K_PCI_D3_L1_WAR },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x002A,
-+ 0x11AD, /* LITEON */
-+ 0x6632),
-+ .driver_data = ATH9K_PCI_D3_L1_WAR },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x002A,
-+ 0x11AD, /* LITEON */
-+ 0x6642),
-+ .driver_data = ATH9K_PCI_D3_L1_WAR },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x002A,
-+ PCI_VENDOR_ID_QMI,
-+ 0x0306),
-+ .driver_data = ATH9K_PCI_D3_L1_WAR },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x002A,
-+ 0x185F, /* WNC */
-+ 0x309D),
-+ .driver_data = ATH9K_PCI_D3_L1_WAR },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x002A,
-+ 0x10CF, /* Fujitsu */
-+ 0x147C),
-+ .driver_data = ATH9K_PCI_D3_L1_WAR },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x002A,
-+ 0x10CF, /* Fujitsu */
-+ 0x147D),
-+ .driver_data = ATH9K_PCI_D3_L1_WAR },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x002A,
-+ 0x10CF, /* Fujitsu */
-+ 0x1536),
-+ .driver_data = ATH9K_PCI_D3_L1_WAR },
-+
-+ /* AR9285 card for Asus */
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x002B,
-+ PCI_VENDOR_ID_AZWAVE,
-+ 0x2C37),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+
- { PCI_VDEVICE(ATHEROS, 0x002B) }, /* PCI-E */
- { PCI_VDEVICE(ATHEROS, 0x002C) }, /* PCI-E 802.11n bonded out */
- { PCI_VDEVICE(ATHEROS, 0x002D) }, /* PCI */
-@@ -40,29 +94,106 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
- 0x0032,
- PCI_VENDOR_ID_AZWAVE,
- 0x2086),
-- .driver_data = ATH9K_PCI_CUS198 },
-+ .driver_data = ATH9K_PCI_CUS198 | ATH9K_PCI_BT_ANT_DIV },
- { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
- 0x0032,
- PCI_VENDOR_ID_AZWAVE,
- 0x1237),
-- .driver_data = ATH9K_PCI_CUS198 },
-+ .driver_data = ATH9K_PCI_CUS198 | ATH9K_PCI_BT_ANT_DIV },
- { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
- 0x0032,
- PCI_VENDOR_ID_AZWAVE,
- 0x2126),
-- .driver_data = ATH9K_PCI_CUS198 },
-+ .driver_data = ATH9K_PCI_CUS198 | ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_AZWAVE,
-+ 0x126A),
-+ .driver_data = ATH9K_PCI_CUS198 | ATH9K_PCI_BT_ANT_DIV },
-
- /* PCI-E CUS230 */
- { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
- 0x0032,
- PCI_VENDOR_ID_AZWAVE,
- 0x2152),
-- .driver_data = ATH9K_PCI_CUS230 },
-+ .driver_data = ATH9K_PCI_CUS230 | ATH9K_PCI_BT_ANT_DIV },
- { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
- 0x0032,
- PCI_VENDOR_ID_FOXCONN,
- 0xE075),
-- .driver_data = ATH9K_PCI_CUS230 },
-+ .driver_data = ATH9K_PCI_CUS230 | ATH9K_PCI_BT_ANT_DIV },
-+
-+ /* WB225 */
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_ATHEROS,
-+ 0x3119),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_ATHEROS,
-+ 0x3122),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ 0x185F, /* WNC */
-+ 0x3119),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ 0x185F, /* WNC */
-+ 0x3027),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_SAMSUNG,
-+ 0x4105),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_SAMSUNG,
-+ 0x4106),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_SAMSUNG,
-+ 0x410D),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_SAMSUNG,
-+ 0x410E),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_SAMSUNG,
-+ 0x410F),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_SAMSUNG,
-+ 0xC706),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_SAMSUNG,
-+ 0xC680),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_SAMSUNG,
-+ 0xC708),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_LENOVO,
-+ 0x3218),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-+ 0x0032,
-+ PCI_VENDOR_ID_LENOVO,
-+ 0x3219),
-+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
-
- { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */
- { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E AR9580 */
-@@ -229,6 +360,22 @@ static void ath_pci_aspm_init(struct ath
- return;
- }
-
-+ /*
-+ * 0x70c - Ack Frequency Register.
-+ *
-+ * Bits 27:29 - DEFAULT_L1_ENTRANCE_LATENCY.
-+ *
-+ * 000 : 1 us
-+ * 001 : 2 us
-+ * 010 : 4 us
-+ * 011 : 8 us
-+ * 100 : 16 us
-+ * 101 : 32 us
-+ * 110/111 : 64 us
-+ */
-+ if (AR_SREV_9462(ah))
-+ pci_read_config_dword(pdev, 0x70c, &ah->config.aspm_l1_fix);
-+
- pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm);
- if (aspm & (PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1)) {
- ah->aspm_enabled = true;
---- a/drivers/net/wireless/ath/ath9k/phy.h
-+++ b/drivers/net/wireless/ath/ath9k/phy.h
-@@ -48,4 +48,11 @@
- #define AR_PHY_PLL_CONTROL 0x16180
- #define AR_PHY_PLL_MODE 0x16184
-
-+enum ath9k_ant_div_comb_lna_conf {
-+ ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2,
-+ ATH_ANT_DIV_COMB_LNA2,
-+ ATH_ANT_DIV_COMB_LNA1,
-+ ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2,
-+};
-+
- #endif
---- a/drivers/net/wireless/iwlwifi/mvm/time-event.c
-+++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c
-@@ -73,7 +73,6 @@
- #include "iwl-prph.h"
-
- /* A TimeUnit is 1024 microsecond */
--#define TU_TO_JIFFIES(_tu) (usecs_to_jiffies((_tu) * 1024))
- #define MSEC_TO_TU(_msec) (_msec*1000/1024)
-
- /*
-@@ -191,8 +190,7 @@ static void iwl_mvm_te_handle_notif(stru
- iwl_mvm_te_clear_data(mvm, te_data);
- } else if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_START) {
- te_data->running = true;
-- te_data->end_jiffies = jiffies +
-- TU_TO_JIFFIES(te_data->duration);
-+ te_data->end_jiffies = TU_TO_EXP_TIME(te_data->duration);
-
- if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) {
- set_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status);
-@@ -329,8 +327,7 @@ void iwl_mvm_protect_session(struct iwl_
- lockdep_assert_held(&mvm->mutex);
-
- if (te_data->running &&
-- time_after(te_data->end_jiffies,
-- jiffies + TU_TO_JIFFIES(min_duration))) {
-+ time_after(te_data->end_jiffies, TU_TO_EXP_TIME(min_duration))) {
- IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n",
- jiffies_to_msecs(te_data->end_jiffies - jiffies));
- return;
---- a/include/linux/ieee80211.h
-+++ b/include/linux/ieee80211.h
-@@ -2279,4 +2279,8 @@ static inline bool ieee80211_check_tim(c
- return !!(tim->virtual_map[index] & mask);
- }
-
-+/* convert time units */
-+#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024))
-+#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x))
-+
- #endif /* LINUX_IEEE80211_H */
---- a/net/mac80211/rate.c
-+++ b/net/mac80211/rate.c
-@@ -210,7 +210,7 @@ static bool rc_no_data_or_no_ack_use_min
- !ieee80211_is_data(fc);
- }
-
--static void rc_send_low_broadcast(s8 *idx, u32 basic_rates,
-+static void rc_send_low_basicrate(s8 *idx, u32 basic_rates,
- struct ieee80211_supported_band *sband)
- {
- u8 i;
-@@ -272,28 +272,37 @@ static void __rate_control_send_low(stru
- }
-
-
--bool rate_control_send_low(struct ieee80211_sta *sta,
-+bool rate_control_send_low(struct ieee80211_sta *pubsta,
- void *priv_sta,
- struct ieee80211_tx_rate_control *txrc)
- {
- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
- struct ieee80211_supported_band *sband = txrc->sband;
-+ struct sta_info *sta;
- int mcast_rate;
-+ bool use_basicrate = false;
-
-- if (!sta || !priv_sta || rc_no_data_or_no_ack_use_min(txrc)) {
-- __rate_control_send_low(txrc->hw, sband, sta, info);
-+ if (!pubsta || !priv_sta || rc_no_data_or_no_ack_use_min(txrc)) {
-+ __rate_control_send_low(txrc->hw, sband, pubsta, info);
-
-- if (!sta && txrc->bss) {
-+ if (!pubsta && txrc->bss) {
- mcast_rate = txrc->bss_conf->mcast_rate[sband->band];
- if (mcast_rate > 0) {
- info->control.rates[0].idx = mcast_rate - 1;
- return true;
- }
-+ use_basicrate = true;
-+ } else if (pubsta) {
-+ sta = container_of(pubsta, struct sta_info, sta);
-+ if (ieee80211_vif_is_mesh(&sta->sdata->vif))
-+ use_basicrate = true;
-+ }
-
-- rc_send_low_broadcast(&info->control.rates[0].idx,
-+ if (use_basicrate)
-+ rc_send_low_basicrate(&info->control.rates[0].idx,
- txrc->bss_conf->basic_rates,
- sband);
-- }
-+
- return true;
- }
- return false;
---- a/drivers/net/wireless/ath/ath9k/Kconfig
-+++ b/drivers/net/wireless/ath/ath9k/Kconfig
-@@ -60,7 +60,7 @@ config ATH9K_AHB
-
- config ATH9K_DEBUGFS
- bool "Atheros ath9k debugging"
-- depends on ATH9K
-+ depends on ATH9K && DEBUG_FS
- select MAC80211_DEBUGFS
- depends on RELAY
- ---help---
---- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
-@@ -269,13 +269,12 @@ static void ar9002_hw_configpcipowersave
- if (ah->config.pcie_waen & AR_WA_D3_L1_DISABLE)
- val |= AR_WA_D3_L1_DISABLE;
- } else {
-- if (((AR_SREV_9285(ah) ||
-- AR_SREV_9271(ah) ||
-- AR_SREV_9287(ah)) &&
-- (AR9285_WA_DEFAULT & AR_WA_D3_L1_DISABLE)) ||
-- (AR_SREV_9280(ah) &&
-- (AR9280_WA_DEFAULT & AR_WA_D3_L1_DISABLE))) {
-- val |= AR_WA_D3_L1_DISABLE;
-+ if (AR_SREV_9285(ah) || AR_SREV_9271(ah) || AR_SREV_9287(ah)) {
-+ if (AR9285_WA_DEFAULT & AR_WA_D3_L1_DISABLE)
-+ val |= AR_WA_D3_L1_DISABLE;
-+ } else if (AR_SREV_9280(ah)) {
-+ if (AR9280_WA_DEFAULT & AR_WA_D3_L1_DISABLE)
-+ val |= AR_WA_D3_L1_DISABLE;
- }
- }
-
-@@ -297,24 +296,18 @@ static void ar9002_hw_configpcipowersave
- } else {
- if (ah->config.pcie_waen) {
- val = ah->config.pcie_waen;
-- if (!power_off)
-- val &= (~AR_WA_D3_L1_DISABLE);
-+ val &= (~AR_WA_D3_L1_DISABLE);
- } else {
-- if (AR_SREV_9285(ah) ||
-- AR_SREV_9271(ah) ||
-- AR_SREV_9287(ah)) {
-+ if (AR_SREV_9285(ah) || AR_SREV_9271(ah) || AR_SREV_9287(ah)) {
- val = AR9285_WA_DEFAULT;
-- if (!power_off)
-- val &= (~AR_WA_D3_L1_DISABLE);
-- }
-- else if (AR_SREV_9280(ah)) {
-+ val &= (~AR_WA_D3_L1_DISABLE);
-+ } else if (AR_SREV_9280(ah)) {
- /*
- * For AR9280 chips, bit 22 of 0x4004
- * needs to be set.
- */
- val = AR9280_WA_DEFAULT;
-- if (!power_off)
-- val &= (~AR_WA_D3_L1_DISABLE);
-+ val &= (~AR_WA_D3_L1_DISABLE);
- } else {
- val = AR_WA_DEFAULT;
- }
---- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
-@@ -153,7 +153,7 @@ static void ar9003_hw_init_mode_regs(str
- if (!ah->is_clk_25mhz)
- INIT_INI_ARRAY(&ah->iniAdditional,
- ar9340_1p0_radio_core_40M);
-- } else if (AR_SREV_9485_11(ah)) {
-+ } else if (AR_SREV_9485_11_OR_LATER(ah)) {
- /* mac */
- INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
- ar9485_1_1_mac_core);
-@@ -424,7 +424,7 @@ static void ar9003_tx_gain_table_mode0(s
- else if (AR_SREV_9340(ah))
- INIT_INI_ARRAY(&ah->iniModesTxGain,
- ar9340Modes_lowest_ob_db_tx_gain_table_1p0);
-- else if (AR_SREV_9485_11(ah))
-+ else if (AR_SREV_9485_11_OR_LATER(ah))
- INIT_INI_ARRAY(&ah->iniModesTxGain,
- ar9485_modes_lowest_ob_db_tx_gain_1_1);
- else if (AR_SREV_9550(ah))
-@@ -458,7 +458,7 @@ static void ar9003_tx_gain_table_mode1(s
- else if (AR_SREV_9340(ah))
- INIT_INI_ARRAY(&ah->iniModesTxGain,
- ar9340Modes_high_ob_db_tx_gain_table_1p0);
-- else if (AR_SREV_9485_11(ah))
-+ else if (AR_SREV_9485_11_OR_LATER(ah))
- INIT_INI_ARRAY(&ah->iniModesTxGain,
- ar9485Modes_high_ob_db_tx_gain_1_1);
- else if (AR_SREV_9580(ah))
-@@ -492,7 +492,7 @@ static void ar9003_tx_gain_table_mode2(s
- else if (AR_SREV_9340(ah))
- INIT_INI_ARRAY(&ah->iniModesTxGain,
- ar9340Modes_low_ob_db_tx_gain_table_1p0);
-- else if (AR_SREV_9485_11(ah))
-+ else if (AR_SREV_9485_11_OR_LATER(ah))
- INIT_INI_ARRAY(&ah->iniModesTxGain,
- ar9485Modes_low_ob_db_tx_gain_1_1);
- else if (AR_SREV_9580(ah))
-@@ -517,7 +517,7 @@ static void ar9003_tx_gain_table_mode3(s
- else if (AR_SREV_9340(ah))
- INIT_INI_ARRAY(&ah->iniModesTxGain,
- ar9340Modes_high_power_tx_gain_table_1p0);
-- else if (AR_SREV_9485_11(ah))
-+ else if (AR_SREV_9485_11_OR_LATER(ah))
- INIT_INI_ARRAY(&ah->iniModesTxGain,
- ar9485Modes_high_power_tx_gain_1_1);
- else if (AR_SREV_9580(ah))
-@@ -552,7 +552,7 @@ static void ar9003_tx_gain_table_mode4(s
-
- static void ar9003_tx_gain_table_mode5(struct ath_hw *ah)
- {
-- if (AR_SREV_9485_11(ah))
-+ if (AR_SREV_9485_11_OR_LATER(ah))
- INIT_INI_ARRAY(&ah->iniModesTxGain,
- ar9485Modes_green_ob_db_tx_gain_1_1);
- else if (AR_SREV_9340(ah))
-@@ -571,7 +571,7 @@ static void ar9003_tx_gain_table_mode6(s
- if (AR_SREV_9340(ah))
- INIT_INI_ARRAY(&ah->iniModesTxGain,
- ar9340Modes_low_ob_db_and_spur_tx_gain_table_1p0);
-- else if (AR_SREV_9485_11(ah))
-+ else if (AR_SREV_9485_11_OR_LATER(ah))
- INIT_INI_ARRAY(&ah->iniModesTxGain,
- ar9485Modes_green_spur_ob_db_tx_gain_1_1);
- else if (AR_SREV_9580(ah))
-@@ -611,7 +611,7 @@ static void ar9003_rx_gain_table_mode0(s
- else if (AR_SREV_9340(ah))
- INIT_INI_ARRAY(&ah->iniModesRxGain,
- ar9340Common_rx_gain_table_1p0);
-- else if (AR_SREV_9485_11(ah))
-+ else if (AR_SREV_9485_11_OR_LATER(ah))
- INIT_INI_ARRAY(&ah->iniModesRxGain,
- ar9485_common_rx_gain_1_1);
- else if (AR_SREV_9550(ah)) {
-@@ -644,7 +644,7 @@ static void ar9003_rx_gain_table_mode1(s
- else if (AR_SREV_9340(ah))
- INIT_INI_ARRAY(&ah->iniModesRxGain,
- ar9340Common_wo_xlna_rx_gain_table_1p0);
-- else if (AR_SREV_9485_11(ah))
-+ else if (AR_SREV_9485_11_OR_LATER(ah))
- INIT_INI_ARRAY(&ah->iniModesRxGain,
- ar9485Common_wo_xlna_rx_gain_1_1);
- else if (AR_SREV_9462_21(ah))
-@@ -745,16 +745,25 @@ static void ar9003_hw_init_mode_gain_reg
- static void ar9003_hw_configpcipowersave(struct ath_hw *ah,
- bool power_off)
- {
-+ /*
-+ * Increase L1 Entry Latency. Some WB222 boards don't have
-+ * this change in eeprom/OTP.
-+ *
-+ */
-+ if (AR_SREV_9462(ah)) {
-+ u32 val = ah->config.aspm_l1_fix;
-+ if ((val & 0xff000000) == 0x17000000) {
-+ val &= 0x00ffffff;
-+ val |= 0x27000000;
-+ REG_WRITE(ah, 0x570c, val);
-+ }
-+ }
-+
- /* Nothing to do on restore for 11N */
- if (!power_off /* !restore */) {
- /* set bit 19 to allow forcing of pcie core into L1 state */
- REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA);
--
-- /* Several PCIe massages to ensure proper behaviour */
-- if (ah->config.pcie_waen)
-- REG_WRITE(ah, AR_WA, ah->config.pcie_waen);
-- else
-- REG_WRITE(ah, AR_WA, ah->WARegVal);
-+ REG_WRITE(ah, AR_WA, ah->WARegVal);
- }
-
- /*
---- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
-@@ -491,6 +491,7 @@ int ath9k_hw_process_rxdesc_edma(struct
- rxs->rs_rate = MS(rxsp->status1, AR_RxRate);
- rxs->rs_more = (rxsp->status2 & AR_RxMore) ? 1 : 0;
-
-+ rxs->rs_firstaggr = (rxsp->status11 & AR_RxFirstAggr) ? 1 : 0;
- rxs->rs_isaggr = (rxsp->status11 & AR_RxAggr) ? 1 : 0;
- rxs->rs_moreaggr = (rxsp->status11 & AR_RxMoreAggr) ? 1 : 0;
- rxs->rs_antenna = (MS(rxsp->status4, AR_RxAntenna) & 0x7);
---- a/drivers/net/wireless/ath/ath9k/common.c
-+++ b/drivers/net/wireless/ath/ath9k/common.c
-@@ -49,37 +49,40 @@ int ath9k_cmn_get_hw_crypto_keytype(stru
- }
- EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_keytype);
-
--static u32 ath9k_get_extchanmode(struct ieee80211_channel *chan,
-- enum nl80211_channel_type channel_type)
-+static u32 ath9k_get_extchanmode(struct cfg80211_chan_def *chandef)
- {
- u32 chanmode = 0;
-
-- switch (chan->band) {
-+ switch (chandef->chan->band) {
- case IEEE80211_BAND_2GHZ:
-- switch (channel_type) {
-- case NL80211_CHAN_NO_HT:
-- case NL80211_CHAN_HT20:
-+ switch (chandef->width) {
-+ case NL80211_CHAN_WIDTH_20_NOHT:
-+ case NL80211_CHAN_WIDTH_20:
- chanmode = CHANNEL_G_HT20;
- break;
-- case NL80211_CHAN_HT40PLUS:
-- chanmode = CHANNEL_G_HT40PLUS;
-+ case NL80211_CHAN_WIDTH_40:
-+ if (chandef->center_freq1 > chandef->chan->center_freq)
-+ chanmode = CHANNEL_G_HT40PLUS;
-+ else
-+ chanmode = CHANNEL_G_HT40MINUS;
- break;
-- case NL80211_CHAN_HT40MINUS:
-- chanmode = CHANNEL_G_HT40MINUS;
-+ default:
- break;
- }
- break;
- case IEEE80211_BAND_5GHZ:
-- switch (channel_type) {
-- case NL80211_CHAN_NO_HT:
-- case NL80211_CHAN_HT20:
-+ switch (chandef->width) {
-+ case NL80211_CHAN_WIDTH_20_NOHT:
-+ case NL80211_CHAN_WIDTH_20:
- chanmode = CHANNEL_A_HT20;
- break;
-- case NL80211_CHAN_HT40PLUS:
-- chanmode = CHANNEL_A_HT40PLUS;
-+ case NL80211_CHAN_WIDTH_40:
-+ if (chandef->center_freq1 > chandef->chan->center_freq)
-+ chanmode = CHANNEL_A_HT40PLUS;
-+ else
-+ chanmode = CHANNEL_A_HT40MINUS;
- break;
-- case NL80211_CHAN_HT40MINUS:
-- chanmode = CHANNEL_A_HT40MINUS;
-+ default:
- break;
- }
- break;
-@@ -94,13 +97,12 @@ static u32 ath9k_get_extchanmode(struct
- * Update internal channel flags.
- */
- void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
-- struct ieee80211_channel *chan,
-- enum nl80211_channel_type channel_type)
-+ struct cfg80211_chan_def *chandef)
- {
-- ichan->channel = chan->center_freq;
-- ichan->chan = chan;
-+ ichan->channel = chandef->chan->center_freq;
-+ ichan->chan = chandef->chan;
-
-- if (chan->band == IEEE80211_BAND_2GHZ) {
-+ if (chandef->chan->band == IEEE80211_BAND_2GHZ) {
- ichan->chanmode = CHANNEL_G;
- ichan->channelFlags = CHANNEL_2GHZ | CHANNEL_OFDM;
- } else {
-@@ -108,8 +110,22 @@ void ath9k_cmn_update_ichannel(struct at
- ichan->channelFlags = CHANNEL_5GHZ | CHANNEL_OFDM;
- }
-
-- if (channel_type != NL80211_CHAN_NO_HT)
-- ichan->chanmode = ath9k_get_extchanmode(chan, channel_type);
-+ switch (chandef->width) {
-+ case NL80211_CHAN_WIDTH_5:
-+ ichan->channelFlags |= CHANNEL_QUARTER;
-+ break;
-+ case NL80211_CHAN_WIDTH_10:
-+ ichan->channelFlags |= CHANNEL_HALF;
-+ break;
-+ case NL80211_CHAN_WIDTH_20_NOHT:
-+ break;
-+ case NL80211_CHAN_WIDTH_20:
-+ case NL80211_CHAN_WIDTH_40:
-+ ichan->chanmode = ath9k_get_extchanmode(chandef);
-+ break;
-+ default:
-+ WARN_ON(1);
-+ }
- }
- EXPORT_SYMBOL(ath9k_cmn_update_ichannel);
-
-@@ -125,8 +141,7 @@ struct ath9k_channel *ath9k_cmn_get_curc
-
- chan_idx = curchan->hw_value;
- channel = &ah->channels[chan_idx];
-- ath9k_cmn_update_ichannel(channel, curchan,
-- cfg80211_get_chandef_type(&hw->conf.chandef));
-+ ath9k_cmn_update_ichannel(channel, &hw->conf.chandef);
-
- return channel;
- }
---- a/drivers/net/wireless/ath/ath9k/common.h
-+++ b/drivers/net/wireless/ath/ath9k/common.h
-@@ -44,8 +44,7 @@
-
- int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb);
- void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
-- struct ieee80211_channel *chan,
-- enum nl80211_channel_type channel_type);
-+ struct cfg80211_chan_def *chandef);
- struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw,
- struct ath_hw *ah);
- int ath9k_cmn_count_streams(unsigned int chainmask, int max);
---- a/drivers/net/wireless/ath/ath9k/hif_usb.c
-+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
-@@ -115,10 +115,10 @@ static int hif_usb_send_regout(struct hi
- cmd->skb = skb;
- cmd->hif_dev = hif_dev;
-
-- usb_fill_bulk_urb(urb, hif_dev->udev,
-- usb_sndbulkpipe(hif_dev->udev, USB_REG_OUT_PIPE),
-+ usb_fill_int_urb(urb, hif_dev->udev,
-+ usb_sndintpipe(hif_dev->udev, USB_REG_OUT_PIPE),
- skb->data, skb->len,
-- hif_usb_regout_cb, cmd);
-+ hif_usb_regout_cb, cmd, 1);
-
- usb_anchor_urb(urb, &hif_dev->regout_submitted);
- ret = usb_submit_urb(urb, GFP_KERNEL);
-@@ -723,11 +723,11 @@ static void ath9k_hif_usb_reg_in_cb(stru
- return;
- }
-
-- usb_fill_bulk_urb(urb, hif_dev->udev,
-- usb_rcvbulkpipe(hif_dev->udev,
-+ usb_fill_int_urb(urb, hif_dev->udev,
-+ usb_rcvintpipe(hif_dev->udev,
- USB_REG_IN_PIPE),
- nskb->data, MAX_REG_IN_BUF_SIZE,
-- ath9k_hif_usb_reg_in_cb, nskb);
-+ ath9k_hif_usb_reg_in_cb, nskb, 1);
- }
-
- resubmit:
-@@ -909,11 +909,11 @@ static int ath9k_hif_usb_alloc_reg_in_ur
- goto err_skb;
- }
-
-- usb_fill_bulk_urb(urb, hif_dev->udev,
-- usb_rcvbulkpipe(hif_dev->udev,
-+ usb_fill_int_urb(urb, hif_dev->udev,
-+ usb_rcvintpipe(hif_dev->udev,
- USB_REG_IN_PIPE),
- skb->data, MAX_REG_IN_BUF_SIZE,
-- ath9k_hif_usb_reg_in_cb, skb);
-+ ath9k_hif_usb_reg_in_cb, skb, 1);
-
- /* Anchor URB */
- usb_anchor_urb(urb, &hif_dev->reg_in_submitted);
-@@ -1031,9 +1031,7 @@ static int ath9k_hif_usb_download_fw(str
-
- static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
- {
-- struct usb_host_interface *alt = &hif_dev->interface->altsetting[0];
-- struct usb_endpoint_descriptor *endp;
-- int ret, idx;
-+ int ret;
-
- ret = ath9k_hif_usb_download_fw(hif_dev);
- if (ret) {
-@@ -1043,20 +1041,6 @@ static int ath9k_hif_usb_dev_init(struct
- return ret;
- }
-
-- /* On downloading the firmware to the target, the USB descriptor of EP4
-- * is 'patched' to change the type of the endpoint to Bulk. This will
-- * bring down CPU usage during the scan period.
-- */
-- for (idx = 0; idx < alt->desc.bNumEndpoints; idx++) {
-- endp = &alt->endpoint[idx].desc;
-- if ((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
-- == USB_ENDPOINT_XFER_INT) {
-- endp->bmAttributes &= ~USB_ENDPOINT_XFERTYPE_MASK;
-- endp->bmAttributes |= USB_ENDPOINT_XFER_BULK;
-- endp->bInterval = 0;
-- }
-- }
--
- /* Alloc URBs */
- ret = ath9k_hif_usb_alloc_urbs(hif_dev);
- if (ret) {
-@@ -1268,7 +1252,7 @@ static void ath9k_hif_usb_reboot(struct
- if (!buf)
- return;
-
-- ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, USB_REG_OUT_PIPE),
-+ ret = usb_interrupt_msg(udev, usb_sndintpipe(udev, USB_REG_OUT_PIPE),
- buf, 4, NULL, HZ);
- if (ret)
- dev_err(&udev->dev, "ath9k_htc: USB reboot failed\n");
---- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
-+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
-@@ -1203,16 +1203,13 @@ static int ath9k_htc_config(struct ieee8
-
- if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || chip_reset) {
- struct ieee80211_channel *curchan = hw->conf.chandef.chan;
-- enum nl80211_channel_type channel_type =
-- cfg80211_get_chandef_type(&hw->conf.chandef);
- int pos = curchan->hw_value;
-
- ath_dbg(common, CONFIG, "Set channel: %d MHz\n",
- curchan->center_freq);
-
- ath9k_cmn_update_ichannel(&priv->ah->channels[pos],
-- hw->conf.chandef.chan,
-- channel_type);
-+ &hw->conf.chandef);
-
- if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) {
- ath_err(common, "Unable to set channel\n");
---- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
-+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
-@@ -448,6 +448,7 @@ static void ath9k_htc_tx_process(struct
- struct ieee80211_conf *cur_conf = &priv->hw->conf;
- bool txok;
- int slot;
-+ int hdrlen, padsize;
-
- slot = strip_drv_header(priv, skb);
- if (slot < 0) {
-@@ -504,6 +505,15 @@ send_mac80211:
-
- ath9k_htc_tx_clear_slot(priv, slot);
-
-+ /* Remove padding before handing frame back to mac80211 */
-+ hdrlen = ieee80211_get_hdrlen_from_skb(skb);
-+
-+ padsize = hdrlen & 3;
-+ if (padsize && skb->len > hdrlen + padsize) {
-+ memmove(skb->data + padsize, skb->data, hdrlen);
-+ skb_pull(skb, padsize);
-+ }
-+
- /* Send status to mac80211 */
- ieee80211_tx_status(priv->hw, skb);
- }
---- a/drivers/net/wireless/ath/ath9k/link.c
-+++ b/drivers/net/wireless/ath/ath9k/link.c
-@@ -41,7 +41,7 @@ void ath_tx_complete_poll_work(struct wo
- txq->axq_tx_inprogress = true;
- }
- }
-- ath_txq_unlock_complete(sc, txq);
-+ ath_txq_unlock(sc, txq);
- }