aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/Makefile3
-rw-r--r--drivers/net/wireless/airo.c11
-rw-r--r--drivers/net/wireless/ath/ath5k/ath5k.h2
-rw-r--r--drivers/net/wireless/ath/ath5k/attach.c1
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c16
-rw-r--r--drivers/net/wireless/ath/ath5k/debug.c58
-rw-r--r--drivers/net/wireless/ath/ath5k/debug.h1
-rw-r--r--drivers/net/wireless/ath/ath5k/dma.c4
-rw-r--r--drivers/net/wireless/ath/ath5k/pcu.c99
-rw-r--r--drivers/net/wireless/ath/ath5k/phy.c4
-rw-r--r--drivers/net/wireless/ath/ath5k/reg.h29
-rw-r--r--drivers/net/wireless/ath/ath9k/ar5008_phy.c22
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_calib.c21
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_hw.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_4k.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_9287.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_def.c18
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_beacon.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_init.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c27
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/reg.h34
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c3
-rw-r--r--drivers/net/wireless/ath/carl9170/Kconfig2
-rw-r--r--drivers/net/wireless/ath/carl9170/carl9170.h1
-rw-r--r--drivers/net/wireless/ath/carl9170/debug.c4
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c20
-rw-r--r--drivers/net/wireless/ath/carl9170/tx.c192
-rw-r--r--drivers/net/wireless/ath/carl9170/usb.c2
-rw-r--r--drivers/net/wireless/wl12xx/Makefile3
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_boot.c17
34 files changed, 367 insertions, 277 deletions
diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
index 85af697574a6..a13a602edb13 100644
--- a/drivers/net/wireless/Makefile
+++ b/drivers/net/wireless/Makefile
@@ -50,7 +50,6 @@ obj-$(CONFIG_ATH_COMMON) += ath/
50obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o 50obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o
51 51
52obj-$(CONFIG_WL12XX) += wl12xx/ 52obj-$(CONFIG_WL12XX) += wl12xx/
53# small builtin driver bit 53obj-$(CONFIG_WL12XX_PLATFORM_DATA) += wl12xx/
54obj-$(CONFIG_WL12XX_PLATFORM_DATA) += wl12xx/wl12xx_platform_data.o
55 54
56obj-$(CONFIG_IWM) += iwmc3200wifi/ 55obj-$(CONFIG_IWM) += iwmc3200wifi/
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 924ed095dd99..5a56502c4eb0 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -217,7 +217,6 @@ static const char *statsLabels[] = {
217 (no spaces) list of rates (up to 8). */ 217 (no spaces) list of rates (up to 8). */
218 218
219static int rates[8]; 219static int rates[8];
220static int basic_rate;
221static char *ssids[3]; 220static char *ssids[3];
222 221
223static int io[4]; 222static int io[4];
@@ -250,7 +249,6 @@ MODULE_LICENSE("Dual BSD/GPL");
250MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340/350"); 249MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340/350");
251module_param_array(io, int, NULL, 0); 250module_param_array(io, int, NULL, 0);
252module_param_array(irq, int, NULL, 0); 251module_param_array(irq, int, NULL, 0);
253module_param(basic_rate, int, 0);
254module_param_array(rates, int, NULL, 0); 252module_param_array(rates, int, NULL, 0);
255module_param_array(ssids, charp, NULL, 0); 253module_param_array(ssids, charp, NULL, 0);
256module_param(auto_wep, int, 0); 254module_param(auto_wep, int, 0);
@@ -3883,15 +3881,6 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
3883 ai->config.rates[i] = rates[i]; 3881 ai->config.rates[i] = rates[i];
3884 } 3882 }
3885 } 3883 }
3886 if ( basic_rate > 0 ) {
3887 for( i = 0; i < 8; i++ ) {
3888 if ( ai->config.rates[i] == basic_rate ||
3889 !ai->config.rates ) {
3890 ai->config.rates[i] = basic_rate | 0x80;
3891 break;
3892 }
3893 }
3894 }
3895 set_bit (FLAG_COMMIT, &ai->flags); 3884 set_bit (FLAG_COMMIT, &ai->flags);
3896 } 3885 }
3897 3886
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index b96bb985b56d..0cba2e315d9a 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1041,7 +1041,6 @@ struct ath5k_hw {
1041#define ah_modes ah_capabilities.cap_mode 1041#define ah_modes ah_capabilities.cap_mode
1042#define ah_ee_version ah_capabilities.cap_eeprom.ee_version 1042#define ah_ee_version ah_capabilities.cap_eeprom.ee_version
1043 1043
1044 u32 ah_atim_window;
1045 u32 ah_limit_tx_retries; 1044 u32 ah_limit_tx_retries;
1046 u8 ah_coverage_class; 1045 u8 ah_coverage_class;
1047 1046
@@ -1196,6 +1195,7 @@ u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah);
1196void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64); 1195void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64);
1197void ath5k_hw_reset_tsf(struct ath5k_hw *ah); 1196void ath5k_hw_reset_tsf(struct ath5k_hw *ah);
1198void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval); 1197void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval);
1198bool ath5k_hw_check_beacon_timers(struct ath5k_hw *ah, int intval);
1199/* ACK bit rate */ 1199/* ACK bit rate */
1200void ath5k_hw_set_ack_bitrate_high(struct ath5k_hw *ah, bool high); 1200void ath5k_hw_set_ack_bitrate_high(struct ath5k_hw *ah, bool high);
1201/* Clock rate related functions */ 1201/* Clock rate related functions */
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c
index 6e02de311cdd..cd0b14a0a93a 100644
--- a/drivers/net/wireless/ath/ath5k/attach.c
+++ b/drivers/net/wireless/ath/ath5k/attach.c
@@ -118,7 +118,6 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
118 ah->ah_turbo = false; 118 ah->ah_turbo = false;
119 ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER; 119 ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
120 ah->ah_imr = 0; 120 ah->ah_imr = 0;
121 ah->ah_atim_window = 0;
122 ah->ah_limit_tx_retries = AR5K_INIT_TX_RETRY; 121 ah->ah_limit_tx_retries = AR5K_INIT_TX_RETRY;
123 ah->ah_software_retry = false; 122 ah->ah_software_retry = false;
124 ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT; 123 ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT;
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 95072db0ec21..94cc3354f3a6 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1191,6 +1191,15 @@ ath5k_check_ibss_tsf(struct ath5k_softc *sc, struct sk_buff *skb,
1191 */ 1191 */
1192 if (hw_tu >= sc->nexttbtt) 1192 if (hw_tu >= sc->nexttbtt)
1193 ath5k_beacon_update_timers(sc, bc_tstamp); 1193 ath5k_beacon_update_timers(sc, bc_tstamp);
1194
1195 /* Check if the beacon timers are still correct, because a TSF
1196 * update might have created a window between them - for a
1197 * longer description see the comment of this function: */
1198 if (!ath5k_hw_check_beacon_timers(sc->ah, sc->bintval)) {
1199 ath5k_beacon_update_timers(sc, bc_tstamp);
1200 ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON,
1201 "fixed beacon timers after beacon receive\n");
1202 }
1194 } 1203 }
1195} 1204}
1196 1205
@@ -1877,8 +1886,11 @@ ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf)
1877 hw_tsf = ath5k_hw_get_tsf64(ah); 1886 hw_tsf = ath5k_hw_get_tsf64(ah);
1878 hw_tu = TSF_TO_TU(hw_tsf); 1887 hw_tu = TSF_TO_TU(hw_tsf);
1879 1888
1880#define FUDGE 3 1889#define FUDGE AR5K_TUNE_SW_BEACON_RESP + 3
1881 /* we use FUDGE to make sure the next TBTT is ahead of the current TU */ 1890 /* We use FUDGE to make sure the next TBTT is ahead of the current TU.
1891 * Since we later substract AR5K_TUNE_SW_BEACON_RESP (10) in the timer
1892 * configuration we need to make sure it is bigger than that. */
1893
1882 if (bc_tsf == -1) { 1894 if (bc_tsf == -1) {
1883 /* 1895 /*
1884 * no beacons received, called internally. 1896 * no beacons received, called internally.
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index 6583a82a0783..0f06e8490314 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -483,6 +483,59 @@ static const struct file_operations fops_antenna = {
483 .owner = THIS_MODULE, 483 .owner = THIS_MODULE,
484}; 484};
485 485
486/* debugfs: misc */
487
488static ssize_t read_file_misc(struct file *file, char __user *user_buf,
489 size_t count, loff_t *ppos)
490{
491 struct ath5k_softc *sc = file->private_data;
492 char buf[700];
493 unsigned int len = 0;
494 u32 filt = ath5k_hw_get_rx_filter(sc->ah);
495
496 len += snprintf(buf+len, sizeof(buf)-len, "bssid-mask: %pM\n",
497 sc->bssidmask);
498 len += snprintf(buf+len, sizeof(buf)-len, "filter-flags: 0x%x ",
499 filt);
500 if (filt & AR5K_RX_FILTER_UCAST)
501 len += snprintf(buf+len, sizeof(buf)-len, " UCAST");
502 if (filt & AR5K_RX_FILTER_MCAST)
503 len += snprintf(buf+len, sizeof(buf)-len, " MCAST");
504 if (filt & AR5K_RX_FILTER_BCAST)
505 len += snprintf(buf+len, sizeof(buf)-len, " BCAST");
506 if (filt & AR5K_RX_FILTER_CONTROL)
507 len += snprintf(buf+len, sizeof(buf)-len, " CONTROL");
508 if (filt & AR5K_RX_FILTER_BEACON)
509 len += snprintf(buf+len, sizeof(buf)-len, " BEACON");
510 if (filt & AR5K_RX_FILTER_PROM)
511 len += snprintf(buf+len, sizeof(buf)-len, " PROM");
512 if (filt & AR5K_RX_FILTER_XRPOLL)
513 len += snprintf(buf+len, sizeof(buf)-len, " XRPOLL");
514 if (filt & AR5K_RX_FILTER_PROBEREQ)
515 len += snprintf(buf+len, sizeof(buf)-len, " PROBEREQ");
516 if (filt & AR5K_RX_FILTER_PHYERR_5212)
517 len += snprintf(buf+len, sizeof(buf)-len, " PHYERR-5212");
518 if (filt & AR5K_RX_FILTER_RADARERR_5212)
519 len += snprintf(buf+len, sizeof(buf)-len, " RADARERR-5212");
520 if (filt & AR5K_RX_FILTER_PHYERR_5211)
521 snprintf(buf+len, sizeof(buf)-len, " PHYERR-5211");
522 if (filt & AR5K_RX_FILTER_RADARERR_5211)
523 len += snprintf(buf+len, sizeof(buf)-len, " RADARERR-5211\n");
524 else
525 len += snprintf(buf+len, sizeof(buf)-len, "\n");
526
527 if (len > sizeof(buf))
528 len = sizeof(buf);
529
530 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
531}
532
533static const struct file_operations fops_misc = {
534 .read = read_file_misc,
535 .open = ath5k_debugfs_open,
536 .owner = THIS_MODULE,
537};
538
486 539
487/* debugfs: frameerrors */ 540/* debugfs: frameerrors */
488 541
@@ -856,6 +909,10 @@ ath5k_debug_init_device(struct ath5k_softc *sc)
856 S_IWUSR | S_IRUSR, 909 S_IWUSR | S_IRUSR,
857 sc->debug.debugfs_phydir, sc, &fops_antenna); 910 sc->debug.debugfs_phydir, sc, &fops_antenna);
858 911
912 sc->debug.debugfs_misc = debugfs_create_file("misc",
913 S_IRUSR,
914 sc->debug.debugfs_phydir, sc, &fops_misc);
915
859 sc->debug.debugfs_frameerrors = debugfs_create_file("frameerrors", 916 sc->debug.debugfs_frameerrors = debugfs_create_file("frameerrors",
860 S_IWUSR | S_IRUSR, 917 S_IWUSR | S_IRUSR,
861 sc->debug.debugfs_phydir, sc, 918 sc->debug.debugfs_phydir, sc,
@@ -886,6 +943,7 @@ ath5k_debug_finish_device(struct ath5k_softc *sc)
886 debugfs_remove(sc->debug.debugfs_beacon); 943 debugfs_remove(sc->debug.debugfs_beacon);
887 debugfs_remove(sc->debug.debugfs_reset); 944 debugfs_remove(sc->debug.debugfs_reset);
888 debugfs_remove(sc->debug.debugfs_antenna); 945 debugfs_remove(sc->debug.debugfs_antenna);
946 debugfs_remove(sc->debug.debugfs_misc);
889 debugfs_remove(sc->debug.debugfs_frameerrors); 947 debugfs_remove(sc->debug.debugfs_frameerrors);
890 debugfs_remove(sc->debug.debugfs_ani); 948 debugfs_remove(sc->debug.debugfs_ani);
891 debugfs_remove(sc->debug.debugfs_queue); 949 debugfs_remove(sc->debug.debugfs_queue);
diff --git a/drivers/net/wireless/ath/ath5k/debug.h b/drivers/net/wireless/ath/ath5k/debug.h
index 9b22722a95f0..4f078b134015 100644
--- a/drivers/net/wireless/ath/ath5k/debug.h
+++ b/drivers/net/wireless/ath/ath5k/debug.h
@@ -75,6 +75,7 @@ struct ath5k_dbg_info {
75 struct dentry *debugfs_beacon; 75 struct dentry *debugfs_beacon;
76 struct dentry *debugfs_reset; 76 struct dentry *debugfs_reset;
77 struct dentry *debugfs_antenna; 77 struct dentry *debugfs_antenna;
78 struct dentry *debugfs_misc;
78 struct dentry *debugfs_frameerrors; 79 struct dentry *debugfs_frameerrors;
79 struct dentry *debugfs_ani; 80 struct dentry *debugfs_ani;
80 struct dentry *debugfs_queue; 81 struct dentry *debugfs_queue;
diff --git a/drivers/net/wireless/ath/ath5k/dma.c b/drivers/net/wireless/ath/ath5k/dma.c
index 58bb6c5dda7b..923c9ca5c4f0 100644
--- a/drivers/net/wireless/ath/ath5k/dma.c
+++ b/drivers/net/wireless/ath/ath5k/dma.c
@@ -244,7 +244,7 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
244 244
245 /* Force channel idle high */ 245 /* Force channel idle high */
246 AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW_5211, 246 AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW_5211,
247 AR5K_DIAG_SW_CHANEL_IDLE_HIGH); 247 AR5K_DIAG_SW_CHANNEL_IDLE_HIGH);
248 248
249 /* Wait a while and disable mechanism */ 249 /* Wait a while and disable mechanism */
250 udelay(200); 250 udelay(200);
@@ -261,7 +261,7 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
261 } while (--i && pending); 261 } while (--i && pending);
262 262
263 AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW_5211, 263 AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW_5211,
264 AR5K_DIAG_SW_CHANEL_IDLE_HIGH); 264 AR5K_DIAG_SW_CHANNEL_IDLE_HIGH);
265 } 265 }
266 266
267 /* Clear register */ 267 /* Clear register */
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c
index 6a891c4484a0..095d30b50ec7 100644
--- a/drivers/net/wireless/ath/ath5k/pcu.c
+++ b/drivers/net/wireless/ath/ath5k/pcu.c
@@ -495,6 +495,10 @@ u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah)
495{ 495{
496 u32 tsf_lower, tsf_upper1, tsf_upper2; 496 u32 tsf_lower, tsf_upper1, tsf_upper2;
497 int i; 497 int i;
498 unsigned long flags;
499
500 /* This code is time critical - we don't want to be interrupted here */
501 local_irq_save(flags);
498 502
499 /* 503 /*
500 * While reading TSF upper and then lower part, the clock is still 504 * While reading TSF upper and then lower part, the clock is still
@@ -517,6 +521,8 @@ u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah)
517 tsf_upper1 = tsf_upper2; 521 tsf_upper1 = tsf_upper2;
518 } 522 }
519 523
524 local_irq_restore(flags);
525
520 WARN_ON( i == ATH5K_MAX_TSF_READ ); 526 WARN_ON( i == ATH5K_MAX_TSF_READ );
521 527
522 return (((u64)tsf_upper1 << 32) | tsf_lower); 528 return (((u64)tsf_upper1 << 32) | tsf_lower);
@@ -600,7 +606,7 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)
600 /* Timer3 marks the end of our ATIM window 606 /* Timer3 marks the end of our ATIM window
601 * a zero length window is not allowed because 607 * a zero length window is not allowed because
602 * we 'll get no beacons */ 608 * we 'll get no beacons */
603 timer3 = next_beacon + (ah->ah_atim_window ? ah->ah_atim_window : 1); 609 timer3 = next_beacon + 1;
604 610
605 /* 611 /*
606 * Set the beacon register and enable all timers. 612 * Set the beacon register and enable all timers.
@@ -641,6 +647,97 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)
641} 647}
642 648
643/** 649/**
650 * ath5k_check_timer_win - Check if timer B is timer A + window
651 *
652 * @a: timer a (before b)
653 * @b: timer b (after a)
654 * @window: difference between a and b
655 * @intval: timers are increased by this interval
656 *
657 * This helper function checks if timer B is timer A + window and covers
658 * cases where timer A or B might have already been updated or wrapped
659 * around (Timers are 16 bit).
660 *
661 * Returns true if O.K.
662 */
663static inline bool
664ath5k_check_timer_win(int a, int b, int window, int intval)
665{
666 /*
667 * 1.) usually B should be A + window
668 * 2.) A already updated, B not updated yet
669 * 3.) A already updated and has wrapped around
670 * 4.) B has wrapped around
671 */
672 if ((b - a == window) || /* 1.) */
673 (a - b == intval - window) || /* 2.) */
674 ((a | 0x10000) - b == intval - window) || /* 3.) */
675 ((b | 0x10000) - a == window)) /* 4.) */
676 return true; /* O.K. */
677 return false;
678}
679
680/**
681 * ath5k_hw_check_beacon_timers - Check if the beacon timers are correct
682 *
683 * @ah: The &struct ath5k_hw
684 * @intval: beacon interval
685 *
686 * This is a workaround for IBSS mode:
687 *
688 * The need for this function arises from the fact that we have 4 separate
689 * HW timer registers (TIMER0 - TIMER3), which are closely related to the
690 * next beacon target time (NBTT), and that the HW updates these timers
691 * seperately based on the current TSF value. The hardware increments each
692 * timer by the beacon interval, when the local TSF coverted to TU is equal
693 * to the value stored in the timer.
694 *
695 * The reception of a beacon with the same BSSID can update the local HW TSF
696 * at any time - this is something we can't avoid. If the TSF jumps to a
697 * time which is later than the time stored in a timer, this timer will not
698 * be updated until the TSF in TU wraps around at 16 bit (the size of the
699 * timers) and reaches the time which is stored in the timer.
700 *
701 * The problem is that these timers are closely related to TIMER0 (NBTT) and
702 * that they define a time "window". When the TSF jumps between two timers
703 * (e.g. ATIM and NBTT), the one in the past will be left behind (not
704 * updated), while the one in the future will be updated every beacon
705 * interval. This causes the window to get larger, until the TSF wraps
706 * around as described above and the timer which was left behind gets
707 * updated again. But - because the beacon interval is usually not an exact
708 * divisor of the size of the timers (16 bit), an unwanted "window" between
709 * these timers has developed!
710 *
711 * This is especially important with the ATIM window, because during
712 * the ATIM window only ATIM frames and no data frames are allowed to be
713 * sent, which creates transmission pauses after each beacon. This symptom
714 * has been described as "ramping ping" because ping times increase linearly
715 * for some time and then drop down again. A wrong window on the DMA beacon
716 * timer has the same effect, so we check for these two conditions.
717 *
718 * Returns true if O.K.
719 */
720bool
721ath5k_hw_check_beacon_timers(struct ath5k_hw *ah, int intval)
722{
723 unsigned int nbtt, atim, dma;
724
725 nbtt = ath5k_hw_reg_read(ah, AR5K_TIMER0);
726 atim = ath5k_hw_reg_read(ah, AR5K_TIMER3);
727 dma = ath5k_hw_reg_read(ah, AR5K_TIMER1) >> 3;
728
729 /* NOTE: SWBA is different. Having a wrong window there does not
730 * stop us from sending data and this condition is catched thru
731 * other means (SWBA interrupt) */
732
733 if (ath5k_check_timer_win(nbtt, atim, 1, intval) &&
734 ath5k_check_timer_win(dma, nbtt, AR5K_TUNE_DMA_BEACON_RESP,
735 intval))
736 return true; /* O.K. */
737 return false;
738}
739
740/**
644 * ath5k_hw_set_coverage_class - Set IEEE 802.11 coverage class 741 * ath5k_hw_set_coverage_class - Set IEEE 802.11 coverage class
645 * 742 *
646 * @ah: The &struct ath5k_hw 743 * @ah: The &struct ath5k_hw
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 4932bf2f35eb..61da913e7c8f 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -1257,7 +1257,7 @@ static int ath5k_hw_rf5110_calibrate(struct ath5k_hw *ah,
1257 * Disable beacons and RX/TX queues, wait 1257 * Disable beacons and RX/TX queues, wait
1258 */ 1258 */
1259 AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW_5210, 1259 AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW_5210,
1260 AR5K_DIAG_SW_DIS_TX | AR5K_DIAG_SW_DIS_RX_5210); 1260 AR5K_DIAG_SW_DIS_TX_5210 | AR5K_DIAG_SW_DIS_RX_5210);
1261 beacon = ath5k_hw_reg_read(ah, AR5K_BEACON_5210); 1261 beacon = ath5k_hw_reg_read(ah, AR5K_BEACON_5210);
1262 ath5k_hw_reg_write(ah, beacon & ~AR5K_BEACON_ENABLE, AR5K_BEACON_5210); 1262 ath5k_hw_reg_write(ah, beacon & ~AR5K_BEACON_ENABLE, AR5K_BEACON_5210);
1263 1263
@@ -1336,7 +1336,7 @@ static int ath5k_hw_rf5110_calibrate(struct ath5k_hw *ah,
1336 * Re-enable RX/TX and beacons 1336 * Re-enable RX/TX and beacons
1337 */ 1337 */
1338 AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW_5210, 1338 AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW_5210,
1339 AR5K_DIAG_SW_DIS_TX | AR5K_DIAG_SW_DIS_RX_5210); 1339 AR5K_DIAG_SW_DIS_TX_5210 | AR5K_DIAG_SW_DIS_RX_5210);
1340 ath5k_hw_reg_write(ah, beacon, AR5K_BEACON_5210); 1340 ath5k_hw_reg_write(ah, beacon, AR5K_BEACON_5210);
1341 1341
1342 return 0; 1342 return 0;
diff --git a/drivers/net/wireless/ath/ath5k/reg.h b/drivers/net/wireless/ath/ath5k/reg.h
index 67d63081705a..a34929f06533 100644
--- a/drivers/net/wireless/ath/ath5k/reg.h
+++ b/drivers/net/wireless/ath/ath5k/reg.h
@@ -1387,10 +1387,9 @@
1387 1387
1388 1388
1389/* 1389/*
1390 * PCU control register 1390 * PCU Diagnostic register
1391 * 1391 *
1392 * Only DIS_RX is used in the code, the rest i guess are 1392 * Used for tweaking/diagnostics.
1393 * for tweaking/diagnostics.
1394 */ 1393 */
1395#define AR5K_DIAG_SW_5210 0x8068 /* Register Address [5210] */ 1394#define AR5K_DIAG_SW_5210 0x8068 /* Register Address [5210] */
1396#define AR5K_DIAG_SW_5211 0x8048 /* Register Address [5211+] */ 1395#define AR5K_DIAG_SW_5211 0x8048 /* Register Address [5211+] */
@@ -1399,22 +1398,22 @@
1399#define AR5K_DIAG_SW_DIS_WEP_ACK 0x00000001 /* Disable ACKs if WEP key is invalid */ 1398#define AR5K_DIAG_SW_DIS_WEP_ACK 0x00000001 /* Disable ACKs if WEP key is invalid */
1400#define AR5K_DIAG_SW_DIS_ACK 0x00000002 /* Disable ACKs */ 1399#define AR5K_DIAG_SW_DIS_ACK 0x00000002 /* Disable ACKs */
1401#define AR5K_DIAG_SW_DIS_CTS 0x00000004 /* Disable CTSs */ 1400#define AR5K_DIAG_SW_DIS_CTS 0x00000004 /* Disable CTSs */
1402#define AR5K_DIAG_SW_DIS_ENC 0x00000008 /* Disable encryption */ 1401#define AR5K_DIAG_SW_DIS_ENC 0x00000008 /* Disable HW encryption */
1403#define AR5K_DIAG_SW_DIS_DEC 0x00000010 /* Disable decryption */ 1402#define AR5K_DIAG_SW_DIS_DEC 0x00000010 /* Disable HW decryption */
1404#define AR5K_DIAG_SW_DIS_TX 0x00000020 /* Disable transmit [5210] */ 1403#define AR5K_DIAG_SW_DIS_TX_5210 0x00000020 /* Disable transmit [5210] */
1405#define AR5K_DIAG_SW_DIS_RX_5210 0x00000040 /* Disable recieve */ 1404#define AR5K_DIAG_SW_DIS_RX_5210 0x00000040 /* Disable receive */
1406#define AR5K_DIAG_SW_DIS_RX_5211 0x00000020 1405#define AR5K_DIAG_SW_DIS_RX_5211 0x00000020
1407#define AR5K_DIAG_SW_DIS_RX (ah->ah_version == AR5K_AR5210 ? \ 1406#define AR5K_DIAG_SW_DIS_RX (ah->ah_version == AR5K_AR5210 ? \
1408 AR5K_DIAG_SW_DIS_RX_5210 : AR5K_DIAG_SW_DIS_RX_5211) 1407 AR5K_DIAG_SW_DIS_RX_5210 : AR5K_DIAG_SW_DIS_RX_5211)
1409#define AR5K_DIAG_SW_LOOP_BACK_5210 0x00000080 /* Loopback (i guess it goes with DIS_TX) [5210] */ 1408#define AR5K_DIAG_SW_LOOP_BACK_5210 0x00000080 /* TX Data Loopback (i guess it goes with DIS_TX) [5210] */
1410#define AR5K_DIAG_SW_LOOP_BACK_5211 0x00000040 1409#define AR5K_DIAG_SW_LOOP_BACK_5211 0x00000040
1411#define AR5K_DIAG_SW_LOOP_BACK (ah->ah_version == AR5K_AR5210 ? \ 1410#define AR5K_DIAG_SW_LOOP_BACK (ah->ah_version == AR5K_AR5210 ? \
1412 AR5K_DIAG_SW_LOOP_BACK_5210 : AR5K_DIAG_SW_LOOP_BACK_5211) 1411 AR5K_DIAG_SW_LOOP_BACK_5210 : AR5K_DIAG_SW_LOOP_BACK_5211)
1413#define AR5K_DIAG_SW_CORR_FCS_5210 0x00000100 /* Corrupted FCS */ 1412#define AR5K_DIAG_SW_CORR_FCS_5210 0x00000100 /* Generate invalid TX FCS */
1414#define AR5K_DIAG_SW_CORR_FCS_5211 0x00000080 1413#define AR5K_DIAG_SW_CORR_FCS_5211 0x00000080
1415#define AR5K_DIAG_SW_CORR_FCS (ah->ah_version == AR5K_AR5210 ? \ 1414#define AR5K_DIAG_SW_CORR_FCS (ah->ah_version == AR5K_AR5210 ? \
1416 AR5K_DIAG_SW_CORR_FCS_5210 : AR5K_DIAG_SW_CORR_FCS_5211) 1415 AR5K_DIAG_SW_CORR_FCS_5210 : AR5K_DIAG_SW_CORR_FCS_5211)
1417#define AR5K_DIAG_SW_CHAN_INFO_5210 0x00000200 /* Dump channel info */ 1416#define AR5K_DIAG_SW_CHAN_INFO_5210 0x00000200 /* Add 56 bytes of channel info before the frame data in the RX buffer */
1418#define AR5K_DIAG_SW_CHAN_INFO_5211 0x00000100 1417#define AR5K_DIAG_SW_CHAN_INFO_5211 0x00000100
1419#define AR5K_DIAG_SW_CHAN_INFO (ah->ah_version == AR5K_AR5210 ? \ 1418#define AR5K_DIAG_SW_CHAN_INFO (ah->ah_version == AR5K_AR5210 ? \
1420 AR5K_DIAG_SW_CHAN_INFO_5210 : AR5K_DIAG_SW_CHAN_INFO_5211) 1419 AR5K_DIAG_SW_CHAN_INFO_5210 : AR5K_DIAG_SW_CHAN_INFO_5211)
@@ -1426,17 +1425,17 @@
1426#define AR5K_DIAG_SW_SCVRAM_SEED 0x0003f800 /* [5210] */ 1425#define AR5K_DIAG_SW_SCVRAM_SEED 0x0003f800 /* [5210] */
1427#define AR5K_DIAG_SW_SCRAM_SEED_M 0x0001fc00 /* Scrambler seed mask */ 1426#define AR5K_DIAG_SW_SCRAM_SEED_M 0x0001fc00 /* Scrambler seed mask */
1428#define AR5K_DIAG_SW_SCRAM_SEED_S 10 1427#define AR5K_DIAG_SW_SCRAM_SEED_S 10
1429#define AR5K_DIAG_SW_DIS_SEQ_INC 0x00040000 /* Disable seqnum increment (?)[5210] */ 1428#define AR5K_DIAG_SW_DIS_SEQ_INC_5210 0x00040000 /* Disable seqnum increment (?)[5210] */
1430#define AR5K_DIAG_SW_FRAME_NV0_5210 0x00080000 1429#define AR5K_DIAG_SW_FRAME_NV0_5210 0x00080000
1431#define AR5K_DIAG_SW_FRAME_NV0_5211 0x00020000 /* Accept frames of non-zero protocol number */ 1430#define AR5K_DIAG_SW_FRAME_NV0_5211 0x00020000 /* Accept frames of non-zero protocol number */
1432#define AR5K_DIAG_SW_FRAME_NV0 (ah->ah_version == AR5K_AR5210 ? \ 1431#define AR5K_DIAG_SW_FRAME_NV0 (ah->ah_version == AR5K_AR5210 ? \
1433 AR5K_DIAG_SW_FRAME_NV0_5210 : AR5K_DIAG_SW_FRAME_NV0_5211) 1432 AR5K_DIAG_SW_FRAME_NV0_5210 : AR5K_DIAG_SW_FRAME_NV0_5211)
1434#define AR5K_DIAG_SW_OBSPT_M 0x000c0000 /* Observation point select (?) */ 1433#define AR5K_DIAG_SW_OBSPT_M 0x000c0000 /* Observation point select (?) */
1435#define AR5K_DIAG_SW_OBSPT_S 18 1434#define AR5K_DIAG_SW_OBSPT_S 18
1436#define AR5K_DIAG_SW_RX_CLEAR_HIGH 0x0010000 /* Force RX Clear high */ 1435#define AR5K_DIAG_SW_RX_CLEAR_HIGH 0x00100000 /* Ignore carrier sense */
1437#define AR5K_DIAG_SW_IGNORE_CARR_SENSE 0x0020000 /* Ignore virtual carrier sense */ 1436#define AR5K_DIAG_SW_IGNORE_CARR_SENSE 0x00200000 /* Ignore virtual carrier sense */
1438#define AR5K_DIAG_SW_CHANEL_IDLE_HIGH 0x0040000 /* Force channel idle high */ 1437#define AR5K_DIAG_SW_CHANNEL_IDLE_HIGH 0x00400000 /* Force channel idle high */
1439#define AR5K_DIAG_SW_PHEAR_ME 0x0080000 /* ??? */ 1438#define AR5K_DIAG_SW_PHEAR_ME 0x00800000 /* ??? */
1440 1439
1441/* 1440/*
1442 * TSF (clock) register (lower 32 bits) 1441 * TSF (clock) register (lower 32 bits)
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index 3d2c8679bc85..525671f52b45 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -118,7 +118,7 @@ static void ar5008_hw_force_bias(struct ath_hw *ah, u16 synth_freq)
118 if (!AR_SREV_5416(ah) || synth_freq >= 3000) 118 if (!AR_SREV_5416(ah) || synth_freq >= 3000)
119 return; 119 return;
120 120
121 BUG_ON(AR_SREV_9280_10_OR_LATER(ah)); 121 BUG_ON(AR_SREV_9280_20_OR_LATER(ah));
122 122
123 if (synth_freq < 2412) 123 if (synth_freq < 2412)
124 new_bias = 0; 124 new_bias = 0;
@@ -454,7 +454,7 @@ static int ar5008_hw_rf_alloc_ext_banks(struct ath_hw *ah)
454 454
455 struct ath_common *common = ath9k_hw_common(ah); 455 struct ath_common *common = ath9k_hw_common(ah);
456 456
457 BUG_ON(AR_SREV_9280_10_OR_LATER(ah)); 457 BUG_ON(AR_SREV_9280_20_OR_LATER(ah));
458 458
459 ATH_ALLOC_BANK(ah->analogBank0Data, ah->iniBank0.ia_rows); 459 ATH_ALLOC_BANK(ah->analogBank0Data, ah->iniBank0.ia_rows);
460 ATH_ALLOC_BANK(ah->analogBank1Data, ah->iniBank1.ia_rows); 460 ATH_ALLOC_BANK(ah->analogBank1Data, ah->iniBank1.ia_rows);
@@ -484,7 +484,7 @@ static void ar5008_hw_rf_free_ext_banks(struct ath_hw *ah)
484 bank = NULL; \ 484 bank = NULL; \
485 } while (0); 485 } while (0);
486 486
487 BUG_ON(AR_SREV_9280_10_OR_LATER(ah)); 487 BUG_ON(AR_SREV_9280_20_OR_LATER(ah));
488 488
489 ATH_FREE_BANK(ah->analogBank0Data); 489 ATH_FREE_BANK(ah->analogBank0Data);
490 ATH_FREE_BANK(ah->analogBank1Data); 490 ATH_FREE_BANK(ah->analogBank1Data);
@@ -525,7 +525,7 @@ static bool ar5008_hw_set_rf_regs(struct ath_hw *ah,
525 * for single chip devices, that is AR9280 or anything 525 * for single chip devices, that is AR9280 or anything
526 * after that. 526 * after that.
527 */ 527 */
528 if (AR_SREV_9280_10_OR_LATER(ah)) 528 if (AR_SREV_9280_20_OR_LATER(ah))
529 return true; 529 return true;
530 530
531 /* Setup rf parameters */ 531 /* Setup rf parameters */
@@ -663,20 +663,20 @@ static void ar5008_hw_override_ini(struct ath_hw *ah,
663 */ 663 */
664 REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); 664 REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
665 665
666 if (AR_SREV_9280_10_OR_LATER(ah)) { 666 if (AR_SREV_9280_20_OR_LATER(ah)) {
667 val = REG_READ(ah, AR_PCU_MISC_MODE2); 667 val = REG_READ(ah, AR_PCU_MISC_MODE2);
668 668
669 if (!AR_SREV_9271(ah)) 669 if (!AR_SREV_9271(ah))
670 val &= ~AR_PCU_MISC_MODE2_HWWAR1; 670 val &= ~AR_PCU_MISC_MODE2_HWWAR1;
671 671
672 if (AR_SREV_9287_10_OR_LATER(ah)) 672 if (AR_SREV_9287_11_OR_LATER(ah))
673 val = val & (~AR_PCU_MISC_MODE2_HWWAR2); 673 val = val & (~AR_PCU_MISC_MODE2_HWWAR2);
674 674
675 REG_WRITE(ah, AR_PCU_MISC_MODE2, val); 675 REG_WRITE(ah, AR_PCU_MISC_MODE2, val);
676 } 676 }
677 677
678 if (!AR_SREV_5416_20_OR_LATER(ah) || 678 if (!AR_SREV_5416_20_OR_LATER(ah) ||
679 AR_SREV_9280_10_OR_LATER(ah)) 679 AR_SREV_9280_20_OR_LATER(ah))
680 return; 680 return;
681 /* 681 /*
682 * Disable BB clock gating 682 * Disable BB clock gating
@@ -701,7 +701,7 @@ static void ar5008_hw_set_channel_regs(struct ath_hw *ah,
701 u32 phymode; 701 u32 phymode;
702 u32 enableDacFifo = 0; 702 u32 enableDacFifo = 0;
703 703
704 if (AR_SREV_9285_10_OR_LATER(ah)) 704 if (AR_SREV_9285_12_OR_LATER(ah))
705 enableDacFifo = (REG_READ(ah, AR_PHY_TURBO) & 705 enableDacFifo = (REG_READ(ah, AR_PHY_TURBO) &
706 AR_PHY_FC_ENABLE_DAC_FIFO); 706 AR_PHY_FC_ENABLE_DAC_FIFO);
707 707
@@ -820,11 +820,11 @@ static int ar5008_hw_process_ini(struct ath_hw *ah,
820 REGWRITE_BUFFER_FLUSH(ah); 820 REGWRITE_BUFFER_FLUSH(ah);
821 DISABLE_REGWRITE_BUFFER(ah); 821 DISABLE_REGWRITE_BUFFER(ah);
822 822
823 if (AR_SREV_9280(ah) || AR_SREV_9287_10_OR_LATER(ah)) 823 if (AR_SREV_9280(ah) || AR_SREV_9287_11_OR_LATER(ah))
824 REG_WRITE_ARRAY(&ah->iniModesRxGain, modesIndex, regWrites); 824 REG_WRITE_ARRAY(&ah->iniModesRxGain, modesIndex, regWrites);
825 825
826 if (AR_SREV_9280(ah) || AR_SREV_9285_12_OR_LATER(ah) || 826 if (AR_SREV_9280(ah) || AR_SREV_9285_12_OR_LATER(ah) ||
827 AR_SREV_9287_10_OR_LATER(ah)) 827 AR_SREV_9287_11_OR_LATER(ah))
828 REG_WRITE_ARRAY(&ah->iniModesTxGain, modesIndex, regWrites); 828 REG_WRITE_ARRAY(&ah->iniModesTxGain, modesIndex, regWrites);
829 829
830 if (AR_SREV_9271_10(ah)) 830 if (AR_SREV_9271_10(ah))
@@ -900,7 +900,7 @@ static void ar5008_hw_set_rfmode(struct ath_hw *ah, struct ath9k_channel *chan)
900 rfMode |= (IS_CHAN_B(chan) || IS_CHAN_G(chan)) 900 rfMode |= (IS_CHAN_B(chan) || IS_CHAN_G(chan))
901 ? AR_PHY_MODE_DYNAMIC : AR_PHY_MODE_OFDM; 901 ? AR_PHY_MODE_DYNAMIC : AR_PHY_MODE_OFDM;
902 902
903 if (!AR_SREV_9280_10_OR_LATER(ah)) 903 if (!AR_SREV_9280_20_OR_LATER(ah))
904 rfMode |= (IS_CHAN_5GHZ(chan)) ? 904 rfMode |= (IS_CHAN_5GHZ(chan)) ?
905 AR_PHY_MODE_RF5GHZ : AR_PHY_MODE_RF2GHZ; 905 AR_PHY_MODE_RF5GHZ : AR_PHY_MODE_RF2GHZ;
906 906
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
index fe7418aefc4a..d7d1d55362e6 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
@@ -567,11 +567,6 @@ static inline void ar9285_hw_pa_cal(struct ath_hw *ah, bool is_reset)
567 AR5416_EEP_TXGAIN_HIGH_POWER) 567 AR5416_EEP_TXGAIN_HIGH_POWER)
568 return; 568 return;
569 569
570 if (AR_SREV_9285_11(ah)) {
571 REG_WRITE(ah, AR9285_AN_TOP4, (AR9285_AN_TOP4_DEFAULT | 0x14));
572 udelay(10);
573 }
574
575 for (i = 0; i < ARRAY_SIZE(regList); i++) 570 for (i = 0; i < ARRAY_SIZE(regList); i++)
576 regList[i][1] = REG_READ(ah, regList[i][0]); 571 regList[i][1] = REG_READ(ah, regList[i][0]);
577 572
@@ -651,10 +646,6 @@ static inline void ar9285_hw_pa_cal(struct ath_hw *ah, bool is_reset)
651 REG_WRITE(ah, regList[i][0], regList[i][1]); 646 REG_WRITE(ah, regList[i][0], regList[i][1]);
652 647
653 REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9285_AN_RF2G6_CCOMP, ccomp_org); 648 REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9285_AN_RF2G6_CCOMP, ccomp_org);
654
655 if (AR_SREV_9285_11(ah))
656 REG_WRITE(ah, AR9285_AN_TOP4, AR9285_AN_TOP4_DEFAULT);
657
658} 649}
659 650
660static void ar9002_hw_pa_cal(struct ath_hw *ah, bool is_reset) 651static void ar9002_hw_pa_cal(struct ath_hw *ah, bool is_reset)
@@ -664,7 +655,7 @@ static void ar9002_hw_pa_cal(struct ath_hw *ah, bool is_reset)
664 ar9271_hw_pa_cal(ah, is_reset); 655 ar9271_hw_pa_cal(ah, is_reset);
665 else 656 else
666 ah->pacal_info.skipcount--; 657 ah->pacal_info.skipcount--;
667 } else if (AR_SREV_9285_11_OR_LATER(ah)) { 658 } else if (AR_SREV_9285_12_OR_LATER(ah)) {
668 if (is_reset || !ah->pacal_info.skipcount) 659 if (is_reset || !ah->pacal_info.skipcount)
669 ar9285_hw_pa_cal(ah, is_reset); 660 ar9285_hw_pa_cal(ah, is_reset);
670 else 661 else
@@ -841,8 +832,8 @@ static bool ar9002_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
841 if (!ar9285_hw_clc(ah, chan)) 832 if (!ar9285_hw_clc(ah, chan))
842 return false; 833 return false;
843 } else { 834 } else {
844 if (AR_SREV_9280_10_OR_LATER(ah)) { 835 if (AR_SREV_9280_20_OR_LATER(ah)) {
845 if (!AR_SREV_9287_10_OR_LATER(ah)) 836 if (!AR_SREV_9287_11_OR_LATER(ah))
846 REG_CLR_BIT(ah, AR_PHY_ADC_CTL, 837 REG_CLR_BIT(ah, AR_PHY_ADC_CTL,
847 AR_PHY_ADC_CTL_OFF_PWDADC); 838 AR_PHY_ADC_CTL_OFF_PWDADC);
848 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, 839 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
@@ -864,8 +855,8 @@ static bool ar9002_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
864 return false; 855 return false;
865 } 856 }
866 857
867 if (AR_SREV_9280_10_OR_LATER(ah)) { 858 if (AR_SREV_9280_20_OR_LATER(ah)) {
868 if (!AR_SREV_9287_10_OR_LATER(ah)) 859 if (!AR_SREV_9287_11_OR_LATER(ah))
869 REG_SET_BIT(ah, AR_PHY_ADC_CTL, 860 REG_SET_BIT(ah, AR_PHY_ADC_CTL,
870 AR_PHY_ADC_CTL_OFF_PWDADC); 861 AR_PHY_ADC_CTL_OFF_PWDADC);
871 REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, 862 REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
@@ -976,7 +967,7 @@ static void ar9002_hw_init_cal_settings(struct ath_hw *ah)
976 } 967 }
977 968
978 if (AR_SREV_9160_10_OR_LATER(ah)) { 969 if (AR_SREV_9160_10_OR_LATER(ah)) {
979 if (AR_SREV_9280_10_OR_LATER(ah)) { 970 if (AR_SREV_9280_20_OR_LATER(ah)) {
980 ah->iq_caldata.calData = &iq_cal_single_sample; 971 ah->iq_caldata.calData = &iq_cal_single_sample;
981 ah->adcgain_caldata.calData = 972 ah->adcgain_caldata.calData =
982 &adc_gain_cal_single_sample; 973 &adc_gain_cal_single_sample;
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
index 94392daebaa0..fde45082a13b 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
@@ -569,7 +569,7 @@ void ar9002_hw_attach_ops(struct ath_hw *ah)
569 ops->config_pci_powersave = ar9002_hw_configpcipowersave; 569 ops->config_pci_powersave = ar9002_hw_configpcipowersave;
570 570
571 ar5008_hw_attach_phy_ops(ah); 571 ar5008_hw_attach_phy_ops(ah);
572 if (AR_SREV_9280_10_OR_LATER(ah)) 572 if (AR_SREV_9280_20_OR_LATER(ah))
573 ar9002_hw_attach_phy_ops(ah); 573 ar9002_hw_attach_phy_ops(ah);
574 574
575 ar9002_hw_attach_calib_ops(ah); 575 ar9002_hw_attach_calib_ops(ah);
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h
index 3030564a0f21..dacb45e1b906 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
@@ -101,7 +101,7 @@
101#define AR5416_VER_MASK (eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) 101#define AR5416_VER_MASK (eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK)
102#define OLC_FOR_AR9280_20_LATER (AR_SREV_9280_20_OR_LATER(ah) && \ 102#define OLC_FOR_AR9280_20_LATER (AR_SREV_9280_20_OR_LATER(ah) && \
103 ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) 103 ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL))
104#define OLC_FOR_AR9287_10_LATER (AR_SREV_9287_10_OR_LATER(ah) && \ 104#define OLC_FOR_AR9287_10_LATER (AR_SREV_9287_11_OR_LATER(ah) && \
105 ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) 105 ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL))
106 106
107#define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c 107#define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
index ead8b0dd3b53..d6eed1f02e84 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
@@ -333,7 +333,7 @@ static void ath9k_hw_get_4k_gain_boundaries_pdadcs(struct ath_hw *ah,
333 } 333 }
334 334
335 if (i == 0) { 335 if (i == 0) {
336 if (AR_SREV_9280_10_OR_LATER(ah)) 336 if (AR_SREV_9280_20_OR_LATER(ah))
337 ss = (int16_t)(0 - (minPwrT4[i] / 2)); 337 ss = (int16_t)(0 - (minPwrT4[i] / 2));
338 else 338 else
339 ss = 0; 339 ss = 0;
@@ -761,7 +761,7 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah,
761 761
762 regulatory->max_power_level = ratesArray[i]; 762 regulatory->max_power_level = ratesArray[i];
763 763
764 if (AR_SREV_9280_10_OR_LATER(ah)) { 764 if (AR_SREV_9280_20_OR_LATER(ah)) {
765 for (i = 0; i < Ar5416RateSize; i++) 765 for (i = 0; i < Ar5416RateSize; i++)
766 ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2; 766 ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2;
767 } 767 }
@@ -909,9 +909,6 @@ static void ath9k_hw_4k_set_gain(struct ath_hw *ah,
909 AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal); 909 AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
910 REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000, 910 REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000,
911 AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]); 911 AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]);
912
913 if (AR_SREV_9285_11(ah))
914 REG_WRITE(ah, AR9285_AN_TOP4, (AR9285_AN_TOP4_DEFAULT | 0x14));
915} 912}
916 913
917/* 914/*
@@ -1109,9 +1106,6 @@ static void ath9k_hw_4k_set_board_values(struct ath_hw *ah,
1109 } 1106 }
1110 1107
1111 1108
1112 if (AR_SREV_9285_11(ah))
1113 REG_WRITE(ah, AR9285_AN_TOP4, AR9285_AN_TOP4_DEFAULT);
1114
1115 REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, 1109 REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH,
1116 pModal->switchSettling); 1110 pModal->switchSettling);
1117 REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC, 1111 REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC,
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
index e6186515d05b..966b9496a9dd 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
@@ -324,7 +324,7 @@ static void ath9k_hw_get_ar9287_gain_boundaries_pdadcs(struct ath_hw *ah,
324 minDelta = 0; 324 minDelta = 0;
325 325
326 if (i == 0) { 326 if (i == 0) {
327 if (AR_SREV_9280_10_OR_LATER(ah)) 327 if (AR_SREV_9280_20_OR_LATER(ah))
328 ss = (int16_t)(0 - (minPwrT4[i] / 2)); 328 ss = (int16_t)(0 - (minPwrT4[i] / 2));
329 else 329 else
330 ss = 0; 330 ss = 0;
@@ -883,7 +883,7 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah,
883 ratesArray[i] = AR9287_MAX_RATE_POWER; 883 ratesArray[i] = AR9287_MAX_RATE_POWER;
884 } 884 }
885 885
886 if (AR_SREV_9280_10_OR_LATER(ah)) { 886 if (AR_SREV_9280_20_OR_LATER(ah)) {
887 for (i = 0; i < Ar5416RateSize; i++) 887 for (i = 0; i < Ar5416RateSize; i++)
888 ratesArray[i] -= AR9287_PWR_TABLE_OFFSET_DB * 2; 888 ratesArray[i] -= AR9287_PWR_TABLE_OFFSET_DB * 2;
889 } 889 }
@@ -977,7 +977,7 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah,
977 else 977 else
978 i = rate6mb; 978 i = rate6mb;
979 979
980 if (AR_SREV_9280_10_OR_LATER(ah)) 980 if (AR_SREV_9280_20_OR_LATER(ah))
981 regulatory->max_power_level = 981 regulatory->max_power_level =
982 ratesArray[i] + AR9287_PWR_TABLE_OFFSET_DB * 2; 982 ratesArray[i] + AR9287_PWR_TABLE_OFFSET_DB * 2;
983 else 983 else
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index 23f480d4c770..76b4d65472dd 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -223,7 +223,7 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)
223 } 223 }
224 224
225 /* Enable fixup for AR_AN_TOP2 if necessary */ 225 /* Enable fixup for AR_AN_TOP2 if necessary */
226 if (AR_SREV_9280_10_OR_LATER(ah) && 226 if (AR_SREV_9280_20_OR_LATER(ah) &&
227 (eep->baseEepHeader.version & 0xff) > 0x0a && 227 (eep->baseEepHeader.version & 0xff) > 0x0a &&
228 eep->baseEepHeader.pwdclkind == 0) 228 eep->baseEepHeader.pwdclkind == 0)
229 ah->need_an_top2_fixup = 1; 229 ah->need_an_top2_fixup = 1;
@@ -317,7 +317,7 @@ static void ath9k_hw_def_set_gain(struct ath_hw *ah,
317 if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) { 317 if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
318 txRxAttenLocal = pModal->txRxAttenCh[i]; 318 txRxAttenLocal = pModal->txRxAttenCh[i];
319 319
320 if (AR_SREV_9280_10_OR_LATER(ah)) { 320 if (AR_SREV_9280_20_OR_LATER(ah)) {
321 REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset, 321 REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
322 AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN, 322 AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN,
323 pModal->bswMargin[i]); 323 pModal->bswMargin[i]);
@@ -344,7 +344,7 @@ static void ath9k_hw_def_set_gain(struct ath_hw *ah,
344 } 344 }
345 } 345 }
346 346
347 if (AR_SREV_9280_10_OR_LATER(ah)) { 347 if (AR_SREV_9280_20_OR_LATER(ah)) {
348 REG_RMW_FIELD(ah, 348 REG_RMW_FIELD(ah,
349 AR_PHY_RXGAIN + regChainOffset, 349 AR_PHY_RXGAIN + regChainOffset,
350 AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal); 350 AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
@@ -408,7 +408,7 @@ static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
408 regChainOffset, i); 408 regChainOffset, i);
409 } 409 }
410 410
411 if (AR_SREV_9280_10_OR_LATER(ah)) { 411 if (AR_SREV_9280_20_OR_LATER(ah)) {
412 if (IS_CHAN_2GHZ(chan)) { 412 if (IS_CHAN_2GHZ(chan)) {
413 ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH0, 413 ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH0,
414 AR_AN_RF2G1_CH0_OB, 414 AR_AN_RF2G1_CH0_OB,
@@ -461,7 +461,7 @@ static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
461 REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC, 461 REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC,
462 pModal->adcDesiredSize); 462 pModal->adcDesiredSize);
463 463
464 if (!AR_SREV_9280_10_OR_LATER(ah)) 464 if (!AR_SREV_9280_20_OR_LATER(ah))
465 REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, 465 REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ,
466 AR_PHY_DESIRED_SZ_PGA, 466 AR_PHY_DESIRED_SZ_PGA,
467 pModal->pgaDesiredSize); 467 pModal->pgaDesiredSize);
@@ -478,7 +478,7 @@ static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
478 REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON, 478 REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON,
479 pModal->txEndToRxOn); 479 pModal->txEndToRxOn);
480 480
481 if (AR_SREV_9280_10_OR_LATER(ah)) { 481 if (AR_SREV_9280_20_OR_LATER(ah)) {
482 REG_RMW_FIELD(ah, AR_PHY_CCA, AR9280_PHY_CCA_THRESH62, 482 REG_RMW_FIELD(ah, AR_PHY_CCA, AR9280_PHY_CCA_THRESH62,
483 pModal->thresh62); 483 pModal->thresh62);
484 REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0, 484 REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0,
@@ -696,7 +696,7 @@ static void ath9k_hw_get_def_gain_boundaries_pdadcs(struct ath_hw *ah,
696 } 696 }
697 697
698 if (i == 0) { 698 if (i == 0) {
699 if (AR_SREV_9280_10_OR_LATER(ah)) 699 if (AR_SREV_9280_20_OR_LATER(ah))
700 ss = (int16_t)(0 - (minPwrT4[i] / 2)); 700 ss = (int16_t)(0 - (minPwrT4[i] / 2));
701 else 701 else
702 ss = 0; 702 ss = 0;
@@ -1291,7 +1291,7 @@ static void ath9k_hw_def_set_txpower(struct ath_hw *ah,
1291 ratesArray[i] = AR5416_MAX_RATE_POWER; 1291 ratesArray[i] = AR5416_MAX_RATE_POWER;
1292 } 1292 }
1293 1293
1294 if (AR_SREV_9280_10_OR_LATER(ah)) { 1294 if (AR_SREV_9280_20_OR_LATER(ah)) {
1295 for (i = 0; i < Ar5416RateSize; i++) { 1295 for (i = 0; i < Ar5416RateSize; i++) {
1296 int8_t pwr_table_offset; 1296 int8_t pwr_table_offset;
1297 1297
@@ -1395,7 +1395,7 @@ static void ath9k_hw_def_set_txpower(struct ath_hw *ah,
1395 else if (IS_CHAN_HT20(chan)) 1395 else if (IS_CHAN_HT20(chan))
1396 i = rateHt20_0; 1396 i = rateHt20_0;
1397 1397
1398 if (AR_SREV_9280_10_OR_LATER(ah)) 1398 if (AR_SREV_9280_20_OR_LATER(ah))
1399 regulatory->max_power_level = 1399 regulatory->max_power_level =
1400 ratesArray[i] + AR5416_PWR_TABLE_OFFSET_DB * 2; 1400 ratesArray[i] + AR5416_PWR_TABLE_OFFSET_DB * 2;
1401 else 1401 else
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index bd1506e69105..1b72aa482ac7 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -235,7 +235,14 @@ void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv)
235 ath9k_hw_get_txq_props(ah, qnum, &qi_be); 235 ath9k_hw_get_txq_props(ah, qnum, &qi_be);
236 236
237 qi.tqi_aifs = qi_be.tqi_aifs; 237 qi.tqi_aifs = qi_be.tqi_aifs;
238 qi.tqi_cwmin = 4*qi_be.tqi_cwmin; 238 /* For WIFI Beacon Distribution
239 * Long slot time : 2x cwmin
240 * Short slot time : 4x cwmin
241 */
242 if (ah->slottime == ATH9K_SLOT_TIME_20)
243 qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
244 else
245 qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
239 qi.tqi_cwmax = qi_be.tqi_cwmax; 246 qi.tqi_cwmax = qi_be.tqi_cwmax;
240 247
241 if (!ath9k_hw_set_txq_props(ah, priv->beaconq, &qi)) { 248 if (!ath9k_hw_set_txq_props(ah, priv->beaconq, &qi)) {
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 33850c952314..b100db2766cf 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -561,6 +561,9 @@ static void ath9k_init_crypto(struct ath9k_htc_priv *priv)
561 common->keymax = ATH_KEYMAX; 561 common->keymax = ATH_KEYMAX;
562 } 562 }
563 563
564 if (priv->ah->misc_mode & AR_PCU_MIC_NEW_LOC_ENA)
565 common->crypt_caps |= ATH_CRYPT_CAP_MIC_COMBINED;
566
564 /* 567 /*
565 * Reset the key cache since some parts do not 568 * Reset the key cache since some parts do not
566 * reset the contents on initial power up. 569 * reset the contents on initial power up.
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 0b2ff98b6f33..25ed65ac992c 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -565,7 +565,7 @@ static int __ath9k_hw_init(struct ath_hw *ah)
565 ath9k_hw_init_cal_settings(ah); 565 ath9k_hw_init_cal_settings(ah);
566 566
567 ah->ani_function = ATH9K_ANI_ALL; 567 ah->ani_function = ATH9K_ANI_ALL;
568 if (AR_SREV_9280_10_OR_LATER(ah) && !AR_SREV_9300_20_OR_LATER(ah)) 568 if (AR_SREV_9280_20_OR_LATER(ah) && !AR_SREV_9300_20_OR_LATER(ah))
569 ah->ani_function &= ~ATH9K_ANI_NOISE_IMMUNITY_LEVEL; 569 ah->ani_function &= ~ATH9K_ANI_NOISE_IMMUNITY_LEVEL;
570 if (!AR_SREV_9300_20_OR_LATER(ah)) 570 if (!AR_SREV_9300_20_OR_LATER(ah))
571 ah->ani_function &= ~ATH9K_ANI_MRC_CCK; 571 ah->ani_function &= ~ATH9K_ANI_MRC_CCK;
@@ -1190,7 +1190,7 @@ bool ath9k_hw_check_alive(struct ath_hw *ah)
1190 int count = 50; 1190 int count = 50;
1191 u32 reg; 1191 u32 reg;
1192 1192
1193 if (AR_SREV_9285_10_OR_LATER(ah)) 1193 if (AR_SREV_9285_12_OR_LATER(ah))
1194 return true; 1194 return true;
1195 1195
1196 do { 1196 do {
@@ -1312,7 +1312,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1312 if (tsf) 1312 if (tsf)
1313 ath9k_hw_settsf64(ah, tsf); 1313 ath9k_hw_settsf64(ah, tsf);
1314 1314
1315 if (AR_SREV_9280_10_OR_LATER(ah)) 1315 if (AR_SREV_9280_20_OR_LATER(ah))
1316 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE); 1316 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE);
1317 1317
1318 if (!AR_SREV_9300_20_OR_LATER(ah)) 1318 if (!AR_SREV_9300_20_OR_LATER(ah))
@@ -1787,7 +1787,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
1787 regulatory->current_rd = eeval; 1787 regulatory->current_rd = eeval;
1788 1788
1789 eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_1); 1789 eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_1);
1790 if (AR_SREV_9285_10_OR_LATER(ah)) 1790 if (AR_SREV_9285_12_OR_LATER(ah))
1791 eeval |= AR9285_RDEXT_DEFAULT; 1791 eeval |= AR9285_RDEXT_DEFAULT;
1792 regulatory->current_rd_ext = eeval; 1792 regulatory->current_rd_ext = eeval;
1793 1793
@@ -1857,8 +1857,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
1857 /* Use rx_chainmask from EEPROM. */ 1857 /* Use rx_chainmask from EEPROM. */
1858 pCap->rx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_RX_MASK); 1858 pCap->rx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_RX_MASK);
1859 1859
1860 if (!(AR_SREV_9280(ah) && (ah->hw_version.macRev == 0))) 1860 ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA;
1861 ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA;
1862 1861
1863 pCap->low_2ghz_chan = 2312; 1862 pCap->low_2ghz_chan = 2312;
1864 pCap->high_2ghz_chan = 2732; 1863 pCap->high_2ghz_chan = 2732;
@@ -1894,9 +1893,9 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
1894 pCap->num_gpio_pins = AR9271_NUM_GPIO; 1893 pCap->num_gpio_pins = AR9271_NUM_GPIO;
1895 else if (AR_DEVID_7010(ah)) 1894 else if (AR_DEVID_7010(ah))
1896 pCap->num_gpio_pins = AR7010_NUM_GPIO; 1895 pCap->num_gpio_pins = AR7010_NUM_GPIO;
1897 else if (AR_SREV_9285_10_OR_LATER(ah)) 1896 else if (AR_SREV_9285_12_OR_LATER(ah))
1898 pCap->num_gpio_pins = AR9285_NUM_GPIO; 1897 pCap->num_gpio_pins = AR9285_NUM_GPIO;
1899 else if (AR_SREV_9280_10_OR_LATER(ah)) 1898 else if (AR_SREV_9280_20_OR_LATER(ah))
1900 pCap->num_gpio_pins = AR928X_NUM_GPIO; 1899 pCap->num_gpio_pins = AR928X_NUM_GPIO;
1901 else 1900 else
1902 pCap->num_gpio_pins = AR_NUM_GPIO; 1901 pCap->num_gpio_pins = AR_NUM_GPIO;
@@ -1953,7 +1952,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
1953 pCap->num_antcfg_2ghz = 1952 pCap->num_antcfg_2ghz =
1954 ah->eep_ops->get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_2GHZ); 1953 ah->eep_ops->get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_2GHZ);
1955 1954
1956 if (AR_SREV_9280_10_OR_LATER(ah) && 1955 if (AR_SREV_9280_20_OR_LATER(ah) &&
1957 ath9k_hw_btcoex_supported(ah)) { 1956 ath9k_hw_btcoex_supported(ah)) {
1958 btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO; 1957 btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO;
1959 btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO; 1958 btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO;
@@ -1990,7 +1989,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
1990 if (AR_SREV_9300_20_OR_LATER(ah)) 1989 if (AR_SREV_9300_20_OR_LATER(ah))
1991 pCap->hw_caps |= ATH9K_HW_CAP_RAC_SUPPORTED; 1990 pCap->hw_caps |= ATH9K_HW_CAP_RAC_SUPPORTED;
1992 1991
1993 if (AR_SREV_9287_10_OR_LATER(ah) || AR_SREV_9271(ah)) 1992 if (AR_SREV_9287_11_OR_LATER(ah) || AR_SREV_9271(ah))
1994 pCap->hw_caps |= ATH9K_HW_CAP_SGI_20; 1993 pCap->hw_caps |= ATH9K_HW_CAP_SGI_20;
1995 1994
1996 if (AR_SREV_9285(ah)) 1995 if (AR_SREV_9285(ah))
@@ -2074,11 +2073,11 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio)
2074 return MS_REG_READ(AR9300, gpio) != 0; 2073 return MS_REG_READ(AR9300, gpio) != 0;
2075 else if (AR_SREV_9271(ah)) 2074 else if (AR_SREV_9271(ah))
2076 return MS_REG_READ(AR9271, gpio) != 0; 2075 return MS_REG_READ(AR9271, gpio) != 0;
2077 else if (AR_SREV_9287_10_OR_LATER(ah)) 2076 else if (AR_SREV_9287_11_OR_LATER(ah))
2078 return MS_REG_READ(AR9287, gpio) != 0; 2077 return MS_REG_READ(AR9287, gpio) != 0;
2079 else if (AR_SREV_9285_10_OR_LATER(ah)) 2078 else if (AR_SREV_9285_12_OR_LATER(ah))
2080 return MS_REG_READ(AR9285, gpio) != 0; 2079 return MS_REG_READ(AR9285, gpio) != 0;
2081 else if (AR_SREV_9280_10_OR_LATER(ah)) 2080 else if (AR_SREV_9280_20_OR_LATER(ah))
2082 return MS_REG_READ(AR928X, gpio) != 0; 2081 return MS_REG_READ(AR928X, gpio) != 0;
2083 else 2082 else
2084 return MS_REG_READ(AR, gpio) != 0; 2083 return MS_REG_READ(AR, gpio) != 0;
@@ -2575,7 +2574,7 @@ void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len)
2575 int used; 2574 int used;
2576 2575
2577 /* chipsets >= AR9280 are single-chip */ 2576 /* chipsets >= AR9280 are single-chip */
2578 if (AR_SREV_9280_10_OR_LATER(ah)) { 2577 if (AR_SREV_9280_20_OR_LATER(ah)) {
2579 used = snprintf(hw_name, len, 2578 used = snprintf(hw_name, len,
2580 "Atheros AR%s Rev:%x", 2579 "Atheros AR%s Rev:%x",
2581 ath9k_hw_mac_bb_name(ah->hw_version.macVersion), 2580 ath9k_hw_mac_bb_name(ah->hw_version.macVersion),
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 573899e27b3d..de3393867e37 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -211,7 +211,7 @@ static void setup_ht_cap(struct ath_softc *sc,
211 else 211 else
212 max_streams = 2; 212 max_streams = 2;
213 213
214 if (AR_SREV_9280_10_OR_LATER(ah)) { 214 if (AR_SREV_9280_20_OR_LATER(ah)) {
215 if (max_streams >= 2) 215 if (max_streams >= 2)
216 ht_info->cap |= IEEE80211_HT_CAP_TX_STBC; 216 ht_info->cap |= IEEE80211_HT_CAP_TX_STBC;
217 ht_info->cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT); 217 ht_info->cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 8b327bcad695..a13387882636 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -270,6 +270,7 @@ static void ath_paprd_activate(struct ath_softc *sc)
270{ 270{
271 struct ath_hw *ah = sc->sc_ah; 271 struct ath_hw *ah = sc->sc_ah;
272 struct ath9k_hw_cal_data *caldata = ah->caldata; 272 struct ath9k_hw_cal_data *caldata = ah->caldata;
273 struct ath_common *common = ath9k_hw_common(ah);
273 int chain; 274 int chain;
274 275
275 if (!caldata || !caldata->paprd_done) 276 if (!caldata || !caldata->paprd_done)
@@ -278,7 +279,7 @@ static void ath_paprd_activate(struct ath_softc *sc)
278 ath9k_ps_wakeup(sc); 279 ath9k_ps_wakeup(sc);
279 ar9003_paprd_enable(ah, false); 280 ar9003_paprd_enable(ah, false);
280 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { 281 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
281 if (!(ah->caps.tx_chainmask & BIT(chain))) 282 if (!(common->tx_chainmask & BIT(chain)))
282 continue; 283 continue;
283 284
284 ar9003_paprd_populate_single_table(ah, caldata, chain); 285 ar9003_paprd_populate_single_table(ah, caldata, chain);
@@ -300,6 +301,7 @@ void ath_paprd_calibrate(struct work_struct *work)
300 struct ieee80211_supported_band *sband = &sc->sbands[band]; 301 struct ieee80211_supported_band *sband = &sc->sbands[band];
301 struct ath_tx_control txctl; 302 struct ath_tx_control txctl;
302 struct ath9k_hw_cal_data *caldata = ah->caldata; 303 struct ath9k_hw_cal_data *caldata = ah->caldata;
304 struct ath_common *common = ath9k_hw_common(ah);
303 int qnum, ftype; 305 int qnum, ftype;
304 int chain_ok = 0; 306 int chain_ok = 0;
305 int chain; 307 int chain;
@@ -333,7 +335,7 @@ void ath_paprd_calibrate(struct work_struct *work)
333 ath9k_ps_wakeup(sc); 335 ath9k_ps_wakeup(sc);
334 ar9003_paprd_init_table(ah); 336 ar9003_paprd_init_table(ah);
335 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { 337 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
336 if (!(ah->caps.tx_chainmask & BIT(chain))) 338 if (!(common->tx_chainmask & BIT(chain)))
337 continue; 339 continue;
338 340
339 chain_ok = 0; 341 chain_ok = 0;
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index c5e7af4f51ab..9c166f3804ab 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -454,8 +454,8 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
454 else 454 else
455 rfilt |= ATH9K_RX_FILTER_BEACON; 455 rfilt |= ATH9K_RX_FILTER_BEACON;
456 456
457 if ((AR_SREV_9280_10_OR_LATER(sc->sc_ah) || 457 if ((AR_SREV_9280_20_OR_LATER(sc->sc_ah) ||
458 AR_SREV_9285_10_OR_LATER(sc->sc_ah)) && 458 AR_SREV_9285_12_OR_LATER(sc->sc_ah)) &&
459 (sc->sc_ah->opmode == NL80211_IFTYPE_AP) && 459 (sc->sc_ah->opmode == NL80211_IFTYPE_AP) &&
460 (sc->rx.rxfilter & FIF_PSPOLL)) 460 (sc->rx.rxfilter & FIF_PSPOLL))
461 rfilt |= ATH9K_RX_FILTER_PSPOLL; 461 rfilt |= ATH9K_RX_FILTER_PSPOLL;
@@ -977,7 +977,11 @@ static void ath9k_process_rssi(struct ath_common *common,
977 * at least one sdata of a wiphy on mac80211 but with ath9k virtual 977 * at least one sdata of a wiphy on mac80211 but with ath9k virtual
978 * wiphy you'd have to iterate over every wiphy and each sdata. 978 * wiphy you'd have to iterate over every wiphy and each sdata.
979 */ 979 */
980 sta = ieee80211_find_sta_by_hw(hw, hdr->addr2); 980 if (is_multicast_ether_addr(hdr->addr1))
981 sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr2, NULL);
982 else
983 sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr2, hdr->addr1);
984
981 if (sta) { 985 if (sta) {
982 an = (struct ath_node *) sta->drv_priv; 986 an = (struct ath_node *) sta->drv_priv;
983 if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && 987 if (rx_stats->rs_rssi != ATH9K_RSSI_BAD &&
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h
index d01c4adab8d6..6d01e501b9b4 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -819,49 +819,23 @@
819 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9160_11)) 819 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9160_11))
820#define AR_SREV_9280(_ah) \ 820#define AR_SREV_9280(_ah) \
821 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9280)) 821 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9280))
822#define AR_SREV_9280_10_OR_LATER(_ah) \ 822#define AR_SREV_9280_20_OR_LATER(_ah) \
823 (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9280)) 823 (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9280))
824#define AR_SREV_9280_20(_ah) \ 824#define AR_SREV_9280_20(_ah) \
825 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9280) && \ 825 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9280))
826 ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9280_20))
827#define AR_SREV_9280_20_OR_LATER(_ah) \
828 (((_ah)->hw_version.macVersion > AR_SREV_VERSION_9280) || \
829 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9280) && \
830 ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9280_20)))
831 826
832#define AR_SREV_9285(_ah) \ 827#define AR_SREV_9285(_ah) \
833 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9285)) 828 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9285))
834#define AR_SREV_9285_10_OR_LATER(_ah) \
835 (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9285))
836#define AR_SREV_9285_11(_ah) \
837 (AR_SREV_9285(ah) && \
838 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9285_11))
839#define AR_SREV_9285_11_OR_LATER(_ah) \
840 (((_ah)->hw_version.macVersion > AR_SREV_VERSION_9285) || \
841 (AR_SREV_9285(ah) && ((_ah)->hw_version.macRev >= \
842 AR_SREV_REVISION_9285_11)))
843#define AR_SREV_9285_12(_ah) \
844 (AR_SREV_9285(ah) && \
845 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9285_12))
846#define AR_SREV_9285_12_OR_LATER(_ah) \ 829#define AR_SREV_9285_12_OR_LATER(_ah) \
847 (((_ah)->hw_version.macVersion > AR_SREV_VERSION_9285) || \ 830 (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9285))
848 (AR_SREV_9285(ah) && ((_ah)->hw_version.macRev >= \
849 AR_SREV_REVISION_9285_12)))
850 831
851#define AR_SREV_9287(_ah) \ 832#define AR_SREV_9287(_ah) \
852 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287)) 833 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287))
853#define AR_SREV_9287_10_OR_LATER(_ah) \ 834#define AR_SREV_9287_11_OR_LATER(_ah) \
854 (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9287)) 835 (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9287))
855#define AR_SREV_9287_10(_ah) \
856 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287) && \
857 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9287_10))
858#define AR_SREV_9287_11(_ah) \ 836#define AR_SREV_9287_11(_ah) \
859 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287) && \ 837 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287) && \
860 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9287_11)) 838 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9287_11))
861#define AR_SREV_9287_11_OR_LATER(_ah) \
862 (((_ah)->hw_version.macVersion > AR_SREV_VERSION_9287) || \
863 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287) && \
864 ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9287_11)))
865#define AR_SREV_9287_12(_ah) \ 839#define AR_SREV_9287_12(_ah) \
866 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287) && \ 840 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287) && \
867 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9287_12)) 841 ((_ah)->hw_version.macRev == AR_SREV_REVISION_9287_12))
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 85a7323a04ef..f7da6b20a925 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -328,8 +328,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
328 328
329 rcu_read_lock(); 329 rcu_read_lock();
330 330
331 /* XXX: use ieee80211_find_sta! */ 331 sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
332 sta = ieee80211_find_sta_by_hw(hw, hdr->addr1);
333 if (!sta) { 332 if (!sta) {
334 rcu_read_unlock(); 333 rcu_read_unlock();
335 334
diff --git a/drivers/net/wireless/ath/carl9170/Kconfig b/drivers/net/wireless/ath/carl9170/Kconfig
index c5d3a3f2e55b..2d1b821b440d 100644
--- a/drivers/net/wireless/ath/carl9170/Kconfig
+++ b/drivers/net/wireless/ath/carl9170/Kconfig
@@ -10,7 +10,7 @@ config CARL9170
10 but it needs a special firmware (carl9170-1.fw) to do that. 10 but it needs a special firmware (carl9170-1.fw) to do that.
11 11
12 The firmware can be downloaded from our wiki here: 12 The firmware can be downloaded from our wiki here:
13 http://wireless.kernel.org/en/users/Drivers/carl9170 13 <http://wireless.kernel.org/en/users/Drivers/carl9170>
14 14
15 If you choose to build a module, it'll be called carl9170. 15 If you choose to build a module, it'll be called carl9170.
16 16
diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h
index d7c5482d74ce..20f2a77e54d2 100644
--- a/drivers/net/wireless/ath/carl9170/carl9170.h
+++ b/drivers/net/wireless/ath/carl9170/carl9170.h
@@ -364,7 +364,6 @@ struct ar9170 {
364 unsigned int tx_dropped; 364 unsigned int tx_dropped;
365 unsigned int tx_ack_failures; 365 unsigned int tx_ack_failures;
366 unsigned int tx_fcs_errors; 366 unsigned int tx_fcs_errors;
367 unsigned int tx_ampdu_timeout;
368 unsigned int rx_dropped; 367 unsigned int rx_dropped;
369 368
370 /* EEPROM */ 369 /* EEPROM */
diff --git a/drivers/net/wireless/ath/carl9170/debug.c b/drivers/net/wireless/ath/carl9170/debug.c
index 19b48369ffed..0ac1124c2a0b 100644
--- a/drivers/net/wireless/ath/carl9170/debug.c
+++ b/drivers/net/wireless/ath/carl9170/debug.c
@@ -798,8 +798,6 @@ DEBUGFS_READONLY_FILE(tx_total_queued, 20, "%d",
798 atomic_read(&ar->tx_total_queued)); 798 atomic_read(&ar->tx_total_queued));
799DEBUGFS_READONLY_FILE(tx_ampdu_scheduler, 20, "%d", 799DEBUGFS_READONLY_FILE(tx_ampdu_scheduler, 20, "%d",
800 atomic_read(&ar->tx_ampdu_scheduler)); 800 atomic_read(&ar->tx_ampdu_scheduler));
801DEBUGFS_READONLY_FILE(tx_ampdu_timeout, 20, "%d",
802 ar->tx_ampdu_timeout);
803 801
804DEBUGFS_READONLY_FILE(tx_total_pending, 20, "%d", 802DEBUGFS_READONLY_FILE(tx_total_pending, 20, "%d",
805 atomic_read(&ar->tx_total_pending)); 803 atomic_read(&ar->tx_total_pending));
@@ -872,8 +870,6 @@ void carl9170_debugfs_register(struct ar9170 *ar)
872 DEBUGFS_ADD(ampdu_density); 870 DEBUGFS_ADD(ampdu_density);
873 DEBUGFS_ADD(ampdu_factor); 871 DEBUGFS_ADD(ampdu_factor);
874 872
875 DEBUGFS_ADD(tx_ampdu_timeout);
876
877 DEBUGFS_ADD(tx_janitor_last_run); 873 DEBUGFS_ADD(tx_janitor_last_run);
878 874
879 DEBUGFS_ADD(tx_status_0); 875 DEBUGFS_ADD(tx_status_0);
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index 43de9dfa5820..84bd38e9961c 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -230,8 +230,15 @@ static void carl9170_flush(struct ar9170 *ar, bool drop_queued)
230 for (i = 0; i < ar->hw->queues; i++) { 230 for (i = 0; i < ar->hw->queues; i++) {
231 struct sk_buff *skb; 231 struct sk_buff *skb;
232 232
233 while ((skb = skb_dequeue(&ar->tx_pending[i]))) 233 while ((skb = skb_dequeue(&ar->tx_pending[i]))) {
234 struct ieee80211_tx_info *info;
235
236 info = IEEE80211_SKB_CB(skb);
237 if (info->flags & IEEE80211_TX_CTL_AMPDU)
238 atomic_dec(&ar->tx_ampdu_upload);
239
234 carl9170_tx_status(ar, skb, false); 240 carl9170_tx_status(ar, skb, false);
241 }
235 } 242 }
236 } 243 }
237 244
@@ -1241,7 +1248,7 @@ static int carl9170_op_ampdu_action(struct ieee80211_hw *hw,
1241 1248
1242 switch (action) { 1249 switch (action) {
1243 case IEEE80211_AMPDU_TX_START: 1250 case IEEE80211_AMPDU_TX_START:
1244 if (WARN_ON_ONCE(!sta_info->ht_sta)) 1251 if (!sta_info->ht_sta)
1245 return -EOPNOTSUPP; 1252 return -EOPNOTSUPP;
1246 1253
1247 rcu_read_lock(); 1254 rcu_read_lock();
@@ -1453,9 +1460,6 @@ static void carl9170_op_sta_notify(struct ieee80211_hw *hw,
1453 while ((skb = __skb_dequeue(&tid_info->queue))) 1460 while ((skb = __skb_dequeue(&tid_info->queue)))
1454 __skb_queue_tail(&free, skb); 1461 __skb_queue_tail(&free, skb);
1455 spin_unlock_bh(&tid_info->lock); 1462 spin_unlock_bh(&tid_info->lock);
1456
1457 ieee80211_stop_tx_ba_session(sta,
1458 tid_info->tid);
1459 } 1463 }
1460 rcu_read_unlock(); 1464 rcu_read_unlock();
1461 } 1465 }
@@ -1465,6 +1469,7 @@ static void carl9170_op_sta_notify(struct ieee80211_hw *hw,
1465 skb_queue_walk_safe(&ar->tx_pending[i], skb, tmp) { 1469 skb_queue_walk_safe(&ar->tx_pending[i], skb, tmp) {
1466 struct _carl9170_tx_superframe *super; 1470 struct _carl9170_tx_superframe *super;
1467 struct ieee80211_hdr *hdr; 1471 struct ieee80211_hdr *hdr;
1472 struct ieee80211_tx_info *info;
1468 1473
1469 super = (void *) skb->data; 1474 super = (void *) skb->data;
1470 hdr = (void *) super->frame_data; 1475 hdr = (void *) super->frame_data;
@@ -1473,6 +1478,11 @@ static void carl9170_op_sta_notify(struct ieee80211_hw *hw,
1473 continue; 1478 continue;
1474 1479
1475 __skb_unlink(skb, &ar->tx_pending[i]); 1480 __skb_unlink(skb, &ar->tx_pending[i]);
1481
1482 info = IEEE80211_SKB_CB(skb);
1483 if (info->flags & IEEE80211_TX_CTL_AMPDU)
1484 atomic_dec(&ar->tx_ampdu_upload);
1485
1476 carl9170_tx_status(ar, skb, false); 1486 carl9170_tx_status(ar, skb, false);
1477 } 1487 }
1478 spin_unlock_bh(&ar->tx_pending[i].lock); 1488 spin_unlock_bh(&ar->tx_pending[i].lock);
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c
index e0d2374e0c77..b575c865142d 100644
--- a/drivers/net/wireless/ath/carl9170/tx.c
+++ b/drivers/net/wireless/ath/carl9170/tx.c
@@ -760,8 +760,8 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
760 struct carl9170_tx_info *arinfo; 760 struct carl9170_tx_info *arinfo;
761 unsigned int hw_queue; 761 unsigned int hw_queue;
762 int i; 762 int i;
763 u16 keytype = 0; 763 __le16 mac_tmp;
764 u16 len, icv = 0; 764 u16 len;
765 bool ampdu, no_ack; 765 bool ampdu, no_ack;
766 766
767 BUILD_BUG_ON(sizeof(*arinfo) > sizeof(info->rate_driver_data)); 767 BUILD_BUG_ON(sizeof(*arinfo) > sizeof(info->rate_driver_data));
@@ -773,6 +773,10 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
773 773
774 BUILD_BUG_ON(IEEE80211_TX_MAX_RATES < CARL9170_TX_MAX_RATES); 774 BUILD_BUG_ON(IEEE80211_TX_MAX_RATES < CARL9170_TX_MAX_RATES);
775 775
776 BUILD_BUG_ON(AR9170_MAX_VIRTUAL_MAC >
777 ((CARL9170_TX_SUPER_MISC_VIF_ID >>
778 CARL9170_TX_SUPER_MISC_VIF_ID_S) + 1));
779
776 hw_queue = ar9170_qmap[carl9170_get_queue(ar, skb)]; 780 hw_queue = ar9170_qmap[carl9170_get_queue(ar, skb)];
777 781
778 hdr = (void *)skb->data; 782 hdr = (void *)skb->data;
@@ -793,20 +797,37 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
793 txc = (void *)skb_push(skb, sizeof(*txc)); 797 txc = (void *)skb_push(skb, sizeof(*txc));
794 memset(txc, 0, sizeof(*txc)); 798 memset(txc, 0, sizeof(*txc));
795 799
796 ampdu = !!(info->flags & IEEE80211_TX_CTL_AMPDU); 800 SET_VAL(CARL9170_TX_SUPER_MISC_QUEUE, txc->s.misc, hw_queue);
801
802 if (likely(cvif))
803 SET_VAL(CARL9170_TX_SUPER_MISC_VIF_ID, txc->s.misc, cvif->id);
804
805 if (unlikely(info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM))
806 txc->s.misc |= CARL9170_TX_SUPER_MISC_CAB;
807
808 if (unlikely(ieee80211_is_probe_resp(hdr->frame_control)))
809 txc->s.misc |= CARL9170_TX_SUPER_MISC_FILL_IN_TSF;
810
811 mac_tmp = cpu_to_le16(AR9170_TX_MAC_HW_DURATION |
812 AR9170_TX_MAC_BACKOFF);
813 mac_tmp |= cpu_to_le16((hw_queue << AR9170_TX_MAC_QOS_S) &&
814 AR9170_TX_MAC_QOS);
815
797 no_ack = !!(info->flags & IEEE80211_TX_CTL_NO_ACK); 816 no_ack = !!(info->flags & IEEE80211_TX_CTL_NO_ACK);
817 if (unlikely(no_ack))
818 mac_tmp |= cpu_to_le16(AR9170_TX_MAC_NO_ACK);
798 819
799 if (info->control.hw_key) { 820 if (info->control.hw_key) {
800 icv = info->control.hw_key->icv_len; 821 len += info->control.hw_key->icv_len;
801 822
802 switch (info->control.hw_key->cipher) { 823 switch (info->control.hw_key->cipher) {
803 case WLAN_CIPHER_SUITE_WEP40: 824 case WLAN_CIPHER_SUITE_WEP40:
804 case WLAN_CIPHER_SUITE_WEP104: 825 case WLAN_CIPHER_SUITE_WEP104:
805 case WLAN_CIPHER_SUITE_TKIP: 826 case WLAN_CIPHER_SUITE_TKIP:
806 keytype = AR9170_TX_MAC_ENCR_RC4; 827 mac_tmp |= cpu_to_le16(AR9170_TX_MAC_ENCR_RC4);
807 break; 828 break;
808 case WLAN_CIPHER_SUITE_CCMP: 829 case WLAN_CIPHER_SUITE_CCMP:
809 keytype = AR9170_TX_MAC_ENCR_AES; 830 mac_tmp |= cpu_to_le16(AR9170_TX_MAC_ENCR_AES);
810 break; 831 break;
811 default: 832 default:
812 WARN_ON(1); 833 WARN_ON(1);
@@ -814,48 +835,58 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
814 } 835 }
815 } 836 }
816 837
817 BUILD_BUG_ON(AR9170_MAX_VIRTUAL_MAC > 838 ampdu = !!(info->flags & IEEE80211_TX_CTL_AMPDU);
818 ((CARL9170_TX_SUPER_MISC_VIF_ID >> 839 if (ampdu) {
819 CARL9170_TX_SUPER_MISC_VIF_ID_S) + 1)); 840 unsigned int density, factor;
820
821 txc->s.len = cpu_to_le16(len + sizeof(*txc));
822 txc->f.length = cpu_to_le16(len + icv + 4);
823 SET_VAL(CARL9170_TX_SUPER_MISC_VIF_ID, txc->s.misc,
824 cvif ? cvif->id : 0);
825 841
826 txc->f.mac_control = cpu_to_le16(AR9170_TX_MAC_HW_DURATION | 842 if (unlikely(!sta || !cvif))
827 AR9170_TX_MAC_BACKOFF); 843 goto err_out;
828 844
829 SET_VAL(CARL9170_TX_SUPER_MISC_QUEUE, txc->s.misc, hw_queue); 845 factor = min_t(unsigned int, 1u,
846 info->control.sta->ht_cap.ampdu_factor);
830 847
831 txc->f.mac_control |= cpu_to_le16(hw_queue << AR9170_TX_MAC_QOS_S); 848 density = info->control.sta->ht_cap.ampdu_density;
832 txc->f.mac_control |= cpu_to_le16(keytype);
833 txc->f.phy_control = cpu_to_le32(0);
834 849
835 if (no_ack) 850 if (density) {
836 txc->f.mac_control |= cpu_to_le16(AR9170_TX_MAC_NO_ACK); 851 /*
852 * Watch out!
853 *
854 * Otus uses slightly different density values than
855 * those from the 802.11n spec.
856 */
837 857
838 if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) 858 density = max_t(unsigned int, density + 1, 7u);
839 txc->s.misc |= CARL9170_TX_SUPER_MISC_CAB; 859 }
840 860
841 txrate = &info->control.rates[0]; 861 SET_VAL(CARL9170_TX_SUPER_AMPDU_DENSITY,
842 if (carl9170_tx_rts_check(ar, txrate, ampdu, no_ack)) 862 txc->s.ampdu_settings, density);
843 txc->f.mac_control |= cpu_to_le16(AR9170_TX_MAC_PROT_RTS);
844 else if (carl9170_tx_cts_check(ar, txrate))
845 txc->f.mac_control |= cpu_to_le16(AR9170_TX_MAC_PROT_CTS);
846 863
847 SET_VAL(CARL9170_TX_SUPER_RI_TRIES, txc->s.ri[0], txrate->count); 864 SET_VAL(CARL9170_TX_SUPER_AMPDU_FACTOR,
848 txc->f.phy_control |= carl9170_tx_physet(ar, info, txrate); 865 txc->s.ampdu_settings, factor);
849 866
850 if (info->flags & IEEE80211_TX_CTL_AMPDU) { 867 for (i = 0; i < CARL9170_TX_MAX_RATES; i++) {
851 for (i = 1; i < CARL9170_TX_MAX_RATES; i++) {
852 txrate = &info->control.rates[i]; 868 txrate = &info->control.rates[i];
853 if (txrate->idx >= 0) 869 if (txrate->idx >= 0) {
870 txc->s.ri[i] =
871 CARL9170_TX_SUPER_RI_AMPDU;
872
873 if (WARN_ON(!(txrate->flags &
874 IEEE80211_TX_RC_MCS))) {
875 /*
876 * Not sure if it's even possible
877 * to aggregate non-ht rates with
878 * this HW.
879 */
880 goto err_out;
881 }
854 continue; 882 continue;
883 }
855 884
856 txrate->idx = 0; 885 txrate->idx = 0;
857 txrate->count = ar->hw->max_rate_tries; 886 txrate->count = ar->hw->max_rate_tries;
858 } 887 }
888
889 mac_tmp |= cpu_to_le16(AR9170_TX_MAC_AGGR);
859 } 890 }
860 891
861 /* 892 /*
@@ -878,57 +909,21 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
878 txc->s.ri[i] |= (AR9170_TX_MAC_PROT_CTS << 909 txc->s.ri[i] |= (AR9170_TX_MAC_PROT_CTS <<
879 CARL9170_TX_SUPER_RI_ERP_PROT_S); 910 CARL9170_TX_SUPER_RI_ERP_PROT_S);
880 911
881 /*
882 * unaggregated fallback, in case aggregation
883 * proves to be unsuccessful and unreliable.
884 */
885 if (ampdu && i < 3)
886 txc->s.ri[i] |= CARL9170_TX_SUPER_RI_AMPDU;
887
888 txc->s.rr[i - 1] = carl9170_tx_physet(ar, info, txrate); 912 txc->s.rr[i - 1] = carl9170_tx_physet(ar, info, txrate);
889 } 913 }
890 914
891 if (ieee80211_is_probe_resp(hdr->frame_control)) 915 txrate = &info->control.rates[0];
892 txc->s.misc |= CARL9170_TX_SUPER_MISC_FILL_IN_TSF; 916 SET_VAL(CARL9170_TX_SUPER_RI_TRIES, txc->s.ri[0], txrate->count);
893
894 if (ampdu) {
895 unsigned int density, factor;
896
897 if (unlikely(!sta || !cvif))
898 goto err_out;
899
900 density = info->control.sta->ht_cap.ampdu_density;
901 factor = info->control.sta->ht_cap.ampdu_factor;
902
903 if (density) {
904 /*
905 * Watch out!
906 *
907 * Otus uses slightly different density values than
908 * those from the 802.11n spec.
909 */
910
911 density = max_t(unsigned int, density + 1, 7u);
912 }
913
914 factor = min_t(unsigned int, 1u, factor);
915
916 SET_VAL(CARL9170_TX_SUPER_AMPDU_DENSITY,
917 txc->s.ampdu_settings, density);
918 917
919 SET_VAL(CARL9170_TX_SUPER_AMPDU_FACTOR, 918 if (carl9170_tx_rts_check(ar, txrate, ampdu, no_ack))
920 txc->s.ampdu_settings, factor); 919 mac_tmp |= cpu_to_le16(AR9170_TX_MAC_PROT_RTS);
920 else if (carl9170_tx_cts_check(ar, txrate))
921 mac_tmp |= cpu_to_le16(AR9170_TX_MAC_PROT_CTS);
921 922
922 if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS) { 923 txc->s.len = cpu_to_le16(skb->len);
923 txc->f.mac_control |= cpu_to_le16(AR9170_TX_MAC_AGGR); 924 txc->f.length = cpu_to_le16(len + FCS_LEN);
924 } else { 925 txc->f.mac_control = mac_tmp;
925 /* 926 txc->f.phy_control = carl9170_tx_physet(ar, info, txrate);
926 * Not sure if it's even possible to aggregate
927 * non-ht rates with this HW.
928 */
929 WARN_ON_ONCE(1);
930 }
931 }
932 927
933 arinfo = (void *)info->rate_driver_data; 928 arinfo = (void *)info->rate_driver_data;
934 arinfo->timeout = jiffies; 929 arinfo->timeout = jiffies;
@@ -1042,41 +1037,8 @@ retry:
1042 queue = TID_TO_WME_AC(tid_info->tid); 1037 queue = TID_TO_WME_AC(tid_info->tid);
1043 1038
1044 spin_lock_bh(&tid_info->lock); 1039 spin_lock_bh(&tid_info->lock);
1045 if (tid_info->state != CARL9170_TID_STATE_XMIT) { 1040 if (tid_info->state != CARL9170_TID_STATE_XMIT)
1046 first = skb_peek(&tid_info->queue); 1041 goto processed;
1047 if (first) {
1048 struct ieee80211_tx_info *txinfo;
1049 struct carl9170_tx_info *arinfo;
1050
1051 txinfo = IEEE80211_SKB_CB(first);
1052 arinfo = (void *) txinfo->rate_driver_data;
1053
1054 if (time_is_after_jiffies(arinfo->timeout +
1055 msecs_to_jiffies(CARL9170_QUEUE_TIMEOUT))
1056 == true)
1057 goto processed;
1058
1059 /*
1060 * We've been waiting for the frame which
1061 * matches "snx" (start sequence of the
1062 * next aggregate) for some time now.
1063 *
1064 * But it never arrived. Therefore
1065 * jump to the next available frame
1066 * and kick-start the transmission.
1067 *
1068 * Note: This might induce odd latency
1069 * spikes because the receiver will be
1070 * waiting for the lost frame too.
1071 */
1072 ar->tx_ampdu_timeout++;
1073
1074 tid_info->snx = carl9170_get_seq(first);
1075 tid_info->state = CARL9170_TID_STATE_XMIT;
1076 } else {
1077 goto processed;
1078 }
1079 }
1080 1042
1081 tid_info->counter++; 1043 tid_info->counter++;
1082 first = skb_peek(&tid_info->queue); 1044 first = skb_peek(&tid_info->queue);
diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c
index eb789a9e4f15..c7f6193934ea 100644
--- a/drivers/net/wireless/ath/carl9170/usb.c
+++ b/drivers/net/wireless/ath/carl9170/usb.c
@@ -606,8 +606,6 @@ int __carl9170_exec_cmd(struct ar9170 *ar, struct carl9170_cmd *cmd,
606 AR9170_USB_EP_CMD), cmd, cmd->hdr.len + 4, 606 AR9170_USB_EP_CMD), cmd, cmd->hdr.len + 4,
607 carl9170_usb_cmd_complete, ar, 1); 607 carl9170_usb_cmd_complete, ar, 1);
608 608
609 urb->transfer_flags |= URB_ZERO_PACKET;
610
611 if (free_buf) 609 if (free_buf)
612 urb->transfer_flags |= URB_FREE_BUFFER; 610 urb->transfer_flags |= URB_FREE_BUFFER;
613 611
diff --git a/drivers/net/wireless/wl12xx/Makefile b/drivers/net/wireless/wl12xx/Makefile
index 078b4398ac1f..0d334d6f86f4 100644
--- a/drivers/net/wireless/wl12xx/Makefile
+++ b/drivers/net/wireless/wl12xx/Makefile
@@ -16,3 +16,6 @@ wl1271-$(CONFIG_NL80211_TESTMODE) += wl1271_testmode.o
16obj-$(CONFIG_WL1271) += wl1271.o 16obj-$(CONFIG_WL1271) += wl1271.o
17obj-$(CONFIG_WL1271_SPI) += wl1271_spi.o 17obj-$(CONFIG_WL1271_SPI) += wl1271_spi.o
18obj-$(CONFIG_WL1271_SDIO) += wl1271_sdio.o 18obj-$(CONFIG_WL1271_SDIO) += wl1271_sdio.o
19
20# small builtin driver bit
21obj-$(CONFIG_WL12XX_PLATFORM_DATA) += wl12xx_platform_data.o
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c
index fc21db810812..e5a7f042645f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.c
@@ -274,11 +274,11 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
274 274
275 /* 275 /*
276 * We've reached the first zero length, the first NVS table 276 * We've reached the first zero length, the first NVS table
277 * is 7 bytes further. 277 * is located at an aligned offset which is at least 7 bytes further.
278 */ 278 */
279 nvs_ptr += 7; 279 nvs_ptr = (u8 *)wl->nvs->nvs +
280 ALIGN(nvs_ptr - (u8 *)wl->nvs->nvs + 7, 4);
280 nvs_len -= nvs_ptr - (u8 *)wl->nvs->nvs; 281 nvs_len -= nvs_ptr - (u8 *)wl->nvs->nvs;
281 nvs_len = ALIGN(nvs_len, 4);
282 282
283 /* FIXME: The driver sets the partition here, but this is not needed, 283 /* FIXME: The driver sets the partition here, but this is not needed,
284 since it sets to the same one as currently in use */ 284 since it sets to the same one as currently in use */
@@ -286,14 +286,9 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
286 wl1271_set_partition(wl, &part_table[PART_WORK]); 286 wl1271_set_partition(wl, &part_table[PART_WORK]);
287 287
288 /* Copy the NVS tables to a new block to ensure alignment */ 288 /* Copy the NVS tables to a new block to ensure alignment */
289 /* FIXME: We jump 3 more bytes before uploading the NVS. It seems 289 nvs_aligned = kmemdup(nvs_ptr, nvs_len, GFP_KERNEL);
290 that our NVS files have three extra zeros here. I'm not sure whether 290 if (!nvs_aligned)
291 the problem is in our NVS generation or we should really jumpt these 291 return -ENOMEM;
292 3 bytes here */
293 nvs_ptr += 3;
294
295 nvs_aligned = kmemdup(nvs_ptr, nvs_len, GFP_KERNEL); if
296 (!nvs_aligned) return -ENOMEM;
297 292
298 /* And finally we upload the NVS tables */ 293 /* And finally we upload the NVS tables */
299 /* FIXME: In wl1271, we upload everything at once. 294 /* FIXME: In wl1271, we upload everything at once.