aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h191
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_paprd.c14
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c7
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c8
-rw-r--r--drivers/net/wireless/ath/carl9170/cmd.h51
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c2
-rw-r--r--drivers/net/wireless/ath/carl9170/usb.c25
-rw-r--r--drivers/net/wireless/b43/phy_n.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c3
-rw-r--r--drivers/net/wireless/wl1251/Makefile8
-rw-r--r--net/mac80211/ibss.c1
-rw-r--r--net/mac80211/main.c8
-rw-r--r--net/mac80211/rate.c3
-rw-r--r--net/wireless/reg.c2
17 files changed, 221 insertions, 108 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index f1ae75d35d5d..8251946842e6 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -3580,6 +3580,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
3580 common->ah = sc->ah; 3580 common->ah = sc->ah;
3581 common->hw = hw; 3581 common->hw = hw;
3582 common->cachelsz = csz << 2; /* convert to bytes */ 3582 common->cachelsz = csz << 2; /* convert to bytes */
3583 spin_lock_init(&common->cc_lock);
3583 3584
3584 /* Initialize device */ 3585 /* Initialize device */
3585 ret = ath5k_hw_attach(sc); 3586 ret = ath5k_hw_attach(sc);
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
index ec98ab50748a..a14a5e43cf56 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
@@ -34,6 +34,10 @@ static const u32 ar9300_2p2_radio_postamble[][5] = {
34 34
35static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = { 35static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = {
36 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 36 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
37 {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
38 {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
39 {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
40 {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
37 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, 41 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
38 {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 42 {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
39 {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, 43 {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
@@ -99,6 +103,30 @@ static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = {
99 {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, 103 {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
100 {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, 104 {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
101 {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, 105 {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
106 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
107 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
108 {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
109 {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
110 {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
111 {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000},
112 {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501},
113 {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501},
114 {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03},
115 {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04},
116 {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04},
117 {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005},
118 {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
119 {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
120 {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
121 {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
122 {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
123 {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
124 {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
125 {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
126 {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
127 {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
128 {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
129 {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
102 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, 130 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
103 {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, 131 {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001},
104 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, 132 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
@@ -118,7 +146,7 @@ static const u32 ar9300Modes_fast_clock_2p2[][3] = {
118 {0x00008014, 0x044c044c, 0x08980898}, 146 {0x00008014, 0x044c044c, 0x08980898},
119 {0x0000801c, 0x148ec02b, 0x148ec057}, 147 {0x0000801c, 0x148ec02b, 0x148ec057},
120 {0x00008318, 0x000044c0, 0x00008980}, 148 {0x00008318, 0x000044c0, 0x00008980},
121 {0x00009e00, 0x03721821, 0x03721821}, 149 {0x00009e00, 0x0372131c, 0x0372131c},
122 {0x0000a230, 0x0000000b, 0x00000016}, 150 {0x0000a230, 0x0000000b, 0x00000016},
123 {0x0000a254, 0x00000898, 0x00001130}, 151 {0x0000a254, 0x00000898, 0x00001130},
124}; 152};
@@ -595,15 +623,16 @@ static const u32 ar9300_2p2_baseband_postamble[][5] = {
595 {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, 623 {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4},
596 {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, 624 {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c},
597 {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, 625 {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4},
598 {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, 626 {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a0},
599 {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, 627 {0x00009e04, 0x001c2020, 0x001c2020, 0x001c2020, 0x001c2020},
600 {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, 628 {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2},
601 {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e}, 629 {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e},
602 {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, 630 {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3379605e, 0x33795d5e},
603 {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 631 {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
604 {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, 632 {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c},
605 {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, 633 {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce},
606 {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, 634 {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021},
635 {0x00009e3c, 0xcf946220, 0xcf946220, 0xcf946222, 0xcf946222},
607 {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27}, 636 {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27},
608 {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, 637 {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012},
609 {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, 638 {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000},
@@ -624,16 +653,16 @@ static const u32 ar9300_2p2_baseband_postamble[][5] = {
624 {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222}, 653 {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222},
625 {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, 654 {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18},
626 {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982}, 655 {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982},
627 {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, 656 {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a},
628 {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 657 {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
629 {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, 658 {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
630 {0x0000ae04, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, 659 {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000},
631 {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 660 {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
632 {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, 661 {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
633 {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, 662 {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce},
634 {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, 663 {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150},
635 {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, 664 {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
636 {0x0000be04, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, 665 {0x0000be04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000},
637 {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 666 {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
638 {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, 667 {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
639 {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, 668 {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce},
@@ -649,13 +678,13 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
649 {0x00009814, 0x9280c00a}, 678 {0x00009814, 0x9280c00a},
650 {0x00009818, 0x00000000}, 679 {0x00009818, 0x00000000},
651 {0x0000981c, 0x00020028}, 680 {0x0000981c, 0x00020028},
652 {0x00009834, 0x5f3ca3de}, 681 {0x00009834, 0x6400a290},
653 {0x00009838, 0x0108ecff}, 682 {0x00009838, 0x0108ecff},
654 {0x0000983c, 0x14750600}, 683 {0x0000983c, 0x14750600},
655 {0x00009880, 0x201fff00}, 684 {0x00009880, 0x201fff00},
656 {0x00009884, 0x00001042}, 685 {0x00009884, 0x00001042},
657 {0x000098a4, 0x00200400}, 686 {0x000098a4, 0x00200400},
658 {0x000098b0, 0x52440bbe}, 687 {0x000098b0, 0x32840bbe},
659 {0x000098d0, 0x004b6a8e}, 688 {0x000098d0, 0x004b6a8e},
660 {0x000098d4, 0x00000820}, 689 {0x000098d4, 0x00000820},
661 {0x000098dc, 0x00000000}, 690 {0x000098dc, 0x00000000},
@@ -681,7 +710,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
681 {0x00009e30, 0x06336f77}, 710 {0x00009e30, 0x06336f77},
682 {0x00009e34, 0x6af6532f}, 711 {0x00009e34, 0x6af6532f},
683 {0x00009e38, 0x0cc80c00}, 712 {0x00009e38, 0x0cc80c00},
684 {0x00009e3c, 0xcf946222},
685 {0x00009e40, 0x0d261820}, 713 {0x00009e40, 0x0d261820},
686 {0x00009e4c, 0x00001004}, 714 {0x00009e4c, 0x00001004},
687 {0x00009e50, 0x00ff03f1}, 715 {0x00009e50, 0x00ff03f1},
@@ -694,7 +722,7 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
694 {0x0000a220, 0x00000000}, 722 {0x0000a220, 0x00000000},
695 {0x0000a224, 0x00000000}, 723 {0x0000a224, 0x00000000},
696 {0x0000a228, 0x10002310}, 724 {0x0000a228, 0x10002310},
697 {0x0000a22c, 0x01036a1e}, 725 {0x0000a22c, 0x01036a27},
698 {0x0000a23c, 0x00000000}, 726 {0x0000a23c, 0x00000000},
699 {0x0000a244, 0x0c000000}, 727 {0x0000a244, 0x0c000000},
700 {0x0000a2a0, 0x00000001}, 728 {0x0000a2a0, 0x00000001},
@@ -702,10 +730,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
702 {0x0000a2c8, 0x00000000}, 730 {0x0000a2c8, 0x00000000},
703 {0x0000a2cc, 0x18c43433}, 731 {0x0000a2cc, 0x18c43433},
704 {0x0000a2d4, 0x00000000}, 732 {0x0000a2d4, 0x00000000},
705 {0x0000a2dc, 0x00000000},
706 {0x0000a2e0, 0x00000000},
707 {0x0000a2e4, 0x00000000},
708 {0x0000a2e8, 0x00000000},
709 {0x0000a2ec, 0x00000000}, 733 {0x0000a2ec, 0x00000000},
710 {0x0000a2f0, 0x00000000}, 734 {0x0000a2f0, 0x00000000},
711 {0x0000a2f4, 0x00000000}, 735 {0x0000a2f4, 0x00000000},
@@ -753,33 +777,17 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
753 {0x0000a430, 0x1ce739ce}, 777 {0x0000a430, 0x1ce739ce},
754 {0x0000a434, 0x00000000}, 778 {0x0000a434, 0x00000000},
755 {0x0000a438, 0x00001801}, 779 {0x0000a438, 0x00001801},
756 {0x0000a43c, 0x00000000}, 780 {0x0000a43c, 0x00100000},
757 {0x0000a440, 0x00000000}, 781 {0x0000a440, 0x00000000},
758 {0x0000a444, 0x00000000}, 782 {0x0000a444, 0x00000000},
759 {0x0000a448, 0x06000080}, 783 {0x0000a448, 0x06000080},
760 {0x0000a44c, 0x00000001}, 784 {0x0000a44c, 0x00000001},
761 {0x0000a450, 0x00010000}, 785 {0x0000a450, 0x00010000},
762 {0x0000a458, 0x00000000}, 786 {0x0000a458, 0x00000000},
763 {0x0000a600, 0x00000000},
764 {0x0000a604, 0x00000000},
765 {0x0000a608, 0x00000000},
766 {0x0000a60c, 0x00000000},
767 {0x0000a610, 0x00000000},
768 {0x0000a614, 0x00000000},
769 {0x0000a618, 0x00000000},
770 {0x0000a61c, 0x00000000},
771 {0x0000a620, 0x00000000},
772 {0x0000a624, 0x00000000},
773 {0x0000a628, 0x00000000},
774 {0x0000a62c, 0x00000000},
775 {0x0000a630, 0x00000000},
776 {0x0000a634, 0x00000000},
777 {0x0000a638, 0x00000000},
778 {0x0000a63c, 0x00000000},
779 {0x0000a640, 0x00000000}, 787 {0x0000a640, 0x00000000},
780 {0x0000a644, 0x3fad9d74}, 788 {0x0000a644, 0x3fad9d74},
781 {0x0000a648, 0x0048060a}, 789 {0x0000a648, 0x0048060a},
782 {0x0000a64c, 0x00000637}, 790 {0x0000a64c, 0x00003c37},
783 {0x0000a670, 0x03020100}, 791 {0x0000a670, 0x03020100},
784 {0x0000a674, 0x09080504}, 792 {0x0000a674, 0x09080504},
785 {0x0000a678, 0x0d0c0b0a}, 793 {0x0000a678, 0x0d0c0b0a},
@@ -802,10 +810,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
802 {0x0000a8f4, 0x00000000}, 810 {0x0000a8f4, 0x00000000},
803 {0x0000b2d0, 0x00000080}, 811 {0x0000b2d0, 0x00000080},
804 {0x0000b2d4, 0x00000000}, 812 {0x0000b2d4, 0x00000000},
805 {0x0000b2dc, 0x00000000},
806 {0x0000b2e0, 0x00000000},
807 {0x0000b2e4, 0x00000000},
808 {0x0000b2e8, 0x00000000},
809 {0x0000b2ec, 0x00000000}, 813 {0x0000b2ec, 0x00000000},
810 {0x0000b2f0, 0x00000000}, 814 {0x0000b2f0, 0x00000000},
811 {0x0000b2f4, 0x00000000}, 815 {0x0000b2f4, 0x00000000},
@@ -820,10 +824,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
820 {0x0000b8f4, 0x00000000}, 824 {0x0000b8f4, 0x00000000},
821 {0x0000c2d0, 0x00000080}, 825 {0x0000c2d0, 0x00000080},
822 {0x0000c2d4, 0x00000000}, 826 {0x0000c2d4, 0x00000000},
823 {0x0000c2dc, 0x00000000},
824 {0x0000c2e0, 0x00000000},
825 {0x0000c2e4, 0x00000000},
826 {0x0000c2e8, 0x00000000},
827 {0x0000c2ec, 0x00000000}, 827 {0x0000c2ec, 0x00000000},
828 {0x0000c2f0, 0x00000000}, 828 {0x0000c2f0, 0x00000000},
829 {0x0000c2f4, 0x00000000}, 829 {0x0000c2f4, 0x00000000},
@@ -835,6 +835,10 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
835 835
836static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { 836static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
837 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 837 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
838 {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
839 {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
840 {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
841 {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
838 {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, 842 {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9},
839 {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, 843 {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
840 {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, 844 {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002},
@@ -855,7 +859,7 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
855 {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, 859 {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660},
856 {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, 860 {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861},
857 {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, 861 {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81},
858 {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, 862 {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83},
859 {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, 863 {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84},
860 {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, 864 {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3},
861 {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, 865 {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5},
@@ -900,6 +904,30 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
900 {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, 904 {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
901 {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, 905 {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
902 {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, 906 {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
907 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
908 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
909 {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
910 {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
911 {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000},
912 {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000},
913 {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501},
914 {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501},
915 {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03},
916 {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04},
917 {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04},
918 {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
919 {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
920 {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
921 {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
922 {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
923 {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
924 {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
925 {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
926 {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
927 {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
928 {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
929 {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
930 {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
903 {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, 931 {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
904 {0x00016048, 0xae480001, 0xae480001, 0xae480001, 0xae480001}, 932 {0x00016048, 0xae480001, 0xae480001, 0xae480001, 0xae480001},
905 {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, 933 {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
@@ -913,6 +941,10 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
913 941
914static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = { 942static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = {
915 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 943 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
944 {0x0000a2dc, 0x01feee00, 0x01feee00, 0x00637800, 0x00637800},
945 {0x0000a2e0, 0x0000f000, 0x0000f000, 0x03838000, 0x03838000},
946 {0x0000a2e4, 0x01ff0000, 0x01ff0000, 0x03fc0000, 0x03fc0000},
947 {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
916 {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, 948 {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9},
917 {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, 949 {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
918 {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, 950 {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002},
@@ -933,7 +965,7 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = {
933 {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, 965 {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660},
934 {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, 966 {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861},
935 {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, 967 {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81},
936 {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, 968 {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83},
937 {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, 969 {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84},
938 {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, 970 {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3},
939 {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, 971 {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5},
@@ -978,6 +1010,30 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = {
978 {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, 1010 {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
979 {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, 1011 {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
980 {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, 1012 {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
1013 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1014 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1015 {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1016 {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1017 {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000},
1018 {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000},
1019 {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501},
1020 {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501},
1021 {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03},
1022 {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04},
1023 {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04},
1024 {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
1025 {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
1026 {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
1027 {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
1028 {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
1029 {0x0000b2dc, 0x01feee00, 0x01feee00, 0x00637800, 0x00637800},
1030 {0x0000b2e0, 0x0000f000, 0x0000f000, 0x03838000, 0x03838000},
1031 {0x0000b2e4, 0x01ff0000, 0x01ff0000, 0x03fc0000, 0x03fc0000},
1032 {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1033 {0x0000c2dc, 0x01feee00, 0x01feee00, 0x00637800, 0x00637800},
1034 {0x0000c2e0, 0x0000f000, 0x0000f000, 0x03838000, 0x03838000},
1035 {0x0000c2e4, 0x01ff0000, 0x01ff0000, 0x03fc0000, 0x03fc0000},
1036 {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
981 {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, 1037 {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
982 {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, 1038 {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001},
983 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, 1039 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
@@ -1151,14 +1207,14 @@ static const u32 ar9300Common_rx_gain_table_2p2[][2] = {
1151 {0x0000b074, 0x00000000}, 1207 {0x0000b074, 0x00000000},
1152 {0x0000b078, 0x00000000}, 1208 {0x0000b078, 0x00000000},
1153 {0x0000b07c, 0x00000000}, 1209 {0x0000b07c, 0x00000000},
1154 {0x0000b080, 0x32323232}, 1210 {0x0000b080, 0x2a2d2f32},
1155 {0x0000b084, 0x2f2f3232}, 1211 {0x0000b084, 0x21232328},
1156 {0x0000b088, 0x23282a2d}, 1212 {0x0000b088, 0x19191c1e},
1157 {0x0000b08c, 0x1c1e2123}, 1213 {0x0000b08c, 0x12141417},
1158 {0x0000b090, 0x14171919}, 1214 {0x0000b090, 0x07070e0e},
1159 {0x0000b094, 0x0e0e1214}, 1215 {0x0000b094, 0x03030305},
1160 {0x0000b098, 0x03050707}, 1216 {0x0000b098, 0x00000003},
1161 {0x0000b09c, 0x00030303}, 1217 {0x0000b09c, 0x00000000},
1162 {0x0000b0a0, 0x00000000}, 1218 {0x0000b0a0, 0x00000000},
1163 {0x0000b0a4, 0x00000000}, 1219 {0x0000b0a4, 0x00000000},
1164 {0x0000b0a8, 0x00000000}, 1220 {0x0000b0a8, 0x00000000},
@@ -1251,6 +1307,10 @@ static const u32 ar9300Common_rx_gain_table_2p2[][2] = {
1251 1307
1252static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = { 1308static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = {
1253 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 1309 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
1310 {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
1311 {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
1312 {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
1313 {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1254 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, 1314 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
1255 {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 1315 {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1256 {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, 1316 {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
@@ -1316,6 +1376,30 @@ static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = {
1316 {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, 1376 {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
1317 {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, 1377 {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
1318 {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, 1378 {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
1379 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1380 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1381 {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1382 {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1383 {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1384 {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000},
1385 {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501},
1386 {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501},
1387 {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03},
1388 {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04},
1389 {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04},
1390 {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005},
1391 {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
1392 {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
1393 {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
1394 {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
1395 {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
1396 {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
1397 {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
1398 {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1399 {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
1400 {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
1401 {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
1402 {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1319 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, 1403 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
1320 {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, 1404 {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
1321 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, 1405 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
@@ -1414,15 +1498,10 @@ static const u32 ar9300_2p2_mac_core[][2] = {
1414 {0x00008144, 0xffffffff}, 1498 {0x00008144, 0xffffffff},
1415 {0x00008168, 0x00000000}, 1499 {0x00008168, 0x00000000},
1416 {0x0000816c, 0x00000000}, 1500 {0x0000816c, 0x00000000},
1417 {0x00008170, 0x18486200},
1418 {0x00008174, 0x33332210},
1419 {0x00008178, 0x00000000},
1420 {0x0000817c, 0x00020000},
1421 {0x000081c0, 0x00000000}, 1501 {0x000081c0, 0x00000000},
1422 {0x000081c4, 0x33332210}, 1502 {0x000081c4, 0x33332210},
1423 {0x000081c8, 0x00000000}, 1503 {0x000081c8, 0x00000000},
1424 {0x000081cc, 0x00000000}, 1504 {0x000081cc, 0x00000000},
1425 {0x000081d4, 0x00000000},
1426 {0x000081ec, 0x00000000}, 1505 {0x000081ec, 0x00000000},
1427 {0x000081f0, 0x00000000}, 1506 {0x000081f0, 0x00000000},
1428 {0x000081f4, 0x00000000}, 1507 {0x000081f4, 0x00000000},
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
index 7c38229ba670..716db414c258 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
@@ -347,6 +347,10 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain)
347 (((Y[6] - Y[3]) * 1 << scale_factor) + 347 (((Y[6] - Y[3]) * 1 << scale_factor) +
348 (x_est[6] - x_est[3])) / (x_est[6] - x_est[3]); 348 (x_est[6] - x_est[3])) / (x_est[6] - x_est[3]);
349 349
350 /* prevent division by zero */
351 if (G_fxp == 0)
352 return false;
353
350 Y_intercept = 354 Y_intercept =
351 (G_fxp * (x_est[0] - x_est[3]) + 355 (G_fxp * (x_est[0] - x_est[3]) +
352 (1 << scale_factor)) / (1 << scale_factor) + Y[3]; 356 (1 << scale_factor)) / (1 << scale_factor) + Y[3];
@@ -356,14 +360,12 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain)
356 360
357 for (i = 0; i <= 3; i++) { 361 for (i = 0; i <= 3; i++) {
358 y_est[i] = i * 32; 362 y_est[i] = i * 32;
359
360 /* prevent division by zero */
361 if (G_fxp == 0)
362 return false;
363
364 x_est[i] = ((y_est[i] * 1 << scale_factor) + G_fxp) / G_fxp; 363 x_est[i] = ((y_est[i] * 1 << scale_factor) + G_fxp) / G_fxp;
365 } 364 }
366 365
366 if (y_est[max_index] == 0)
367 return false;
368
367 x_est_fxp1_nonlin = 369 x_est_fxp1_nonlin =
368 x_est[max_index] - ((1 << scale_factor) * y_est[max_index] + 370 x_est[max_index] - ((1 << scale_factor) * y_est[max_index] +
369 G_fxp) / G_fxp; 371 G_fxp) / G_fxp;
@@ -457,6 +459,8 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain)
457 459
458 Q_scale_B = find_proper_scale(find_expn(abs(scale_B)), 10); 460 Q_scale_B = find_proper_scale(find_expn(abs(scale_B)), 10);
459 scale_B = scale_B / (1 << Q_scale_B); 461 scale_B = scale_B / (1 << Q_scale_B);
462 if (scale_B == 0)
463 return false;
460 Q_beta = find_proper_scale(find_expn(abs(beta_raw)), 10); 464 Q_beta = find_proper_scale(find_expn(abs(beta_raw)), 10);
461 Q_alpha = find_proper_scale(find_expn(abs(alpha_raw)), 10); 465 Q_alpha = find_proper_scale(find_expn(abs(alpha_raw)), 10);
462 beta_raw = beta_raw / (1 << Q_beta); 466 beta_raw = beta_raw / (1 << Q_beta);
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 4ed010d4ef96..19891e7d49ae 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -370,7 +370,7 @@ void ath_beacon_tasklet(unsigned long data)
370 ath_print(common, ATH_DBG_BSTUCK, 370 ath_print(common, ATH_DBG_BSTUCK,
371 "beacon is officially stuck\n"); 371 "beacon is officially stuck\n");
372 sc->sc_flags |= SC_OP_TSF_RESET; 372 sc->sc_flags |= SC_OP_TSF_RESET;
373 ath_reset(sc, false); 373 ath_reset(sc, true);
374 } 374 }
375 375
376 return; 376 return;
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index bc6c4df9712c..95b41db0d86b 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
577 common->hw = sc->hw; 577 common->hw = sc->hw;
578 common->priv = sc; 578 common->priv = sc;
579 common->debug_mask = ath9k_debug; 579 common->debug_mask = ath9k_debug;
580 spin_lock_init(&common->cc_lock);
580 581
581 spin_lock_init(&sc->wiphy_lock); 582 spin_lock_init(&sc->wiphy_lock);
582 spin_lock_init(&sc->sc_resetlock); 583 spin_lock_init(&sc->sc_resetlock);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 3ff0e476c2b3..c6ec800d7a6b 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -182,6 +182,9 @@ static void ath_update_survey_stats(struct ath_softc *sc)
182 struct ath_cycle_counters *cc = &common->cc_survey; 182 struct ath_cycle_counters *cc = &common->cc_survey;
183 unsigned int div = common->clockrate * 1000; 183 unsigned int div = common->clockrate * 1000;
184 184
185 if (!ah->curchan)
186 return;
187
185 if (ah->power_mode == ATH9K_PM_AWAKE) 188 if (ah->power_mode == ATH9K_PM_AWAKE)
186 ath_hw_cycle_counters_update(common); 189 ath_hw_cycle_counters_update(common);
187 190
@@ -577,7 +580,7 @@ void ath_hw_check(struct work_struct *work)
577 580
578 msleep(1); 581 msleep(1);
579 } 582 }
580 ath_reset(sc, false); 583 ath_reset(sc, true);
581 584
582out: 585out:
583 ath9k_ps_restore(sc); 586 ath9k_ps_restore(sc);
@@ -595,7 +598,7 @@ void ath9k_tasklet(unsigned long data)
595 ath9k_ps_wakeup(sc); 598 ath9k_ps_wakeup(sc);
596 599
597 if (status & ATH9K_INT_FATAL) { 600 if (status & ATH9K_INT_FATAL) {
598 ath_reset(sc, false); 601 ath_reset(sc, true);
599 ath9k_ps_restore(sc); 602 ath9k_ps_restore(sc);
600 return; 603 return;
601 } 604 }
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index d077186da870..30ef2dfc1ed2 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -673,6 +673,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
673 u16 aggr_limit = 0, al = 0, bpad = 0, 673 u16 aggr_limit = 0, al = 0, bpad = 0,
674 al_delta, h_baw = tid->baw_size / 2; 674 al_delta, h_baw = tid->baw_size / 2;
675 enum ATH_AGGR_STATUS status = ATH_AGGR_DONE; 675 enum ATH_AGGR_STATUS status = ATH_AGGR_DONE;
676 struct ieee80211_tx_info *tx_info;
676 677
677 bf_first = list_first_entry(&tid->buf_q, struct ath_buf, list); 678 bf_first = list_first_entry(&tid->buf_q, struct ath_buf, list);
678 679
@@ -699,6 +700,11 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
699 break; 700 break;
700 } 701 }
701 702
703 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
704 if (nframes && ((tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) ||
705 !(tx_info->control.rates[0].flags & IEEE80211_TX_RC_MCS)))
706 break;
707
702 /* do not exceed subframe limit */ 708 /* do not exceed subframe limit */
703 if (nframes >= min((int)h_baw, ATH_AMPDU_SUBFRAME_DEFAULT)) { 709 if (nframes >= min((int)h_baw, ATH_AMPDU_SUBFRAME_DEFAULT)) {
704 status = ATH_AGGR_LIMITED; 710 status = ATH_AGGR_LIMITED;
@@ -2157,7 +2163,7 @@ static void ath_tx_complete_poll_work(struct work_struct *work)
2157 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET, 2163 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET,
2158 "tx hung, resetting the chip\n"); 2164 "tx hung, resetting the chip\n");
2159 ath9k_ps_wakeup(sc); 2165 ath9k_ps_wakeup(sc);
2160 ath_reset(sc, false); 2166 ath_reset(sc, true);
2161 ath9k_ps_restore(sc); 2167 ath9k_ps_restore(sc);
2162 } 2168 }
2163 2169
diff --git a/drivers/net/wireless/ath/carl9170/cmd.h b/drivers/net/wireless/ath/carl9170/cmd.h
index f78728c38294..568174c71b94 100644
--- a/drivers/net/wireless/ath/carl9170/cmd.h
+++ b/drivers/net/wireless/ath/carl9170/cmd.h
@@ -116,8 +116,9 @@ __regwrite_out : \
116} while (0); 116} while (0);
117 117
118 118
119#define carl9170_async_get_buf() \ 119#define carl9170_async_regwrite_get_buf() \
120do { \ 120do { \
121 __nreg = 0; \
121 __cmd = carl9170_cmd_buf(__carl, CARL9170_CMD_WREG_ASYNC, \ 122 __cmd = carl9170_cmd_buf(__carl, CARL9170_CMD_WREG_ASYNC, \
122 CARL9170_MAX_CMD_PAYLOAD_LEN); \ 123 CARL9170_MAX_CMD_PAYLOAD_LEN); \
123 if (__cmd == NULL) { \ 124 if (__cmd == NULL) { \
@@ -128,38 +129,42 @@ do { \
128 129
129#define carl9170_async_regwrite_begin(carl) \ 130#define carl9170_async_regwrite_begin(carl) \
130do { \ 131do { \
131 int __nreg = 0, __err = 0; \
132 struct ar9170 *__carl = carl; \ 132 struct ar9170 *__carl = carl; \
133 struct carl9170_cmd *__cmd; \ 133 struct carl9170_cmd *__cmd; \
134 carl9170_async_get_buf(); \ 134 unsigned int __nreg; \
135 int __err = 0; \
136 carl9170_async_regwrite_get_buf(); \
137
138#define carl9170_async_regwrite_flush() \
139do { \
140 if (__cmd == NULL || __nreg == 0) \
141 break; \
142 \
143 if (IS_ACCEPTING_CMD(__carl) && __nreg) { \
144 __cmd->hdr.len = 8 * __nreg; \
145 __err = __carl9170_exec_cmd(__carl, __cmd, true); \
146 __cmd = NULL; \
147 break; \
148 } \
149 goto __async_regwrite_out; \
150} while (0)
135 151
136#define carl9170_async_regwrite(r, v) do { \ 152#define carl9170_async_regwrite(r, v) do { \
153 if (__cmd == NULL) \
154 carl9170_async_regwrite_get_buf(); \
137 __cmd->wreg.regs[__nreg].addr = cpu_to_le32(r); \ 155 __cmd->wreg.regs[__nreg].addr = cpu_to_le32(r); \
138 __cmd->wreg.regs[__nreg].val = cpu_to_le32(v); \ 156 __cmd->wreg.regs[__nreg].val = cpu_to_le32(v); \
139 __nreg++; \ 157 __nreg++; \
140 if ((__nreg >= PAYLOAD_MAX/2)) { \ 158 if ((__nreg >= PAYLOAD_MAX / 2)) \
141 if (IS_ACCEPTING_CMD(__carl)) { \ 159 carl9170_async_regwrite_flush(); \
142 __cmd->hdr.len = 8 * __nreg; \
143 __err = __carl9170_exec_cmd(__carl, __cmd, true);\
144 __cmd = NULL; \
145 carl9170_async_get_buf(); \
146 } else { \
147 goto __async_regwrite_out; \
148 } \
149 __nreg = 0; \
150 if (__err) \
151 goto __async_regwrite_out; \
152 } \
153} while (0) 160} while (0)
154 161
155#define carl9170_async_regwrite_finish() \ 162#define carl9170_async_regwrite_finish() do { \
156__async_regwrite_out : \ 163__async_regwrite_out : \
157 if (__err == 0 && __nreg) { \ 164 if (__cmd != NULL && __err == 0) \
158 __cmd->hdr.len = 8 * __nreg; \ 165 carl9170_async_regwrite_flush(); \
159 if (IS_ACCEPTING_CMD(__carl)) \ 166 kfree(__cmd); \
160 __err = __carl9170_exec_cmd(__carl, __cmd, true);\ 167} while (0) \
161 __nreg = 0; \
162 }
163 168
164#define carl9170_async_regwrite_result() \ 169#define carl9170_async_regwrite_result() \
165 __err; \ 170 __err; \
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index 3cc99f3f7ab5..980ae70ea424 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -639,8 +639,8 @@ init:
639 if (err) 639 if (err)
640 goto unlock; 640 goto unlock;
641 } else { 641 } else {
642 err = carl9170_mod_virtual_mac(ar, vif_id, vif->addr);
643 rcu_read_unlock(); 642 rcu_read_unlock();
643 err = carl9170_mod_virtual_mac(ar, vif_id, vif->addr);
644 644
645 if (err) 645 if (err)
646 goto unlock; 646 goto unlock;
diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c
index c7f6193934ea..d8607f4c144d 100644
--- a/drivers/net/wireless/ath/carl9170/usb.c
+++ b/drivers/net/wireless/ath/carl9170/usb.c
@@ -591,16 +591,23 @@ int __carl9170_exec_cmd(struct ar9170 *ar, struct carl9170_cmd *cmd,
591 const bool free_buf) 591 const bool free_buf)
592{ 592{
593 struct urb *urb; 593 struct urb *urb;
594 int err = 0;
594 595
595 if (!IS_INITIALIZED(ar)) 596 if (!IS_INITIALIZED(ar)) {
596 return -EPERM; 597 err = -EPERM;
598 goto err_free;
599 }
597 600
598 if (WARN_ON(cmd->hdr.len > CARL9170_MAX_CMD_LEN - 4)) 601 if (WARN_ON(cmd->hdr.len > CARL9170_MAX_CMD_LEN - 4)) {
599 return -EINVAL; 602 err = -EINVAL;
603 goto err_free;
604 }
600 605
601 urb = usb_alloc_urb(0, GFP_ATOMIC); 606 urb = usb_alloc_urb(0, GFP_ATOMIC);
602 if (!urb) 607 if (!urb) {
603 return -ENOMEM; 608 err = -ENOMEM;
609 goto err_free;
610 }
604 611
605 usb_fill_int_urb(urb, ar->udev, usb_sndintpipe(ar->udev, 612 usb_fill_int_urb(urb, ar->udev, usb_sndintpipe(ar->udev,
606 AR9170_USB_EP_CMD), cmd, cmd->hdr.len + 4, 613 AR9170_USB_EP_CMD), cmd, cmd->hdr.len + 4,
@@ -613,6 +620,12 @@ int __carl9170_exec_cmd(struct ar9170 *ar, struct carl9170_cmd *cmd,
613 usb_free_urb(urb); 620 usb_free_urb(urb);
614 621
615 return carl9170_usb_submit_cmd_urb(ar); 622 return carl9170_usb_submit_cmd_urb(ar);
623
624err_free:
625 if (free_buf)
626 kfree(cmd);
627
628 return err;
616} 629}
617 630
618int carl9170_exec_cmd(struct ar9170 *ar, const enum carl9170_cmd_oids cmd, 631int carl9170_exec_cmd(struct ar9170 *ar, const enum carl9170_cmd_oids cmd,
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index dfec5496055e..e0f2d122e124 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -2964,7 +2964,7 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
2964 (2 - i)); 2964 (2 - i));
2965 } 2965 }
2966 2966
2967 for (j = 0; i < 4; j++) { 2967 for (j = 0; j < 4; j++) {
2968 if (j < 3) { 2968 if (j < 3) {
2969 cur_lna = lna[j]; 2969 cur_lna = lna[j];
2970 cur_hpf1 = hpf1[j]; 2970 cur_hpf1 = hpf1[j];
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index db57aea629d9..2b078a995729 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -1227,7 +1227,8 @@ static int iwlagn_tx_status_reply_compressed_ba(struct iwl_priv *priv,
1227 struct ieee80211_tx_info *info; 1227 struct ieee80211_tx_info *info;
1228 1228
1229 if (unlikely(!agg->wait_for_ba)) { 1229 if (unlikely(!agg->wait_for_ba)) {
1230 IWL_ERR(priv, "Received BA when not expected\n"); 1230 if (unlikely(ba_resp->bitmap))
1231 IWL_ERR(priv, "Received BA when not expected\n");
1231 return -EINVAL; 1232 return -EINVAL;
1232 } 1233 }
1233 1234
diff --git a/drivers/net/wireless/wl1251/Makefile b/drivers/net/wireless/wl1251/Makefile
index 4fe246824db3..58b4f935a3f6 100644
--- a/drivers/net/wireless/wl1251/Makefile
+++ b/drivers/net/wireless/wl1251/Makefile
@@ -1,6 +1,8 @@
1wl1251-objs = main.o event.o tx.o rx.o ps.o cmd.o \ 1wl1251-objs = main.o event.o tx.o rx.o ps.o cmd.o \
2 acx.o boot.o init.o debugfs.o io.o 2 acx.o boot.o init.o debugfs.o io.o
3wl1251_spi-objs += spi.o
4wl1251_sdio-objs += sdio.o
3 5
4obj-$(CONFIG_WL1251) += wl1251.o 6obj-$(CONFIG_WL1251) += wl1251.o
5obj-$(CONFIG_WL1251_SPI) += spi.o 7obj-$(CONFIG_WL1251_SPI) += wl1251_spi.o
6obj-$(CONFIG_WL1251_SDIO) += sdio.o 8obj-$(CONFIG_WL1251_SDIO) += wl1251_sdio.o
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index ff60c022f51d..239c4836a946 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -456,6 +456,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
456 if (!sta) 456 if (!sta)
457 return NULL; 457 return NULL;
458 458
459 sta->last_rx = jiffies;
459 set_sta_flags(sta, WLAN_STA_AUTHORIZED); 460 set_sta_flags(sta, WLAN_STA_AUTHORIZED);
460 461
461 /* make sure mandatory rates are always added */ 462 /* make sure mandatory rates are always added */
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 22bc42b18991..6b322fa681f5 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -748,7 +748,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
748 hw->queues = IEEE80211_MAX_QUEUES; 748 hw->queues = IEEE80211_MAX_QUEUES;
749 749
750 local->workqueue = 750 local->workqueue =
751 create_singlethread_workqueue(wiphy_name(local->hw.wiphy)); 751 alloc_ordered_workqueue(wiphy_name(local->hw.wiphy), 0);
752 if (!local->workqueue) { 752 if (!local->workqueue) {
753 result = -ENOMEM; 753 result = -ENOMEM;
754 goto fail_workqueue; 754 goto fail_workqueue;
@@ -962,12 +962,6 @@ static void __exit ieee80211_exit(void)
962 rc80211_minstrel_ht_exit(); 962 rc80211_minstrel_ht_exit();
963 rc80211_minstrel_exit(); 963 rc80211_minstrel_exit();
964 964
965 /*
966 * For key todo, it'll be empty by now but the work
967 * might still be scheduled.
968 */
969 flush_scheduled_work();
970
971 if (mesh_allocated) 965 if (mesh_allocated)
972 ieee80211s_stop(); 966 ieee80211s_stop();
973 967
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 809cf230d251..33f76993da08 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -329,6 +329,9 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
329 * if needed. 329 * if needed.
330 */ 330 */
331 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { 331 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
332 /* Skip invalid rates */
333 if (info->control.rates[i].idx < 0)
334 break;
332 /* Rate masking supports only legacy rates for now */ 335 /* Rate masking supports only legacy rates for now */
333 if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS) 336 if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS)
334 continue; 337 continue;
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index d14bbf960c18..4b9f8912526c 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1167,7 +1167,7 @@ static int ignore_request(struct wiphy *wiphy,
1167 return 0; 1167 return 0;
1168 return -EALREADY; 1168 return -EALREADY;
1169 } 1169 }
1170 return REG_INTERSECT; 1170 return 0;
1171 case NL80211_REGDOM_SET_BY_DRIVER: 1171 case NL80211_REGDOM_SET_BY_DRIVER:
1172 if (last_request->initiator == NL80211_REGDOM_SET_BY_CORE) { 1172 if (last_request->initiator == NL80211_REGDOM_SET_BY_CORE) {
1173 if (regdom_changes(pending_request->alpha2)) 1173 if (regdom_changes(pending_request->alpha2))