--#define AR_PHY_TX_IQCAL_START_9485 (AR_SM_BASE + 0x3c4)
--#define AR_PHY_TX_IQCAL_START_DO_CAL_9485 0x80000000
--#define AR_PHY_TX_IQCAL_START_DO_CAL_9485_S 31
--#define AR_PHY_TX_IQCAL_CONTROL_1_9485 (AR_SM_BASE + 0x3c8)
--#define AR_PHY_TX_IQCAL_STATUS_B0_9485 (AR_SM_BASE + 0x3f0)
--
--#define AR_PHY_TX_IQCAL_CONTROL_1 (AR_SM_BASE + 0x448)
--#define AR_PHY_TX_IQCAL_START (AR_SM_BASE + 0x440)
--#define AR_PHY_TX_IQCAL_STATUS_B0 (AR_SM_BASE + 0x48c)
-+#define AR_PHY_TX_IQCAL_CONTROL_1 (AR_SM_BASE + AR_SREV_9485(ah) ? \
-+ 0x3c8 : 0x448)
-+#define AR_PHY_TX_IQCAL_START (AR_SM_BASE + AR_SREV_9485(ah) ? \
-+ 0x3c4 : 0x440)
-+#define AR_PHY_TX_IQCAL_STATUS_B0 (AR_SM_BASE + AR_SREV_9485(ah) ? \
-+ 0x3f0 : 0x48c)
- #define AR_PHY_TX_IQCAL_CORR_COEFF_B0(_i) (AR_SM_BASE + \
- (AR_SREV_9485(ah) ? \
- 0x3d0 : 0x450) + ((_i) << 2))
-@@ -758,10 +755,10 @@
- #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000
- #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24
- #define AR_PHY_CHANNEL_STATUS_RX_CLEAR 0x00000004
--#define AR_PHY_TX_IQCAQL_CONTROL_1_IQCORR_I_Q_COFF_DELPT 0x01fc0000
--#define AR_PHY_TX_IQCAQL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_S 18
--#define AR_PHY_TX_IQCAL_START_DO_CAL 0x00000001
--#define AR_PHY_TX_IQCAL_START_DO_CAL_S 0
-+#define AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT 0x01fc0000
-+#define AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_S 18
-+#define AR_PHY_TX_IQCAL_START_DO_CAL 0x00000001
-+#define AR_PHY_TX_IQCAL_START_DO_CAL_S 0
-
- #define AR_PHY_TX_IQCAL_STATUS_FAILED 0x00000001
- #define AR_PHY_CALIBRATED_GAINS_0 0x3e
---- a/drivers/net/wireless/ath/ath9k/ath9k.h
-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -453,6 +453,7 @@ void ath9k_btcoex_timer_pause(struct ath
-
- #define ATH_LED_PIN_DEF 1
- #define ATH_LED_PIN_9287 8
-+#define ATH_LED_PIN_9300 10
- #define ATH_LED_PIN_9485 6
-
- #ifdef CONFIG_MAC80211_LEDS
---- a/drivers/net/wireless/ath/ath9k/gpio.c
-+++ b/drivers/net/wireless/ath/ath9k/gpio.c
-@@ -46,6 +46,8 @@ void ath_init_leds(struct ath_softc *sc)
- sc->sc_ah->led_pin = ATH_LED_PIN_9287;
- else if (AR_SREV_9485(sc->sc_ah))
- sc->sc_ah->led_pin = ATH_LED_PIN_9485;
-+ else if (AR_SREV_9300(sc->sc_ah))
-+ sc->sc_ah->led_pin = ATH_LED_PIN_9300;
- else
- sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
+- return ieee80211_wep_encrypt_data(tfm, rc4key, 16, pos, payload_len);
++ return ieee80211_wep_encrypt_data(tfm, rc4key, 16,
++ payload, payload_len);
+ }
+
+ /* Decrypt packet payload with TKIP using @key. @pos is a pointer to the
+--- a/net/mac80211/tkip.h
++++ b/net/mac80211/tkip.h
+@@ -13,11 +13,13 @@
+ #include <linux/crypto.h>
+ #include "key.h"
+
+-u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key, u16 iv16);
++u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key);
+
+ int ieee80211_tkip_encrypt_data(struct crypto_cipher *tfm,
+- struct ieee80211_key *key,
+- u8 *pos, size_t payload_len, u8 *ta);
++ struct ieee80211_key *key,
++ struct sk_buff *skb,
++ u8 *payload, size_t payload_len);
++
+ enum {
+ TKIP_DECRYPT_OK = 0,
+ TKIP_DECRYPT_NO_EXT_IV = -1,
+--- a/net/mac80211/cfg.c
++++ b/net/mac80211/cfg.c
+@@ -209,6 +209,7 @@ static int ieee80211_get_key(struct wiph
+ u8 seq[6] = {0};
+ struct key_params params;
+ struct ieee80211_key *key = NULL;
++ u64 pn64;
+ u32 iv32;
+ u16 iv16;
+ int err = -ENOENT;
+@@ -256,12 +257,13 @@ static int ieee80211_get_key(struct wiph
+ params.seq_len = 6;
+ break;
+ case WLAN_CIPHER_SUITE_CCMP:
+- seq[0] = key->u.ccmp.tx_pn[5];
+- seq[1] = key->u.ccmp.tx_pn[4];
+- seq[2] = key->u.ccmp.tx_pn[3];
+- seq[3] = key->u.ccmp.tx_pn[2];
+- seq[4] = key->u.ccmp.tx_pn[1];
+- seq[5] = key->u.ccmp.tx_pn[0];
++ pn64 = atomic64_read(&key->u.ccmp.tx_pn);
++ seq[0] = pn64;
++ seq[1] = pn64 >> 8;
++ seq[2] = pn64 >> 16;
++ seq[3] = pn64 >> 24;
++ seq[4] = pn64 >> 32;
++ seq[5] = pn64 >> 40;
+ params.seq = seq;
+ params.seq_len = 6;
+ break;
+--- a/net/mac80211/debugfs_key.c
++++ b/net/mac80211/debugfs_key.c
+@@ -79,6 +79,7 @@ static ssize_t key_tx_spec_read(struct f
+ size_t count, loff_t *ppos)
+ {
+ const u8 *tpn;
++ u64 pn;
+ char buf[20];
+ int len;
+ struct ieee80211_key *key = file->private_data;
+@@ -94,9 +95,10 @@ static ssize_t key_tx_spec_read(struct f
+ key->u.tkip.tx.iv16);
+ break;
+ case WLAN_CIPHER_SUITE_CCMP:
+- tpn = key->u.ccmp.tx_pn;
++ pn = atomic64_read(&key->u.ccmp.tx_pn);
+ len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
+- tpn[0], tpn[1], tpn[2], tpn[3], tpn[4], tpn[5]);
++ (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
++ (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
+ break;
+ case WLAN_CIPHER_SUITE_AES_CMAC:
+ tpn = key->u.aes_cmac.tx_pn;
+--- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
++++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
+@@ -653,8 +653,8 @@ static const u32 ar9300_2p2_baseband_pos
+ {0x0000a288, 0x00000110, 0x00000110, 0x00000110, 0x00000110},
+ {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222},
+ {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18},
+- {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982},
+- {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a},
++ {0x0000a2d0, 0x00041981, 0x00041981, 0x00041981, 0x00041982},
++ {0x0000a2d8, 0x7999a83b, 0x7999a83b, 0x7999a83b, 0x7999a83b},
+ {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
+ {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
+ {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000},
+@@ -761,7 +761,7 @@ static const u32 ar9300_2p2_baseband_cor
+ {0x0000a3ec, 0x20202020},
+ {0x0000a3f0, 0x00000000},
+ {0x0000a3f4, 0x00000246},
+- {0x0000a3f8, 0x0cdbd380},
++ {0x0000a3f8, 0x0c9bd380},
+ {0x0000a3fc, 0x000f0f01},
+ {0x0000a400, 0x8fa91f01},
+ {0x0000a404, 0x00000000},
+@@ -780,7 +780,7 @@ static const u32 ar9300_2p2_baseband_cor
+ {0x0000a43c, 0x00100000},
+ {0x0000a440, 0x00000000},
+ {0x0000a444, 0x00000000},
+- {0x0000a448, 0x06000080},
++ {0x0000a448, 0x05000080},
+ {0x0000a44c, 0x00000001},
+ {0x0000a450, 0x00010000},
+ {0x0000a458, 0x00000000},
+@@ -1500,8 +1500,6 @@ static const u32 ar9300_2p2_mac_core[][2
+ {0x0000816c, 0x00000000},
+ {0x000081c0, 0x00000000},
+ {0x000081c4, 0x33332210},
+- {0x000081c8, 0x00000000},
+- {0x000081cc, 0x00000000},
+ {0x000081ec, 0x00000000},
+ {0x000081f0, 0x00000000},
+ {0x000081f4, 0x00000000},
+--- a/net/mac80211/work.c
++++ b/net/mac80211/work.c
+@@ -1075,14 +1075,13 @@ static void ieee80211_work_work(struct w
+ continue;
+ if (wk->chan != local->tmp_channel)
+ continue;
+- if (ieee80211_work_ct_coexists(wk->chan_type,
+- local->tmp_channel_type))
++ if (!ieee80211_work_ct_coexists(wk->chan_type,
++ local->tmp_channel_type))
+ continue;
+ remain_off_channel = true;