---- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
-+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
-@@ -961,18 +961,6 @@ static void ar5008_hw_rfbus_done(struct
- REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0);
- }
-
--static void ar5008_hw_enable_rfkill(struct ath_hw *ah)
--{
-- REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
-- AR_GPIO_INPUT_EN_VAL_RFSILENT_BB);
--
-- REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2,
-- AR_GPIO_INPUT_MUX2_RFSILENT);
--
-- ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
-- REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB);
--}
--
- static void ar5008_restore_chainmask(struct ath_hw *ah)
- {
- int rx_chainmask = ah->rxchainmask;
-@@ -1629,7 +1617,6 @@ void ar5008_hw_attach_phy_ops(struct ath
- priv_ops->set_delta_slope = ar5008_hw_set_delta_slope;
- priv_ops->rfbus_req = ar5008_hw_rfbus_req;
- priv_ops->rfbus_done = ar5008_hw_rfbus_done;
-- priv_ops->enable_rfkill = ar5008_hw_enable_rfkill;
- priv_ops->restore_chainmask = ar5008_restore_chainmask;
- priv_ops->set_diversity = ar5008_set_diversity;
- priv_ops->do_getnf = ar5008_hw_do_getnf;
---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
-@@ -745,28 +745,6 @@ static void ar9003_hw_rfbus_done(struct
- REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0);
+--- a/drivers/net/wireless/ath/ath9k/xmit.c
++++ b/drivers/net/wireless/ath/ath9k/xmit.c
+@@ -1221,49 +1221,59 @@ void ath_tx_cleanupq(struct ath_softc *s
+ sc->tx.txqsetup &= ~(1<<txq->axq_qnum);
}
--/*
-- * Set the interrupt and GPIO values so the ISR can disable RF
-- * on a switch signal. Assumes GPIO port and interrupt polarity
-- * are set prior to call.
-- */
--static void ar9003_hw_enable_rfkill(struct ath_hw *ah)
--{
-- /* Connect rfsilent_bb_l to baseband */
-- REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
-- AR_GPIO_INPUT_EN_VAL_RFSILENT_BB);
-- /* Set input mux for rfsilent_bb_l to GPIO #0 */
-- REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2,
-- AR_GPIO_INPUT_MUX2_RFSILENT);
--
-- /*
-- * Configure the desired GPIO port for input and
-- * enable baseband rf silence.
-- */
-- ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
-- REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB);
--}
--
- static void ar9003_hw_set_diversity(struct ath_hw *ah, bool value)
++/* For each axq_acq entry, for each tid, try to schedule packets
++ * for transmit until ampdu_depth has reached min Q depth.
++ */
+ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
{
- u32 v = REG_READ(ah, AR_PHY_CCK_DETECT);
-@@ -1203,7 +1181,6 @@ void ar9003_hw_attach_phy_ops(struct ath
- priv_ops->set_delta_slope = ar9003_hw_set_delta_slope;
- priv_ops->rfbus_req = ar9003_hw_rfbus_req;
- priv_ops->rfbus_done = ar9003_hw_rfbus_done;
-- priv_ops->enable_rfkill = ar9003_hw_enable_rfkill;
- priv_ops->set_diversity = ar9003_hw_set_diversity;
- priv_ops->ani_control = ar9003_hw_ani_control;
- priv_ops->do_getnf = ar9003_hw_do_getnf;
---- a/drivers/net/wireless/ath/ath9k/ath9k.h
-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -189,6 +189,7 @@ struct ath_txq {
- struct list_head axq_q;
- spinlock_t axq_lock;
- u32 axq_depth;
-+ u32 axq_ampdu_depth;
- bool stopped;
- bool axq_tx_inprogress;
- struct list_head axq_acq;
---- a/drivers/net/wireless/ath/ath9k/hw-ops.h
-+++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
-@@ -223,11 +223,6 @@ static inline void ath9k_hw_rfbus_done(s
- return ath9k_hw_private_ops(ah)->rfbus_done(ah);
- }
-
--static inline void ath9k_enable_rfkill(struct ath_hw *ah)
--{
-- return ath9k_hw_private_ops(ah)->enable_rfkill(ah);
--}
+- struct ath_atx_ac *ac;
+- struct ath_atx_tid *tid, *last;
++ struct ath_atx_ac *ac, *ac_tmp, *last_ac;
++ struct ath_atx_tid *tid, *last_tid;
+
+ if (list_empty(&txq->axq_acq) ||
+ txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
+ return;
+
+ ac = list_first_entry(&txq->axq_acq, struct ath_atx_ac, list);
+- last = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);
+- list_del(&ac->list);
+- ac->sched = false;
++ last_ac = list_entry(txq->axq_acq.prev, struct ath_atx_ac, list);
+
+- do {
+- if (list_empty(&ac->tid_q))
+- return;
-
- static inline void ath9k_hw_restore_chainmask(struct ath_hw *ah)
- {
- if (!ath9k_hw_private_ops(ah)->restore_chainmask)
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -491,6 +491,17 @@ static int __ath9k_hw_init(struct ath_hw
- if (ah->hw_version.devid == AR5416_AR9100_DEVID)
- ah->hw_version.macVersion = AR_SREV_VERSION_9100;
-
-+ ath9k_hw_read_revisions(ah);
+- tid = list_first_entry(&ac->tid_q, struct ath_atx_tid, list);
+- list_del(&tid->list);
+- tid->sched = false;
++ list_for_each_entry_safe(ac, ac_tmp, &txq->axq_acq, list) {
++ last_tid = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);
++ list_del(&ac->list);
++ ac->sched = false;
+
-+ /*
-+ * Read back AR_WA into a permanent copy and set bits 14 and 17.
-+ * We need to do this to avoid RMW of this register. We cannot
-+ * read the reg when chip is asleep.
-+ */
-+ ah->WARegVal = REG_READ(ah, AR_WA);
-+ ah->WARegVal |= (AR_WA_D3_L1_DISABLE |
-+ AR_WA_ASPM_TIMER_BASED_DISABLE);
++ while (!list_empty(&ac->tid_q)) {
++ tid = list_first_entry(&ac->tid_q, struct ath_atx_tid,
++ list);
++ list_del(&tid->list);
++ tid->sched = false;
+
+- if (tid->paused)
+- continue;
++ if (tid->paused)
++ continue;
+
+- ath_tx_sched_aggr(sc, txq, tid);
++ ath_tx_sched_aggr(sc, txq, tid);
+
+- /*
+- * add tid to round-robin queue if more frames
+- * are pending for the tid
+- */
+- if (!list_empty(&tid->buf_q))
+- ath_tx_queue_tid(txq, tid);
++ /*
++ * add tid to round-robin queue if more frames
++ * are pending for the tid
++ */
++ if (!list_empty(&tid->buf_q))
++ ath_tx_queue_tid(txq, tid);
+
+- if (tid == last || txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
+- break;
+- } while (!list_empty(&ac->tid_q));
++ if (tid == last_tid ||
++ txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
++ break;
++ }
+
+- if (!list_empty(&ac->tid_q)) {
+- if (!ac->sched) {
+- ac->sched = true;
+- list_add_tail(&ac->list, &txq->axq_acq);
++ if (!list_empty(&ac->tid_q)) {
++ if (!ac->sched) {
++ ac->sched = true;
++ list_add_tail(&ac->list, &txq->axq_acq);
++ }
+ }
+
- if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) {
- ath_err(common, "Couldn't reset chip\n");
- return -EIO;
-@@ -559,14 +570,6 @@ static int __ath9k_hw_init(struct ath_hw
-
- ath9k_hw_init_mode_regs(ah);
-
-- /*
-- * Read back AR_WA into a permanent copy and set bits 14 and 17.
-- * We need to do this to avoid RMW of this register. We cannot
-- * read the reg when chip is asleep.
-- */
-- ah->WARegVal = REG_READ(ah, AR_WA);
-- ah->WARegVal |= (AR_WA_D3_L1_DISABLE |
-- AR_WA_ASPM_TIMER_BASED_DISABLE);
-
- if (ah->is_pciexpress)
- ath9k_hw_configpcipowersave(ah, 0, 0);
-@@ -1078,8 +1081,6 @@ static bool ath9k_hw_set_reset_power_on(
- return false;
++ if (ac == last_ac ||
++ txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH)
++ return;
}
-
-- ath9k_hw_read_revisions(ah);
--
- return ath9k_hw_set_reset(ah, ATH9K_RESET_WARM);
}
-@@ -1399,7 +1400,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
- ath9k_hw_init_qos(ah);
-
- if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
-- ath9k_enable_rfkill(ah);
-+ ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
-
- ath9k_hw_init_global_settings(ah);
+--- a/drivers/net/wireless/ath/ath9k/hw.c
++++ b/drivers/net/wireless/ath/ath9k/hw.c
+@@ -369,6 +369,9 @@ static void ath9k_hw_init_config(struct
+ else
+ ah->config.ht_enable = 0;
++ /* PAPRD needs some more work to be enabled */
++ ah->config.paprd_disable = 1;
++
+ ah->config.rx_intr_mitigation = true;
+ ah->config.pcieSerDesWrite = true;
+
+@@ -1949,7 +1952,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw
+ pCap->rx_status_len = sizeof(struct ar9003_rxs);
+ pCap->tx_desc_len = sizeof(struct ar9003_txc);
+ pCap->txs_len = sizeof(struct ar9003_txs);
+- if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD))
++ if (!ah->config.paprd_disable &&
++ ah->eep_ops->get_eeprom(ah, EEP_PAPRD))
+ pCap->hw_caps |= ATH9K_HW_CAP_PAPRD;
+ } else {
+ pCap->tx_desc_len = sizeof(struct ath_desc);
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -576,7 +576,6 @@ struct ath_hw_private_ops {
- void (*set_delta_slope)(struct ath_hw *ah, struct ath9k_channel *chan);
- bool (*rfbus_req)(struct ath_hw *ah);
- void (*rfbus_done)(struct ath_hw *ah);
-- void (*enable_rfkill)(struct ath_hw *ah);
- void (*restore_chainmask)(struct ath_hw *ah);
- void (*set_diversity)(struct ath_hw *ah, bool value);
- u32 (*compute_pll_control)(struct ath_hw *ah,
---- a/drivers/net/wireless/ath/ath9k/xmit.c
-+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -838,7 +838,7 @@ static void ath_tx_sched_aggr(struct ath
- ath_tx_txqaddbuf(sc, txq, &bf_q);
- TX_STAT_INC(txq->axq_qnum, a_aggr);
-
-- } while (txq->axq_depth < ATH_AGGR_MIN_QDEPTH &&
-+ } while (txq->axq_ampdu_depth < ATH_AGGR_MIN_QDEPTH &&
- status != ATH_AGGR_BAW_CLOSED);
- }
-
-@@ -999,6 +999,7 @@ struct ath_txq *ath_txq_setup(struct ath
- INIT_LIST_HEAD(&txq->axq_acq);
- spin_lock_init(&txq->axq_lock);
- txq->axq_depth = 0;
-+ txq->axq_ampdu_depth = 0;
- txq->axq_tx_inprogress = false;
- sc->tx.txqsetup |= 1<<qnum;
-
-@@ -1068,6 +1069,12 @@ int ath_cabq_update(struct ath_softc *sc
- return 0;
- }
-
-+static bool bf_is_ampdu_not_probing(struct ath_buf *bf)
-+{
-+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
-+ return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
-+}
-+
- /*
- * Drain a given TX queue (could be Beacon or Data)
- *
-@@ -1126,7 +1133,8 @@ void ath_draintxq(struct ath_softc *sc,
- }
-
- txq->axq_depth--;
--
-+ if (bf_is_ampdu_not_probing(bf))
-+ txq->axq_ampdu_depth--;
- spin_unlock_bh(&txq->axq_lock);
-
- if (bf_isampdu(bf))
-@@ -1316,6 +1324,8 @@ static void ath_tx_txqaddbuf(struct ath_
- ath9k_hw_txstart(ah, txq->axq_qnum);
- }
- txq->axq_depth++;
-+ if (bf_is_ampdu_not_probing(bf))
-+ txq->axq_ampdu_depth++;
- }
-
- static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
-@@ -1336,7 +1346,7 @@ static void ath_tx_send_ampdu(struct ath
- */
- if (!list_empty(&tid->buf_q) || tid->paused ||
- !BAW_WITHIN(tid->seq_start, tid->baw_size, fi->seqno) ||
-- txctl->txq->axq_depth >= ATH_AGGR_MIN_QDEPTH) {
-+ txctl->txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) {
- /*
- * Add this frame to software queue for scheduling later
- * for aggregation.
-@@ -2040,6 +2050,9 @@ static void ath_tx_processq(struct ath_s
- txq->axq_tx_inprogress = false;
- if (bf_held)
- list_del(&bf_held->list);
-+
-+ if (bf_is_ampdu_not_probing(bf))
-+ txq->axq_ampdu_depth--;
- spin_unlock_bh(&txq->axq_lock);
-
- if (bf_held)
-@@ -2168,6 +2181,8 @@ void ath_tx_edma_tasklet(struct ath_soft
- INCR(txq->txq_tailidx, ATH_TXFIFO_DEPTH);
- txq->axq_depth--;
- txq->axq_tx_inprogress = false;
-+ if (bf_is_ampdu_not_probing(bf))
-+ txq->axq_ampdu_depth--;
- spin_unlock_bh(&txq->axq_lock);
-
- txok = !(txs.ts_status & ATH9K_TXERR_MASK);
+@@ -228,6 +228,7 @@ struct ath9k_ops_config {
+ u32 pcie_waen;
+ u8 analog_shiftreg;
+ u8 ht_enable;
++ u8 paprd_disable;
+ u32 ofdm_trig_low;
+ u32 ofdm_trig_high;
+ u32 cck_trig_high;