diff options
author | John W. Linville <linville@tuxdriver.com> | 2011-05-05 13:32:35 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-05-05 13:32:35 -0400 |
commit | a70171dce9cd44cb06c7d299eba9fa87a8933045 (patch) | |
tree | 5425df5f33fadc617c7dec99578d06f0d933578e /drivers/net/wireless/ath/ath9k | |
parent | 5a412ad7f4c95bb5b756aa12b52646e857e7c75d (diff) | |
parent | eaef6a93bd52a2cc47b9fce201310010707afdb4 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts:
drivers/net/wireless/libertas/if_cs.c
drivers/net/wireless/rtlwifi/pci.c
net/bluetooth/l2cap_sock.c
Diffstat (limited to 'drivers/net/wireless/ath/ath9k')
40 files changed, 2901 insertions, 726 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c index 5193ed58a17b..61956392f2da 100644 --- a/drivers/net/wireless/ath/ath9k/ahb.c +++ b/drivers/net/wireless/ath/ath9k/ahb.c | |||
@@ -21,11 +21,15 @@ | |||
21 | #include <linux/ath9k_platform.h> | 21 | #include <linux/ath9k_platform.h> |
22 | #include "ath9k.h" | 22 | #include "ath9k.h" |
23 | 23 | ||
24 | const struct platform_device_id ath9k_platform_id_table[] = { | 24 | static const struct platform_device_id ath9k_platform_id_table[] = { |
25 | { | 25 | { |
26 | .name = "ath9k", | 26 | .name = "ath9k", |
27 | .driver_data = AR5416_AR9100_DEVID, | 27 | .driver_data = AR5416_AR9100_DEVID, |
28 | }, | 28 | }, |
29 | { | ||
30 | .name = "ar934x_wmac", | ||
31 | .driver_data = AR9300_DEVID_AR9340, | ||
32 | }, | ||
29 | {}, | 33 | {}, |
30 | }; | 34 | }; |
31 | 35 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c index 2e31c775351f..5a1f4f511bc1 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c | |||
@@ -899,12 +899,6 @@ void ath9k_hw_ani_init(struct ath_hw *ah) | |||
899 | * check here default level should not modify INI setting. | 899 | * check here default level should not modify INI setting. |
900 | */ | 900 | */ |
901 | if (use_new_ani(ah)) { | 901 | if (use_new_ani(ah)) { |
902 | const struct ani_ofdm_level_entry *entry_ofdm; | ||
903 | const struct ani_cck_level_entry *entry_cck; | ||
904 | |||
905 | entry_ofdm = &ofdm_level_table[ATH9K_ANI_OFDM_DEF_LEVEL]; | ||
906 | entry_cck = &cck_level_table[ATH9K_ANI_CCK_DEF_LEVEL]; | ||
907 | |||
908 | ah->aniperiod = ATH9K_ANI_PERIOD_NEW; | 902 | ah->aniperiod = ATH9K_ANI_PERIOD_NEW; |
909 | ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL_NEW; | 903 | ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL_NEW; |
910 | } else { | 904 | } else { |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c index 4a4cd88429c0..f276cb922b4d 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c | |||
@@ -18,13 +18,13 @@ | |||
18 | #include "hw-ops.h" | 18 | #include "hw-ops.h" |
19 | #include "ar9003_phy.h" | 19 | #include "ar9003_phy.h" |
20 | 20 | ||
21 | #define MPASS 3 | ||
22 | #define MAX_MEASUREMENT 8 | 21 | #define MAX_MEASUREMENT 8 |
23 | #define MAX_DIFFERENCE 10 | 22 | #define MAX_MAG_DELTA 11 |
23 | #define MAX_PHS_DELTA 10 | ||
24 | 24 | ||
25 | struct coeff { | 25 | struct coeff { |
26 | int mag_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT][MPASS]; | 26 | int mag_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT]; |
27 | int phs_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT][MPASS]; | 27 | int phs_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT]; |
28 | int iqc_coeff[2]; | 28 | int iqc_coeff[2]; |
29 | }; | 29 | }; |
30 | 30 | ||
@@ -185,17 +185,19 @@ static void ar9003_hw_iqcal_collect(struct ath_hw *ah) | |||
185 | 185 | ||
186 | /* Accumulate IQ cal measures for active chains */ | 186 | /* Accumulate IQ cal measures for active chains */ |
187 | for (i = 0; i < AR5416_MAX_CHAINS; i++) { | 187 | for (i = 0; i < AR5416_MAX_CHAINS; i++) { |
188 | ah->totalPowerMeasI[i] += | 188 | if (ah->txchainmask & BIT(i)) { |
189 | REG_READ(ah, AR_PHY_CAL_MEAS_0(i)); | 189 | ah->totalPowerMeasI[i] += |
190 | ah->totalPowerMeasQ[i] += | 190 | REG_READ(ah, AR_PHY_CAL_MEAS_0(i)); |
191 | REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); | 191 | ah->totalPowerMeasQ[i] += |
192 | ah->totalIqCorrMeas[i] += | 192 | REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); |
193 | (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); | 193 | ah->totalIqCorrMeas[i] += |
194 | ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, | 194 | (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); |
195 | "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n", | 195 | ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, |
196 | ah->cal_samples, i, ah->totalPowerMeasI[i], | 196 | "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n", |
197 | ah->totalPowerMeasQ[i], | 197 | ah->cal_samples, i, ah->totalPowerMeasI[i], |
198 | ah->totalIqCorrMeas[i]); | 198 | ah->totalPowerMeasQ[i], |
199 | ah->totalIqCorrMeas[i]); | ||
200 | } | ||
199 | } | 201 | } |
200 | } | 202 | } |
201 | 203 | ||
@@ -608,36 +610,48 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah, | |||
608 | return true; | 610 | return true; |
609 | } | 611 | } |
610 | 612 | ||
611 | static bool ar9003_hw_compute_closest_pass_and_avg(int *mp_coeff, int *mp_avg) | 613 | static void ar9003_hw_detect_outlier(int *mp_coeff, int nmeasurement, |
614 | int max_delta) | ||
612 | { | 615 | { |
613 | int diff[MPASS]; | 616 | int mp_max = -64, max_idx = 0; |
614 | 617 | int mp_min = 63, min_idx = 0; | |
615 | diff[0] = abs(mp_coeff[0] - mp_coeff[1]); | 618 | int mp_avg = 0, i, outlier_idx = 0; |
616 | diff[1] = abs(mp_coeff[1] - mp_coeff[2]); | 619 | |
617 | diff[2] = abs(mp_coeff[2] - mp_coeff[0]); | 620 | /* find min/max mismatch across all calibrated gains */ |
618 | 621 | for (i = 0; i < nmeasurement; i++) { | |
619 | if (diff[0] > MAX_DIFFERENCE && | 622 | mp_avg += mp_coeff[i]; |
620 | diff[1] > MAX_DIFFERENCE && | 623 | if (mp_coeff[i] > mp_max) { |
621 | diff[2] > MAX_DIFFERENCE) | 624 | mp_max = mp_coeff[i]; |
622 | return false; | 625 | max_idx = i; |
626 | } else if (mp_coeff[i] < mp_min) { | ||
627 | mp_min = mp_coeff[i]; | ||
628 | min_idx = i; | ||
629 | } | ||
630 | } | ||
623 | 631 | ||
624 | if (diff[0] <= diff[1] && diff[0] <= diff[2]) | 632 | /* find average (exclude max abs value) */ |
625 | *mp_avg = (mp_coeff[0] + mp_coeff[1]) / 2; | 633 | for (i = 0; i < nmeasurement; i++) { |
626 | else if (diff[1] <= diff[2]) | 634 | if ((abs(mp_coeff[i]) < abs(mp_max)) || |
627 | *mp_avg = (mp_coeff[1] + mp_coeff[2]) / 2; | 635 | (abs(mp_coeff[i]) < abs(mp_min))) |
628 | else | 636 | mp_avg += mp_coeff[i]; |
629 | *mp_avg = (mp_coeff[2] + mp_coeff[0]) / 2; | 637 | } |
638 | mp_avg /= (nmeasurement - 1); | ||
630 | 639 | ||
631 | return true; | 640 | /* detect outlier */ |
641 | if (abs(mp_max - mp_min) > max_delta) { | ||
642 | if (abs(mp_max - mp_avg) > abs(mp_min - mp_avg)) | ||
643 | outlier_idx = max_idx; | ||
644 | else | ||
645 | outlier_idx = min_idx; | ||
646 | } | ||
647 | mp_coeff[outlier_idx] = mp_avg; | ||
632 | } | 648 | } |
633 | 649 | ||
634 | static void ar9003_hw_tx_iqcal_load_avg_2_passes(struct ath_hw *ah, | 650 | static void ar9003_hw_tx_iqcal_load_avg_2_passes(struct ath_hw *ah, |
635 | u8 num_chains, | 651 | u8 num_chains, |
636 | struct coeff *coeff) | 652 | struct coeff *coeff) |
637 | { | 653 | { |
638 | struct ath_common *common = ath9k_hw_common(ah); | ||
639 | int i, im, nmeasurement; | 654 | int i, im, nmeasurement; |
640 | int magnitude, phase; | ||
641 | u32 tx_corr_coeff[MAX_MEASUREMENT][AR9300_MAX_CHAINS]; | 655 | u32 tx_corr_coeff[MAX_MEASUREMENT][AR9300_MAX_CHAINS]; |
642 | 656 | ||
643 | memset(tx_corr_coeff, 0, sizeof(tx_corr_coeff)); | 657 | memset(tx_corr_coeff, 0, sizeof(tx_corr_coeff)); |
@@ -657,37 +671,28 @@ static void ar9003_hw_tx_iqcal_load_avg_2_passes(struct ath_hw *ah, | |||
657 | 671 | ||
658 | /* Load the average of 2 passes */ | 672 | /* Load the average of 2 passes */ |
659 | for (i = 0; i < num_chains; i++) { | 673 | for (i = 0; i < num_chains; i++) { |
660 | if (AR_SREV_9485(ah)) | 674 | nmeasurement = REG_READ_FIELD(ah, |
661 | nmeasurement = REG_READ_FIELD(ah, | 675 | AR_PHY_TX_IQCAL_STATUS_B0, |
662 | AR_PHY_TX_IQCAL_STATUS_B0_9485, | 676 | AR_PHY_CALIBRATED_GAINS_0); |
663 | AR_PHY_CALIBRATED_GAINS_0); | ||
664 | else | ||
665 | nmeasurement = REG_READ_FIELD(ah, | ||
666 | AR_PHY_TX_IQCAL_STATUS_B0, | ||
667 | AR_PHY_CALIBRATED_GAINS_0); | ||
668 | 677 | ||
669 | if (nmeasurement > MAX_MEASUREMENT) | 678 | if (nmeasurement > MAX_MEASUREMENT) |
670 | nmeasurement = MAX_MEASUREMENT; | 679 | nmeasurement = MAX_MEASUREMENT; |
671 | 680 | ||
672 | for (im = 0; im < nmeasurement; im++) { | 681 | /* detect outlier only if nmeasurement > 1 */ |
673 | /* | 682 | if (nmeasurement > 1) { |
674 | * Determine which 2 passes are closest and compute avg | 683 | /* Detect magnitude outlier */ |
675 | * magnitude | 684 | ar9003_hw_detect_outlier(coeff->mag_coeff[i], |
676 | */ | 685 | nmeasurement, MAX_MAG_DELTA); |
677 | if (!ar9003_hw_compute_closest_pass_and_avg(coeff->mag_coeff[i][im], | ||
678 | &magnitude)) | ||
679 | goto disable_txiqcal; | ||
680 | 686 | ||
681 | /* | 687 | /* Detect phase outlier */ |
682 | * Determine which 2 passes are closest and compute avg | 688 | ar9003_hw_detect_outlier(coeff->phs_coeff[i], |
683 | * phase | 689 | nmeasurement, MAX_PHS_DELTA); |
684 | */ | 690 | } |
685 | if (!ar9003_hw_compute_closest_pass_and_avg(coeff->phs_coeff[i][im], | 691 | |
686 | &phase)) | 692 | for (im = 0; im < nmeasurement; im++) { |
687 | goto disable_txiqcal; | ||
688 | 693 | ||
689 | coeff->iqc_coeff[0] = (magnitude & 0x7f) | | 694 | coeff->iqc_coeff[0] = (coeff->mag_coeff[i][im] & 0x7f) | |
690 | ((phase & 0x7f) << 7); | 695 | ((coeff->phs_coeff[i][im] & 0x7f) << 7); |
691 | 696 | ||
692 | if ((im % 2) == 0) | 697 | if ((im % 2) == 0) |
693 | REG_RMW_FIELD(ah, tx_corr_coeff[im][i], | 698 | REG_RMW_FIELD(ah, tx_corr_coeff[im][i], |
@@ -707,141 +712,37 @@ static void ar9003_hw_tx_iqcal_load_avg_2_passes(struct ath_hw *ah, | |||
707 | 712 | ||
708 | return; | 713 | return; |
709 | 714 | ||
710 | disable_txiqcal: | ||
711 | REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_3, | ||
712 | AR_PHY_TX_IQCAL_CONTROL_3_IQCORR_EN, 0x0); | ||
713 | REG_RMW_FIELD(ah, AR_PHY_RX_IQCAL_CORR_B0, | ||
714 | AR_PHY_RX_IQCAL_CORR_B0_LOOPBACK_IQCORR_EN, 0x0); | ||
715 | |||
716 | ath_dbg(common, ATH_DBG_CALIBRATE, "TX IQ Cal disabled\n"); | ||
717 | } | 715 | } |
718 | 716 | ||
719 | static void ar9003_hw_tx_iq_cal(struct ath_hw *ah) | 717 | static bool ar9003_hw_tx_iq_cal_run(struct ath_hw *ah) |
720 | { | 718 | { |
721 | struct ath_common *common = ath9k_hw_common(ah); | 719 | struct ath_common *common = ath9k_hw_common(ah); |
722 | static const u32 txiqcal_status[AR9300_MAX_CHAINS] = { | ||
723 | AR_PHY_TX_IQCAL_STATUS_B0, | ||
724 | AR_PHY_TX_IQCAL_STATUS_B1, | ||
725 | AR_PHY_TX_IQCAL_STATUS_B2, | ||
726 | }; | ||
727 | static const u32 chan_info_tab[] = { | ||
728 | AR_PHY_CHAN_INFO_TAB_0, | ||
729 | AR_PHY_CHAN_INFO_TAB_1, | ||
730 | AR_PHY_CHAN_INFO_TAB_2, | ||
731 | }; | ||
732 | struct coeff coeff; | ||
733 | s32 iq_res[6]; | ||
734 | s32 i, j, ip, im, nmeasurement; | ||
735 | u8 nchains = get_streams(common->tx_chainmask); | ||
736 | |||
737 | for (ip = 0; ip < MPASS; ip++) { | ||
738 | REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_1, | ||
739 | AR_PHY_TX_IQCAQL_CONTROL_1_IQCORR_I_Q_COFF_DELPT, | ||
740 | DELPT); | ||
741 | REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_START, | ||
742 | AR_PHY_TX_IQCAL_START_DO_CAL, | ||
743 | AR_PHY_TX_IQCAL_START_DO_CAL); | ||
744 | |||
745 | if (!ath9k_hw_wait(ah, AR_PHY_TX_IQCAL_START, | ||
746 | AR_PHY_TX_IQCAL_START_DO_CAL, | ||
747 | 0, AH_WAIT_TIMEOUT)) { | ||
748 | ath_dbg(common, ATH_DBG_CALIBRATE, | ||
749 | "Tx IQ Cal not complete.\n"); | ||
750 | goto TX_IQ_CAL_FAILED; | ||
751 | } | ||
752 | |||
753 | nmeasurement = REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_STATUS_B0, | ||
754 | AR_PHY_CALIBRATED_GAINS_0); | ||
755 | if (nmeasurement > MAX_MEASUREMENT) | ||
756 | nmeasurement = MAX_MEASUREMENT; | ||
757 | |||
758 | for (i = 0; i < nchains; i++) { | ||
759 | ath_dbg(common, ATH_DBG_CALIBRATE, | ||
760 | "Doing Tx IQ Cal for chain %d.\n", i); | ||
761 | for (im = 0; im < nmeasurement; im++) { | ||
762 | if (REG_READ(ah, txiqcal_status[i]) & | ||
763 | AR_PHY_TX_IQCAL_STATUS_FAILED) { | ||
764 | ath_dbg(common, ATH_DBG_CALIBRATE, | ||
765 | "Tx IQ Cal failed for chain %d.\n", i); | ||
766 | goto TX_IQ_CAL_FAILED; | ||
767 | } | ||
768 | |||
769 | for (j = 0; j < 3; j++) { | ||
770 | u8 idx = 2 * j, | ||
771 | offset = 4 * (3 * im + j); | ||
772 | |||
773 | REG_RMW_FIELD(ah, AR_PHY_CHAN_INFO_MEMORY, | ||
774 | AR_PHY_CHAN_INFO_TAB_S2_READ, | ||
775 | 0); | ||
776 | |||
777 | /* 32 bits */ | ||
778 | iq_res[idx] = REG_READ(ah, | ||
779 | chan_info_tab[i] + | ||
780 | offset); | ||
781 | |||
782 | REG_RMW_FIELD(ah, AR_PHY_CHAN_INFO_MEMORY, | ||
783 | AR_PHY_CHAN_INFO_TAB_S2_READ, | ||
784 | 1); | ||
785 | |||
786 | /* 16 bits */ | ||
787 | iq_res[idx+1] = 0xffff & REG_READ(ah, | ||
788 | chan_info_tab[i] + | ||
789 | offset); | ||
790 | |||
791 | ath_dbg(common, ATH_DBG_CALIBRATE, | ||
792 | "IQ RES[%d]=0x%x IQ_RES[%d]=0x%x\n", | ||
793 | idx, iq_res[idx], idx+1, iq_res[idx+1]); | ||
794 | } | ||
795 | |||
796 | if (!ar9003_hw_calc_iq_corr(ah, i, iq_res, | ||
797 | coeff.iqc_coeff)) { | ||
798 | ath_dbg(common, ATH_DBG_CALIBRATE, | ||
799 | "Failed in calculation of IQ correction.\n"); | ||
800 | goto TX_IQ_CAL_FAILED; | ||
801 | } | ||
802 | coeff.mag_coeff[i][im][ip] = | ||
803 | coeff.iqc_coeff[0] & 0x7f; | ||
804 | coeff.phs_coeff[i][im][ip] = | ||
805 | (coeff.iqc_coeff[0] >> 7) & 0x7f; | ||
806 | |||
807 | if (coeff.mag_coeff[i][im][ip] > 63) | ||
808 | coeff.mag_coeff[i][im][ip] -= 128; | ||
809 | if (coeff.phs_coeff[i][im][ip] > 63) | ||
810 | coeff.phs_coeff[i][im][ip] -= 128; | ||
811 | |||
812 | } | ||
813 | } | ||
814 | } | ||
815 | |||
816 | ar9003_hw_tx_iqcal_load_avg_2_passes(ah, nchains, &coeff); | ||
817 | |||
818 | return; | ||
819 | |||
820 | TX_IQ_CAL_FAILED: | ||
821 | ath_dbg(common, ATH_DBG_CALIBRATE, "Tx IQ Cal failed\n"); | ||
822 | } | ||
823 | |||
824 | static void ar9003_hw_tx_iq_cal_run(struct ath_hw *ah) | ||
825 | { | ||
826 | u8 tx_gain_forced; | 720 | u8 tx_gain_forced; |
827 | 721 | ||
828 | REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_1_9485, | ||
829 | AR_PHY_TX_IQCAQL_CONTROL_1_IQCORR_I_Q_COFF_DELPT, DELPT); | ||
830 | tx_gain_forced = REG_READ_FIELD(ah, AR_PHY_TX_FORCED_GAIN, | 722 | tx_gain_forced = REG_READ_FIELD(ah, AR_PHY_TX_FORCED_GAIN, |
831 | AR_PHY_TXGAIN_FORCE); | 723 | AR_PHY_TXGAIN_FORCE); |
832 | if (tx_gain_forced) | 724 | if (tx_gain_forced) |
833 | REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, | 725 | REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, |
834 | AR_PHY_TXGAIN_FORCE, 0); | 726 | AR_PHY_TXGAIN_FORCE, 0); |
835 | 727 | ||
836 | REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_START_9485, | 728 | REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_START, |
837 | AR_PHY_TX_IQCAL_START_DO_CAL_9485, 1); | 729 | AR_PHY_TX_IQCAL_START_DO_CAL, 1); |
730 | |||
731 | if (!ath9k_hw_wait(ah, AR_PHY_TX_IQCAL_START, | ||
732 | AR_PHY_TX_IQCAL_START_DO_CAL, 0, | ||
733 | AH_WAIT_TIMEOUT)) { | ||
734 | ath_dbg(common, ATH_DBG_CALIBRATE, | ||
735 | "Tx IQ Cal is not completed.\n"); | ||
736 | return false; | ||
737 | } | ||
738 | return true; | ||
838 | } | 739 | } |
839 | 740 | ||
840 | static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah) | 741 | static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah) |
841 | { | 742 | { |
842 | struct ath_common *common = ath9k_hw_common(ah); | 743 | struct ath_common *common = ath9k_hw_common(ah); |
843 | const u32 txiqcal_status[AR9300_MAX_CHAINS] = { | 744 | const u32 txiqcal_status[AR9300_MAX_CHAINS] = { |
844 | AR_PHY_TX_IQCAL_STATUS_B0_9485, | 745 | AR_PHY_TX_IQCAL_STATUS_B0, |
845 | AR_PHY_TX_IQCAL_STATUS_B1, | 746 | AR_PHY_TX_IQCAL_STATUS_B1, |
846 | AR_PHY_TX_IQCAL_STATUS_B2, | 747 | AR_PHY_TX_IQCAL_STATUS_B2, |
847 | }; | 748 | }; |
@@ -853,7 +754,7 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah) | |||
853 | struct coeff coeff; | 754 | struct coeff coeff; |
854 | s32 iq_res[6]; | 755 | s32 iq_res[6]; |
855 | u8 num_chains = 0; | 756 | u8 num_chains = 0; |
856 | int i, ip, im, j; | 757 | int i, im, j; |
857 | int nmeasurement; | 758 | int nmeasurement; |
858 | 759 | ||
859 | for (i = 0; i < AR9300_MAX_CHAINS; i++) { | 760 | for (i = 0; i < AR9300_MAX_CHAINS; i++) { |
@@ -861,71 +762,69 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah) | |||
861 | num_chains++; | 762 | num_chains++; |
862 | } | 763 | } |
863 | 764 | ||
864 | for (ip = 0; ip < MPASS; ip++) { | 765 | for (i = 0; i < num_chains; i++) { |
865 | for (i = 0; i < num_chains; i++) { | 766 | nmeasurement = REG_READ_FIELD(ah, |
866 | nmeasurement = REG_READ_FIELD(ah, | 767 | AR_PHY_TX_IQCAL_STATUS_B0, |
867 | AR_PHY_TX_IQCAL_STATUS_B0_9485, | 768 | AR_PHY_CALIBRATED_GAINS_0); |
868 | AR_PHY_CALIBRATED_GAINS_0); | 769 | if (nmeasurement > MAX_MEASUREMENT) |
869 | if (nmeasurement > MAX_MEASUREMENT) | 770 | nmeasurement = MAX_MEASUREMENT; |
870 | nmeasurement = MAX_MEASUREMENT; | ||
871 | 771 | ||
872 | for (im = 0; im < nmeasurement; im++) { | 772 | for (im = 0; im < nmeasurement; im++) { |
873 | ath_dbg(common, ATH_DBG_CALIBRATE, | 773 | ath_dbg(common, ATH_DBG_CALIBRATE, |
874 | "Doing Tx IQ Cal for chain %d.\n", i); | 774 | "Doing Tx IQ Cal for chain %d.\n", i); |
875 | 775 | ||
876 | if (REG_READ(ah, txiqcal_status[i]) & | 776 | if (REG_READ(ah, txiqcal_status[i]) & |
877 | AR_PHY_TX_IQCAL_STATUS_FAILED) { | 777 | AR_PHY_TX_IQCAL_STATUS_FAILED) { |
878 | ath_dbg(common, ATH_DBG_CALIBRATE, | 778 | ath_dbg(common, ATH_DBG_CALIBRATE, |
879 | "Tx IQ Cal failed for chain %d.\n", i); | 779 | "Tx IQ Cal failed for chain %d.\n", i); |
880 | goto tx_iqcal_fail; | 780 | goto tx_iqcal_fail; |
881 | } | 781 | } |
882 | 782 | ||
883 | for (j = 0; j < 3; j++) { | 783 | for (j = 0; j < 3; j++) { |
884 | u32 idx = 2 * j, offset = 4 * (3 * im + j); | 784 | u32 idx = 2 * j, offset = 4 * (3 * im + j); |
885 | 785 | ||
886 | REG_RMW_FIELD(ah, | 786 | REG_RMW_FIELD(ah, |
887 | AR_PHY_CHAN_INFO_MEMORY, | 787 | AR_PHY_CHAN_INFO_MEMORY, |
888 | AR_PHY_CHAN_INFO_TAB_S2_READ, | 788 | AR_PHY_CHAN_INFO_TAB_S2_READ, |
889 | 0); | 789 | 0); |
890 | 790 | ||
891 | /* 32 bits */ | 791 | /* 32 bits */ |
892 | iq_res[idx] = REG_READ(ah, | 792 | iq_res[idx] = REG_READ(ah, |
893 | chan_info_tab[i] + | 793 | chan_info_tab[i] + |
894 | offset); | 794 | offset); |
895 | 795 | ||
896 | REG_RMW_FIELD(ah, | 796 | REG_RMW_FIELD(ah, |
897 | AR_PHY_CHAN_INFO_MEMORY, | 797 | AR_PHY_CHAN_INFO_MEMORY, |
898 | AR_PHY_CHAN_INFO_TAB_S2_READ, | 798 | AR_PHY_CHAN_INFO_TAB_S2_READ, |
899 | 1); | 799 | 1); |
900 | 800 | ||
901 | /* 16 bits */ | 801 | /* 16 bits */ |
902 | iq_res[idx + 1] = 0xffff & REG_READ(ah, | 802 | iq_res[idx + 1] = 0xffff & REG_READ(ah, |
903 | chan_info_tab[i] + offset); | 803 | chan_info_tab[i] + offset); |
904 | 804 | ||
905 | ath_dbg(common, ATH_DBG_CALIBRATE, | 805 | ath_dbg(common, ATH_DBG_CALIBRATE, |
906 | "IQ RES[%d]=0x%x" | 806 | "IQ RES[%d]=0x%x" |
907 | "IQ_RES[%d]=0x%x\n", | 807 | "IQ_RES[%d]=0x%x\n", |
908 | idx, iq_res[idx], idx + 1, | 808 | idx, iq_res[idx], idx + 1, |
909 | iq_res[idx + 1]); | 809 | iq_res[idx + 1]); |
910 | } | 810 | } |
911 | 811 | ||
912 | if (!ar9003_hw_calc_iq_corr(ah, i, iq_res, | 812 | if (!ar9003_hw_calc_iq_corr(ah, i, iq_res, |
913 | coeff.iqc_coeff)) { | 813 | coeff.iqc_coeff)) { |
914 | ath_dbg(common, ATH_DBG_CALIBRATE, | 814 | ath_dbg(common, ATH_DBG_CALIBRATE, |
915 | "Failed in calculation of IQ correction.\n"); | 815 | "Failed in calculation of \ |
916 | goto tx_iqcal_fail; | 816 | IQ correction.\n"); |
917 | } | 817 | goto tx_iqcal_fail; |
818 | } | ||
918 | 819 | ||
919 | coeff.mag_coeff[i][im][ip] = | 820 | coeff.mag_coeff[i][im] = coeff.iqc_coeff[0] & 0x7f; |
920 | coeff.iqc_coeff[0] & 0x7f; | 821 | coeff.phs_coeff[i][im] = |
921 | coeff.phs_coeff[i][im][ip] = | 822 | (coeff.iqc_coeff[0] >> 7) & 0x7f; |
922 | (coeff.iqc_coeff[0] >> 7) & 0x7f; | ||
923 | 823 | ||
924 | if (coeff.mag_coeff[i][im][ip] > 63) | 824 | if (coeff.mag_coeff[i][im] > 63) |
925 | coeff.mag_coeff[i][im][ip] -= 128; | 825 | coeff.mag_coeff[i][im] -= 128; |
926 | if (coeff.phs_coeff[i][im][ip] > 63) | 826 | if (coeff.phs_coeff[i][im] > 63) |
927 | coeff.phs_coeff[i][im][ip] -= 128; | 827 | coeff.phs_coeff[i][im] -= 128; |
928 | } | ||
929 | } | 828 | } |
930 | } | 829 | } |
931 | ar9003_hw_tx_iqcal_load_avg_2_passes(ah, num_chains, &coeff); | 830 | ar9003_hw_tx_iqcal_load_avg_2_passes(ah, num_chains, &coeff); |
@@ -940,31 +839,37 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, | |||
940 | struct ath9k_channel *chan) | 839 | struct ath9k_channel *chan) |
941 | { | 840 | { |
942 | struct ath_common *common = ath9k_hw_common(ah); | 841 | struct ath_common *common = ath9k_hw_common(ah); |
842 | struct ath9k_hw_capabilities *pCap = &ah->caps; | ||
943 | int val; | 843 | int val; |
844 | bool txiqcal_done = false; | ||
944 | 845 | ||
945 | val = REG_READ(ah, AR_ENT_OTP); | 846 | val = REG_READ(ah, AR_ENT_OTP); |
946 | ath_dbg(common, ATH_DBG_CALIBRATE, "ath9k: AR_ENT_OTP 0x%x\n", val); | 847 | ath_dbg(common, ATH_DBG_CALIBRATE, "ath9k: AR_ENT_OTP 0x%x\n", val); |
947 | 848 | ||
948 | if (AR_SREV_9485(ah)) | 849 | /* Configure rx/tx chains before running AGC/TxiQ cals */ |
949 | ar9003_hw_set_chain_masks(ah, 0x1, 0x1); | 850 | if (val & AR_ENT_OTP_CHAIN2_DISABLE) |
950 | else if (val & AR_ENT_OTP_CHAIN2_DISABLE) | ||
951 | ar9003_hw_set_chain_masks(ah, 0x3, 0x3); | 851 | ar9003_hw_set_chain_masks(ah, 0x3, 0x3); |
952 | else | 852 | else |
953 | /* | 853 | ar9003_hw_set_chain_masks(ah, pCap->rx_chainmask, |
954 | * 0x7 = 0b111 , AR9003 needs to be configured for 3-chain | 854 | pCap->tx_chainmask); |
955 | * mode before running AGC/TxIQ cals | ||
956 | */ | ||
957 | ar9003_hw_set_chain_masks(ah, 0x7, 0x7); | ||
958 | 855 | ||
959 | /* Do Tx IQ Calibration */ | 856 | /* Do Tx IQ Calibration */ |
960 | if (AR_SREV_9485(ah)) | 857 | REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_1, |
961 | ar9003_hw_tx_iq_cal_run(ah); | 858 | AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT, |
962 | else | 859 | DELPT); |
963 | ar9003_hw_tx_iq_cal(ah); | ||
964 | 860 | ||
965 | REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS); | 861 | /* |
966 | udelay(5); | 862 | * For AR9485 or later chips, TxIQ cal runs as part of |
967 | REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); | 863 | * AGC calibration |
864 | */ | ||
865 | if (AR_SREV_9485_OR_LATER(ah)) | ||
866 | txiqcal_done = true; | ||
867 | else { | ||
868 | txiqcal_done = ar9003_hw_tx_iq_cal_run(ah); | ||
869 | REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS); | ||
870 | udelay(5); | ||
871 | REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); | ||
872 | } | ||
968 | 873 | ||
969 | /* Calibrate the AGC */ | 874 | /* Calibrate the AGC */ |
970 | REG_WRITE(ah, AR_PHY_AGC_CONTROL, | 875 | REG_WRITE(ah, AR_PHY_AGC_CONTROL, |
@@ -979,7 +884,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, | |||
979 | return false; | 884 | return false; |
980 | } | 885 | } |
981 | 886 | ||
982 | if (AR_SREV_9485(ah)) | 887 | if (txiqcal_done) |
983 | ar9003_hw_tx_iq_cal_post_proc(ah); | 888 | ar9003_hw_tx_iq_cal_post_proc(ah); |
984 | 889 | ||
985 | /* Revert chainmasks to their original values before NF cal */ | 890 | /* Revert chainmasks to their original values before NF cal */ |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 6eadf975ae48..fb892e5d141a 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -3217,7 +3217,6 @@ static int ar9300_compress_decision(struct ath_hw *ah, | |||
3217 | u8 *word, int length, int mdata_size) | 3217 | u8 *word, int length, int mdata_size) |
3218 | { | 3218 | { |
3219 | struct ath_common *common = ath9k_hw_common(ah); | 3219 | struct ath_common *common = ath9k_hw_common(ah); |
3220 | u8 *dptr; | ||
3221 | const struct ar9300_eeprom *eep = NULL; | 3220 | const struct ar9300_eeprom *eep = NULL; |
3222 | 3221 | ||
3223 | switch (code) { | 3222 | switch (code) { |
@@ -3235,7 +3234,6 @@ static int ar9300_compress_decision(struct ath_hw *ah, | |||
3235 | break; | 3234 | break; |
3236 | case _CompressBlock: | 3235 | case _CompressBlock: |
3237 | if (reference == 0) { | 3236 | if (reference == 0) { |
3238 | dptr = mptr; | ||
3239 | } else { | 3237 | } else { |
3240 | eep = ar9003_eeprom_struct_find_by_id(reference); | 3238 | eep = ar9003_eeprom_struct_find_by_id(reference); |
3241 | if (eep == NULL) { | 3239 | if (eep == NULL) { |
@@ -3448,9 +3446,13 @@ static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz) | |||
3448 | REG_RMW_FIELD(ah, AR_CH0_TOP2, AR_CH0_TOP2_XPABIASLVL, bias); | 3446 | REG_RMW_FIELD(ah, AR_CH0_TOP2, AR_CH0_TOP2_XPABIASLVL, bias); |
3449 | else { | 3447 | else { |
3450 | REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias); | 3448 | REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias); |
3451 | REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPABIASLVL_MSB, | 3449 | if (!AR_SREV_9340(ah)) { |
3452 | bias >> 2); | 3450 | REG_RMW_FIELD(ah, AR_CH0_THERM, |
3453 | REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPASHORT2GND, 1); | 3451 | AR_CH0_THERM_XPABIASLVL_MSB, |
3452 | bias >> 2); | ||
3453 | REG_RMW_FIELD(ah, AR_CH0_THERM, | ||
3454 | AR_CH0_THERM_XPASHORT2GND, 1); | ||
3455 | } | ||
3454 | } | 3456 | } |
3455 | } | 3457 | } |
3456 | 3458 | ||
@@ -3497,23 +3499,28 @@ static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah, | |||
3497 | 3499 | ||
3498 | static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz) | 3500 | static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz) |
3499 | { | 3501 | { |
3502 | int chain; | ||
3503 | static const u32 switch_chain_reg[AR9300_MAX_CHAINS] = { | ||
3504 | AR_PHY_SWITCH_CHAIN_0, | ||
3505 | AR_PHY_SWITCH_CHAIN_1, | ||
3506 | AR_PHY_SWITCH_CHAIN_2, | ||
3507 | }; | ||
3508 | |||
3500 | u32 value = ar9003_hw_ant_ctrl_common_get(ah, is2ghz); | 3509 | u32 value = ar9003_hw_ant_ctrl_common_get(ah, is2ghz); |
3510 | |||
3501 | REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM, AR_SWITCH_TABLE_COM_ALL, value); | 3511 | REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM, AR_SWITCH_TABLE_COM_ALL, value); |
3502 | 3512 | ||
3503 | value = ar9003_hw_ant_ctrl_common_2_get(ah, is2ghz); | 3513 | value = ar9003_hw_ant_ctrl_common_2_get(ah, is2ghz); |
3504 | REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM_2, AR_SWITCH_TABLE_COM2_ALL, value); | 3514 | REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM_2, AR_SWITCH_TABLE_COM2_ALL, value); |
3505 | 3515 | ||
3506 | value = ar9003_hw_ant_ctrl_chain_get(ah, 0, is2ghz); | 3516 | for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { |
3507 | REG_RMW_FIELD(ah, AR_PHY_SWITCH_CHAIN_0, AR_SWITCH_TABLE_ALL, value); | 3517 | if ((ah->rxchainmask & BIT(chain)) || |
3508 | 3518 | (ah->txchainmask & BIT(chain))) { | |
3509 | if (!AR_SREV_9485(ah)) { | 3519 | value = ar9003_hw_ant_ctrl_chain_get(ah, chain, |
3510 | value = ar9003_hw_ant_ctrl_chain_get(ah, 1, is2ghz); | 3520 | is2ghz); |
3511 | REG_RMW_FIELD(ah, AR_PHY_SWITCH_CHAIN_1, AR_SWITCH_TABLE_ALL, | 3521 | REG_RMW_FIELD(ah, switch_chain_reg[chain], |
3512 | value); | 3522 | AR_SWITCH_TABLE_ALL, value); |
3513 | 3523 | } | |
3514 | value = ar9003_hw_ant_ctrl_chain_get(ah, 2, is2ghz); | ||
3515 | REG_RMW_FIELD(ah, AR_PHY_SWITCH_CHAIN_2, AR_SWITCH_TABLE_ALL, | ||
3516 | value); | ||
3517 | } | 3524 | } |
3518 | 3525 | ||
3519 | if (AR_SREV_9485(ah)) { | 3526 | if (AR_SREV_9485(ah)) { |
@@ -3634,13 +3641,16 @@ static void ar9003_hw_atten_apply(struct ath_hw *ah, struct ath9k_channel *chan) | |||
3634 | 3641 | ||
3635 | /* Test value. if 0 then attenuation is unused. Don't load anything. */ | 3642 | /* Test value. if 0 then attenuation is unused. Don't load anything. */ |
3636 | for (i = 0; i < 3; i++) { | 3643 | for (i = 0; i < 3; i++) { |
3637 | value = ar9003_hw_atten_chain_get(ah, i, chan); | 3644 | if (ah->txchainmask & BIT(i)) { |
3638 | REG_RMW_FIELD(ah, ext_atten_reg[i], | 3645 | value = ar9003_hw_atten_chain_get(ah, i, chan); |
3639 | AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB, value); | 3646 | REG_RMW_FIELD(ah, ext_atten_reg[i], |
3640 | 3647 | AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB, value); | |
3641 | value = ar9003_hw_atten_chain_get_margin(ah, i, chan); | 3648 | |
3642 | REG_RMW_FIELD(ah, ext_atten_reg[i], | 3649 | value = ar9003_hw_atten_chain_get_margin(ah, i, chan); |
3643 | AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN, value); | 3650 | REG_RMW_FIELD(ah, ext_atten_reg[i], |
3651 | AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN, | ||
3652 | value); | ||
3653 | } | ||
3644 | } | 3654 | } |
3645 | } | 3655 | } |
3646 | 3656 | ||
@@ -3749,8 +3759,9 @@ static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah, | |||
3749 | ar9003_hw_ant_ctrl_apply(ah, IS_CHAN_2GHZ(chan)); | 3759 | ar9003_hw_ant_ctrl_apply(ah, IS_CHAN_2GHZ(chan)); |
3750 | ar9003_hw_drive_strength_apply(ah); | 3760 | ar9003_hw_drive_strength_apply(ah); |
3751 | ar9003_hw_atten_apply(ah, chan); | 3761 | ar9003_hw_atten_apply(ah, chan); |
3752 | ar9003_hw_internal_regulator_apply(ah); | 3762 | if (!AR_SREV_9340(ah)) |
3753 | if (AR_SREV_9485(ah)) | 3763 | ar9003_hw_internal_regulator_apply(ah); |
3764 | if (AR_SREV_9485(ah) || AR_SREV_9340(ah)) | ||
3754 | ar9003_hw_apply_tuning_caps(ah); | 3765 | ar9003_hw_apply_tuning_caps(ah); |
3755 | } | 3766 | } |
3756 | 3767 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c index aebaad97b190..a55eddbb2589 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include "ar9003_mac.h" | 18 | #include "ar9003_mac.h" |
19 | #include "ar9003_2p2_initvals.h" | 19 | #include "ar9003_2p2_initvals.h" |
20 | #include "ar9485_initvals.h" | 20 | #include "ar9485_initvals.h" |
21 | #include "ar9340_initvals.h" | ||
21 | 22 | ||
22 | /* General hardware code for the AR9003 hadware family */ | 23 | /* General hardware code for the AR9003 hadware family */ |
23 | 24 | ||
@@ -28,7 +29,63 @@ | |||
28 | */ | 29 | */ |
29 | static void ar9003_hw_init_mode_regs(struct ath_hw *ah) | 30 | static void ar9003_hw_init_mode_regs(struct ath_hw *ah) |
30 | { | 31 | { |
31 | if (AR_SREV_9485_11(ah)) { | 32 | if (AR_SREV_9340(ah)) { |
33 | /* mac */ | ||
34 | INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0); | ||
35 | INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], | ||
36 | ar9340_1p0_mac_core, | ||
37 | ARRAY_SIZE(ar9340_1p0_mac_core), 2); | ||
38 | INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], | ||
39 | ar9340_1p0_mac_postamble, | ||
40 | ARRAY_SIZE(ar9340_1p0_mac_postamble), 5); | ||
41 | |||
42 | /* bb */ | ||
43 | INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0); | ||
44 | INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], | ||
45 | ar9340_1p0_baseband_core, | ||
46 | ARRAY_SIZE(ar9340_1p0_baseband_core), 2); | ||
47 | INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], | ||
48 | ar9340_1p0_baseband_postamble, | ||
49 | ARRAY_SIZE(ar9340_1p0_baseband_postamble), 5); | ||
50 | |||
51 | /* radio */ | ||
52 | INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0); | ||
53 | INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], | ||
54 | ar9340_1p0_radio_core, | ||
55 | ARRAY_SIZE(ar9340_1p0_radio_core), 2); | ||
56 | INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], | ||
57 | ar9340_1p0_radio_postamble, | ||
58 | ARRAY_SIZE(ar9340_1p0_radio_postamble), 5); | ||
59 | |||
60 | /* soc */ | ||
61 | INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], | ||
62 | ar9340_1p0_soc_preamble, | ||
63 | ARRAY_SIZE(ar9340_1p0_soc_preamble), 2); | ||
64 | INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0); | ||
65 | INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], | ||
66 | ar9340_1p0_soc_postamble, | ||
67 | ARRAY_SIZE(ar9340_1p0_soc_postamble), 5); | ||
68 | |||
69 | /* rx/tx gain */ | ||
70 | INIT_INI_ARRAY(&ah->iniModesRxGain, | ||
71 | ar9340Common_wo_xlna_rx_gain_table_1p0, | ||
72 | ARRAY_SIZE(ar9340Common_wo_xlna_rx_gain_table_1p0), | ||
73 | 5); | ||
74 | INIT_INI_ARRAY(&ah->iniModesTxGain, | ||
75 | ar9340Modes_high_ob_db_tx_gain_table_1p0, | ||
76 | ARRAY_SIZE(ar9340Modes_high_ob_db_tx_gain_table_1p0), | ||
77 | 5); | ||
78 | |||
79 | INIT_INI_ARRAY(&ah->iniModesAdditional, | ||
80 | ar9340Modes_fast_clock_1p0, | ||
81 | ARRAY_SIZE(ar9340Modes_fast_clock_1p0), | ||
82 | 3); | ||
83 | |||
84 | INIT_INI_ARRAY(&ah->iniModesAdditional_40M, | ||
85 | ar9340_1p0_radio_core_40M, | ||
86 | ARRAY_SIZE(ar9340_1p0_radio_core_40M), | ||
87 | 2); | ||
88 | } else if (AR_SREV_9485_11(ah)) { | ||
32 | /* mac */ | 89 | /* mac */ |
33 | INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0); | 90 | INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0); |
34 | INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], | 91 | INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], |
@@ -163,7 +220,12 @@ static void ar9003_tx_gain_table_apply(struct ath_hw *ah) | |||
163 | switch (ar9003_hw_get_tx_gain_idx(ah)) { | 220 | switch (ar9003_hw_get_tx_gain_idx(ah)) { |
164 | case 0: | 221 | case 0: |
165 | default: | 222 | default: |
166 | if (AR_SREV_9485_11(ah)) | 223 | if (AR_SREV_9340(ah)) |
224 | INIT_INI_ARRAY(&ah->iniModesTxGain, | ||
225 | ar9340Modes_lowest_ob_db_tx_gain_table_1p0, | ||
226 | ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0), | ||
227 | 5); | ||
228 | else if (AR_SREV_9485_11(ah)) | ||
167 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 229 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
168 | ar9485_modes_lowest_ob_db_tx_gain_1_1, | 230 | ar9485_modes_lowest_ob_db_tx_gain_1_1, |
169 | ARRAY_SIZE(ar9485_modes_lowest_ob_db_tx_gain_1_1), | 231 | ARRAY_SIZE(ar9485_modes_lowest_ob_db_tx_gain_1_1), |
@@ -175,7 +237,12 @@ static void ar9003_tx_gain_table_apply(struct ath_hw *ah) | |||
175 | 5); | 237 | 5); |
176 | break; | 238 | break; |
177 | case 1: | 239 | case 1: |
178 | if (AR_SREV_9485_11(ah)) | 240 | if (AR_SREV_9340(ah)) |
241 | INIT_INI_ARRAY(&ah->iniModesTxGain, | ||
242 | ar9340Modes_lowest_ob_db_tx_gain_table_1p0, | ||
243 | ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0), | ||
244 | 5); | ||
245 | else if (AR_SREV_9485_11(ah)) | ||
179 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 246 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
180 | ar9485Modes_high_ob_db_tx_gain_1_1, | 247 | ar9485Modes_high_ob_db_tx_gain_1_1, |
181 | ARRAY_SIZE(ar9485Modes_high_ob_db_tx_gain_1_1), | 248 | ARRAY_SIZE(ar9485Modes_high_ob_db_tx_gain_1_1), |
@@ -187,7 +254,12 @@ static void ar9003_tx_gain_table_apply(struct ath_hw *ah) | |||
187 | 5); | 254 | 5); |
188 | break; | 255 | break; |
189 | case 2: | 256 | case 2: |
190 | if (AR_SREV_9485_11(ah)) | 257 | if (AR_SREV_9340(ah)) |
258 | INIT_INI_ARRAY(&ah->iniModesTxGain, | ||
259 | ar9340Modes_lowest_ob_db_tx_gain_table_1p0, | ||
260 | ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0), | ||
261 | 5); | ||
262 | else if (AR_SREV_9485_11(ah)) | ||
191 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 263 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
192 | ar9485Modes_low_ob_db_tx_gain_1_1, | 264 | ar9485Modes_low_ob_db_tx_gain_1_1, |
193 | ARRAY_SIZE(ar9485Modes_low_ob_db_tx_gain_1_1), | 265 | ARRAY_SIZE(ar9485Modes_low_ob_db_tx_gain_1_1), |
@@ -199,7 +271,12 @@ static void ar9003_tx_gain_table_apply(struct ath_hw *ah) | |||
199 | 5); | 271 | 5); |
200 | break; | 272 | break; |
201 | case 3: | 273 | case 3: |
202 | if (AR_SREV_9485_11(ah)) | 274 | if (AR_SREV_9340(ah)) |
275 | INIT_INI_ARRAY(&ah->iniModesTxGain, | ||
276 | ar9340Modes_lowest_ob_db_tx_gain_table_1p0, | ||
277 | ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0), | ||
278 | 5); | ||
279 | else if (AR_SREV_9485_11(ah)) | ||
203 | INIT_INI_ARRAY(&ah->iniModesTxGain, | 280 | INIT_INI_ARRAY(&ah->iniModesTxGain, |
204 | ar9485Modes_high_power_tx_gain_1_1, | 281 | ar9485Modes_high_power_tx_gain_1_1, |
205 | ARRAY_SIZE(ar9485Modes_high_power_tx_gain_1_1), | 282 | ARRAY_SIZE(ar9485Modes_high_power_tx_gain_1_1), |
@@ -218,7 +295,12 @@ static void ar9003_rx_gain_table_apply(struct ath_hw *ah) | |||
218 | switch (ar9003_hw_get_rx_gain_idx(ah)) { | 295 | switch (ar9003_hw_get_rx_gain_idx(ah)) { |
219 | case 0: | 296 | case 0: |
220 | default: | 297 | default: |
221 | if (AR_SREV_9485_11(ah)) | 298 | if (AR_SREV_9340(ah)) |
299 | INIT_INI_ARRAY(&ah->iniModesRxGain, | ||
300 | ar9340Common_rx_gain_table_1p0, | ||
301 | ARRAY_SIZE(ar9340Common_rx_gain_table_1p0), | ||
302 | 2); | ||
303 | else if (AR_SREV_9485_11(ah)) | ||
222 | INIT_INI_ARRAY(&ah->iniModesRxGain, | 304 | INIT_INI_ARRAY(&ah->iniModesRxGain, |
223 | ar9485Common_wo_xlna_rx_gain_1_1, | 305 | ar9485Common_wo_xlna_rx_gain_1_1, |
224 | ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1), | 306 | ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1), |
@@ -230,7 +312,12 @@ static void ar9003_rx_gain_table_apply(struct ath_hw *ah) | |||
230 | 2); | 312 | 2); |
231 | break; | 313 | break; |
232 | case 1: | 314 | case 1: |
233 | if (AR_SREV_9485_11(ah)) | 315 | if (AR_SREV_9340(ah)) |
316 | INIT_INI_ARRAY(&ah->iniModesRxGain, | ||
317 | ar9340Common_wo_xlna_rx_gain_table_1p0, | ||
318 | ARRAY_SIZE(ar9340Common_wo_xlna_rx_gain_table_1p0), | ||
319 | 2); | ||
320 | else if (AR_SREV_9485_11(ah)) | ||
234 | INIT_INI_ARRAY(&ah->iniModesRxGain, | 321 | INIT_INI_ARRAY(&ah->iniModesRxGain, |
235 | ar9485Common_wo_xlna_rx_gain_1_1, | 322 | ar9485Common_wo_xlna_rx_gain_1_1, |
236 | ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1), | 323 | ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1), |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 1bc33f51e466..c83be2dd5718 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -86,14 +86,31 @@ static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan) | |||
86 | channelSel = (freq * 4) / 120; | 86 | channelSel = (freq * 4) / 120; |
87 | chan_frac = (((freq * 4) % 120) * 0x20000) / 120; | 87 | chan_frac = (((freq * 4) % 120) * 0x20000) / 120; |
88 | channelSel = (channelSel << 17) | chan_frac; | 88 | channelSel = (channelSel << 17) | chan_frac; |
89 | } else if (AR_SREV_9340(ah)) { | ||
90 | if (ah->is_clk_25mhz) { | ||
91 | u32 chan_frac; | ||
92 | |||
93 | channelSel = (freq * 2) / 75; | ||
94 | chan_frac = (((freq * 2) % 75) * 0x20000) / 75; | ||
95 | channelSel = (channelSel << 17) | chan_frac; | ||
96 | } else | ||
97 | channelSel = CHANSEL_2G(freq) >> 1; | ||
89 | } else | 98 | } else |
90 | channelSel = CHANSEL_2G(freq); | 99 | channelSel = CHANSEL_2G(freq); |
91 | /* Set to 2G mode */ | 100 | /* Set to 2G mode */ |
92 | bMode = 1; | 101 | bMode = 1; |
93 | } else { | 102 | } else { |
94 | channelSel = CHANSEL_5G(freq); | 103 | if (AR_SREV_9340(ah) && ah->is_clk_25mhz) { |
95 | /* Doubler is ON, so, divide channelSel by 2. */ | 104 | u32 chan_frac; |
96 | channelSel >>= 1; | 105 | |
106 | channelSel = (freq * 2) / 75; | ||
107 | chan_frac = ((freq % 75) * 0x20000) / 75; | ||
108 | channelSel = (channelSel << 17) | chan_frac; | ||
109 | } else { | ||
110 | channelSel = CHANSEL_5G(freq); | ||
111 | /* Doubler is ON, so, divide channelSel by 2. */ | ||
112 | channelSel >>= 1; | ||
113 | } | ||
97 | /* Set to 5G mode */ | 114 | /* Set to 5G mode */ |
98 | bMode = 0; | 115 | bMode = 0; |
99 | } | 116 | } |
@@ -151,7 +168,7 @@ static void ar9003_hw_spur_mitigate_mrc_cck(struct ath_hw *ah, | |||
151 | * is out-of-band and can be ignored. | 168 | * is out-of-band and can be ignored. |
152 | */ | 169 | */ |
153 | 170 | ||
154 | if (AR_SREV_9485(ah)) { | 171 | if (AR_SREV_9485(ah) || AR_SREV_9340(ah)) { |
155 | spur_fbin_ptr = ar9003_get_spur_chan_ptr(ah, | 172 | spur_fbin_ptr = ar9003_get_spur_chan_ptr(ah, |
156 | IS_CHAN_2GHZ(chan)); | 173 | IS_CHAN_2GHZ(chan)); |
157 | if (spur_fbin_ptr[0] == 0) /* No spur */ | 174 | if (spur_fbin_ptr[0] == 0) /* No spur */ |
@@ -176,7 +193,7 @@ static void ar9003_hw_spur_mitigate_mrc_cck(struct ath_hw *ah, | |||
176 | 193 | ||
177 | for (i = 0; i < max_spur_cnts; i++) { | 194 | for (i = 0; i < max_spur_cnts; i++) { |
178 | negative = 0; | 195 | negative = 0; |
179 | if (AR_SREV_9485(ah)) | 196 | if (AR_SREV_9485(ah) || AR_SREV_9340(ah)) |
180 | cur_bb_spur = FBIN2FREQ(spur_fbin_ptr[i], | 197 | cur_bb_spur = FBIN2FREQ(spur_fbin_ptr[i], |
181 | IS_CHAN_2GHZ(chan)) - synth_freq; | 198 | IS_CHAN_2GHZ(chan)) - synth_freq; |
182 | else | 199 | else |
@@ -599,29 +616,25 @@ static int ar9003_hw_process_ini(struct ath_hw *ah, | |||
599 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | 616 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); |
600 | unsigned int regWrites = 0, i; | 617 | unsigned int regWrites = 0, i; |
601 | struct ieee80211_channel *channel = chan->chan; | 618 | struct ieee80211_channel *channel = chan->chan; |
602 | u32 modesIndex, freqIndex; | 619 | u32 modesIndex; |
603 | 620 | ||
604 | switch (chan->chanmode) { | 621 | switch (chan->chanmode) { |
605 | case CHANNEL_A: | 622 | case CHANNEL_A: |
606 | case CHANNEL_A_HT20: | 623 | case CHANNEL_A_HT20: |
607 | modesIndex = 1; | 624 | modesIndex = 1; |
608 | freqIndex = 1; | ||
609 | break; | 625 | break; |
610 | case CHANNEL_A_HT40PLUS: | 626 | case CHANNEL_A_HT40PLUS: |
611 | case CHANNEL_A_HT40MINUS: | 627 | case CHANNEL_A_HT40MINUS: |
612 | modesIndex = 2; | 628 | modesIndex = 2; |
613 | freqIndex = 1; | ||
614 | break; | 629 | break; |
615 | case CHANNEL_G: | 630 | case CHANNEL_G: |
616 | case CHANNEL_G_HT20: | 631 | case CHANNEL_G_HT20: |
617 | case CHANNEL_B: | 632 | case CHANNEL_B: |
618 | modesIndex = 4; | 633 | modesIndex = 4; |
619 | freqIndex = 2; | ||
620 | break; | 634 | break; |
621 | case CHANNEL_G_HT40PLUS: | 635 | case CHANNEL_G_HT40PLUS: |
622 | case CHANNEL_G_HT40MINUS: | 636 | case CHANNEL_G_HT40MINUS: |
623 | modesIndex = 3; | 637 | modesIndex = 3; |
624 | freqIndex = 2; | ||
625 | break; | 638 | break; |
626 | 639 | ||
627 | default: | 640 | default: |
@@ -646,6 +659,9 @@ static int ar9003_hw_process_ini(struct ath_hw *ah, | |||
646 | REG_WRITE_ARRAY(&ah->iniModesAdditional, | 659 | REG_WRITE_ARRAY(&ah->iniModesAdditional, |
647 | modesIndex, regWrites); | 660 | modesIndex, regWrites); |
648 | 661 | ||
662 | if (AR_SREV_9340(ah) && !ah->is_clk_25mhz) | ||
663 | REG_WRITE_ARRAY(&ah->iniModesAdditional_40M, 1, regWrites); | ||
664 | |||
649 | ar9003_hw_override_ini(ah); | 665 | ar9003_hw_override_ini(ah); |
650 | ar9003_hw_set_channel_regs(ah, chan); | 666 | ar9003_hw_set_channel_regs(ah, chan); |
651 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); | 667 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h index 8bdda2cf9dd7..2a0d5cbb7e76 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h | |||
@@ -548,15 +548,12 @@ | |||
548 | 548 | ||
549 | #define AR_PHY_TXGAIN_TABLE (AR_SM_BASE + 0x300) | 549 | #define AR_PHY_TXGAIN_TABLE (AR_SM_BASE + 0x300) |
550 | 550 | ||
551 | #define AR_PHY_TX_IQCAL_START_9485 (AR_SM_BASE + 0x3c4) | 551 | #define AR_PHY_TX_IQCAL_CONTROL_1 (AR_SM_BASE + AR_SREV_9485(ah) ? \ |
552 | #define AR_PHY_TX_IQCAL_START_DO_CAL_9485 0x80000000 | 552 | 0x3c8 : 0x448) |
553 | #define AR_PHY_TX_IQCAL_START_DO_CAL_9485_S 31 | 553 | #define AR_PHY_TX_IQCAL_START (AR_SM_BASE + AR_SREV_9485(ah) ? \ |
554 | #define AR_PHY_TX_IQCAL_CONTROL_1_9485 (AR_SM_BASE + 0x3c8) | 554 | 0x3c4 : 0x440) |
555 | #define AR_PHY_TX_IQCAL_STATUS_B0_9485 (AR_SM_BASE + 0x3f0) | 555 | #define AR_PHY_TX_IQCAL_STATUS_B0 (AR_SM_BASE + AR_SREV_9485(ah) ? \ |
556 | 556 | 0x3f0 : 0x48c) | |
557 | #define AR_PHY_TX_IQCAL_CONTROL_1 (AR_SM_BASE + 0x448) | ||
558 | #define AR_PHY_TX_IQCAL_START (AR_SM_BASE + 0x440) | ||
559 | #define AR_PHY_TX_IQCAL_STATUS_B0 (AR_SM_BASE + 0x48c) | ||
560 | #define AR_PHY_TX_IQCAL_CORR_COEFF_B0(_i) (AR_SM_BASE + \ | 557 | #define AR_PHY_TX_IQCAL_CORR_COEFF_B0(_i) (AR_SM_BASE + \ |
561 | (AR_SREV_9485(ah) ? \ | 558 | (AR_SREV_9485(ah) ? \ |
562 | 0x3d0 : 0x450) + ((_i) << 2)) | 559 | 0x3d0 : 0x450) + ((_i) << 2)) |
@@ -588,7 +585,7 @@ | |||
588 | #define AR_PHY_65NM_CH0_BIAS2 0x160c4 | 585 | #define AR_PHY_65NM_CH0_BIAS2 0x160c4 |
589 | #define AR_PHY_65NM_CH0_BIAS4 0x160cc | 586 | #define AR_PHY_65NM_CH0_BIAS4 0x160cc |
590 | #define AR_PHY_65NM_CH0_RXTX4 0x1610c | 587 | #define AR_PHY_65NM_CH0_RXTX4 0x1610c |
591 | #define AR_PHY_65NM_CH0_THERM (AR_SREV_9485(ah) ? 0x1628c : 0x16290) | 588 | #define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 : 0x1628c) |
592 | 589 | ||
593 | #define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000 | 590 | #define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000 |
594 | #define AR_PHY_65NM_CH0_THERM_LOCAL_S 31 | 591 | #define AR_PHY_65NM_CH0_THERM_LOCAL_S 31 |
@@ -758,10 +755,10 @@ | |||
758 | #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 | 755 | #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 |
759 | #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 | 756 | #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 |
760 | #define AR_PHY_CHANNEL_STATUS_RX_CLEAR 0x00000004 | 757 | #define AR_PHY_CHANNEL_STATUS_RX_CLEAR 0x00000004 |
761 | #define AR_PHY_TX_IQCAQL_CONTROL_1_IQCORR_I_Q_COFF_DELPT 0x01fc0000 | 758 | #define AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT 0x01fc0000 |
762 | #define AR_PHY_TX_IQCAQL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_S 18 | 759 | #define AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_S 18 |
763 | #define AR_PHY_TX_IQCAL_START_DO_CAL 0x00000001 | 760 | #define AR_PHY_TX_IQCAL_START_DO_CAL 0x00000001 |
764 | #define AR_PHY_TX_IQCAL_START_DO_CAL_S 0 | 761 | #define AR_PHY_TX_IQCAL_START_DO_CAL_S 0 |
765 | 762 | ||
766 | #define AR_PHY_TX_IQCAL_STATUS_FAILED 0x00000001 | 763 | #define AR_PHY_TX_IQCAL_STATUS_FAILED 0x00000001 |
767 | #define AR_PHY_CALIBRATED_GAINS_0 0x3e | 764 | #define AR_PHY_CALIBRATED_GAINS_0 0x3e |
diff --git a/drivers/net/wireless/ath/ath9k/ar9340_initvals.h b/drivers/net/wireless/ath/ath9k/ar9340_initvals.h new file mode 100644 index 000000000000..815a8af1beef --- /dev/null +++ b/drivers/net/wireless/ath/ath9k/ar9340_initvals.h | |||
@@ -0,0 +1,1525 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Atheros Communications Inc. | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | #ifndef INITVALS_9340_H | ||
18 | #define INITVALS_9340_H | ||
19 | |||
20 | static const u32 ar9340_1p0_radio_postamble[][5] = { | ||
21 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
22 | {0x000160ac, 0xa4646800, 0xa4646800, 0xa4646800, 0xa4646800}, | ||
23 | {0x0001610c, 0x08000000, 0x08000000, 0x00000000, 0x00000000}, | ||
24 | {0x00016140, 0x10804000, 0x10804000, 0x50804000, 0x50804000}, | ||
25 | {0x0001650c, 0x08000000, 0x08000000, 0x00000000, 0x00000000}, | ||
26 | {0x00016540, 0x10804000, 0x10804000, 0x50804000, 0x50804000}, | ||
27 | }; | ||
28 | |||
29 | static const u32 ar9340Modes_lowest_ob_db_tx_gain_table_1p0[][5] = { | ||
30 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
31 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | ||
32 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
33 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, | ||
34 | {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, | ||
35 | {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, | ||
36 | {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, | ||
37 | {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, | ||
38 | {0x0000a518, 0x21020220, 0x21020220, 0x16000402, 0x16000402}, | ||
39 | {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404}, | ||
40 | {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, | ||
41 | {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, | ||
42 | {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, | ||
43 | {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, | ||
44 | {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, | ||
45 | {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, | ||
46 | {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, | ||
47 | {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, | ||
48 | {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, | ||
49 | {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861}, | ||
50 | {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81}, | ||
51 | {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x47001a83, 0x47001a83}, | ||
52 | {0x0000a550, 0x61042a6c, 0x61042a6c, 0x4a001c84, 0x4a001c84}, | ||
53 | {0x0000a554, 0x66062a6c, 0x66062a6c, 0x4e001ce3, 0x4e001ce3}, | ||
54 | {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x52001ce5, 0x52001ce5}, | ||
55 | {0x0000a55c, 0x7006308c, 0x7006308c, 0x56001ce9, 0x56001ce9}, | ||
56 | {0x0000a560, 0x730a308a, 0x730a308a, 0x5a001ceb, 0x5a001ceb}, | ||
57 | {0x0000a564, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
58 | {0x0000a568, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
59 | {0x0000a56c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
60 | {0x0000a570, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
61 | {0x0000a574, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
62 | {0x0000a578, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
63 | {0x0000a57c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
64 | {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, | ||
65 | {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, | ||
66 | {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, | ||
67 | {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, | ||
68 | {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, | ||
69 | {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, | ||
70 | {0x0000a598, 0x21820220, 0x21820220, 0x16800402, 0x16800402}, | ||
71 | {0x0000a59c, 0x27820223, 0x27820223, 0x19800404, 0x19800404}, | ||
72 | {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, | ||
73 | {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, | ||
74 | {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, | ||
75 | {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, | ||
76 | {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, | ||
77 | {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, | ||
78 | {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, | ||
79 | {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, | ||
80 | {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, | ||
81 | {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861}, | ||
82 | {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81}, | ||
83 | {0x0000a5cc, 0x5c84286b, 0x5c84286b, 0x47801a83, 0x47801a83}, | ||
84 | {0x0000a5d0, 0x61842a6c, 0x61842a6c, 0x4a801c84, 0x4a801c84}, | ||
85 | {0x0000a5d4, 0x66862a6c, 0x66862a6c, 0x4e801ce3, 0x4e801ce3}, | ||
86 | {0x0000a5d8, 0x6b862e6c, 0x6b862e6c, 0x52801ce5, 0x52801ce5}, | ||
87 | {0x0000a5dc, 0x7086308c, 0x7086308c, 0x56801ce9, 0x56801ce9}, | ||
88 | {0x0000a5e0, 0x738a308a, 0x738a308a, 0x5a801ceb, 0x5a801ceb}, | ||
89 | {0x0000a5e4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
90 | {0x0000a5e8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
91 | {0x0000a5ec, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
92 | {0x0000a5f0, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
93 | {0x0000a5f4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
94 | {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
95 | {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
96 | {0x00016044, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, | ||
97 | {0x00016048, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, | ||
98 | {0x00016444, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, | ||
99 | {0x00016448, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, | ||
100 | }; | ||
101 | |||
102 | static const u32 ar9340Modes_fast_clock_1p0[][3] = { | ||
103 | /* Addr 5G_HT20 5G_HT40 */ | ||
104 | {0x00001030, 0x00000268, 0x000004d0}, | ||
105 | {0x00001070, 0x0000018c, 0x00000318}, | ||
106 | {0x000010b0, 0x00000fd0, 0x00001fa0}, | ||
107 | {0x00008014, 0x044c044c, 0x08980898}, | ||
108 | {0x0000801c, 0x148ec02b, 0x148ec057}, | ||
109 | {0x00008318, 0x000044c0, 0x00008980}, | ||
110 | {0x00009e00, 0x03721821, 0x03721821}, | ||
111 | {0x0000a230, 0x0000000b, 0x00000016}, | ||
112 | {0x0000a254, 0x00000898, 0x00001130}, | ||
113 | }; | ||
114 | |||
115 | static const u32 ar9340_1p0_radio_core[][2] = { | ||
116 | /* Addr allmodes */ | ||
117 | {0x00016000, 0x36db6db6}, | ||
118 | {0x00016004, 0x6db6db40}, | ||
119 | {0x00016008, 0x73f00000}, | ||
120 | {0x0001600c, 0x00000000}, | ||
121 | {0x00016040, 0x7f80fff8}, | ||
122 | {0x00016044, 0x03b6d2db}, | ||
123 | {0x00016048, 0x24925266}, | ||
124 | {0x0001604c, 0x000f0278}, | ||
125 | {0x00016050, 0x6db6db6c}, | ||
126 | {0x00016054, 0x6db60000}, | ||
127 | {0x00016080, 0x00080000}, | ||
128 | {0x00016084, 0x0e48048c}, | ||
129 | {0x00016088, 0x14214514}, | ||
130 | {0x0001608c, 0x119f081c}, | ||
131 | {0x00016090, 0x24926490}, | ||
132 | {0x00016094, 0x00000000}, | ||
133 | {0x00016098, 0xd411eb84}, | ||
134 | {0x0001609c, 0x03e47f32}, | ||
135 | {0x000160a0, 0xc2108ffe}, | ||
136 | {0x000160a4, 0x812fc370}, | ||
137 | {0x000160a8, 0x423c8000}, | ||
138 | {0x000160ac, 0xa4646800}, | ||
139 | {0x000160b0, 0x00fe7f46}, | ||
140 | {0x000160b4, 0x92480000}, | ||
141 | {0x000160c0, 0x006db6db}, | ||
142 | {0x000160c4, 0x6db6db60}, | ||
143 | {0x000160c8, 0x6db6db6c}, | ||
144 | {0x000160cc, 0x6de6db6c}, | ||
145 | {0x000160d0, 0xb6da4924}, | ||
146 | {0x00016100, 0x04cb0001}, | ||
147 | {0x00016104, 0xfff80000}, | ||
148 | {0x00016108, 0x00080010}, | ||
149 | {0x0001610c, 0x00000000}, | ||
150 | {0x00016140, 0x50804008}, | ||
151 | {0x00016144, 0x01884080}, | ||
152 | {0x00016148, 0x000080c0}, | ||
153 | {0x00016280, 0x01000015}, | ||
154 | {0x00016284, 0x05530000}, | ||
155 | {0x00016288, 0x00318000}, | ||
156 | {0x0001628c, 0x50000000}, | ||
157 | {0x00016290, 0x4080294f}, | ||
158 | {0x00016380, 0x00000000}, | ||
159 | {0x00016384, 0x00000000}, | ||
160 | {0x00016388, 0x00800700}, | ||
161 | {0x0001638c, 0x00800700}, | ||
162 | {0x00016390, 0x00800700}, | ||
163 | {0x00016394, 0x00000000}, | ||
164 | {0x00016398, 0x00000000}, | ||
165 | {0x0001639c, 0x00000000}, | ||
166 | {0x000163a0, 0x00000001}, | ||
167 | {0x000163a4, 0x00000001}, | ||
168 | {0x000163a8, 0x00000000}, | ||
169 | {0x000163ac, 0x00000000}, | ||
170 | {0x000163b0, 0x00000000}, | ||
171 | {0x000163b4, 0x00000000}, | ||
172 | {0x000163b8, 0x00000000}, | ||
173 | {0x000163bc, 0x00000000}, | ||
174 | {0x000163c0, 0x000000a0}, | ||
175 | {0x000163c4, 0x000c0000}, | ||
176 | {0x000163c8, 0x14021402}, | ||
177 | {0x000163cc, 0x00001402}, | ||
178 | {0x000163d0, 0x00000000}, | ||
179 | {0x000163d4, 0x00000000}, | ||
180 | {0x00016400, 0x36db6db6}, | ||
181 | {0x00016404, 0x6db6db40}, | ||
182 | {0x00016408, 0x73f00000}, | ||
183 | {0x0001640c, 0x00000000}, | ||
184 | {0x00016440, 0x7f80fff8}, | ||
185 | {0x00016444, 0x03b6d2db}, | ||
186 | {0x00016448, 0x24927266}, | ||
187 | {0x0001644c, 0x000f0278}, | ||
188 | {0x00016450, 0x6db6db6c}, | ||
189 | {0x00016454, 0x6db60000}, | ||
190 | {0x00016500, 0x04cb0001}, | ||
191 | {0x00016504, 0xfff80000}, | ||
192 | {0x00016508, 0x00080010}, | ||
193 | {0x0001650c, 0x00000000}, | ||
194 | {0x00016540, 0x50804008}, | ||
195 | {0x00016544, 0x01884080}, | ||
196 | {0x00016548, 0x000080c0}, | ||
197 | {0x00016780, 0x00000000}, | ||
198 | {0x00016784, 0x00000000}, | ||
199 | {0x00016788, 0x00800700}, | ||
200 | {0x0001678c, 0x00800700}, | ||
201 | {0x00016790, 0x00800700}, | ||
202 | {0x00016794, 0x00000000}, | ||
203 | {0x00016798, 0x00000000}, | ||
204 | {0x0001679c, 0x00000000}, | ||
205 | {0x000167a0, 0x00000001}, | ||
206 | {0x000167a4, 0x00000001}, | ||
207 | {0x000167a8, 0x00000000}, | ||
208 | {0x000167ac, 0x00000000}, | ||
209 | {0x000167b0, 0x00000000}, | ||
210 | {0x000167b4, 0x00000000}, | ||
211 | {0x000167b8, 0x00000000}, | ||
212 | {0x000167bc, 0x00000000}, | ||
213 | {0x000167c0, 0x000000a0}, | ||
214 | {0x000167c4, 0x000c0000}, | ||
215 | {0x000167c8, 0x14021402}, | ||
216 | {0x000167cc, 0x00001402}, | ||
217 | {0x000167d0, 0x00000000}, | ||
218 | {0x000167d4, 0x00000000}, | ||
219 | }; | ||
220 | |||
221 | static const u32 ar9340_1p0_radio_core_40M[][2] = { | ||
222 | {0x0001609c, 0x02566f3a}, | ||
223 | {0x000160ac, 0xa4647c00}, | ||
224 | {0x000160b0, 0x01885f5a}, | ||
225 | }; | ||
226 | |||
227 | static const u32 ar9340_1p0_mac_postamble[][5] = { | ||
228 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
229 | {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, | ||
230 | {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, | ||
231 | {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, | ||
232 | {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, | ||
233 | {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, | ||
234 | {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, | ||
235 | {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, | ||
236 | {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, | ||
237 | }; | ||
238 | |||
239 | static const u32 ar9340_1p0_soc_postamble[][5] = { | ||
240 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
241 | {0x00007010, 0x00000023, 0x00000023, 0x00000023, 0x00000023}, | ||
242 | }; | ||
243 | |||
244 | static const u32 ar9340_1p0_baseband_postamble[][5] = { | ||
245 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
246 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011}, | ||
247 | {0x00009820, 0x206a022e, 0x206a022e, 0x206a022e, 0x206a022e}, | ||
248 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, | ||
249 | {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, | ||
250 | {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, | ||
251 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, | ||
252 | {0x00009c00, 0x00000044, 0x000000c4, 0x000000c4, 0x00000044}, | ||
253 | {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, | ||
254 | {0x00009e04, 0x00182020, 0x00182020, 0x00182020, 0x00182020}, | ||
255 | {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, | ||
256 | {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec88d2e, 0x7ec88d2e}, | ||
257 | {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, | ||
258 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
259 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, | ||
260 | {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, | ||
261 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, | ||
262 | {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27}, | ||
263 | {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, | ||
264 | {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, | ||
265 | {0x0000a204, 0x00003fc0, 0x00003fc4, 0x00003fc4, 0x00003fc0}, | ||
266 | {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, | ||
267 | {0x0000a230, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b}, | ||
268 | {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, | ||
269 | {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, | ||
270 | {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, | ||
271 | {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, | ||
272 | {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, | ||
273 | {0x0000a260, 0x0a021501, 0x0a021501, 0x3a021501, 0x3a021501}, | ||
274 | {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, | ||
275 | {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, | ||
276 | {0x0000a284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, | ||
277 | {0x0000a288, 0x00000220, 0x00000220, 0x00000110, 0x00000110}, | ||
278 | {0x0000a28c, 0x00011111, 0x00011111, 0x00022222, 0x00022222}, | ||
279 | {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, | ||
280 | {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982}, | ||
281 | {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, | ||
282 | {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
283 | {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, | ||
284 | {0x0000ae04, 0x00180000, 0x00180000, 0x00180000, 0x00180000}, | ||
285 | {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
286 | {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, | ||
287 | {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, | ||
288 | {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, | ||
289 | }; | ||
290 | |||
291 | static const u32 ar9340_1p0_baseband_core[][2] = { | ||
292 | /* Addr allmodes */ | ||
293 | {0x00009800, 0xafe68e30}, | ||
294 | {0x00009804, 0xfd14e000}, | ||
295 | {0x00009808, 0x9c0a9f6b}, | ||
296 | {0x0000980c, 0x04900000}, | ||
297 | {0x00009814, 0xb280c00a}, | ||
298 | {0x00009818, 0x00000000}, | ||
299 | {0x0000981c, 0x00020028}, | ||
300 | {0x00009834, 0x5f3ca3de}, | ||
301 | {0x00009838, 0x0108ecff}, | ||
302 | {0x0000983c, 0x14750600}, | ||
303 | {0x00009880, 0x201fff00}, | ||
304 | {0x00009884, 0x00001042}, | ||
305 | {0x000098a4, 0x00200400}, | ||
306 | {0x000098b0, 0x52440bbe}, | ||
307 | {0x000098d0, 0x004b6a8e}, | ||
308 | {0x000098d4, 0x00000820}, | ||
309 | {0x000098dc, 0x00000000}, | ||
310 | {0x000098f0, 0x00000000}, | ||
311 | {0x000098f4, 0x00000000}, | ||
312 | {0x00009c04, 0xff55ff55}, | ||
313 | {0x00009c08, 0x0320ff55}, | ||
314 | {0x00009c0c, 0x00000000}, | ||
315 | {0x00009c10, 0x00000000}, | ||
316 | {0x00009c14, 0x00046384}, | ||
317 | {0x00009c18, 0x05b6b440}, | ||
318 | {0x00009c1c, 0x00b6b440}, | ||
319 | {0x00009d00, 0xc080a333}, | ||
320 | {0x00009d04, 0x40206c10}, | ||
321 | {0x00009d08, 0x009c4060}, | ||
322 | {0x00009d0c, 0x9883800a}, | ||
323 | {0x00009d10, 0x01834061}, | ||
324 | {0x00009d14, 0x00c0040b}, | ||
325 | {0x00009d18, 0x00000000}, | ||
326 | {0x00009e08, 0x0038230c}, | ||
327 | {0x00009e24, 0x990bb515}, | ||
328 | {0x00009e28, 0x0c6f0000}, | ||
329 | {0x00009e30, 0x06336f77}, | ||
330 | {0x00009e34, 0x6af6532f}, | ||
331 | {0x00009e38, 0x0cc80c00}, | ||
332 | {0x00009e3c, 0xcf946222}, | ||
333 | {0x00009e40, 0x0d261820}, | ||
334 | {0x00009e4c, 0x00001004}, | ||
335 | {0x00009e50, 0x00ff03f1}, | ||
336 | {0x00009e54, 0x00000000}, | ||
337 | {0x00009fc0, 0x803e4788}, | ||
338 | {0x00009fc4, 0x0001efb5}, | ||
339 | {0x00009fcc, 0x40000014}, | ||
340 | {0x00009fd0, 0x01193b93}, | ||
341 | {0x0000a20c, 0x00000000}, | ||
342 | {0x0000a220, 0x00000000}, | ||
343 | {0x0000a224, 0x00000000}, | ||
344 | {0x0000a228, 0x10002310}, | ||
345 | {0x0000a22c, 0x01036a1e}, | ||
346 | {0x0000a234, 0x10000fff}, | ||
347 | {0x0000a23c, 0x00000000}, | ||
348 | {0x0000a244, 0x0c000000}, | ||
349 | {0x0000a2a0, 0x00000001}, | ||
350 | {0x0000a2c0, 0x00000001}, | ||
351 | {0x0000a2c8, 0x00000000}, | ||
352 | {0x0000a2cc, 0x18c43433}, | ||
353 | {0x0000a2d4, 0x00000000}, | ||
354 | {0x0000a2dc, 0x00000000}, | ||
355 | {0x0000a2e0, 0x00000000}, | ||
356 | {0x0000a2e4, 0x00000000}, | ||
357 | {0x0000a2e8, 0x00000000}, | ||
358 | {0x0000a2ec, 0x00000000}, | ||
359 | {0x0000a2f0, 0x00000000}, | ||
360 | {0x0000a2f4, 0x00000000}, | ||
361 | {0x0000a2f8, 0x00000000}, | ||
362 | {0x0000a344, 0x00000000}, | ||
363 | {0x0000a34c, 0x00000000}, | ||
364 | {0x0000a350, 0x0000a000}, | ||
365 | {0x0000a364, 0x00000000}, | ||
366 | {0x0000a370, 0x00000000}, | ||
367 | {0x0000a390, 0x00000001}, | ||
368 | {0x0000a394, 0x00000444}, | ||
369 | {0x0000a398, 0x001f0e0f}, | ||
370 | {0x0000a39c, 0x0075393f}, | ||
371 | {0x0000a3a0, 0xb79f6427}, | ||
372 | {0x0000a3a4, 0x00000000}, | ||
373 | {0x0000a3a8, 0xaaaaaaaa}, | ||
374 | {0x0000a3ac, 0x3c466478}, | ||
375 | {0x0000a3c0, 0x20202020}, | ||
376 | {0x0000a3c4, 0x22222220}, | ||
377 | {0x0000a3c8, 0x20200020}, | ||
378 | {0x0000a3cc, 0x20202020}, | ||
379 | {0x0000a3d0, 0x20202020}, | ||
380 | {0x0000a3d4, 0x20202020}, | ||
381 | {0x0000a3d8, 0x20202020}, | ||
382 | {0x0000a3dc, 0x20202020}, | ||
383 | {0x0000a3e0, 0x20202020}, | ||
384 | {0x0000a3e4, 0x20202020}, | ||
385 | {0x0000a3e8, 0x20202020}, | ||
386 | {0x0000a3ec, 0x20202020}, | ||
387 | {0x0000a3f0, 0x00000000}, | ||
388 | {0x0000a3f4, 0x00000246}, | ||
389 | {0x0000a3f8, 0x0cdbd380}, | ||
390 | {0x0000a3fc, 0x000f0f01}, | ||
391 | {0x0000a400, 0x8fa91f01}, | ||
392 | {0x0000a404, 0x00000000}, | ||
393 | {0x0000a408, 0x0e79e5c6}, | ||
394 | {0x0000a40c, 0x00820820}, | ||
395 | {0x0000a414, 0x1ce739ce}, | ||
396 | {0x0000a418, 0x2d001dce}, | ||
397 | {0x0000a41c, 0x1ce739ce}, | ||
398 | {0x0000a420, 0x000001ce}, | ||
399 | {0x0000a424, 0x1ce739ce}, | ||
400 | {0x0000a428, 0x000001ce}, | ||
401 | {0x0000a42c, 0x1ce739ce}, | ||
402 | {0x0000a430, 0x1ce739ce}, | ||
403 | {0x0000a434, 0x00000000}, | ||
404 | {0x0000a438, 0x00001801}, | ||
405 | {0x0000a43c, 0x00000000}, | ||
406 | {0x0000a440, 0x00000000}, | ||
407 | {0x0000a444, 0x00000000}, | ||
408 | {0x0000a448, 0x04000080}, | ||
409 | {0x0000a44c, 0x00000001}, | ||
410 | {0x0000a450, 0x00010000}, | ||
411 | {0x0000a458, 0x00000000}, | ||
412 | {0x0000a600, 0x00000000}, | ||
413 | {0x0000a604, 0x00000000}, | ||
414 | {0x0000a608, 0x00000000}, | ||
415 | {0x0000a60c, 0x00000000}, | ||
416 | {0x0000a610, 0x00000000}, | ||
417 | {0x0000a614, 0x00000000}, | ||
418 | {0x0000a618, 0x00000000}, | ||
419 | {0x0000a61c, 0x00000000}, | ||
420 | {0x0000a620, 0x00000000}, | ||
421 | {0x0000a624, 0x00000000}, | ||
422 | {0x0000a628, 0x00000000}, | ||
423 | {0x0000a62c, 0x00000000}, | ||
424 | {0x0000a630, 0x00000000}, | ||
425 | {0x0000a634, 0x00000000}, | ||
426 | {0x0000a638, 0x00000000}, | ||
427 | {0x0000a63c, 0x00000000}, | ||
428 | {0x0000a640, 0x00000000}, | ||
429 | {0x0000a644, 0x3fad9d74}, | ||
430 | {0x0000a648, 0x0048060a}, | ||
431 | {0x0000a64c, 0x00000637}, | ||
432 | {0x0000a670, 0x03020100}, | ||
433 | {0x0000a674, 0x09080504}, | ||
434 | {0x0000a678, 0x0d0c0b0a}, | ||
435 | {0x0000a67c, 0x13121110}, | ||
436 | {0x0000a680, 0x31301514}, | ||
437 | {0x0000a684, 0x35343332}, | ||
438 | {0x0000a688, 0x00000036}, | ||
439 | {0x0000a690, 0x00000838}, | ||
440 | {0x0000a7c0, 0x00000000}, | ||
441 | {0x0000a7c4, 0xfffffffc}, | ||
442 | {0x0000a7c8, 0x00000000}, | ||
443 | {0x0000a7cc, 0x00000000}, | ||
444 | {0x0000a7d0, 0x00000000}, | ||
445 | {0x0000a7d4, 0x00000004}, | ||
446 | {0x0000a7dc, 0x00000000}, | ||
447 | {0x0000a8d0, 0x004b6a8e}, | ||
448 | {0x0000a8d4, 0x00000820}, | ||
449 | {0x0000a8dc, 0x00000000}, | ||
450 | {0x0000a8f0, 0x00000000}, | ||
451 | {0x0000a8f4, 0x00000000}, | ||
452 | {0x0000b2d0, 0x00000080}, | ||
453 | {0x0000b2d4, 0x00000000}, | ||
454 | {0x0000b2dc, 0x00000000}, | ||
455 | {0x0000b2e0, 0x00000000}, | ||
456 | {0x0000b2e4, 0x00000000}, | ||
457 | {0x0000b2e8, 0x00000000}, | ||
458 | {0x0000b2ec, 0x00000000}, | ||
459 | {0x0000b2f0, 0x00000000}, | ||
460 | {0x0000b2f4, 0x00000000}, | ||
461 | {0x0000b2f8, 0x00000000}, | ||
462 | {0x0000b408, 0x0e79e5c0}, | ||
463 | {0x0000b40c, 0x00820820}, | ||
464 | {0x0000b420, 0x00000000}, | ||
465 | }; | ||
466 | |||
467 | static const u32 ar9340Modes_high_power_tx_gain_table_1p0[][5] = { | ||
468 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
469 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, | ||
470 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, | ||
471 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, | ||
472 | {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004}, | ||
473 | {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200}, | ||
474 | {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202}, | ||
475 | {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400}, | ||
476 | {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402}, | ||
477 | {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404}, | ||
478 | {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603}, | ||
479 | {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02}, | ||
480 | {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04}, | ||
481 | {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20}, | ||
482 | {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20}, | ||
483 | {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22}, | ||
484 | {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24}, | ||
485 | {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640}, | ||
486 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, | ||
487 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, | ||
488 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, | ||
489 | {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, | ||
490 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, | ||
491 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, | ||
492 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, | ||
493 | {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9}, | ||
494 | {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb}, | ||
495 | {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
496 | {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
497 | {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
498 | {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
499 | {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
500 | {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
501 | {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
502 | {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, | ||
503 | {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002}, | ||
504 | {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004}, | ||
505 | {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200}, | ||
506 | {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202}, | ||
507 | {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400}, | ||
508 | {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402}, | ||
509 | {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404}, | ||
510 | {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603}, | ||
511 | {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02}, | ||
512 | {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04}, | ||
513 | {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20}, | ||
514 | {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20}, | ||
515 | {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22}, | ||
516 | {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24}, | ||
517 | {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640}, | ||
518 | {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660}, | ||
519 | {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861}, | ||
520 | {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81}, | ||
521 | {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83}, | ||
522 | {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84}, | ||
523 | {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3}, | ||
524 | {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5}, | ||
525 | {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9}, | ||
526 | {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb}, | ||
527 | {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
528 | {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
529 | {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
530 | {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
531 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
532 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
533 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
534 | {0x00016044, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, | ||
535 | {0x00016048, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, | ||
536 | {0x00016444, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, | ||
537 | {0x00016448, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, | ||
538 | }; | ||
539 | |||
540 | static const u32 ar9340Modes_high_ob_db_tx_gain_table_1p0[][5] = { | ||
541 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
542 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, | ||
543 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, | ||
544 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, | ||
545 | {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004}, | ||
546 | {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200}, | ||
547 | {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202}, | ||
548 | {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400}, | ||
549 | {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402}, | ||
550 | {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404}, | ||
551 | {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603}, | ||
552 | {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02}, | ||
553 | {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04}, | ||
554 | {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20}, | ||
555 | {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20}, | ||
556 | {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22}, | ||
557 | {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24}, | ||
558 | {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640}, | ||
559 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, | ||
560 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, | ||
561 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, | ||
562 | {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, | ||
563 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, | ||
564 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, | ||
565 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, | ||
566 | {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9}, | ||
567 | {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb}, | ||
568 | {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
569 | {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
570 | {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
571 | {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
572 | {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
573 | {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
574 | {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
575 | {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, | ||
576 | {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002}, | ||
577 | {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004}, | ||
578 | {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200}, | ||
579 | {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202}, | ||
580 | {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400}, | ||
581 | {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402}, | ||
582 | {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404}, | ||
583 | {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603}, | ||
584 | {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02}, | ||
585 | {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04}, | ||
586 | {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20}, | ||
587 | {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20}, | ||
588 | {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22}, | ||
589 | {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24}, | ||
590 | {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640}, | ||
591 | {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660}, | ||
592 | {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861}, | ||
593 | {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81}, | ||
594 | {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83}, | ||
595 | {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84}, | ||
596 | {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3}, | ||
597 | {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5}, | ||
598 | {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9}, | ||
599 | {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb}, | ||
600 | {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
601 | {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
602 | {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
603 | {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
604 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
605 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
606 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
607 | {0x00016044, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4}, | ||
608 | {0x00016048, 0x8e481266, 0x8e481266, 0x8e481266, 0x8e481266}, | ||
609 | {0x00016444, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4}, | ||
610 | {0x00016448, 0x8e481266, 0x8e481266, 0x8e481266, 0x8e481266}, | ||
611 | }; | ||
612 | static const u32 ar9340Modes_ub124_tx_gain_table_1p0[][5] = { | ||
613 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
614 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, | ||
615 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, | ||
616 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, | ||
617 | {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004}, | ||
618 | {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200}, | ||
619 | {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202}, | ||
620 | {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400}, | ||
621 | {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402}, | ||
622 | {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404}, | ||
623 | {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603}, | ||
624 | {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02}, | ||
625 | {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04}, | ||
626 | {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20}, | ||
627 | {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20}, | ||
628 | {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22}, | ||
629 | {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24}, | ||
630 | {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640}, | ||
631 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, | ||
632 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, | ||
633 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, | ||
634 | {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, | ||
635 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, | ||
636 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, | ||
637 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, | ||
638 | {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9}, | ||
639 | {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb}, | ||
640 | {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
641 | {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
642 | {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
643 | {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
644 | {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
645 | {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
646 | {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
647 | {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, | ||
648 | {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002}, | ||
649 | {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004}, | ||
650 | {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200}, | ||
651 | {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202}, | ||
652 | {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400}, | ||
653 | {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402}, | ||
654 | {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404}, | ||
655 | {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603}, | ||
656 | {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02}, | ||
657 | {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04}, | ||
658 | {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20}, | ||
659 | {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20}, | ||
660 | {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22}, | ||
661 | {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24}, | ||
662 | {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640}, | ||
663 | {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660}, | ||
664 | {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861}, | ||
665 | {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81}, | ||
666 | {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83}, | ||
667 | {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84}, | ||
668 | {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3}, | ||
669 | {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5}, | ||
670 | {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9}, | ||
671 | {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb}, | ||
672 | {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
673 | {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
674 | {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
675 | {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
676 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
677 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
678 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
679 | {0x00016044, 0x036db2db, 0x036db2db, 0x036db2db, 0x036db2db}, | ||
680 | {0x00016048, 0x69b65266, 0x69b65266, 0x69b65266, 0x69b65266}, | ||
681 | {0x00016444, 0x036db2db, 0x036db2db, 0x036db2db, 0x036db2db}, | ||
682 | {0x00016448, 0x69b65266, 0x69b65266, 0x69b65266, 0x69b65266}, | ||
683 | }; | ||
684 | |||
685 | |||
686 | static const u32 ar9340Common_rx_gain_table_1p0[][2] = { | ||
687 | /* Addr allmodes */ | ||
688 | {0x0000a000, 0x00010000}, | ||
689 | {0x0000a004, 0x00030002}, | ||
690 | {0x0000a008, 0x00050004}, | ||
691 | {0x0000a00c, 0x00810080}, | ||
692 | {0x0000a010, 0x00830082}, | ||
693 | {0x0000a014, 0x01810180}, | ||
694 | {0x0000a018, 0x01830182}, | ||
695 | {0x0000a01c, 0x01850184}, | ||
696 | {0x0000a020, 0x01890188}, | ||
697 | {0x0000a024, 0x018b018a}, | ||
698 | {0x0000a028, 0x018d018c}, | ||
699 | {0x0000a02c, 0x01910190}, | ||
700 | {0x0000a030, 0x01930192}, | ||
701 | {0x0000a034, 0x01950194}, | ||
702 | {0x0000a038, 0x038a0196}, | ||
703 | {0x0000a03c, 0x038c038b}, | ||
704 | {0x0000a040, 0x0390038d}, | ||
705 | {0x0000a044, 0x03920391}, | ||
706 | {0x0000a048, 0x03940393}, | ||
707 | {0x0000a04c, 0x03960395}, | ||
708 | {0x0000a050, 0x00000000}, | ||
709 | {0x0000a054, 0x00000000}, | ||
710 | {0x0000a058, 0x00000000}, | ||
711 | {0x0000a05c, 0x00000000}, | ||
712 | {0x0000a060, 0x00000000}, | ||
713 | {0x0000a064, 0x00000000}, | ||
714 | {0x0000a068, 0x00000000}, | ||
715 | {0x0000a06c, 0x00000000}, | ||
716 | {0x0000a070, 0x00000000}, | ||
717 | {0x0000a074, 0x00000000}, | ||
718 | {0x0000a078, 0x00000000}, | ||
719 | {0x0000a07c, 0x00000000}, | ||
720 | {0x0000a080, 0x22222229}, | ||
721 | {0x0000a084, 0x1d1d1d1d}, | ||
722 | {0x0000a088, 0x1d1d1d1d}, | ||
723 | {0x0000a08c, 0x1d1d1d1d}, | ||
724 | {0x0000a090, 0x171d1d1d}, | ||
725 | {0x0000a094, 0x11111717}, | ||
726 | {0x0000a098, 0x00030311}, | ||
727 | {0x0000a09c, 0x00000000}, | ||
728 | {0x0000a0a0, 0x00000000}, | ||
729 | {0x0000a0a4, 0x00000000}, | ||
730 | {0x0000a0a8, 0x00000000}, | ||
731 | {0x0000a0ac, 0x00000000}, | ||
732 | {0x0000a0b0, 0x00000000}, | ||
733 | {0x0000a0b4, 0x00000000}, | ||
734 | {0x0000a0b8, 0x00000000}, | ||
735 | {0x0000a0bc, 0x00000000}, | ||
736 | {0x0000a0c0, 0x001f0000}, | ||
737 | {0x0000a0c4, 0x01000101}, | ||
738 | {0x0000a0c8, 0x011e011f}, | ||
739 | {0x0000a0cc, 0x011c011d}, | ||
740 | {0x0000a0d0, 0x02030204}, | ||
741 | {0x0000a0d4, 0x02010202}, | ||
742 | {0x0000a0d8, 0x021f0200}, | ||
743 | {0x0000a0dc, 0x0302021e}, | ||
744 | {0x0000a0e0, 0x03000301}, | ||
745 | {0x0000a0e4, 0x031e031f}, | ||
746 | {0x0000a0e8, 0x0402031d}, | ||
747 | {0x0000a0ec, 0x04000401}, | ||
748 | {0x0000a0f0, 0x041e041f}, | ||
749 | {0x0000a0f4, 0x0502041d}, | ||
750 | {0x0000a0f8, 0x05000501}, | ||
751 | {0x0000a0fc, 0x051e051f}, | ||
752 | {0x0000a100, 0x06010602}, | ||
753 | {0x0000a104, 0x061f0600}, | ||
754 | {0x0000a108, 0x061d061e}, | ||
755 | {0x0000a10c, 0x07020703}, | ||
756 | {0x0000a110, 0x07000701}, | ||
757 | {0x0000a114, 0x00000000}, | ||
758 | {0x0000a118, 0x00000000}, | ||
759 | {0x0000a11c, 0x00000000}, | ||
760 | {0x0000a120, 0x00000000}, | ||
761 | {0x0000a124, 0x00000000}, | ||
762 | {0x0000a128, 0x00000000}, | ||
763 | {0x0000a12c, 0x00000000}, | ||
764 | {0x0000a130, 0x00000000}, | ||
765 | {0x0000a134, 0x00000000}, | ||
766 | {0x0000a138, 0x00000000}, | ||
767 | {0x0000a13c, 0x00000000}, | ||
768 | {0x0000a140, 0x001f0000}, | ||
769 | {0x0000a144, 0x01000101}, | ||
770 | {0x0000a148, 0x011e011f}, | ||
771 | {0x0000a14c, 0x011c011d}, | ||
772 | {0x0000a150, 0x02030204}, | ||
773 | {0x0000a154, 0x02010202}, | ||
774 | {0x0000a158, 0x021f0200}, | ||
775 | {0x0000a15c, 0x0302021e}, | ||
776 | {0x0000a160, 0x03000301}, | ||
777 | {0x0000a164, 0x031e031f}, | ||
778 | {0x0000a168, 0x0402031d}, | ||
779 | {0x0000a16c, 0x04000401}, | ||
780 | {0x0000a170, 0x041e041f}, | ||
781 | {0x0000a174, 0x0502041d}, | ||
782 | {0x0000a178, 0x05000501}, | ||
783 | {0x0000a17c, 0x051e051f}, | ||
784 | {0x0000a180, 0x06010602}, | ||
785 | {0x0000a184, 0x061f0600}, | ||
786 | {0x0000a188, 0x061d061e}, | ||
787 | {0x0000a18c, 0x07020703}, | ||
788 | {0x0000a190, 0x07000701}, | ||
789 | {0x0000a194, 0x00000000}, | ||
790 | {0x0000a198, 0x00000000}, | ||
791 | {0x0000a19c, 0x00000000}, | ||
792 | {0x0000a1a0, 0x00000000}, | ||
793 | {0x0000a1a4, 0x00000000}, | ||
794 | {0x0000a1a8, 0x00000000}, | ||
795 | {0x0000a1ac, 0x00000000}, | ||
796 | {0x0000a1b0, 0x00000000}, | ||
797 | {0x0000a1b4, 0x00000000}, | ||
798 | {0x0000a1b8, 0x00000000}, | ||
799 | {0x0000a1bc, 0x00000000}, | ||
800 | {0x0000a1c0, 0x00000000}, | ||
801 | {0x0000a1c4, 0x00000000}, | ||
802 | {0x0000a1c8, 0x00000000}, | ||
803 | {0x0000a1cc, 0x00000000}, | ||
804 | {0x0000a1d0, 0x00000000}, | ||
805 | {0x0000a1d4, 0x00000000}, | ||
806 | {0x0000a1d8, 0x00000000}, | ||
807 | {0x0000a1dc, 0x00000000}, | ||
808 | {0x0000a1e0, 0x00000000}, | ||
809 | {0x0000a1e4, 0x00000000}, | ||
810 | {0x0000a1e8, 0x00000000}, | ||
811 | {0x0000a1ec, 0x00000000}, | ||
812 | {0x0000a1f0, 0x00000396}, | ||
813 | {0x0000a1f4, 0x00000396}, | ||
814 | {0x0000a1f8, 0x00000396}, | ||
815 | {0x0000a1fc, 0x00000196}, | ||
816 | {0x0000b000, 0x00010000}, | ||
817 | {0x0000b004, 0x00030002}, | ||
818 | {0x0000b008, 0x00050004}, | ||
819 | {0x0000b00c, 0x00810080}, | ||
820 | {0x0000b010, 0x00830082}, | ||
821 | {0x0000b014, 0x01810180}, | ||
822 | {0x0000b018, 0x01830182}, | ||
823 | {0x0000b01c, 0x01850184}, | ||
824 | {0x0000b020, 0x02810280}, | ||
825 | {0x0000b024, 0x02830282}, | ||
826 | {0x0000b028, 0x02850284}, | ||
827 | {0x0000b02c, 0x02890288}, | ||
828 | {0x0000b030, 0x028b028a}, | ||
829 | {0x0000b034, 0x0388028c}, | ||
830 | {0x0000b038, 0x038a0389}, | ||
831 | {0x0000b03c, 0x038c038b}, | ||
832 | {0x0000b040, 0x0390038d}, | ||
833 | {0x0000b044, 0x03920391}, | ||
834 | {0x0000b048, 0x03940393}, | ||
835 | {0x0000b04c, 0x03960395}, | ||
836 | {0x0000b050, 0x00000000}, | ||
837 | {0x0000b054, 0x00000000}, | ||
838 | {0x0000b058, 0x00000000}, | ||
839 | {0x0000b05c, 0x00000000}, | ||
840 | {0x0000b060, 0x00000000}, | ||
841 | {0x0000b064, 0x00000000}, | ||
842 | {0x0000b068, 0x00000000}, | ||
843 | {0x0000b06c, 0x00000000}, | ||
844 | {0x0000b070, 0x00000000}, | ||
845 | {0x0000b074, 0x00000000}, | ||
846 | {0x0000b078, 0x00000000}, | ||
847 | {0x0000b07c, 0x00000000}, | ||
848 | {0x0000b080, 0x32323232}, | ||
849 | {0x0000b084, 0x2f2f3232}, | ||
850 | {0x0000b088, 0x23282a2d}, | ||
851 | {0x0000b08c, 0x1c1e2123}, | ||
852 | {0x0000b090, 0x14171919}, | ||
853 | {0x0000b094, 0x0e0e1214}, | ||
854 | {0x0000b098, 0x03050707}, | ||
855 | {0x0000b09c, 0x00030303}, | ||
856 | {0x0000b0a0, 0x00000000}, | ||
857 | {0x0000b0a4, 0x00000000}, | ||
858 | {0x0000b0a8, 0x00000000}, | ||
859 | {0x0000b0ac, 0x00000000}, | ||
860 | {0x0000b0b0, 0x00000000}, | ||
861 | {0x0000b0b4, 0x00000000}, | ||
862 | {0x0000b0b8, 0x00000000}, | ||
863 | {0x0000b0bc, 0x00000000}, | ||
864 | {0x0000b0c0, 0x003f0020}, | ||
865 | {0x0000b0c4, 0x00400041}, | ||
866 | {0x0000b0c8, 0x0140005f}, | ||
867 | {0x0000b0cc, 0x0160015f}, | ||
868 | {0x0000b0d0, 0x017e017f}, | ||
869 | {0x0000b0d4, 0x02410242}, | ||
870 | {0x0000b0d8, 0x025f0240}, | ||
871 | {0x0000b0dc, 0x027f0260}, | ||
872 | {0x0000b0e0, 0x0341027e}, | ||
873 | {0x0000b0e4, 0x035f0340}, | ||
874 | {0x0000b0e8, 0x037f0360}, | ||
875 | {0x0000b0ec, 0x04400441}, | ||
876 | {0x0000b0f0, 0x0460045f}, | ||
877 | {0x0000b0f4, 0x0541047f}, | ||
878 | {0x0000b0f8, 0x055f0540}, | ||
879 | {0x0000b0fc, 0x057f0560}, | ||
880 | {0x0000b100, 0x06400641}, | ||
881 | {0x0000b104, 0x0660065f}, | ||
882 | {0x0000b108, 0x067e067f}, | ||
883 | {0x0000b10c, 0x07410742}, | ||
884 | {0x0000b110, 0x075f0740}, | ||
885 | {0x0000b114, 0x077f0760}, | ||
886 | {0x0000b118, 0x07800781}, | ||
887 | {0x0000b11c, 0x07a0079f}, | ||
888 | {0x0000b120, 0x07c107bf}, | ||
889 | {0x0000b124, 0x000007c0}, | ||
890 | {0x0000b128, 0x00000000}, | ||
891 | {0x0000b12c, 0x00000000}, | ||
892 | {0x0000b130, 0x00000000}, | ||
893 | {0x0000b134, 0x00000000}, | ||
894 | {0x0000b138, 0x00000000}, | ||
895 | {0x0000b13c, 0x00000000}, | ||
896 | {0x0000b140, 0x003f0020}, | ||
897 | {0x0000b144, 0x00400041}, | ||
898 | {0x0000b148, 0x0140005f}, | ||
899 | {0x0000b14c, 0x0160015f}, | ||
900 | {0x0000b150, 0x017e017f}, | ||
901 | {0x0000b154, 0x02410242}, | ||
902 | {0x0000b158, 0x025f0240}, | ||
903 | {0x0000b15c, 0x027f0260}, | ||
904 | {0x0000b160, 0x0341027e}, | ||
905 | {0x0000b164, 0x035f0340}, | ||
906 | {0x0000b168, 0x037f0360}, | ||
907 | {0x0000b16c, 0x04400441}, | ||
908 | {0x0000b170, 0x0460045f}, | ||
909 | {0x0000b174, 0x0541047f}, | ||
910 | {0x0000b178, 0x055f0540}, | ||
911 | {0x0000b17c, 0x057f0560}, | ||
912 | {0x0000b180, 0x06400641}, | ||
913 | {0x0000b184, 0x0660065f}, | ||
914 | {0x0000b188, 0x067e067f}, | ||
915 | {0x0000b18c, 0x07410742}, | ||
916 | {0x0000b190, 0x075f0740}, | ||
917 | {0x0000b194, 0x077f0760}, | ||
918 | {0x0000b198, 0x07800781}, | ||
919 | {0x0000b19c, 0x07a0079f}, | ||
920 | {0x0000b1a0, 0x07c107bf}, | ||
921 | {0x0000b1a4, 0x000007c0}, | ||
922 | {0x0000b1a8, 0x00000000}, | ||
923 | {0x0000b1ac, 0x00000000}, | ||
924 | {0x0000b1b0, 0x00000000}, | ||
925 | {0x0000b1b4, 0x00000000}, | ||
926 | {0x0000b1b8, 0x00000000}, | ||
927 | {0x0000b1bc, 0x00000000}, | ||
928 | {0x0000b1c0, 0x00000000}, | ||
929 | {0x0000b1c4, 0x00000000}, | ||
930 | {0x0000b1c8, 0x00000000}, | ||
931 | {0x0000b1cc, 0x00000000}, | ||
932 | {0x0000b1d0, 0x00000000}, | ||
933 | {0x0000b1d4, 0x00000000}, | ||
934 | {0x0000b1d8, 0x00000000}, | ||
935 | {0x0000b1dc, 0x00000000}, | ||
936 | {0x0000b1e0, 0x00000000}, | ||
937 | {0x0000b1e4, 0x00000000}, | ||
938 | {0x0000b1e8, 0x00000000}, | ||
939 | {0x0000b1ec, 0x00000000}, | ||
940 | {0x0000b1f0, 0x00000396}, | ||
941 | {0x0000b1f4, 0x00000396}, | ||
942 | {0x0000b1f8, 0x00000396}, | ||
943 | {0x0000b1fc, 0x00000196}, | ||
944 | }; | ||
945 | |||
946 | static const u32 ar9340Modes_low_ob_db_tx_gain_table_1p0[][5] = { | ||
947 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
948 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | ||
949 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
950 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, | ||
951 | {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, | ||
952 | {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, | ||
953 | {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, | ||
954 | {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, | ||
955 | {0x0000a518, 0x21020220, 0x21020220, 0x16000402, 0x16000402}, | ||
956 | {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404}, | ||
957 | {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, | ||
958 | {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, | ||
959 | {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, | ||
960 | {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, | ||
961 | {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, | ||
962 | {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, | ||
963 | {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, | ||
964 | {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, | ||
965 | {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, | ||
966 | {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861}, | ||
967 | {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81}, | ||
968 | {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x47001a83, 0x47001a83}, | ||
969 | {0x0000a550, 0x61042a6c, 0x61042a6c, 0x4a001c84, 0x4a001c84}, | ||
970 | {0x0000a554, 0x66062a6c, 0x66062a6c, 0x4e001ce3, 0x4e001ce3}, | ||
971 | {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x52001ce5, 0x52001ce5}, | ||
972 | {0x0000a55c, 0x7006308c, 0x7006308c, 0x56001ce9, 0x56001ce9}, | ||
973 | {0x0000a560, 0x730a308a, 0x730a308a, 0x5a001ceb, 0x5a001ceb}, | ||
974 | {0x0000a564, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
975 | {0x0000a568, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
976 | {0x0000a56c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
977 | {0x0000a570, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
978 | {0x0000a574, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
979 | {0x0000a578, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
980 | {0x0000a57c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, | ||
981 | {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, | ||
982 | {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, | ||
983 | {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, | ||
984 | {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, | ||
985 | {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, | ||
986 | {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, | ||
987 | {0x0000a598, 0x21820220, 0x21820220, 0x16800402, 0x16800402}, | ||
988 | {0x0000a59c, 0x27820223, 0x27820223, 0x19800404, 0x19800404}, | ||
989 | {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, | ||
990 | {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, | ||
991 | {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, | ||
992 | {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, | ||
993 | {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, | ||
994 | {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, | ||
995 | {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, | ||
996 | {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, | ||
997 | {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, | ||
998 | {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861}, | ||
999 | {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81}, | ||
1000 | {0x0000a5cc, 0x5c84286b, 0x5c84286b, 0x47801a83, 0x47801a83}, | ||
1001 | {0x0000a5d0, 0x61842a6c, 0x61842a6c, 0x4a801c84, 0x4a801c84}, | ||
1002 | {0x0000a5d4, 0x66862a6c, 0x66862a6c, 0x4e801ce3, 0x4e801ce3}, | ||
1003 | {0x0000a5d8, 0x6b862e6c, 0x6b862e6c, 0x52801ce5, 0x52801ce5}, | ||
1004 | {0x0000a5dc, 0x7086308c, 0x7086308c, 0x56801ce9, 0x56801ce9}, | ||
1005 | {0x0000a5e0, 0x738a308a, 0x738a308a, 0x5a801ceb, 0x5a801ceb}, | ||
1006 | {0x0000a5e4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
1007 | {0x0000a5e8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
1008 | {0x0000a5ec, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
1009 | {0x0000a5f0, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
1010 | {0x0000a5f4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
1011 | {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
1012 | {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | ||
1013 | {0x00016044, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, | ||
1014 | {0x00016048, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, | ||
1015 | {0x00016444, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, | ||
1016 | {0x00016448, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, | ||
1017 | }; | ||
1018 | |||
1019 | static const u32 ar9340Modes_mixed_ob_db_tx_gain_table_1p0[][5] = { | ||
1020 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
1021 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | ||
1022 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1023 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, | ||
1024 | {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, | ||
1025 | {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, | ||
1026 | {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, | ||
1027 | {0x0000a514, 0x1c000223, 0x1c000223, 0x11000400, 0x11000400}, | ||
1028 | {0x0000a518, 0x21020220, 0x21020220, 0x15000402, 0x15000402}, | ||
1029 | {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404}, | ||
1030 | {0x0000a520, 0x2b022220, 0x2b022220, 0x1b000603, 0x1b000603}, | ||
1031 | {0x0000a524, 0x2f022222, 0x2f022222, 0x1f000a02, 0x1f000a02}, | ||
1032 | {0x0000a528, 0x34022225, 0x34022225, 0x23000a04, 0x23000a04}, | ||
1033 | {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x26000a20, 0x26000a20}, | ||
1034 | {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2a000e20, 0x2a000e20}, | ||
1035 | {0x0000a534, 0x4202242a, 0x4202242a, 0x2e000e22, 0x2e000e22}, | ||
1036 | {0x0000a538, 0x4702244a, 0x4702244a, 0x31000e24, 0x31000e24}, | ||
1037 | {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x34001640, 0x34001640}, | ||
1038 | {0x0000a540, 0x4e02246c, 0x4e02246c, 0x38001660, 0x38001660}, | ||
1039 | {0x0000a544, 0x5302266c, 0x5302266c, 0x3b001861, 0x3b001861}, | ||
1040 | {0x0000a548, 0x5702286c, 0x5702286c, 0x3e001a81, 0x3e001a81}, | ||
1041 | {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x42001a83, 0x42001a83}, | ||
1042 | {0x0000a550, 0x61042a6c, 0x61042a6c, 0x44001c84, 0x44001c84}, | ||
1043 | {0x0000a554, 0x66062a6c, 0x66062a6c, 0x48001ce3, 0x48001ce3}, | ||
1044 | {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x4c001ce5, 0x4c001ce5}, | ||
1045 | {0x0000a55c, 0x7006308c, 0x7006308c, 0x50001ce9, 0x50001ce9}, | ||
1046 | {0x0000a560, 0x730a308a, 0x730a308a, 0x54001ceb, 0x54001ceb}, | ||
1047 | {0x0000a564, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | ||
1048 | {0x0000a568, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | ||
1049 | {0x0000a56c, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | ||
1050 | {0x0000a570, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | ||
1051 | {0x0000a574, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | ||
1052 | {0x0000a578, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | ||
1053 | {0x0000a57c, 0x770a308c, 0x770a308c, 0x56001eec, 0x56001eec}, | ||
1054 | {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, | ||
1055 | {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, | ||
1056 | {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, | ||
1057 | {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, | ||
1058 | {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, | ||
1059 | {0x0000a594, 0x1c800223, 0x1c800223, 0x11800400, 0x11800400}, | ||
1060 | {0x0000a598, 0x21820220, 0x21820220, 0x15800402, 0x15800402}, | ||
1061 | {0x0000a59c, 0x27820223, 0x27820223, 0x19800404, 0x19800404}, | ||
1062 | {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1b800603, 0x1b800603}, | ||
1063 | {0x0000a5a4, 0x2f822222, 0x2f822222, 0x1f800a02, 0x1f800a02}, | ||
1064 | {0x0000a5a8, 0x34822225, 0x34822225, 0x23800a04, 0x23800a04}, | ||
1065 | {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x26800a20, 0x26800a20}, | ||
1066 | {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2a800e20, 0x2a800e20}, | ||
1067 | {0x0000a5b4, 0x4282242a, 0x4282242a, 0x2e800e22, 0x2e800e22}, | ||
1068 | {0x0000a5b8, 0x4782244a, 0x4782244a, 0x31800e24, 0x31800e24}, | ||
1069 | {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x34801640, 0x34801640}, | ||
1070 | {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x38801660, 0x38801660}, | ||
1071 | {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3b801861, 0x3b801861}, | ||
1072 | {0x0000a5c8, 0x5782286c, 0x5782286c, 0x3e801a81, 0x3e801a81}, | ||
1073 | {0x0000a5cc, 0x5c84286b, 0x5c84286b, 0x42801a83, 0x42801a83}, | ||
1074 | {0x0000a5d0, 0x61842a6c, 0x61842a6c, 0x44801c84, 0x44801c84}, | ||
1075 | {0x0000a5d4, 0x66862a6c, 0x66862a6c, 0x48801ce3, 0x48801ce3}, | ||
1076 | {0x0000a5d8, 0x6b862e6c, 0x6b862e6c, 0x4c801ce5, 0x4c801ce5}, | ||
1077 | {0x0000a5dc, 0x7086308c, 0x7086308c, 0x50801ce9, 0x50801ce9}, | ||
1078 | {0x0000a5e0, 0x738a308a, 0x738a308a, 0x54801ceb, 0x54801ceb}, | ||
1079 | {0x0000a5e4, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, | ||
1080 | {0x0000a5e8, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, | ||
1081 | {0x0000a5ec, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, | ||
1082 | {0x0000a5f0, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, | ||
1083 | {0x0000a5f4, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, | ||
1084 | {0x0000a5f8, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, | ||
1085 | {0x0000a5fc, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, | ||
1086 | {0x00016044, 0x056db2db, 0x056db2db, 0x03b6d2e4, 0x03b6d2e4}, | ||
1087 | {0x00016048, 0x24927266, 0x24927266, 0x8e483266, 0x8e483266}, | ||
1088 | {0x00016444, 0x056db2db, 0x056db2db, 0x03b6d2e4, 0x03b6d2e4}, | ||
1089 | {0x00016448, 0x24927266, 0x24927266, 0x8e482266, 0x8e482266}, | ||
1090 | }; | ||
1091 | |||
1092 | static const u32 ar9340_1p0_mac_core[][2] = { | ||
1093 | /* Addr allmodes */ | ||
1094 | {0x00000008, 0x00000000}, | ||
1095 | {0x00000030, 0x00020085}, | ||
1096 | {0x00000034, 0x00000005}, | ||
1097 | {0x00000040, 0x00000000}, | ||
1098 | {0x00000044, 0x00000000}, | ||
1099 | {0x00000048, 0x00000008}, | ||
1100 | {0x0000004c, 0x00000010}, | ||
1101 | {0x00000050, 0x00000000}, | ||
1102 | {0x00001040, 0x002ffc0f}, | ||
1103 | {0x00001044, 0x002ffc0f}, | ||
1104 | {0x00001048, 0x002ffc0f}, | ||
1105 | {0x0000104c, 0x002ffc0f}, | ||
1106 | {0x00001050, 0x002ffc0f}, | ||
1107 | {0x00001054, 0x002ffc0f}, | ||
1108 | {0x00001058, 0x002ffc0f}, | ||
1109 | {0x0000105c, 0x002ffc0f}, | ||
1110 | {0x00001060, 0x002ffc0f}, | ||
1111 | {0x00001064, 0x002ffc0f}, | ||
1112 | {0x000010f0, 0x00000100}, | ||
1113 | {0x00001270, 0x00000000}, | ||
1114 | {0x000012b0, 0x00000000}, | ||
1115 | {0x000012f0, 0x00000000}, | ||
1116 | {0x0000143c, 0x00000000}, | ||
1117 | {0x0000147c, 0x00000000}, | ||
1118 | {0x00008000, 0x00000000}, | ||
1119 | {0x00008004, 0x00000000}, | ||
1120 | {0x00008008, 0x00000000}, | ||
1121 | {0x0000800c, 0x00000000}, | ||
1122 | {0x00008018, 0x00000000}, | ||
1123 | {0x00008020, 0x00000000}, | ||
1124 | {0x00008038, 0x00000000}, | ||
1125 | {0x0000803c, 0x00000000}, | ||
1126 | {0x00008040, 0x00000000}, | ||
1127 | {0x00008044, 0x00000000}, | ||
1128 | {0x00008048, 0x00000000}, | ||
1129 | {0x0000804c, 0xffffffff}, | ||
1130 | {0x00008054, 0x00000000}, | ||
1131 | {0x00008058, 0x00000000}, | ||
1132 | {0x0000805c, 0x000fc78f}, | ||
1133 | {0x00008060, 0x0000000f}, | ||
1134 | {0x00008064, 0x00000000}, | ||
1135 | {0x00008070, 0x00000310}, | ||
1136 | {0x00008074, 0x00000020}, | ||
1137 | {0x00008078, 0x00000000}, | ||
1138 | {0x0000809c, 0x0000000f}, | ||
1139 | {0x000080a0, 0x00000000}, | ||
1140 | {0x000080a4, 0x02ff0000}, | ||
1141 | {0x000080a8, 0x0e070605}, | ||
1142 | {0x000080ac, 0x0000000d}, | ||
1143 | {0x000080b0, 0x00000000}, | ||
1144 | {0x000080b4, 0x00000000}, | ||
1145 | {0x000080b8, 0x00000000}, | ||
1146 | {0x000080bc, 0x00000000}, | ||
1147 | {0x000080c0, 0x2a800000}, | ||
1148 | {0x000080c4, 0x06900168}, | ||
1149 | {0x000080c8, 0x13881c20}, | ||
1150 | {0x000080cc, 0x01f40000}, | ||
1151 | {0x000080d0, 0x00252500}, | ||
1152 | {0x000080d4, 0x00a00000}, | ||
1153 | {0x000080d8, 0x00400000}, | ||
1154 | {0x000080dc, 0x00000000}, | ||
1155 | {0x000080e0, 0xffffffff}, | ||
1156 | {0x000080e4, 0x0000ffff}, | ||
1157 | {0x000080e8, 0x3f3f3f3f}, | ||
1158 | {0x000080ec, 0x00000000}, | ||
1159 | {0x000080f0, 0x00000000}, | ||
1160 | {0x000080f4, 0x00000000}, | ||
1161 | {0x000080fc, 0x00020000}, | ||
1162 | {0x00008100, 0x00000000}, | ||
1163 | {0x00008108, 0x00000052}, | ||
1164 | {0x0000810c, 0x00000000}, | ||
1165 | {0x00008110, 0x00000000}, | ||
1166 | {0x00008114, 0x000007ff}, | ||
1167 | {0x00008118, 0x000000aa}, | ||
1168 | {0x0000811c, 0x00003210}, | ||
1169 | {0x00008124, 0x00000000}, | ||
1170 | {0x00008128, 0x00000000}, | ||
1171 | {0x0000812c, 0x00000000}, | ||
1172 | {0x00008130, 0x00000000}, | ||
1173 | {0x00008134, 0x00000000}, | ||
1174 | {0x00008138, 0x00000000}, | ||
1175 | {0x0000813c, 0x0000ffff}, | ||
1176 | {0x00008144, 0xffffffff}, | ||
1177 | {0x00008168, 0x00000000}, | ||
1178 | {0x0000816c, 0x00000000}, | ||
1179 | {0x00008170, 0x18486200}, | ||
1180 | {0x00008174, 0x33332210}, | ||
1181 | {0x00008178, 0x00000000}, | ||
1182 | {0x0000817c, 0x00020000}, | ||
1183 | {0x000081c0, 0x00000000}, | ||
1184 | {0x000081c4, 0x33332210}, | ||
1185 | {0x000081c8, 0x00000000}, | ||
1186 | {0x000081cc, 0x00000000}, | ||
1187 | {0x000081d4, 0x00000000}, | ||
1188 | {0x000081ec, 0x00000000}, | ||
1189 | {0x000081f0, 0x00000000}, | ||
1190 | {0x000081f4, 0x00000000}, | ||
1191 | {0x000081f8, 0x00000000}, | ||
1192 | {0x000081fc, 0x00000000}, | ||
1193 | {0x00008240, 0x00100000}, | ||
1194 | {0x00008244, 0x0010f424}, | ||
1195 | {0x00008248, 0x00000800}, | ||
1196 | {0x0000824c, 0x0001e848}, | ||
1197 | {0x00008250, 0x00000000}, | ||
1198 | {0x00008254, 0x00000000}, | ||
1199 | {0x00008258, 0x00000000}, | ||
1200 | {0x0000825c, 0x40000000}, | ||
1201 | {0x00008260, 0x00080922}, | ||
1202 | {0x00008264, 0x9d400010}, | ||
1203 | {0x00008268, 0xffffffff}, | ||
1204 | {0x0000826c, 0x0000ffff}, | ||
1205 | {0x00008270, 0x00000000}, | ||
1206 | {0x00008274, 0x40000000}, | ||
1207 | {0x00008278, 0x003e4180}, | ||
1208 | {0x0000827c, 0x00000004}, | ||
1209 | {0x00008284, 0x0000002c}, | ||
1210 | {0x00008288, 0x0000002c}, | ||
1211 | {0x0000828c, 0x000000ff}, | ||
1212 | {0x00008294, 0x00000000}, | ||
1213 | {0x00008298, 0x00000000}, | ||
1214 | {0x0000829c, 0x00000000}, | ||
1215 | {0x00008300, 0x00000140}, | ||
1216 | {0x00008314, 0x00000000}, | ||
1217 | {0x0000831c, 0x0000010d}, | ||
1218 | {0x00008328, 0x00000000}, | ||
1219 | {0x0000832c, 0x00000007}, | ||
1220 | {0x00008330, 0x00000302}, | ||
1221 | {0x00008334, 0x00000700}, | ||
1222 | {0x00008338, 0x00ff0000}, | ||
1223 | {0x0000833c, 0x02400000}, | ||
1224 | {0x00008340, 0x000107ff}, | ||
1225 | {0x00008344, 0xaa48105b}, | ||
1226 | {0x00008348, 0x008f0000}, | ||
1227 | {0x0000835c, 0x00000000}, | ||
1228 | {0x00008360, 0xffffffff}, | ||
1229 | {0x00008364, 0xffffffff}, | ||
1230 | {0x00008368, 0x00000000}, | ||
1231 | {0x00008370, 0x00000000}, | ||
1232 | {0x00008374, 0x000000ff}, | ||
1233 | {0x00008378, 0x00000000}, | ||
1234 | {0x0000837c, 0x00000000}, | ||
1235 | {0x00008380, 0xffffffff}, | ||
1236 | {0x00008384, 0xffffffff}, | ||
1237 | {0x00008390, 0xffffffff}, | ||
1238 | {0x00008394, 0xffffffff}, | ||
1239 | {0x00008398, 0x00000000}, | ||
1240 | {0x0000839c, 0x00000000}, | ||
1241 | {0x000083a0, 0x00000000}, | ||
1242 | {0x000083a4, 0x0000fa14}, | ||
1243 | {0x000083a8, 0x000f0c00}, | ||
1244 | {0x000083ac, 0x33332210}, | ||
1245 | {0x000083b0, 0x33332210}, | ||
1246 | {0x000083b4, 0x33332210}, | ||
1247 | {0x000083b8, 0x33332210}, | ||
1248 | {0x000083bc, 0x00000000}, | ||
1249 | {0x000083c0, 0x00000000}, | ||
1250 | {0x000083c4, 0x00000000}, | ||
1251 | {0x000083c8, 0x00000000}, | ||
1252 | {0x000083cc, 0x00000200}, | ||
1253 | {0x000083d0, 0x000301ff}, | ||
1254 | }; | ||
1255 | |||
1256 | static const u32 ar9340Common_wo_xlna_rx_gain_table_1p0[][2] = { | ||
1257 | /* Addr allmodes */ | ||
1258 | {0x0000a000, 0x00010000}, | ||
1259 | {0x0000a004, 0x00030002}, | ||
1260 | {0x0000a008, 0x00050004}, | ||
1261 | {0x0000a00c, 0x00810080}, | ||
1262 | {0x0000a010, 0x00830082}, | ||
1263 | {0x0000a014, 0x01810180}, | ||
1264 | {0x0000a018, 0x01830182}, | ||
1265 | {0x0000a01c, 0x01850184}, | ||
1266 | {0x0000a020, 0x01890188}, | ||
1267 | {0x0000a024, 0x018b018a}, | ||
1268 | {0x0000a028, 0x018d018c}, | ||
1269 | {0x0000a02c, 0x03820190}, | ||
1270 | {0x0000a030, 0x03840383}, | ||
1271 | {0x0000a034, 0x03880385}, | ||
1272 | {0x0000a038, 0x038a0389}, | ||
1273 | {0x0000a03c, 0x038c038b}, | ||
1274 | {0x0000a040, 0x0390038d}, | ||
1275 | {0x0000a044, 0x03920391}, | ||
1276 | {0x0000a048, 0x03940393}, | ||
1277 | {0x0000a04c, 0x03960395}, | ||
1278 | {0x0000a050, 0x00000000}, | ||
1279 | {0x0000a054, 0x00000000}, | ||
1280 | {0x0000a058, 0x00000000}, | ||
1281 | {0x0000a05c, 0x00000000}, | ||
1282 | {0x0000a060, 0x00000000}, | ||
1283 | {0x0000a064, 0x00000000}, | ||
1284 | {0x0000a068, 0x00000000}, | ||
1285 | {0x0000a06c, 0x00000000}, | ||
1286 | {0x0000a070, 0x00000000}, | ||
1287 | {0x0000a074, 0x00000000}, | ||
1288 | {0x0000a078, 0x00000000}, | ||
1289 | {0x0000a07c, 0x00000000}, | ||
1290 | {0x0000a080, 0x29292929}, | ||
1291 | {0x0000a084, 0x29292929}, | ||
1292 | {0x0000a088, 0x29292929}, | ||
1293 | {0x0000a08c, 0x29292929}, | ||
1294 | {0x0000a090, 0x22292929}, | ||
1295 | {0x0000a094, 0x1d1d2222}, | ||
1296 | {0x0000a098, 0x0c111117}, | ||
1297 | {0x0000a09c, 0x00030303}, | ||
1298 | {0x0000a0a0, 0x00000000}, | ||
1299 | {0x0000a0a4, 0x00000000}, | ||
1300 | {0x0000a0a8, 0x00000000}, | ||
1301 | {0x0000a0ac, 0x00000000}, | ||
1302 | {0x0000a0b0, 0x00000000}, | ||
1303 | {0x0000a0b4, 0x00000000}, | ||
1304 | {0x0000a0b8, 0x00000000}, | ||
1305 | {0x0000a0bc, 0x00000000}, | ||
1306 | {0x0000a0c0, 0x001f0000}, | ||
1307 | {0x0000a0c4, 0x01000101}, | ||
1308 | {0x0000a0c8, 0x011e011f}, | ||
1309 | {0x0000a0cc, 0x011c011d}, | ||
1310 | {0x0000a0d0, 0x02030204}, | ||
1311 | {0x0000a0d4, 0x02010202}, | ||
1312 | {0x0000a0d8, 0x021f0200}, | ||
1313 | {0x0000a0dc, 0x0302021e}, | ||
1314 | {0x0000a0e0, 0x03000301}, | ||
1315 | {0x0000a0e4, 0x031e031f}, | ||
1316 | {0x0000a0e8, 0x0402031d}, | ||
1317 | {0x0000a0ec, 0x04000401}, | ||
1318 | {0x0000a0f0, 0x041e041f}, | ||
1319 | {0x0000a0f4, 0x0502041d}, | ||
1320 | {0x0000a0f8, 0x05000501}, | ||
1321 | {0x0000a0fc, 0x051e051f}, | ||
1322 | {0x0000a100, 0x06010602}, | ||
1323 | {0x0000a104, 0x061f0600}, | ||
1324 | {0x0000a108, 0x061d061e}, | ||
1325 | {0x0000a10c, 0x07020703}, | ||
1326 | {0x0000a110, 0x07000701}, | ||
1327 | {0x0000a114, 0x00000000}, | ||
1328 | {0x0000a118, 0x00000000}, | ||
1329 | {0x0000a11c, 0x00000000}, | ||
1330 | {0x0000a120, 0x00000000}, | ||
1331 | {0x0000a124, 0x00000000}, | ||
1332 | {0x0000a128, 0x00000000}, | ||
1333 | {0x0000a12c, 0x00000000}, | ||
1334 | {0x0000a130, 0x00000000}, | ||
1335 | {0x0000a134, 0x00000000}, | ||
1336 | {0x0000a138, 0x00000000}, | ||
1337 | {0x0000a13c, 0x00000000}, | ||
1338 | {0x0000a140, 0x001f0000}, | ||
1339 | {0x0000a144, 0x01000101}, | ||
1340 | {0x0000a148, 0x011e011f}, | ||
1341 | {0x0000a14c, 0x011c011d}, | ||
1342 | {0x0000a150, 0x02030204}, | ||
1343 | {0x0000a154, 0x02010202}, | ||
1344 | {0x0000a158, 0x021f0200}, | ||
1345 | {0x0000a15c, 0x0302021e}, | ||
1346 | {0x0000a160, 0x03000301}, | ||
1347 | {0x0000a164, 0x031e031f}, | ||
1348 | {0x0000a168, 0x0402031d}, | ||
1349 | {0x0000a16c, 0x04000401}, | ||
1350 | {0x0000a170, 0x041e041f}, | ||
1351 | {0x0000a174, 0x0502041d}, | ||
1352 | {0x0000a178, 0x05000501}, | ||
1353 | {0x0000a17c, 0x051e051f}, | ||
1354 | {0x0000a180, 0x06010602}, | ||
1355 | {0x0000a184, 0x061f0600}, | ||
1356 | {0x0000a188, 0x061d061e}, | ||
1357 | {0x0000a18c, 0x07020703}, | ||
1358 | {0x0000a190, 0x07000701}, | ||
1359 | {0x0000a194, 0x00000000}, | ||
1360 | {0x0000a198, 0x00000000}, | ||
1361 | {0x0000a19c, 0x00000000}, | ||
1362 | {0x0000a1a0, 0x00000000}, | ||
1363 | {0x0000a1a4, 0x00000000}, | ||
1364 | {0x0000a1a8, 0x00000000}, | ||
1365 | {0x0000a1ac, 0x00000000}, | ||
1366 | {0x0000a1b0, 0x00000000}, | ||
1367 | {0x0000a1b4, 0x00000000}, | ||
1368 | {0x0000a1b8, 0x00000000}, | ||
1369 | {0x0000a1bc, 0x00000000}, | ||
1370 | {0x0000a1c0, 0x00000000}, | ||
1371 | {0x0000a1c4, 0x00000000}, | ||
1372 | {0x0000a1c8, 0x00000000}, | ||
1373 | {0x0000a1cc, 0x00000000}, | ||
1374 | {0x0000a1d0, 0x00000000}, | ||
1375 | {0x0000a1d4, 0x00000000}, | ||
1376 | {0x0000a1d8, 0x00000000}, | ||
1377 | {0x0000a1dc, 0x00000000}, | ||
1378 | {0x0000a1e0, 0x00000000}, | ||
1379 | {0x0000a1e4, 0x00000000}, | ||
1380 | {0x0000a1e8, 0x00000000}, | ||
1381 | {0x0000a1ec, 0x00000000}, | ||
1382 | {0x0000a1f0, 0x00000396}, | ||
1383 | {0x0000a1f4, 0x00000396}, | ||
1384 | {0x0000a1f8, 0x00000396}, | ||
1385 | {0x0000a1fc, 0x00000196}, | ||
1386 | {0x0000b000, 0x00010000}, | ||
1387 | {0x0000b004, 0x00030002}, | ||
1388 | {0x0000b008, 0x00050004}, | ||
1389 | {0x0000b00c, 0x00810080}, | ||
1390 | {0x0000b010, 0x00830082}, | ||
1391 | {0x0000b014, 0x01810180}, | ||
1392 | {0x0000b018, 0x01830182}, | ||
1393 | {0x0000b01c, 0x01850184}, | ||
1394 | {0x0000b020, 0x02810280}, | ||
1395 | {0x0000b024, 0x02830282}, | ||
1396 | {0x0000b028, 0x02850284}, | ||
1397 | {0x0000b02c, 0x02890288}, | ||
1398 | {0x0000b030, 0x028b028a}, | ||
1399 | {0x0000b034, 0x0388028c}, | ||
1400 | {0x0000b038, 0x038a0389}, | ||
1401 | {0x0000b03c, 0x038c038b}, | ||
1402 | {0x0000b040, 0x0390038d}, | ||
1403 | {0x0000b044, 0x03920391}, | ||
1404 | {0x0000b048, 0x03940393}, | ||
1405 | {0x0000b04c, 0x03960395}, | ||
1406 | {0x0000b050, 0x00000000}, | ||
1407 | {0x0000b054, 0x00000000}, | ||
1408 | {0x0000b058, 0x00000000}, | ||
1409 | {0x0000b05c, 0x00000000}, | ||
1410 | {0x0000b060, 0x00000000}, | ||
1411 | {0x0000b064, 0x00000000}, | ||
1412 | {0x0000b068, 0x00000000}, | ||
1413 | {0x0000b06c, 0x00000000}, | ||
1414 | {0x0000b070, 0x00000000}, | ||
1415 | {0x0000b074, 0x00000000}, | ||
1416 | {0x0000b078, 0x00000000}, | ||
1417 | {0x0000b07c, 0x00000000}, | ||
1418 | {0x0000b080, 0x32323232}, | ||
1419 | {0x0000b084, 0x2f2f3232}, | ||
1420 | {0x0000b088, 0x23282a2d}, | ||
1421 | {0x0000b08c, 0x1c1e2123}, | ||
1422 | {0x0000b090, 0x14171919}, | ||
1423 | {0x0000b094, 0x0e0e1214}, | ||
1424 | {0x0000b098, 0x03050707}, | ||
1425 | {0x0000b09c, 0x00030303}, | ||
1426 | {0x0000b0a0, 0x00000000}, | ||
1427 | {0x0000b0a4, 0x00000000}, | ||
1428 | {0x0000b0a8, 0x00000000}, | ||
1429 | {0x0000b0ac, 0x00000000}, | ||
1430 | {0x0000b0b0, 0x00000000}, | ||
1431 | {0x0000b0b4, 0x00000000}, | ||
1432 | {0x0000b0b8, 0x00000000}, | ||
1433 | {0x0000b0bc, 0x00000000}, | ||
1434 | {0x0000b0c0, 0x003f0020}, | ||
1435 | {0x0000b0c4, 0x00400041}, | ||
1436 | {0x0000b0c8, 0x0140005f}, | ||
1437 | {0x0000b0cc, 0x0160015f}, | ||
1438 | {0x0000b0d0, 0x017e017f}, | ||
1439 | {0x0000b0d4, 0x02410242}, | ||
1440 | {0x0000b0d8, 0x025f0240}, | ||
1441 | {0x0000b0dc, 0x027f0260}, | ||
1442 | {0x0000b0e0, 0x0341027e}, | ||
1443 | {0x0000b0e4, 0x035f0340}, | ||
1444 | {0x0000b0e8, 0x037f0360}, | ||
1445 | {0x0000b0ec, 0x04400441}, | ||
1446 | {0x0000b0f0, 0x0460045f}, | ||
1447 | {0x0000b0f4, 0x0541047f}, | ||
1448 | {0x0000b0f8, 0x055f0540}, | ||
1449 | {0x0000b0fc, 0x057f0560}, | ||
1450 | {0x0000b100, 0x06400641}, | ||
1451 | {0x0000b104, 0x0660065f}, | ||
1452 | {0x0000b108, 0x067e067f}, | ||
1453 | {0x0000b10c, 0x07410742}, | ||
1454 | {0x0000b110, 0x075f0740}, | ||
1455 | {0x0000b114, 0x077f0760}, | ||
1456 | {0x0000b118, 0x07800781}, | ||
1457 | {0x0000b11c, 0x07a0079f}, | ||
1458 | {0x0000b120, 0x07c107bf}, | ||
1459 | {0x0000b124, 0x000007c0}, | ||
1460 | {0x0000b128, 0x00000000}, | ||
1461 | {0x0000b12c, 0x00000000}, | ||
1462 | {0x0000b130, 0x00000000}, | ||
1463 | {0x0000b134, 0x00000000}, | ||
1464 | {0x0000b138, 0x00000000}, | ||
1465 | {0x0000b13c, 0x00000000}, | ||
1466 | {0x0000b140, 0x003f0020}, | ||
1467 | {0x0000b144, 0x00400041}, | ||
1468 | {0x0000b148, 0x0140005f}, | ||
1469 | {0x0000b14c, 0x0160015f}, | ||
1470 | {0x0000b150, 0x017e017f}, | ||
1471 | {0x0000b154, 0x02410242}, | ||
1472 | {0x0000b158, 0x025f0240}, | ||
1473 | {0x0000b15c, 0x027f0260}, | ||
1474 | {0x0000b160, 0x0341027e}, | ||
1475 | {0x0000b164, 0x035f0340}, | ||
1476 | {0x0000b168, 0x037f0360}, | ||
1477 | {0x0000b16c, 0x04400441}, | ||
1478 | {0x0000b170, 0x0460045f}, | ||
1479 | {0x0000b174, 0x0541047f}, | ||
1480 | {0x0000b178, 0x055f0540}, | ||
1481 | {0x0000b17c, 0x057f0560}, | ||
1482 | {0x0000b180, 0x06400641}, | ||
1483 | {0x0000b184, 0x0660065f}, | ||
1484 | {0x0000b188, 0x067e067f}, | ||
1485 | {0x0000b18c, 0x07410742}, | ||
1486 | {0x0000b190, 0x075f0740}, | ||
1487 | {0x0000b194, 0x077f0760}, | ||
1488 | {0x0000b198, 0x07800781}, | ||
1489 | {0x0000b19c, 0x07a0079f}, | ||
1490 | {0x0000b1a0, 0x07c107bf}, | ||
1491 | {0x0000b1a4, 0x000007c0}, | ||
1492 | {0x0000b1a8, 0x00000000}, | ||
1493 | {0x0000b1ac, 0x00000000}, | ||
1494 | {0x0000b1b0, 0x00000000}, | ||
1495 | {0x0000b1b4, 0x00000000}, | ||
1496 | {0x0000b1b8, 0x00000000}, | ||
1497 | {0x0000b1bc, 0x00000000}, | ||
1498 | {0x0000b1c0, 0x00000000}, | ||
1499 | {0x0000b1c4, 0x00000000}, | ||
1500 | {0x0000b1c8, 0x00000000}, | ||
1501 | {0x0000b1cc, 0x00000000}, | ||
1502 | {0x0000b1d0, 0x00000000}, | ||
1503 | {0x0000b1d4, 0x00000000}, | ||
1504 | {0x0000b1d8, 0x00000000}, | ||
1505 | {0x0000b1dc, 0x00000000}, | ||
1506 | {0x0000b1e0, 0x00000000}, | ||
1507 | {0x0000b1e4, 0x00000000}, | ||
1508 | {0x0000b1e8, 0x00000000}, | ||
1509 | {0x0000b1ec, 0x00000000}, | ||
1510 | {0x0000b1f0, 0x00000396}, | ||
1511 | {0x0000b1f4, 0x00000396}, | ||
1512 | {0x0000b1f8, 0x00000396}, | ||
1513 | {0x0000b1fc, 0x00000196}, | ||
1514 | }; | ||
1515 | |||
1516 | static const u32 ar9340_1p0_soc_preamble[][2] = { | ||
1517 | /* Addr allmodes */ | ||
1518 | {0x000040a4, 0x00a0c1c9}, | ||
1519 | {0x00007008, 0x00000000}, | ||
1520 | {0x00007020, 0x00000000}, | ||
1521 | {0x00007034, 0x00000002}, | ||
1522 | {0x00007038, 0x000004c2}, | ||
1523 | }; | ||
1524 | |||
1525 | #endif | ||
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index a6b538802251..0312aa091807 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -423,6 +423,7 @@ void ath9k_set_beaconing_status(struct ath_softc *sc, bool status); | |||
423 | #define ATH_PAPRD_TIMEOUT 100 /* msecs */ | 423 | #define ATH_PAPRD_TIMEOUT 100 /* msecs */ |
424 | 424 | ||
425 | void ath_hw_check(struct work_struct *work); | 425 | void ath_hw_check(struct work_struct *work); |
426 | void ath_hw_pll_work(struct work_struct *work); | ||
426 | void ath_paprd_calibrate(struct work_struct *work); | 427 | void ath_paprd_calibrate(struct work_struct *work); |
427 | void ath_ani_calibrate(unsigned long data); | 428 | void ath_ani_calibrate(unsigned long data); |
428 | 429 | ||
@@ -453,6 +454,7 @@ void ath9k_btcoex_timer_pause(struct ath_softc *sc); | |||
453 | 454 | ||
454 | #define ATH_LED_PIN_DEF 1 | 455 | #define ATH_LED_PIN_DEF 1 |
455 | #define ATH_LED_PIN_9287 8 | 456 | #define ATH_LED_PIN_9287 8 |
457 | #define ATH_LED_PIN_9300 10 | ||
456 | #define ATH_LED_PIN_9485 6 | 458 | #define ATH_LED_PIN_9485 6 |
457 | 459 | ||
458 | #ifdef CONFIG_MAC80211_LEDS | 460 | #ifdef CONFIG_MAC80211_LEDS |
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c index 24f565ba9988..22cd241a098b 100644 --- a/drivers/net/wireless/ath/ath9k/beacon.c +++ b/drivers/net/wireless/ath/ath9k/beacon.c | |||
@@ -781,12 +781,6 @@ void ath_set_beacon(struct ath_softc *sc) | |||
781 | break; | 781 | break; |
782 | case NL80211_IFTYPE_STATION: | 782 | case NL80211_IFTYPE_STATION: |
783 | ath_beacon_config_sta(sc, cur_conf); | 783 | ath_beacon_config_sta(sc, cur_conf); |
784 | /* | ||
785 | * Request a re-configuration of Beacon related timers | ||
786 | * on the receipt of the first Beacon frame (i.e., | ||
787 | * after time sync with the AP). | ||
788 | */ | ||
789 | sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; | ||
790 | break; | 784 | break; |
791 | default: | 785 | default: |
792 | ath_dbg(common, ATH_DBG_CONFIG, | 786 | ath_dbg(common, ATH_DBG_CONFIG, |
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c b/drivers/net/wireless/ath/ath9k/btcoex.c index d33bf204c995..23f15a7ca7f1 100644 --- a/drivers/net/wireless/ath/ath9k/btcoex.c +++ b/drivers/net/wireless/ath/ath9k/btcoex.c | |||
@@ -51,6 +51,10 @@ void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum) | |||
51 | .bt_hold_rx_clear = true, | 51 | .bt_hold_rx_clear = true, |
52 | }; | 52 | }; |
53 | u32 i; | 53 | u32 i; |
54 | bool rxclear_polarity = ath_bt_config.bt_rxclear_polarity; | ||
55 | |||
56 | if (AR_SREV_9300_20_OR_LATER(ah)) | ||
57 | rxclear_polarity = !ath_bt_config.bt_rxclear_polarity; | ||
54 | 58 | ||
55 | btcoex_hw->bt_coex_mode = | 59 | btcoex_hw->bt_coex_mode = |
56 | (btcoex_hw->bt_coex_mode & AR_BT_QCU_THRESH) | | 60 | (btcoex_hw->bt_coex_mode & AR_BT_QCU_THRESH) | |
@@ -59,7 +63,7 @@ void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum) | |||
59 | SM(ath_bt_config.bt_txframe_extend, AR_BT_TX_FRAME_EXTEND) | | 63 | SM(ath_bt_config.bt_txframe_extend, AR_BT_TX_FRAME_EXTEND) | |
60 | SM(ath_bt_config.bt_mode, AR_BT_MODE) | | 64 | SM(ath_bt_config.bt_mode, AR_BT_MODE) | |
61 | SM(ath_bt_config.bt_quiet_collision, AR_BT_QUIET) | | 65 | SM(ath_bt_config.bt_quiet_collision, AR_BT_QUIET) | |
62 | SM(ath_bt_config.bt_rxclear_polarity, AR_BT_RX_CLEAR_POLARITY) | | 66 | SM(rxclear_polarity, AR_BT_RX_CLEAR_POLARITY) | |
63 | SM(ath_bt_config.bt_priority_time, AR_BT_PRIORITY_TIME) | | 67 | SM(ath_bt_config.bt_priority_time, AR_BT_PRIORITY_TIME) | |
64 | SM(ath_bt_config.bt_first_slot_time, AR_BT_FIRST_SLOT_TIME) | | 68 | SM(ath_bt_config.bt_first_slot_time, AR_BT_FIRST_SLOT_TIME) | |
65 | SM(qnum, AR_BT_QCU_THRESH); | 69 | SM(qnum, AR_BT_QCU_THRESH); |
@@ -142,6 +146,7 @@ void ath9k_hw_btcoex_set_weight(struct ath_hw *ah, | |||
142 | } | 146 | } |
143 | EXPORT_SYMBOL(ath9k_hw_btcoex_set_weight); | 147 | EXPORT_SYMBOL(ath9k_hw_btcoex_set_weight); |
144 | 148 | ||
149 | |||
145 | static void ath9k_hw_btcoex_enable_3wire(struct ath_hw *ah) | 150 | static void ath9k_hw_btcoex_enable_3wire(struct ath_hw *ah) |
146 | { | 151 | { |
147 | struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; | 152 | struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; |
@@ -152,9 +157,22 @@ static void ath9k_hw_btcoex_enable_3wire(struct ath_hw *ah) | |||
152 | * enable coex 3-wire | 157 | * enable coex 3-wire |
153 | */ | 158 | */ |
154 | REG_WRITE(ah, AR_BT_COEX_MODE, btcoex_hw->bt_coex_mode); | 159 | REG_WRITE(ah, AR_BT_COEX_MODE, btcoex_hw->bt_coex_mode); |
155 | REG_WRITE(ah, AR_BT_COEX_WEIGHT, btcoex_hw->bt_coex_weights); | ||
156 | REG_WRITE(ah, AR_BT_COEX_MODE2, btcoex_hw->bt_coex_mode2); | 160 | REG_WRITE(ah, AR_BT_COEX_MODE2, btcoex_hw->bt_coex_mode2); |
157 | 161 | ||
162 | |||
163 | if (AR_SREV_9300_20_OR_LATER(ah)) { | ||
164 | REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS0, ah->bt_coex_wlan_weight[0]); | ||
165 | REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS1, ah->bt_coex_wlan_weight[1]); | ||
166 | REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS0, ah->bt_coex_bt_weight[0]); | ||
167 | REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS1, ah->bt_coex_bt_weight[1]); | ||
168 | REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS2, ah->bt_coex_bt_weight[2]); | ||
169 | REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS3, ah->bt_coex_bt_weight[3]); | ||
170 | |||
171 | } else | ||
172 | REG_WRITE(ah, AR_BT_COEX_WEIGHT, btcoex_hw->bt_coex_weights); | ||
173 | |||
174 | |||
175 | |||
158 | if (AR_SREV_9271(ah)) { | 176 | if (AR_SREV_9271(ah)) { |
159 | val = REG_READ(ah, 0x50040); | 177 | val = REG_READ(ah, 0x50040); |
160 | val &= 0xFFFFFEFF; | 178 | val &= 0xFFFFFEFF; |
@@ -202,10 +220,86 @@ void ath9k_hw_btcoex_disable(struct ath_hw *ah) | |||
202 | 220 | ||
203 | if (btcoex_hw->scheme == ATH_BTCOEX_CFG_3WIRE) { | 221 | if (btcoex_hw->scheme == ATH_BTCOEX_CFG_3WIRE) { |
204 | REG_WRITE(ah, AR_BT_COEX_MODE, AR_BT_QUIET | AR_BT_MODE); | 222 | REG_WRITE(ah, AR_BT_COEX_MODE, AR_BT_QUIET | AR_BT_MODE); |
205 | REG_WRITE(ah, AR_BT_COEX_WEIGHT, 0); | ||
206 | REG_WRITE(ah, AR_BT_COEX_MODE2, 0); | 223 | REG_WRITE(ah, AR_BT_COEX_MODE2, 0); |
224 | |||
225 | if (AR_SREV_9300_20_OR_LATER(ah)) { | ||
226 | REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS0, 0); | ||
227 | REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS1, 0); | ||
228 | REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS0, 0); | ||
229 | REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS1, 0); | ||
230 | REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS2, 0); | ||
231 | REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS3, 0); | ||
232 | } else | ||
233 | REG_WRITE(ah, AR_BT_COEX_WEIGHT, 0); | ||
234 | |||
207 | } | 235 | } |
208 | 236 | ||
209 | ah->btcoex_hw.enabled = false; | 237 | ah->btcoex_hw.enabled = false; |
210 | } | 238 | } |
211 | EXPORT_SYMBOL(ath9k_hw_btcoex_disable); | 239 | EXPORT_SYMBOL(ath9k_hw_btcoex_disable); |
240 | |||
241 | static void ar9003_btcoex_bt_stomp(struct ath_hw *ah, | ||
242 | enum ath_stomp_type stomp_type) | ||
243 | { | ||
244 | ah->bt_coex_bt_weight[0] = AR9300_BT_WGHT; | ||
245 | ah->bt_coex_bt_weight[1] = AR9300_BT_WGHT; | ||
246 | ah->bt_coex_bt_weight[2] = AR9300_BT_WGHT; | ||
247 | ah->bt_coex_bt_weight[3] = AR9300_BT_WGHT; | ||
248 | |||
249 | |||
250 | switch (stomp_type) { | ||
251 | case ATH_BTCOEX_STOMP_ALL: | ||
252 | ah->bt_coex_wlan_weight[0] = AR9300_STOMP_ALL_WLAN_WGHT0; | ||
253 | ah->bt_coex_wlan_weight[1] = AR9300_STOMP_ALL_WLAN_WGHT1; | ||
254 | break; | ||
255 | case ATH_BTCOEX_STOMP_LOW: | ||
256 | ah->bt_coex_wlan_weight[0] = AR9300_STOMP_LOW_WLAN_WGHT0; | ||
257 | ah->bt_coex_wlan_weight[1] = AR9300_STOMP_LOW_WLAN_WGHT1; | ||
258 | break; | ||
259 | case ATH_BTCOEX_STOMP_NONE: | ||
260 | ah->bt_coex_wlan_weight[0] = AR9300_STOMP_NONE_WLAN_WGHT0; | ||
261 | ah->bt_coex_wlan_weight[1] = AR9300_STOMP_NONE_WLAN_WGHT1; | ||
262 | break; | ||
263 | |||
264 | default: | ||
265 | ath_dbg(ath9k_hw_common(ah), ATH_DBG_BTCOEX, | ||
266 | "Invalid Stomptype\n"); | ||
267 | break; | ||
268 | } | ||
269 | |||
270 | ath9k_hw_btcoex_enable(ah); | ||
271 | } | ||
272 | |||
273 | /* | ||
274 | * Configures appropriate weight based on stomp type. | ||
275 | */ | ||
276 | void ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah, | ||
277 | enum ath_stomp_type stomp_type) | ||
278 | { | ||
279 | if (AR_SREV_9300_20_OR_LATER(ah)) { | ||
280 | ar9003_btcoex_bt_stomp(ah, stomp_type); | ||
281 | return; | ||
282 | } | ||
283 | |||
284 | switch (stomp_type) { | ||
285 | case ATH_BTCOEX_STOMP_ALL: | ||
286 | ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, | ||
287 | AR_STOMP_ALL_WLAN_WGHT); | ||
288 | break; | ||
289 | case ATH_BTCOEX_STOMP_LOW: | ||
290 | ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, | ||
291 | AR_STOMP_LOW_WLAN_WGHT); | ||
292 | break; | ||
293 | case ATH_BTCOEX_STOMP_NONE: | ||
294 | ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, | ||
295 | AR_STOMP_NONE_WLAN_WGHT); | ||
296 | break; | ||
297 | default: | ||
298 | ath_dbg(ath9k_hw_common(ah), ATH_DBG_BTCOEX, | ||
299 | "Invalid Stomptype\n"); | ||
300 | break; | ||
301 | } | ||
302 | |||
303 | ath9k_hw_btcoex_enable(ah); | ||
304 | } | ||
305 | EXPORT_SYMBOL(ath9k_hw_btcoex_bt_stomp); | ||
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.h b/drivers/net/wireless/ath/ath9k/btcoex.h index 588dfd464dd1..a9efca83d676 100644 --- a/drivers/net/wireless/ath/ath9k/btcoex.h +++ b/drivers/net/wireless/ath/ath9k/btcoex.h | |||
@@ -19,9 +19,13 @@ | |||
19 | 19 | ||
20 | #include "hw.h" | 20 | #include "hw.h" |
21 | 21 | ||
22 | #define ATH_WLANACTIVE_GPIO 5 | 22 | #define ATH_WLANACTIVE_GPIO_9280 5 |
23 | #define ATH_BTACTIVE_GPIO 6 | 23 | #define ATH_BTACTIVE_GPIO_9280 6 |
24 | #define ATH_BTPRIORITY_GPIO 7 | 24 | #define ATH_BTPRIORITY_GPIO_9285 7 |
25 | |||
26 | #define ATH_WLANACTIVE_GPIO_9300 5 | ||
27 | #define ATH_BTACTIVE_GPIO_9300 4 | ||
28 | #define ATH_BTPRIORITY_GPIO_9300 8 | ||
25 | 29 | ||
26 | #define ATH_BTCOEX_DEF_BT_PERIOD 45 | 30 | #define ATH_BTCOEX_DEF_BT_PERIOD 45 |
27 | #define ATH_BTCOEX_DEF_DUTY_CYCLE 55 | 31 | #define ATH_BTCOEX_DEF_DUTY_CYCLE 55 |
@@ -32,6 +36,14 @@ | |||
32 | #define ATH_BT_CNT_THRESHOLD 3 | 36 | #define ATH_BT_CNT_THRESHOLD 3 |
33 | #define ATH_BT_CNT_SCAN_THRESHOLD 15 | 37 | #define ATH_BT_CNT_SCAN_THRESHOLD 15 |
34 | 38 | ||
39 | /* Defines the BT AR_BT_COEX_WGHT used */ | ||
40 | enum ath_stomp_type { | ||
41 | ATH_BTCOEX_NO_STOMP, | ||
42 | ATH_BTCOEX_STOMP_ALL, | ||
43 | ATH_BTCOEX_STOMP_LOW, | ||
44 | ATH_BTCOEX_STOMP_NONE | ||
45 | }; | ||
46 | |||
35 | enum ath_btcoex_scheme { | 47 | enum ath_btcoex_scheme { |
36 | ATH_BTCOEX_CFG_NONE, | 48 | ATH_BTCOEX_CFG_NONE, |
37 | ATH_BTCOEX_CFG_2WIRE, | 49 | ATH_BTCOEX_CFG_2WIRE, |
@@ -57,5 +69,7 @@ void ath9k_hw_btcoex_set_weight(struct ath_hw *ah, | |||
57 | u32 wlan_weight); | 69 | u32 wlan_weight); |
58 | void ath9k_hw_btcoex_enable(struct ath_hw *ah); | 70 | void ath9k_hw_btcoex_enable(struct ath_hw *ah); |
59 | void ath9k_hw_btcoex_disable(struct ath_hw *ah); | 71 | void ath9k_hw_btcoex_disable(struct ath_hw *ah); |
72 | void ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah, | ||
73 | enum ath_stomp_type stomp_type); | ||
60 | 74 | ||
61 | #endif | 75 | #endif |
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c index 16ba8c67fbd5..74535e6dfb82 100644 --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c | |||
@@ -158,37 +158,6 @@ int ath9k_cmn_count_streams(unsigned int chainmask, int max) | |||
158 | } | 158 | } |
159 | EXPORT_SYMBOL(ath9k_cmn_count_streams); | 159 | EXPORT_SYMBOL(ath9k_cmn_count_streams); |
160 | 160 | ||
161 | /* | ||
162 | * Configures appropriate weight based on stomp type. | ||
163 | */ | ||
164 | void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common, | ||
165 | enum ath_stomp_type stomp_type) | ||
166 | { | ||
167 | struct ath_hw *ah = common->ah; | ||
168 | |||
169 | switch (stomp_type) { | ||
170 | case ATH_BTCOEX_STOMP_ALL: | ||
171 | ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, | ||
172 | AR_STOMP_ALL_WLAN_WGHT); | ||
173 | break; | ||
174 | case ATH_BTCOEX_STOMP_LOW: | ||
175 | ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, | ||
176 | AR_STOMP_LOW_WLAN_WGHT); | ||
177 | break; | ||
178 | case ATH_BTCOEX_STOMP_NONE: | ||
179 | ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, | ||
180 | AR_STOMP_NONE_WLAN_WGHT); | ||
181 | break; | ||
182 | default: | ||
183 | ath_dbg(common, ATH_DBG_BTCOEX, | ||
184 | "Invalid Stomptype\n"); | ||
185 | break; | ||
186 | } | ||
187 | |||
188 | ath9k_hw_btcoex_enable(ah); | ||
189 | } | ||
190 | EXPORT_SYMBOL(ath9k_cmn_btcoex_bt_stomp); | ||
191 | |||
192 | void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow, | 161 | void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow, |
193 | u16 new_txpow, u16 *txpower) | 162 | u16 new_txpow, u16 *txpower) |
194 | { | 163 | { |
diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h index b2f7b5f89097..5124f1420b3a 100644 --- a/drivers/net/wireless/ath/ath9k/common.h +++ b/drivers/net/wireless/ath/ath9k/common.h | |||
@@ -50,14 +50,6 @@ | |||
50 | #define ATH_EP_RND(x, mul) \ | 50 | #define ATH_EP_RND(x, mul) \ |
51 | ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) | 51 | ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) |
52 | 52 | ||
53 | /* Defines the BT AR_BT_COEX_WGHT used */ | ||
54 | enum ath_stomp_type { | ||
55 | ATH_BTCOEX_NO_STOMP, | ||
56 | ATH_BTCOEX_STOMP_ALL, | ||
57 | ATH_BTCOEX_STOMP_LOW, | ||
58 | ATH_BTCOEX_STOMP_NONE | ||
59 | }; | ||
60 | |||
61 | int ath9k_cmn_padpos(__le16 frame_control); | 53 | int ath9k_cmn_padpos(__le16 frame_control); |
62 | int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb); | 54 | int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb); |
63 | void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, | 55 | void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 34f191ec8e8c..bad1a87249b6 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -326,6 +326,8 @@ void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status) | |||
326 | sc->debug.stats.istats.dtimsync++; | 326 | sc->debug.stats.istats.dtimsync++; |
327 | if (status & ATH9K_INT_DTIM) | 327 | if (status & ATH9K_INT_DTIM) |
328 | sc->debug.stats.istats.dtim++; | 328 | sc->debug.stats.istats.dtim++; |
329 | if (status & ATH9K_INT_TSFOOR) | ||
330 | sc->debug.stats.istats.tsfoor++; | ||
329 | } | 331 | } |
330 | 332 | ||
331 | static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, | 333 | static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, |
@@ -380,8 +382,11 @@ static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, | |||
380 | len += snprintf(buf + len, sizeof(buf) - len, | 382 | len += snprintf(buf + len, sizeof(buf) - len, |
381 | "%8s: %10u\n", "DTIM", sc->debug.stats.istats.dtim); | 383 | "%8s: %10u\n", "DTIM", sc->debug.stats.istats.dtim); |
382 | len += snprintf(buf + len, sizeof(buf) - len, | 384 | len += snprintf(buf + len, sizeof(buf) - len, |
385 | "%8s: %10u\n", "TSFOOR", sc->debug.stats.istats.tsfoor); | ||
386 | len += snprintf(buf + len, sizeof(buf) - len, | ||
383 | "%8s: %10u\n", "TOTAL", sc->debug.stats.istats.total); | 387 | "%8s: %10u\n", "TOTAL", sc->debug.stats.istats.total); |
384 | 388 | ||
389 | |||
385 | if (len > sizeof(buf)) | 390 | if (len > sizeof(buf)) |
386 | len = sizeof(buf); | 391 | len = sizeof(buf); |
387 | 392 | ||
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h index 1f9f8eada465..5488a324cc10 100644 --- a/drivers/net/wireless/ath/ath9k/debug.h +++ b/drivers/net/wireless/ath/ath9k/debug.h | |||
@@ -54,6 +54,9 @@ struct ath_buf; | |||
54 | * @dtimsync: DTIM sync lossage | 54 | * @dtimsync: DTIM sync lossage |
55 | * @dtim: RX Beacon with DTIM | 55 | * @dtim: RX Beacon with DTIM |
56 | * @bb_watchdog: Baseband watchdog | 56 | * @bb_watchdog: Baseband watchdog |
57 | * @tsfoor: TSF out of range, indicates that the corrected TSF received | ||
58 | * from a beacon differs from the PCU's internal TSF by more than a | ||
59 | * (programmable) threshold | ||
57 | */ | 60 | */ |
58 | struct ath_interrupt_stats { | 61 | struct ath_interrupt_stats { |
59 | u32 total; | 62 | u32 total; |
@@ -78,6 +81,7 @@ struct ath_interrupt_stats { | |||
78 | u32 dtimsync; | 81 | u32 dtimsync; |
79 | u32 dtim; | 82 | u32 dtim; |
80 | u32 bb_watchdog; | 83 | u32 bb_watchdog; |
84 | u32 tsfoor; | ||
81 | }; | 85 | }; |
82 | 86 | ||
83 | /** | 87 | /** |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index 13579752a300..b87db4763098 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
@@ -319,10 +319,9 @@ static void ath9k_hw_set_ar9287_power_cal_table(struct ath_hw *ah, | |||
319 | u16 numXpdGain, xpdMask; | 319 | u16 numXpdGain, xpdMask; |
320 | u16 xpdGainValues[AR5416_NUM_PD_GAINS] = {0, 0, 0, 0}; | 320 | u16 xpdGainValues[AR5416_NUM_PD_GAINS] = {0, 0, 0, 0}; |
321 | u32 reg32, regOffset, regChainOffset, regval; | 321 | u32 reg32, regOffset, regChainOffset, regval; |
322 | int16_t modalIdx, diff = 0; | 322 | int16_t diff = 0; |
323 | struct ar9287_eeprom *pEepData = &ah->eeprom.map9287; | 323 | struct ar9287_eeprom *pEepData = &ah->eeprom.map9287; |
324 | 324 | ||
325 | modalIdx = IS_CHAN_2GHZ(chan) ? 1 : 0; | ||
326 | xpdMask = pEepData->modalHeader.xpdGain; | 325 | xpdMask = pEepData->modalHeader.xpdGain; |
327 | 326 | ||
328 | if ((pEepData->baseEepHeader.version & AR9287_EEP_VER_MINOR_MASK) >= | 327 | if ((pEepData->baseEepHeader.version & AR9287_EEP_VER_MINOR_MASK) >= |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c index 995949ddd63e..c031854b569f 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c | |||
@@ -231,6 +231,10 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah) | |||
231 | integer = swab32(pModal->antCtrlChain[i]); | 231 | integer = swab32(pModal->antCtrlChain[i]); |
232 | pModal->antCtrlChain[i] = integer; | 232 | pModal->antCtrlChain[i] = integer; |
233 | } | 233 | } |
234 | for (i = 0; i < 3; i++) { | ||
235 | word = swab16(pModal->xpaBiasLvlFreq[i]); | ||
236 | pModal->xpaBiasLvlFreq[i] = word; | ||
237 | } | ||
234 | 238 | ||
235 | for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { | 239 | for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { |
236 | word = swab16(pModal->spurChans[i].spurChan); | 240 | word = swab16(pModal->spurChans[i].spurChan); |
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c index 44a0a886124d..0349b3a1cc58 100644 --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c | |||
@@ -46,6 +46,8 @@ void ath_init_leds(struct ath_softc *sc) | |||
46 | sc->sc_ah->led_pin = ATH_LED_PIN_9287; | 46 | sc->sc_ah->led_pin = ATH_LED_PIN_9287; |
47 | else if (AR_SREV_9485(sc->sc_ah)) | 47 | else if (AR_SREV_9485(sc->sc_ah)) |
48 | sc->sc_ah->led_pin = ATH_LED_PIN_9485; | 48 | sc->sc_ah->led_pin = ATH_LED_PIN_9485; |
49 | else if (AR_SREV_9300(sc->sc_ah)) | ||
50 | sc->sc_ah->led_pin = ATH_LED_PIN_9300; | ||
49 | else | 51 | else |
50 | sc->sc_ah->led_pin = ATH_LED_PIN_DEF; | 52 | sc->sc_ah->led_pin = ATH_LED_PIN_DEF; |
51 | } | 53 | } |
@@ -138,10 +140,10 @@ static void ath_detect_bt_priority(struct ath_softc *sc) | |||
138 | 140 | ||
139 | static void ath9k_gen_timer_start(struct ath_hw *ah, | 141 | static void ath9k_gen_timer_start(struct ath_hw *ah, |
140 | struct ath_gen_timer *timer, | 142 | struct ath_gen_timer *timer, |
141 | u32 timer_next, | 143 | u32 trig_timeout, |
142 | u32 timer_period) | 144 | u32 timer_period) |
143 | { | 145 | { |
144 | ath9k_hw_gen_timer_start(ah, timer, timer_next, timer_period); | 146 | ath9k_hw_gen_timer_start(ah, timer, trig_timeout, timer_period); |
145 | 147 | ||
146 | if ((ah->imask & ATH9K_INT_GENTIMER) == 0) { | 148 | if ((ah->imask & ATH9K_INT_GENTIMER) == 0) { |
147 | ath9k_hw_disable_interrupts(ah); | 149 | ath9k_hw_disable_interrupts(ah); |
@@ -174,17 +176,17 @@ static void ath_btcoex_period_timer(unsigned long data) | |||
174 | struct ath_softc *sc = (struct ath_softc *) data; | 176 | struct ath_softc *sc = (struct ath_softc *) data; |
175 | struct ath_hw *ah = sc->sc_ah; | 177 | struct ath_hw *ah = sc->sc_ah; |
176 | struct ath_btcoex *btcoex = &sc->btcoex; | 178 | struct ath_btcoex *btcoex = &sc->btcoex; |
177 | struct ath_common *common = ath9k_hw_common(ah); | ||
178 | u32 timer_period; | 179 | u32 timer_period; |
179 | bool is_btscan; | 180 | bool is_btscan; |
180 | 181 | ||
182 | ath9k_ps_wakeup(sc); | ||
181 | ath_detect_bt_priority(sc); | 183 | ath_detect_bt_priority(sc); |
182 | 184 | ||
183 | is_btscan = sc->sc_flags & SC_OP_BT_SCAN; | 185 | is_btscan = sc->sc_flags & SC_OP_BT_SCAN; |
184 | 186 | ||
185 | spin_lock_bh(&btcoex->btcoex_lock); | 187 | spin_lock_bh(&btcoex->btcoex_lock); |
186 | 188 | ||
187 | ath9k_cmn_btcoex_bt_stomp(common, is_btscan ? ATH_BTCOEX_STOMP_ALL : | 189 | ath9k_hw_btcoex_bt_stomp(ah, is_btscan ? ATH_BTCOEX_STOMP_ALL : |
188 | btcoex->bt_stomp_type); | 190 | btcoex->bt_stomp_type); |
189 | 191 | ||
190 | spin_unlock_bh(&btcoex->btcoex_lock); | 192 | spin_unlock_bh(&btcoex->btcoex_lock); |
@@ -195,11 +197,12 @@ static void ath_btcoex_period_timer(unsigned long data) | |||
195 | 197 | ||
196 | timer_period = is_btscan ? btcoex->btscan_no_stomp : | 198 | timer_period = is_btscan ? btcoex->btscan_no_stomp : |
197 | btcoex->btcoex_no_stomp; | 199 | btcoex->btcoex_no_stomp; |
198 | ath9k_gen_timer_start(ah, btcoex->no_stomp_timer, 0, | 200 | ath9k_gen_timer_start(ah, btcoex->no_stomp_timer, timer_period, |
199 | timer_period * 10); | 201 | timer_period * 10); |
200 | btcoex->hw_timer_enabled = true; | 202 | btcoex->hw_timer_enabled = true; |
201 | } | 203 | } |
202 | 204 | ||
205 | ath9k_ps_restore(sc); | ||
203 | mod_timer(&btcoex->period_timer, jiffies + | 206 | mod_timer(&btcoex->period_timer, jiffies + |
204 | msecs_to_jiffies(ATH_BTCOEX_DEF_BT_PERIOD)); | 207 | msecs_to_jiffies(ATH_BTCOEX_DEF_BT_PERIOD)); |
205 | } | 208 | } |
@@ -219,14 +222,16 @@ static void ath_btcoex_no_stomp_timer(void *arg) | |||
219 | ath_dbg(common, ATH_DBG_BTCOEX, | 222 | ath_dbg(common, ATH_DBG_BTCOEX, |
220 | "no stomp timer running\n"); | 223 | "no stomp timer running\n"); |
221 | 224 | ||
225 | ath9k_ps_wakeup(sc); | ||
222 | spin_lock_bh(&btcoex->btcoex_lock); | 226 | spin_lock_bh(&btcoex->btcoex_lock); |
223 | 227 | ||
224 | if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || is_btscan) | 228 | if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || is_btscan) |
225 | ath9k_cmn_btcoex_bt_stomp(common, ATH_BTCOEX_STOMP_NONE); | 229 | ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); |
226 | else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) | 230 | else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) |
227 | ath9k_cmn_btcoex_bt_stomp(common, ATH_BTCOEX_STOMP_LOW); | 231 | ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_LOW); |
228 | 232 | ||
229 | spin_unlock_bh(&btcoex->btcoex_lock); | 233 | spin_unlock_bh(&btcoex->btcoex_lock); |
234 | ath9k_ps_restore(sc); | ||
230 | } | 235 | } |
231 | 236 | ||
232 | int ath_init_btcoex_timer(struct ath_softc *sc) | 237 | int ath_init_btcoex_timer(struct ath_softc *sc) |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h index f59df48a86e2..2bdcdbc14b1e 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.h +++ b/drivers/net/wireless/ath/ath9k/hif_usb.h | |||
@@ -17,6 +17,9 @@ | |||
17 | #ifndef HTC_USB_H | 17 | #ifndef HTC_USB_H |
18 | #define HTC_USB_H | 18 | #define HTC_USB_H |
19 | 19 | ||
20 | #define MAJOR_VERSION_REQ 1 | ||
21 | #define MINOR_VERSION_REQ 2 | ||
22 | |||
20 | #define IS_AR7010_DEVICE(_v) (((_v) == AR9280_USB) || ((_v) == AR9287_USB)) | 23 | #define IS_AR7010_DEVICE(_v) (((_v) == AR9280_USB) || ((_v) == AR9287_USB)) |
21 | 24 | ||
22 | #define AR9271_FIRMWARE 0x501000 | 25 | #define AR9271_FIRMWARE 0x501000 |
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index 48a885575085..dfc7a982fc7e 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h | |||
@@ -66,8 +66,6 @@ enum htc_opmode { | |||
66 | HTC_M_WDS = 2 | 66 | HTC_M_WDS = 2 |
67 | }; | 67 | }; |
68 | 68 | ||
69 | #define ATH9K_HTC_HDRSPACE sizeof(struct htc_frame_hdr) | ||
70 | |||
71 | #define ATH9K_HTC_AMPDU 1 | 69 | #define ATH9K_HTC_AMPDU 1 |
72 | #define ATH9K_HTC_NORMAL 2 | 70 | #define ATH9K_HTC_NORMAL 2 |
73 | #define ATH9K_HTC_BEACON 3 | 71 | #define ATH9K_HTC_BEACON 3 |
@@ -75,7 +73,6 @@ enum htc_opmode { | |||
75 | 73 | ||
76 | #define ATH9K_HTC_TX_CTSONLY 0x1 | 74 | #define ATH9K_HTC_TX_CTSONLY 0x1 |
77 | #define ATH9K_HTC_TX_RTSCTS 0x2 | 75 | #define ATH9K_HTC_TX_RTSCTS 0x2 |
78 | #define ATH9K_HTC_TX_USE_MIN_RATE 0x100 | ||
79 | 76 | ||
80 | struct tx_frame_hdr { | 77 | struct tx_frame_hdr { |
81 | u8 data_type; | 78 | u8 data_type; |
@@ -106,15 +103,14 @@ struct tx_beacon_header { | |||
106 | u16 rev; | 103 | u16 rev; |
107 | } __packed; | 104 | } __packed; |
108 | 105 | ||
106 | #define MAX_TX_AMPDU_SUBFRAMES_9271 17 | ||
107 | #define MAX_TX_AMPDU_SUBFRAMES_7010 22 | ||
108 | |||
109 | struct ath9k_htc_cap_target { | 109 | struct ath9k_htc_cap_target { |
110 | u32 flags; | 110 | __be32 ampdu_limit; |
111 | u32 flags_ext; | ||
112 | u32 ampdu_limit; | ||
113 | u8 ampdu_subframes; | 111 | u8 ampdu_subframes; |
112 | u8 enable_coex; | ||
114 | u8 tx_chainmask; | 113 | u8 tx_chainmask; |
115 | u8 tx_chainmask_legacy; | ||
116 | u8 rtscts_ratecode; | ||
117 | u8 protmode; | ||
118 | u8 pad; | 114 | u8 pad; |
119 | } __packed; | 115 | } __packed; |
120 | 116 | ||
@@ -175,6 +171,13 @@ struct ath9k_htc_target_rate { | |||
175 | struct ath9k_htc_rate rates; | 171 | struct ath9k_htc_rate rates; |
176 | }; | 172 | }; |
177 | 173 | ||
174 | struct ath9k_htc_target_rate_mask { | ||
175 | u8 vif_index; | ||
176 | u8 band; | ||
177 | __be32 mask; | ||
178 | u16 pad; | ||
179 | } __packed; | ||
180 | |||
178 | struct ath9k_htc_target_int_stats { | 181 | struct ath9k_htc_target_int_stats { |
179 | __be32 rx; | 182 | __be32 rx; |
180 | __be32 rxorn; | 183 | __be32 rxorn; |
@@ -382,25 +385,6 @@ static inline void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, | |||
382 | #define ATH_LED_PIN_9287 10 | 385 | #define ATH_LED_PIN_9287 10 |
383 | #define ATH_LED_PIN_9271 15 | 386 | #define ATH_LED_PIN_9271 15 |
384 | #define ATH_LED_PIN_7010 12 | 387 | #define ATH_LED_PIN_7010 12 |
385 | #define ATH_LED_ON_DURATION_IDLE 350 /* in msecs */ | ||
386 | #define ATH_LED_OFF_DURATION_IDLE 250 /* in msecs */ | ||
387 | |||
388 | enum ath_led_type { | ||
389 | ATH_LED_RADIO, | ||
390 | ATH_LED_ASSOC, | ||
391 | ATH_LED_TX, | ||
392 | ATH_LED_RX | ||
393 | }; | ||
394 | |||
395 | struct ath_led { | ||
396 | struct ath9k_htc_priv *priv; | ||
397 | struct led_classdev led_cdev; | ||
398 | enum ath_led_type led_type; | ||
399 | struct delayed_work brightness_work; | ||
400 | char name[32]; | ||
401 | bool registered; | ||
402 | int brightness; | ||
403 | }; | ||
404 | 388 | ||
405 | #define BSTUCK_THRESHOLD 10 | 389 | #define BSTUCK_THRESHOLD 10 |
406 | 390 | ||
@@ -434,14 +418,11 @@ void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv *priv); | |||
434 | 418 | ||
435 | #define OP_INVALID BIT(0) | 419 | #define OP_INVALID BIT(0) |
436 | #define OP_SCANNING BIT(1) | 420 | #define OP_SCANNING BIT(1) |
437 | #define OP_LED_ASSOCIATED BIT(2) | 421 | #define OP_ENABLE_BEACON BIT(2) |
438 | #define OP_LED_ON BIT(3) | 422 | #define OP_BT_PRIORITY_DETECTED BIT(3) |
439 | #define OP_ENABLE_BEACON BIT(4) | 423 | #define OP_BT_SCAN BIT(4) |
440 | #define OP_LED_DEINIT BIT(5) | 424 | #define OP_ANI_RUNNING BIT(5) |
441 | #define OP_BT_PRIORITY_DETECTED BIT(6) | 425 | #define OP_TSF_RESET BIT(6) |
442 | #define OP_BT_SCAN BIT(7) | ||
443 | #define OP_ANI_RUNNING BIT(8) | ||
444 | #define OP_TSF_RESET BIT(9) | ||
445 | 426 | ||
446 | struct ath9k_htc_priv { | 427 | struct ath9k_htc_priv { |
447 | struct device *dev; | 428 | struct device *dev; |
@@ -501,15 +482,13 @@ struct ath9k_htc_priv { | |||
501 | bool ps_enabled; | 482 | bool ps_enabled; |
502 | bool ps_idle; | 483 | bool ps_idle; |
503 | 484 | ||
504 | struct ath_led radio_led; | 485 | #ifdef CONFIG_MAC80211_LEDS |
505 | struct ath_led assoc_led; | 486 | enum led_brightness brightness; |
506 | struct ath_led tx_led; | 487 | bool led_registered; |
507 | struct ath_led rx_led; | 488 | char led_name[32]; |
508 | struct delayed_work ath9k_led_blink_work; | 489 | struct led_classdev led_cdev; |
509 | int led_on_duration; | 490 | struct work_struct led_work; |
510 | int led_off_duration; | 491 | #endif |
511 | int led_on_cnt; | ||
512 | int led_off_cnt; | ||
513 | 492 | ||
514 | int beaconq; | 493 | int beaconq; |
515 | int cabq; | 494 | int cabq; |
@@ -551,7 +530,8 @@ void ath9k_htc_txep(void *priv, struct sk_buff *skb, enum htc_endpoint_id ep_id, | |||
551 | void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb, | 530 | void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb, |
552 | enum htc_endpoint_id ep_id, bool txok); | 531 | enum htc_endpoint_id ep_id, bool txok); |
553 | 532 | ||
554 | int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv); | 533 | int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv, |
534 | u8 enable_coex); | ||
555 | void ath9k_htc_station_work(struct work_struct *work); | 535 | void ath9k_htc_station_work(struct work_struct *work); |
556 | void ath9k_htc_aggr_work(struct work_struct *work); | 536 | void ath9k_htc_aggr_work(struct work_struct *work); |
557 | void ath9k_htc_ani_work(struct work_struct *work); | 537 | void ath9k_htc_ani_work(struct work_struct *work); |
@@ -593,9 +573,24 @@ void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv); | |||
593 | void ath9k_htc_rfkill_poll_state(struct ieee80211_hw *hw); | 573 | void ath9k_htc_rfkill_poll_state(struct ieee80211_hw *hw); |
594 | void ath9k_htc_radio_enable(struct ieee80211_hw *hw); | 574 | void ath9k_htc_radio_enable(struct ieee80211_hw *hw); |
595 | void ath9k_htc_radio_disable(struct ieee80211_hw *hw); | 575 | void ath9k_htc_radio_disable(struct ieee80211_hw *hw); |
596 | void ath9k_led_stop_brightness(struct ath9k_htc_priv *priv); | 576 | |
577 | #ifdef CONFIG_MAC80211_LEDS | ||
597 | void ath9k_init_leds(struct ath9k_htc_priv *priv); | 578 | void ath9k_init_leds(struct ath9k_htc_priv *priv); |
598 | void ath9k_deinit_leds(struct ath9k_htc_priv *priv); | 579 | void ath9k_deinit_leds(struct ath9k_htc_priv *priv); |
580 | void ath9k_led_work(struct work_struct *work); | ||
581 | #else | ||
582 | static inline void ath9k_init_leds(struct ath9k_htc_priv *priv) | ||
583 | { | ||
584 | } | ||
585 | |||
586 | static inline void ath9k_deinit_leds(struct ath9k_htc_priv *priv) | ||
587 | { | ||
588 | } | ||
589 | |||
590 | static inline void ath9k_led_work(struct work_struct *work) | ||
591 | { | ||
592 | } | ||
593 | #endif | ||
599 | 594 | ||
600 | int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, | 595 | int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, |
601 | u16 devid, char *product, u32 drv_info); | 596 | u16 devid, char *product, u32 drv_info); |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c index a157107b3f3b..0ded2c66d5ff 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c | |||
@@ -74,7 +74,7 @@ static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv, | |||
74 | __be32 htc_imask = 0; | 74 | __be32 htc_imask = 0; |
75 | u64 tsf; | 75 | u64 tsf; |
76 | int num_beacons, offset, dtim_dec_count, cfp_dec_count; | 76 | int num_beacons, offset, dtim_dec_count, cfp_dec_count; |
77 | int ret; | 77 | int ret __attribute__ ((unused)); |
78 | u8 cmd_rsp; | 78 | u8 cmd_rsp; |
79 | 79 | ||
80 | memset(&bs, 0, sizeof(bs)); | 80 | memset(&bs, 0, sizeof(bs)); |
@@ -190,7 +190,7 @@ static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv, | |||
190 | enum ath9k_int imask = 0; | 190 | enum ath9k_int imask = 0; |
191 | u32 nexttbtt, intval, tsftu; | 191 | u32 nexttbtt, intval, tsftu; |
192 | __be32 htc_imask = 0; | 192 | __be32 htc_imask = 0; |
193 | int ret; | 193 | int ret __attribute__ ((unused)); |
194 | u8 cmd_rsp; | 194 | u8 cmd_rsp; |
195 | u64 tsf; | 195 | u64 tsf; |
196 | 196 | ||
@@ -246,7 +246,7 @@ static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv, | |||
246 | enum ath9k_int imask = 0; | 246 | enum ath9k_int imask = 0; |
247 | u32 nexttbtt, intval, tsftu; | 247 | u32 nexttbtt, intval, tsftu; |
248 | __be32 htc_imask = 0; | 248 | __be32 htc_imask = 0; |
249 | int ret; | 249 | int ret __attribute__ ((unused)); |
250 | u8 cmd_rsp; | 250 | u8 cmd_rsp; |
251 | u64 tsf; | 251 | u64 tsf; |
252 | 252 | ||
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c index eca777497fe5..aa48b3abbc48 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c | |||
@@ -33,9 +33,15 @@ static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf, | |||
33 | 33 | ||
34 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); | 34 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); |
35 | 35 | ||
36 | ath9k_htc_ps_wakeup(priv); | ||
37 | |||
36 | WMI_CMD(WMI_INT_STATS_CMDID); | 38 | WMI_CMD(WMI_INT_STATS_CMDID); |
37 | if (ret) | 39 | if (ret) { |
40 | ath9k_htc_ps_restore(priv); | ||
38 | return -EINVAL; | 41 | return -EINVAL; |
42 | } | ||
43 | |||
44 | ath9k_htc_ps_restore(priv); | ||
39 | 45 | ||
40 | len += snprintf(buf + len, sizeof(buf) - len, | 46 | len += snprintf(buf + len, sizeof(buf) - len, |
41 | "%20s : %10u\n", "RX", | 47 | "%20s : %10u\n", "RX", |
@@ -85,9 +91,15 @@ static ssize_t read_file_tgt_tx_stats(struct file *file, char __user *user_buf, | |||
85 | 91 | ||
86 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); | 92 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); |
87 | 93 | ||
94 | ath9k_htc_ps_wakeup(priv); | ||
95 | |||
88 | WMI_CMD(WMI_TX_STATS_CMDID); | 96 | WMI_CMD(WMI_TX_STATS_CMDID); |
89 | if (ret) | 97 | if (ret) { |
98 | ath9k_htc_ps_restore(priv); | ||
90 | return -EINVAL; | 99 | return -EINVAL; |
100 | } | ||
101 | |||
102 | ath9k_htc_ps_restore(priv); | ||
91 | 103 | ||
92 | len += snprintf(buf + len, sizeof(buf) - len, | 104 | len += snprintf(buf + len, sizeof(buf) - len, |
93 | "%20s : %10u\n", "Xretries", | 105 | "%20s : %10u\n", "Xretries", |
@@ -149,9 +161,15 @@ static ssize_t read_file_tgt_rx_stats(struct file *file, char __user *user_buf, | |||
149 | 161 | ||
150 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); | 162 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); |
151 | 163 | ||
164 | ath9k_htc_ps_wakeup(priv); | ||
165 | |||
152 | WMI_CMD(WMI_RX_STATS_CMDID); | 166 | WMI_CMD(WMI_RX_STATS_CMDID); |
153 | if (ret) | 167 | if (ret) { |
168 | ath9k_htc_ps_restore(priv); | ||
154 | return -EINVAL; | 169 | return -EINVAL; |
170 | } | ||
171 | |||
172 | ath9k_htc_ps_restore(priv); | ||
155 | 173 | ||
156 | len += snprintf(buf + len, sizeof(buf) - len, | 174 | len += snprintf(buf + len, sizeof(buf) - len, |
157 | "%20s : %10u\n", "NoBuf", | 175 | "%20s : %10u\n", "NoBuf", |
@@ -474,6 +492,439 @@ static const struct file_operations fops_debug = { | |||
474 | .llseek = default_llseek, | 492 | .llseek = default_llseek, |
475 | }; | 493 | }; |
476 | 494 | ||
495 | static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, | ||
496 | size_t count, loff_t *ppos) | ||
497 | { | ||
498 | struct ath9k_htc_priv *priv = file->private_data; | ||
499 | struct ath_common *common = ath9k_hw_common(priv->ah); | ||
500 | struct base_eep_header *pBase = NULL; | ||
501 | unsigned int len = 0, size = 1500; | ||
502 | ssize_t retval = 0; | ||
503 | char *buf; | ||
504 | |||
505 | /* | ||
506 | * This can be done since all the 3 EEPROM families have the | ||
507 | * same base header upto a certain point, and we are interested in | ||
508 | * the data only upto that point. | ||
509 | */ | ||
510 | |||
511 | if (AR_SREV_9271(priv->ah)) | ||
512 | pBase = (struct base_eep_header *) | ||
513 | &priv->ah->eeprom.map4k.baseEepHeader; | ||
514 | else if (priv->ah->hw_version.usbdev == AR9280_USB) | ||
515 | pBase = (struct base_eep_header *) | ||
516 | &priv->ah->eeprom.def.baseEepHeader; | ||
517 | else if (priv->ah->hw_version.usbdev == AR9287_USB) | ||
518 | pBase = (struct base_eep_header *) | ||
519 | &priv->ah->eeprom.map9287.baseEepHeader; | ||
520 | |||
521 | if (pBase == NULL) { | ||
522 | ath_err(common, "Unknown EEPROM type\n"); | ||
523 | return 0; | ||
524 | } | ||
525 | |||
526 | buf = kzalloc(size, GFP_KERNEL); | ||
527 | if (buf == NULL) | ||
528 | return -ENOMEM; | ||
529 | |||
530 | len += snprintf(buf + len, size - len, | ||
531 | "%20s : %10d\n", "Major Version", | ||
532 | pBase->version >> 12); | ||
533 | len += snprintf(buf + len, size - len, | ||
534 | "%20s : %10d\n", "Minor Version", | ||
535 | pBase->version & 0xFFF); | ||
536 | len += snprintf(buf + len, size - len, | ||
537 | "%20s : %10d\n", "Checksum", | ||
538 | pBase->checksum); | ||
539 | len += snprintf(buf + len, size - len, | ||
540 | "%20s : %10d\n", "Length", | ||
541 | pBase->length); | ||
542 | len += snprintf(buf + len, size - len, | ||
543 | "%20s : %10d\n", "RegDomain1", | ||
544 | pBase->regDmn[0]); | ||
545 | len += snprintf(buf + len, size - len, | ||
546 | "%20s : %10d\n", "RegDomain2", | ||
547 | pBase->regDmn[1]); | ||
548 | len += snprintf(buf + len, size - len, | ||
549 | "%20s : %10d\n", | ||
550 | "TX Mask", pBase->txMask); | ||
551 | len += snprintf(buf + len, size - len, | ||
552 | "%20s : %10d\n", | ||
553 | "RX Mask", pBase->rxMask); | ||
554 | len += snprintf(buf + len, size - len, | ||
555 | "%20s : %10d\n", | ||
556 | "Allow 5GHz", | ||
557 | !!(pBase->opCapFlags & AR5416_OPFLAGS_11A)); | ||
558 | len += snprintf(buf + len, size - len, | ||
559 | "%20s : %10d\n", | ||
560 | "Allow 2GHz", | ||
561 | !!(pBase->opCapFlags & AR5416_OPFLAGS_11G)); | ||
562 | len += snprintf(buf + len, size - len, | ||
563 | "%20s : %10d\n", | ||
564 | "Disable 2GHz HT20", | ||
565 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT20)); | ||
566 | len += snprintf(buf + len, size - len, | ||
567 | "%20s : %10d\n", | ||
568 | "Disable 2GHz HT40", | ||
569 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT40)); | ||
570 | len += snprintf(buf + len, size - len, | ||
571 | "%20s : %10d\n", | ||
572 | "Disable 5Ghz HT20", | ||
573 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT20)); | ||
574 | len += snprintf(buf + len, size - len, | ||
575 | "%20s : %10d\n", | ||
576 | "Disable 5Ghz HT40", | ||
577 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT40)); | ||
578 | len += snprintf(buf + len, size - len, | ||
579 | "%20s : %10d\n", | ||
580 | "Big Endian", | ||
581 | !!(pBase->eepMisc & 0x01)); | ||
582 | len += snprintf(buf + len, size - len, | ||
583 | "%20s : %10d\n", | ||
584 | "Cal Bin Major Ver", | ||
585 | (pBase->binBuildNumber >> 24) & 0xFF); | ||
586 | len += snprintf(buf + len, size - len, | ||
587 | "%20s : %10d\n", | ||
588 | "Cal Bin Minor Ver", | ||
589 | (pBase->binBuildNumber >> 16) & 0xFF); | ||
590 | len += snprintf(buf + len, size - len, | ||
591 | "%20s : %10d\n", | ||
592 | "Cal Bin Build", | ||
593 | (pBase->binBuildNumber >> 8) & 0xFF); | ||
594 | |||
595 | /* | ||
596 | * UB91 specific data. | ||
597 | */ | ||
598 | if (AR_SREV_9271(priv->ah)) { | ||
599 | struct base_eep_header_4k *pBase4k = | ||
600 | &priv->ah->eeprom.map4k.baseEepHeader; | ||
601 | |||
602 | len += snprintf(buf + len, size - len, | ||
603 | "%20s : %10d\n", | ||
604 | "TX Gain type", | ||
605 | pBase4k->txGainType); | ||
606 | } | ||
607 | |||
608 | /* | ||
609 | * UB95 specific data. | ||
610 | */ | ||
611 | if (priv->ah->hw_version.usbdev == AR9287_USB) { | ||
612 | struct base_eep_ar9287_header *pBase9287 = | ||
613 | &priv->ah->eeprom.map9287.baseEepHeader; | ||
614 | |||
615 | len += snprintf(buf + len, size - len, | ||
616 | "%20s : %10ddB\n", | ||
617 | "Power Table Offset", | ||
618 | pBase9287->pwrTableOffset); | ||
619 | |||
620 | len += snprintf(buf + len, size - len, | ||
621 | "%20s : %10d\n", | ||
622 | "OpenLoop Power Ctrl", | ||
623 | pBase9287->openLoopPwrCntl); | ||
624 | } | ||
625 | |||
626 | len += snprintf(buf + len, size - len, | ||
627 | "%20s : %02X:%02X:%02X:%02X:%02X:%02X\n", | ||
628 | "MacAddress", | ||
629 | pBase->macAddr[0], pBase->macAddr[1], pBase->macAddr[2], | ||
630 | pBase->macAddr[3], pBase->macAddr[4], pBase->macAddr[5]); | ||
631 | if (len > size) | ||
632 | len = size; | ||
633 | |||
634 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
635 | kfree(buf); | ||
636 | |||
637 | return retval; | ||
638 | } | ||
639 | |||
640 | static const struct file_operations fops_base_eeprom = { | ||
641 | .read = read_file_base_eeprom, | ||
642 | .open = ath9k_debugfs_open, | ||
643 | .owner = THIS_MODULE, | ||
644 | .llseek = default_llseek, | ||
645 | }; | ||
646 | |||
647 | static ssize_t read_4k_modal_eeprom(struct file *file, | ||
648 | char __user *user_buf, | ||
649 | size_t count, loff_t *ppos) | ||
650 | { | ||
651 | #define PR_EEP(_s, _val) \ | ||
652 | do { \ | ||
653 | len += snprintf(buf + len, size - len, "%20s : %10d\n", \ | ||
654 | _s, (_val)); \ | ||
655 | } while (0) | ||
656 | |||
657 | struct ath9k_htc_priv *priv = file->private_data; | ||
658 | struct modal_eep_4k_header *pModal = &priv->ah->eeprom.map4k.modalHeader; | ||
659 | unsigned int len = 0, size = 2048; | ||
660 | ssize_t retval = 0; | ||
661 | char *buf; | ||
662 | |||
663 | buf = kzalloc(size, GFP_KERNEL); | ||
664 | if (buf == NULL) | ||
665 | return -ENOMEM; | ||
666 | |||
667 | PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); | ||
668 | PR_EEP("Ant. Common Control", pModal->antCtrlCommon); | ||
669 | PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); | ||
670 | PR_EEP("Switch Settle", pModal->switchSettling); | ||
671 | PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); | ||
672 | PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); | ||
673 | PR_EEP("ADC Desired size", pModal->adcDesiredSize); | ||
674 | PR_EEP("PGA Desired size", pModal->pgaDesiredSize); | ||
675 | PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]); | ||
676 | PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); | ||
677 | PR_EEP("txEndToRxOn", pModal->txEndToRxOn); | ||
678 | PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); | ||
679 | PR_EEP("CCA Threshold)", pModal->thresh62); | ||
680 | PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); | ||
681 | PR_EEP("xpdGain", pModal->xpdGain); | ||
682 | PR_EEP("External PD", pModal->xpd); | ||
683 | PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); | ||
684 | PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); | ||
685 | PR_EEP("pdGainOverlap", pModal->pdGainOverlap); | ||
686 | PR_EEP("O/D Bias Version", pModal->version); | ||
687 | PR_EEP("CCK OutputBias", pModal->ob_0); | ||
688 | PR_EEP("BPSK OutputBias", pModal->ob_1); | ||
689 | PR_EEP("QPSK OutputBias", pModal->ob_2); | ||
690 | PR_EEP("16QAM OutputBias", pModal->ob_3); | ||
691 | PR_EEP("64QAM OutputBias", pModal->ob_4); | ||
692 | PR_EEP("CCK Driver1_Bias", pModal->db1_0); | ||
693 | PR_EEP("BPSK Driver1_Bias", pModal->db1_1); | ||
694 | PR_EEP("QPSK Driver1_Bias", pModal->db1_2); | ||
695 | PR_EEP("16QAM Driver1_Bias", pModal->db1_3); | ||
696 | PR_EEP("64QAM Driver1_Bias", pModal->db1_4); | ||
697 | PR_EEP("CCK Driver2_Bias", pModal->db2_0); | ||
698 | PR_EEP("BPSK Driver2_Bias", pModal->db2_1); | ||
699 | PR_EEP("QPSK Driver2_Bias", pModal->db2_2); | ||
700 | PR_EEP("16QAM Driver2_Bias", pModal->db2_3); | ||
701 | PR_EEP("64QAM Driver2_Bias", pModal->db2_4); | ||
702 | PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); | ||
703 | PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); | ||
704 | PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); | ||
705 | PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); | ||
706 | PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); | ||
707 | PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); | ||
708 | PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); | ||
709 | PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]); | ||
710 | PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]); | ||
711 | PR_EEP("Ant. Diversity ctl1", pModal->antdiv_ctl1); | ||
712 | PR_EEP("Ant. Diversity ctl2", pModal->antdiv_ctl2); | ||
713 | PR_EEP("TX Diversity", pModal->tx_diversity); | ||
714 | |||
715 | if (len > size) | ||
716 | len = size; | ||
717 | |||
718 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
719 | kfree(buf); | ||
720 | |||
721 | return retval; | ||
722 | |||
723 | #undef PR_EEP | ||
724 | } | ||
725 | |||
726 | static ssize_t read_def_modal_eeprom(struct file *file, | ||
727 | char __user *user_buf, | ||
728 | size_t count, loff_t *ppos) | ||
729 | { | ||
730 | #define PR_EEP(_s, _val) \ | ||
731 | do { \ | ||
732 | if (pBase->opCapFlags & AR5416_OPFLAGS_11G) { \ | ||
733 | pModal = &priv->ah->eeprom.def.modalHeader[1]; \ | ||
734 | len += snprintf(buf + len, size - len, "%20s : %8d%7s", \ | ||
735 | _s, (_val), "|"); \ | ||
736 | } \ | ||
737 | if (pBase->opCapFlags & AR5416_OPFLAGS_11A) { \ | ||
738 | pModal = &priv->ah->eeprom.def.modalHeader[0]; \ | ||
739 | len += snprintf(buf + len, size - len, "%9d\n", \ | ||
740 | (_val)); \ | ||
741 | } \ | ||
742 | } while (0) | ||
743 | |||
744 | struct ath9k_htc_priv *priv = file->private_data; | ||
745 | struct base_eep_header *pBase = &priv->ah->eeprom.def.baseEepHeader; | ||
746 | struct modal_eep_header *pModal = NULL; | ||
747 | unsigned int len = 0, size = 3500; | ||
748 | ssize_t retval = 0; | ||
749 | char *buf; | ||
750 | |||
751 | buf = kzalloc(size, GFP_KERNEL); | ||
752 | if (buf == NULL) | ||
753 | return -ENOMEM; | ||
754 | |||
755 | len += snprintf(buf + len, size - len, | ||
756 | "%31s %15s\n", "2G", "5G"); | ||
757 | len += snprintf(buf + len, size - len, | ||
758 | "%32s %16s\n", "====", "====\n"); | ||
759 | |||
760 | PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); | ||
761 | PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]); | ||
762 | PR_EEP("Chain2 Ant. Control", pModal->antCtrlChain[2]); | ||
763 | PR_EEP("Ant. Common Control", pModal->antCtrlCommon); | ||
764 | PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); | ||
765 | PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]); | ||
766 | PR_EEP("Chain2 Ant. Gain", pModal->antennaGainCh[2]); | ||
767 | PR_EEP("Switch Settle", pModal->switchSettling); | ||
768 | PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); | ||
769 | PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]); | ||
770 | PR_EEP("Chain2 TxRxAtten", pModal->txRxAttenCh[2]); | ||
771 | PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); | ||
772 | PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]); | ||
773 | PR_EEP("Chain2 RxTxMargin", pModal->rxTxMarginCh[2]); | ||
774 | PR_EEP("ADC Desired size", pModal->adcDesiredSize); | ||
775 | PR_EEP("PGA Desired size", pModal->pgaDesiredSize); | ||
776 | PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]); | ||
777 | PR_EEP("Chain1 xlna Gain", pModal->xlnaGainCh[1]); | ||
778 | PR_EEP("Chain2 xlna Gain", pModal->xlnaGainCh[2]); | ||
779 | PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); | ||
780 | PR_EEP("txEndToRxOn", pModal->txEndToRxOn); | ||
781 | PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); | ||
782 | PR_EEP("CCA Threshold)", pModal->thresh62); | ||
783 | PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); | ||
784 | PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]); | ||
785 | PR_EEP("Chain2 NF Threshold", pModal->noiseFloorThreshCh[2]); | ||
786 | PR_EEP("xpdGain", pModal->xpdGain); | ||
787 | PR_EEP("External PD", pModal->xpd); | ||
788 | PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); | ||
789 | PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]); | ||
790 | PR_EEP("Chain2 I Coefficient", pModal->iqCalICh[2]); | ||
791 | PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); | ||
792 | PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]); | ||
793 | PR_EEP("Chain2 Q Coefficient", pModal->iqCalQCh[2]); | ||
794 | PR_EEP("pdGainOverlap", pModal->pdGainOverlap); | ||
795 | PR_EEP("Chain0 OutputBias", pModal->ob); | ||
796 | PR_EEP("Chain0 DriverBias", pModal->db); | ||
797 | PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); | ||
798 | PR_EEP("2chain pwr decrease", pModal->pwrDecreaseFor2Chain); | ||
799 | PR_EEP("3chain pwr decrease", pModal->pwrDecreaseFor3Chain); | ||
800 | PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); | ||
801 | PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); | ||
802 | PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); | ||
803 | PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); | ||
804 | PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]); | ||
805 | PR_EEP("Chain2 bswAtten", pModal->bswAtten[2]); | ||
806 | PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); | ||
807 | PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]); | ||
808 | PR_EEP("Chain2 bswMargin", pModal->bswMargin[2]); | ||
809 | PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); | ||
810 | PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]); | ||
811 | PR_EEP("Chain1 xatten2Db", pModal->xatten2Db[1]); | ||
812 | PR_EEP("Chain2 xatten2Db", pModal->xatten2Db[2]); | ||
813 | PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]); | ||
814 | PR_EEP("Chain1 xatten2Margin", pModal->xatten2Margin[1]); | ||
815 | PR_EEP("Chain2 xatten2Margin", pModal->xatten2Margin[2]); | ||
816 | PR_EEP("Chain1 OutputBias", pModal->ob_ch1); | ||
817 | PR_EEP("Chain1 DriverBias", pModal->db_ch1); | ||
818 | PR_EEP("LNA Control", pModal->lna_ctl); | ||
819 | PR_EEP("XPA Bias Freq0", pModal->xpaBiasLvlFreq[0]); | ||
820 | PR_EEP("XPA Bias Freq1", pModal->xpaBiasLvlFreq[1]); | ||
821 | PR_EEP("XPA Bias Freq2", pModal->xpaBiasLvlFreq[2]); | ||
822 | |||
823 | if (len > size) | ||
824 | len = size; | ||
825 | |||
826 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
827 | kfree(buf); | ||
828 | |||
829 | return retval; | ||
830 | |||
831 | #undef PR_EEP | ||
832 | } | ||
833 | |||
834 | static ssize_t read_9287_modal_eeprom(struct file *file, | ||
835 | char __user *user_buf, | ||
836 | size_t count, loff_t *ppos) | ||
837 | { | ||
838 | #define PR_EEP(_s, _val) \ | ||
839 | do { \ | ||
840 | len += snprintf(buf + len, size - len, "%20s : %10d\n", \ | ||
841 | _s, (_val)); \ | ||
842 | } while (0) | ||
843 | |||
844 | struct ath9k_htc_priv *priv = file->private_data; | ||
845 | struct modal_eep_ar9287_header *pModal = &priv->ah->eeprom.map9287.modalHeader; | ||
846 | unsigned int len = 0, size = 3000; | ||
847 | ssize_t retval = 0; | ||
848 | char *buf; | ||
849 | |||
850 | buf = kzalloc(size, GFP_KERNEL); | ||
851 | if (buf == NULL) | ||
852 | return -ENOMEM; | ||
853 | |||
854 | PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); | ||
855 | PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]); | ||
856 | PR_EEP("Ant. Common Control", pModal->antCtrlCommon); | ||
857 | PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); | ||
858 | PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]); | ||
859 | PR_EEP("Switch Settle", pModal->switchSettling); | ||
860 | PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); | ||
861 | PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]); | ||
862 | PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); | ||
863 | PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]); | ||
864 | PR_EEP("ADC Desired size", pModal->adcDesiredSize); | ||
865 | PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); | ||
866 | PR_EEP("txEndToRxOn", pModal->txEndToRxOn); | ||
867 | PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); | ||
868 | PR_EEP("CCA Threshold)", pModal->thresh62); | ||
869 | PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); | ||
870 | PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]); | ||
871 | PR_EEP("xpdGain", pModal->xpdGain); | ||
872 | PR_EEP("External PD", pModal->xpd); | ||
873 | PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); | ||
874 | PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]); | ||
875 | PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); | ||
876 | PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]); | ||
877 | PR_EEP("pdGainOverlap", pModal->pdGainOverlap); | ||
878 | PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); | ||
879 | PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); | ||
880 | PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); | ||
881 | PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); | ||
882 | PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); | ||
883 | PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]); | ||
884 | PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); | ||
885 | PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]); | ||
886 | PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); | ||
887 | PR_EEP("AR92x7 Version", pModal->version); | ||
888 | PR_EEP("DriverBias1", pModal->db1); | ||
889 | PR_EEP("DriverBias2", pModal->db1); | ||
890 | PR_EEP("CCK OutputBias", pModal->ob_cck); | ||
891 | PR_EEP("PSK OutputBias", pModal->ob_psk); | ||
892 | PR_EEP("QAM OutputBias", pModal->ob_qam); | ||
893 | PR_EEP("PAL_OFF OutputBias", pModal->ob_pal_off); | ||
894 | |||
895 | if (len > size) | ||
896 | len = size; | ||
897 | |||
898 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
899 | kfree(buf); | ||
900 | |||
901 | return retval; | ||
902 | |||
903 | #undef PR_EEP | ||
904 | } | ||
905 | |||
906 | static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, | ||
907 | size_t count, loff_t *ppos) | ||
908 | { | ||
909 | struct ath9k_htc_priv *priv = file->private_data; | ||
910 | |||
911 | if (AR_SREV_9271(priv->ah)) | ||
912 | return read_4k_modal_eeprom(file, user_buf, count, ppos); | ||
913 | else if (priv->ah->hw_version.usbdev == AR9280_USB) | ||
914 | return read_def_modal_eeprom(file, user_buf, count, ppos); | ||
915 | else if (priv->ah->hw_version.usbdev == AR9287_USB) | ||
916 | return read_9287_modal_eeprom(file, user_buf, count, ppos); | ||
917 | |||
918 | return 0; | ||
919 | } | ||
920 | |||
921 | static const struct file_operations fops_modal_eeprom = { | ||
922 | .read = read_file_modal_eeprom, | ||
923 | .open = ath9k_debugfs_open, | ||
924 | .owner = THIS_MODULE, | ||
925 | .llseek = default_llseek, | ||
926 | }; | ||
927 | |||
477 | int ath9k_htc_init_debug(struct ath_hw *ah) | 928 | int ath9k_htc_init_debug(struct ath_hw *ah) |
478 | { | 929 | { |
479 | struct ath_common *common = ath9k_hw_common(ah); | 930 | struct ath_common *common = ath9k_hw_common(ah); |
@@ -485,21 +936,25 @@ int ath9k_htc_init_debug(struct ath_hw *ah) | |||
485 | return -ENOMEM; | 936 | return -ENOMEM; |
486 | 937 | ||
487 | debugfs_create_file("tgt_int_stats", S_IRUSR, priv->debug.debugfs_phy, | 938 | debugfs_create_file("tgt_int_stats", S_IRUSR, priv->debug.debugfs_phy, |
488 | priv, &fops_tgt_int_stats); | 939 | priv, &fops_tgt_int_stats); |
489 | debugfs_create_file("tgt_tx_stats", S_IRUSR, priv->debug.debugfs_phy, | 940 | debugfs_create_file("tgt_tx_stats", S_IRUSR, priv->debug.debugfs_phy, |
490 | priv, &fops_tgt_tx_stats); | 941 | priv, &fops_tgt_tx_stats); |
491 | debugfs_create_file("tgt_rx_stats", S_IRUSR, priv->debug.debugfs_phy, | 942 | debugfs_create_file("tgt_rx_stats", S_IRUSR, priv->debug.debugfs_phy, |
492 | priv, &fops_tgt_rx_stats); | 943 | priv, &fops_tgt_rx_stats); |
493 | debugfs_create_file("xmit", S_IRUSR, priv->debug.debugfs_phy, | 944 | debugfs_create_file("xmit", S_IRUSR, priv->debug.debugfs_phy, |
494 | priv, &fops_xmit); | 945 | priv, &fops_xmit); |
495 | debugfs_create_file("recv", S_IRUSR, priv->debug.debugfs_phy, | 946 | debugfs_create_file("recv", S_IRUSR, priv->debug.debugfs_phy, |
496 | priv, &fops_recv); | 947 | priv, &fops_recv); |
497 | debugfs_create_file("slot", S_IRUSR, priv->debug.debugfs_phy, | 948 | debugfs_create_file("slot", S_IRUSR, priv->debug.debugfs_phy, |
498 | priv, &fops_slot); | 949 | priv, &fops_slot); |
499 | debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy, | 950 | debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy, |
500 | priv, &fops_queue); | 951 | priv, &fops_queue); |
501 | debugfs_create_file("debug", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy, | 952 | debugfs_create_file("debug", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy, |
502 | priv, &fops_debug); | 953 | priv, &fops_debug); |
954 | debugfs_create_file("base_eeprom", S_IRUSR, priv->debug.debugfs_phy, | ||
955 | priv, &fops_base_eeprom); | ||
956 | debugfs_create_file("modal_eeprom", S_IRUSR, priv->debug.debugfs_phy, | ||
957 | priv, &fops_modal_eeprom); | ||
503 | 958 | ||
504 | return 0; | 959 | return 0; |
505 | } | 960 | } |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c index dc0b33d01210..af57fe5aab98 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c | |||
@@ -65,17 +65,19 @@ static void ath_btcoex_period_work(struct work_struct *work) | |||
65 | u32 timer_period; | 65 | u32 timer_period; |
66 | bool is_btscan; | 66 | bool is_btscan; |
67 | int ret; | 67 | int ret; |
68 | u8 cmd_rsp, aggr; | ||
69 | 68 | ||
70 | ath_detect_bt_priority(priv); | 69 | ath_detect_bt_priority(priv); |
71 | 70 | ||
72 | is_btscan = !!(priv->op_flags & OP_BT_SCAN); | 71 | is_btscan = !!(priv->op_flags & OP_BT_SCAN); |
73 | 72 | ||
74 | aggr = priv->op_flags & OP_BT_PRIORITY_DETECTED; | 73 | ret = ath9k_htc_update_cap_target(priv, |
75 | 74 | !!(priv->op_flags & OP_BT_PRIORITY_DETECTED)); | |
76 | WMI_CMD_BUF(WMI_AGGR_LIMIT_CMD, &aggr); | 75 | if (ret) { |
76 | ath_err(common, "Unable to set BTCOEX parameters\n"); | ||
77 | return; | ||
78 | } | ||
77 | 79 | ||
78 | ath9k_cmn_btcoex_bt_stomp(common, is_btscan ? ATH_BTCOEX_STOMP_ALL : | 80 | ath9k_hw_btcoex_bt_stomp(priv->ah, is_btscan ? ATH_BTCOEX_STOMP_ALL : |
79 | btcoex->bt_stomp_type); | 81 | btcoex->bt_stomp_type); |
80 | 82 | ||
81 | timer_period = is_btscan ? btcoex->btscan_no_stomp : | 83 | timer_period = is_btscan ? btcoex->btscan_no_stomp : |
@@ -103,9 +105,9 @@ static void ath_btcoex_duty_cycle_work(struct work_struct *work) | |||
103 | "time slice work for bt and wlan\n"); | 105 | "time slice work for bt and wlan\n"); |
104 | 106 | ||
105 | if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || is_btscan) | 107 | if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || is_btscan) |
106 | ath9k_cmn_btcoex_bt_stomp(common, ATH_BTCOEX_STOMP_NONE); | 108 | ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); |
107 | else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) | 109 | else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) |
108 | ath9k_cmn_btcoex_bt_stomp(common, ATH_BTCOEX_STOMP_LOW); | 110 | ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_LOW); |
109 | } | 111 | } |
110 | 112 | ||
111 | void ath_htc_init_btcoex_work(struct ath9k_htc_priv *priv) | 113 | void ath_htc_init_btcoex_work(struct ath9k_htc_priv *priv) |
@@ -152,140 +154,41 @@ void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv *priv) | |||
152 | /* LED */ | 154 | /* LED */ |
153 | /*******/ | 155 | /*******/ |
154 | 156 | ||
155 | static void ath9k_led_blink_work(struct work_struct *work) | 157 | #ifdef CONFIG_MAC80211_LEDS |
158 | void ath9k_led_work(struct work_struct *work) | ||
156 | { | 159 | { |
157 | struct ath9k_htc_priv *priv = container_of(work, struct ath9k_htc_priv, | 160 | struct ath9k_htc_priv *priv = container_of(work, |
158 | ath9k_led_blink_work.work); | 161 | struct ath9k_htc_priv, |
162 | led_work); | ||
159 | 163 | ||
160 | if (!(priv->op_flags & OP_LED_ASSOCIATED)) | 164 | ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, |
161 | return; | 165 | (priv->brightness == LED_OFF)); |
162 | |||
163 | if ((priv->led_on_duration == ATH_LED_ON_DURATION_IDLE) || | ||
164 | (priv->led_off_duration == ATH_LED_OFF_DURATION_IDLE)) | ||
165 | ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, 0); | ||
166 | else | ||
167 | ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, | ||
168 | (priv->op_flags & OP_LED_ON) ? 1 : 0); | ||
169 | |||
170 | ieee80211_queue_delayed_work(priv->hw, | ||
171 | &priv->ath9k_led_blink_work, | ||
172 | (priv->op_flags & OP_LED_ON) ? | ||
173 | msecs_to_jiffies(priv->led_off_duration) : | ||
174 | msecs_to_jiffies(priv->led_on_duration)); | ||
175 | |||
176 | priv->led_on_duration = priv->led_on_cnt ? | ||
177 | max((ATH_LED_ON_DURATION_IDLE - priv->led_on_cnt), 25) : | ||
178 | ATH_LED_ON_DURATION_IDLE; | ||
179 | priv->led_off_duration = priv->led_off_cnt ? | ||
180 | max((ATH_LED_OFF_DURATION_IDLE - priv->led_off_cnt), 10) : | ||
181 | ATH_LED_OFF_DURATION_IDLE; | ||
182 | priv->led_on_cnt = priv->led_off_cnt = 0; | ||
183 | |||
184 | if (priv->op_flags & OP_LED_ON) | ||
185 | priv->op_flags &= ~OP_LED_ON; | ||
186 | else | ||
187 | priv->op_flags |= OP_LED_ON; | ||
188 | } | ||
189 | |||
190 | static void ath9k_led_brightness_work(struct work_struct *work) | ||
191 | { | ||
192 | struct ath_led *led = container_of(work, struct ath_led, | ||
193 | brightness_work.work); | ||
194 | struct ath9k_htc_priv *priv = led->priv; | ||
195 | |||
196 | switch (led->brightness) { | ||
197 | case LED_OFF: | ||
198 | if (led->led_type == ATH_LED_ASSOC || | ||
199 | led->led_type == ATH_LED_RADIO) { | ||
200 | ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, | ||
201 | (led->led_type == ATH_LED_RADIO)); | ||
202 | priv->op_flags &= ~OP_LED_ASSOCIATED; | ||
203 | if (led->led_type == ATH_LED_RADIO) | ||
204 | priv->op_flags &= ~OP_LED_ON; | ||
205 | } else { | ||
206 | priv->led_off_cnt++; | ||
207 | } | ||
208 | break; | ||
209 | case LED_FULL: | ||
210 | if (led->led_type == ATH_LED_ASSOC) { | ||
211 | priv->op_flags |= OP_LED_ASSOCIATED; | ||
212 | ieee80211_queue_delayed_work(priv->hw, | ||
213 | &priv->ath9k_led_blink_work, 0); | ||
214 | } else if (led->led_type == ATH_LED_RADIO) { | ||
215 | ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, 0); | ||
216 | priv->op_flags |= OP_LED_ON; | ||
217 | } else { | ||
218 | priv->led_on_cnt++; | ||
219 | } | ||
220 | break; | ||
221 | default: | ||
222 | break; | ||
223 | } | ||
224 | } | 166 | } |
225 | 167 | ||
226 | static void ath9k_led_brightness(struct led_classdev *led_cdev, | 168 | static void ath9k_led_brightness(struct led_classdev *led_cdev, |
227 | enum led_brightness brightness) | 169 | enum led_brightness brightness) |
228 | { | 170 | { |
229 | struct ath_led *led = container_of(led_cdev, struct ath_led, led_cdev); | 171 | struct ath9k_htc_priv *priv = container_of(led_cdev, |
230 | struct ath9k_htc_priv *priv = led->priv; | 172 | struct ath9k_htc_priv, |
173 | led_cdev); | ||
231 | 174 | ||
232 | led->brightness = brightness; | 175 | /* Not locked, but it's just a tiny green light..*/ |
233 | if (!(priv->op_flags & OP_LED_DEINIT)) | 176 | priv->brightness = brightness; |
234 | ieee80211_queue_delayed_work(priv->hw, | 177 | ieee80211_queue_work(priv->hw, &priv->led_work); |
235 | &led->brightness_work, 0); | ||
236 | } | ||
237 | |||
238 | void ath9k_led_stop_brightness(struct ath9k_htc_priv *priv) | ||
239 | { | ||
240 | cancel_delayed_work_sync(&priv->radio_led.brightness_work); | ||
241 | cancel_delayed_work_sync(&priv->assoc_led.brightness_work); | ||
242 | cancel_delayed_work_sync(&priv->tx_led.brightness_work); | ||
243 | cancel_delayed_work_sync(&priv->rx_led.brightness_work); | ||
244 | } | ||
245 | |||
246 | static int ath9k_register_led(struct ath9k_htc_priv *priv, struct ath_led *led, | ||
247 | char *trigger) | ||
248 | { | ||
249 | int ret; | ||
250 | |||
251 | led->priv = priv; | ||
252 | led->led_cdev.name = led->name; | ||
253 | led->led_cdev.default_trigger = trigger; | ||
254 | led->led_cdev.brightness_set = ath9k_led_brightness; | ||
255 | |||
256 | ret = led_classdev_register(wiphy_dev(priv->hw->wiphy), &led->led_cdev); | ||
257 | if (ret) | ||
258 | ath_err(ath9k_hw_common(priv->ah), | ||
259 | "Failed to register led:%s", led->name); | ||
260 | else | ||
261 | led->registered = 1; | ||
262 | |||
263 | INIT_DELAYED_WORK(&led->brightness_work, ath9k_led_brightness_work); | ||
264 | |||
265 | return ret; | ||
266 | } | ||
267 | |||
268 | static void ath9k_unregister_led(struct ath_led *led) | ||
269 | { | ||
270 | if (led->registered) { | ||
271 | led_classdev_unregister(&led->led_cdev); | ||
272 | led->registered = 0; | ||
273 | } | ||
274 | } | 178 | } |
275 | 179 | ||
276 | void ath9k_deinit_leds(struct ath9k_htc_priv *priv) | 180 | void ath9k_deinit_leds(struct ath9k_htc_priv *priv) |
277 | { | 181 | { |
278 | priv->op_flags |= OP_LED_DEINIT; | 182 | if (!priv->led_registered) |
279 | ath9k_unregister_led(&priv->assoc_led); | 183 | return; |
280 | priv->op_flags &= ~OP_LED_ASSOCIATED; | 184 | |
281 | ath9k_unregister_led(&priv->tx_led); | 185 | ath9k_led_brightness(&priv->led_cdev, LED_OFF); |
282 | ath9k_unregister_led(&priv->rx_led); | 186 | led_classdev_unregister(&priv->led_cdev); |
283 | ath9k_unregister_led(&priv->radio_led); | 187 | cancel_work_sync(&priv->led_work); |
284 | } | 188 | } |
285 | 189 | ||
286 | void ath9k_init_leds(struct ath9k_htc_priv *priv) | 190 | void ath9k_init_leds(struct ath9k_htc_priv *priv) |
287 | { | 191 | { |
288 | char *trigger; | ||
289 | int ret; | 192 | int ret; |
290 | 193 | ||
291 | if (AR_SREV_9287(priv->ah)) | 194 | if (AR_SREV_9287(priv->ah)) |
@@ -303,48 +206,21 @@ void ath9k_init_leds(struct ath9k_htc_priv *priv) | |||
303 | /* LED off, active low */ | 206 | /* LED off, active low */ |
304 | ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, 1); | 207 | ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, 1); |
305 | 208 | ||
306 | INIT_DELAYED_WORK(&priv->ath9k_led_blink_work, ath9k_led_blink_work); | 209 | snprintf(priv->led_name, sizeof(priv->led_name), |
307 | 210 | "ath9k_htc-%s", wiphy_name(priv->hw->wiphy)); | |
308 | trigger = ieee80211_get_radio_led_name(priv->hw); | 211 | priv->led_cdev.name = priv->led_name; |
309 | snprintf(priv->radio_led.name, sizeof(priv->radio_led.name), | 212 | priv->led_cdev.brightness_set = ath9k_led_brightness; |
310 | "ath9k-%s::radio", wiphy_name(priv->hw->wiphy)); | ||
311 | ret = ath9k_register_led(priv, &priv->radio_led, trigger); | ||
312 | priv->radio_led.led_type = ATH_LED_RADIO; | ||
313 | if (ret) | ||
314 | goto fail; | ||
315 | |||
316 | trigger = ieee80211_get_assoc_led_name(priv->hw); | ||
317 | snprintf(priv->assoc_led.name, sizeof(priv->assoc_led.name), | ||
318 | "ath9k-%s::assoc", wiphy_name(priv->hw->wiphy)); | ||
319 | ret = ath9k_register_led(priv, &priv->assoc_led, trigger); | ||
320 | priv->assoc_led.led_type = ATH_LED_ASSOC; | ||
321 | if (ret) | ||
322 | goto fail; | ||
323 | |||
324 | trigger = ieee80211_get_tx_led_name(priv->hw); | ||
325 | snprintf(priv->tx_led.name, sizeof(priv->tx_led.name), | ||
326 | "ath9k-%s::tx", wiphy_name(priv->hw->wiphy)); | ||
327 | ret = ath9k_register_led(priv, &priv->tx_led, trigger); | ||
328 | priv->tx_led.led_type = ATH_LED_TX; | ||
329 | if (ret) | ||
330 | goto fail; | ||
331 | |||
332 | trigger = ieee80211_get_rx_led_name(priv->hw); | ||
333 | snprintf(priv->rx_led.name, sizeof(priv->rx_led.name), | ||
334 | "ath9k-%s::rx", wiphy_name(priv->hw->wiphy)); | ||
335 | ret = ath9k_register_led(priv, &priv->rx_led, trigger); | ||
336 | priv->rx_led.led_type = ATH_LED_RX; | ||
337 | if (ret) | ||
338 | goto fail; | ||
339 | |||
340 | priv->op_flags &= ~OP_LED_DEINIT; | ||
341 | 213 | ||
342 | return; | 214 | ret = led_classdev_register(wiphy_dev(priv->hw->wiphy), &priv->led_cdev); |
215 | if (ret < 0) | ||
216 | return; | ||
343 | 217 | ||
344 | fail: | 218 | INIT_WORK(&priv->led_work, ath9k_led_work); |
345 | cancel_delayed_work_sync(&priv->ath9k_led_blink_work); | 219 | priv->led_registered = true; |
346 | ath9k_deinit_leds(priv); | 220 | |
221 | return; | ||
347 | } | 222 | } |
223 | #endif | ||
348 | 224 | ||
349 | /*******************/ | 225 | /*******************/ |
350 | /* Rfkill */ | 226 | /* Rfkill */ |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 06e043bffaf4..bfdc8a887183 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -117,6 +117,21 @@ static struct ieee80211_rate ath9k_legacy_rates[] = { | |||
117 | RATE(540, 0x0c, 0), | 117 | RATE(540, 0x0c, 0), |
118 | }; | 118 | }; |
119 | 119 | ||
120 | #ifdef CONFIG_MAC80211_LEDS | ||
121 | static const struct ieee80211_tpt_blink ath9k_htc_tpt_blink[] = { | ||
122 | { .throughput = 0 * 1024, .blink_time = 334 }, | ||
123 | { .throughput = 1 * 1024, .blink_time = 260 }, | ||
124 | { .throughput = 5 * 1024, .blink_time = 220 }, | ||
125 | { .throughput = 10 * 1024, .blink_time = 190 }, | ||
126 | { .throughput = 20 * 1024, .blink_time = 170 }, | ||
127 | { .throughput = 50 * 1024, .blink_time = 150 }, | ||
128 | { .throughput = 70 * 1024, .blink_time = 130 }, | ||
129 | { .throughput = 100 * 1024, .blink_time = 110 }, | ||
130 | { .throughput = 200 * 1024, .blink_time = 80 }, | ||
131 | { .throughput = 300 * 1024, .blink_time = 50 }, | ||
132 | }; | ||
133 | #endif | ||
134 | |||
120 | static int ath9k_htc_wait_for_target(struct ath9k_htc_priv *priv) | 135 | static int ath9k_htc_wait_for_target(struct ath9k_htc_priv *priv) |
121 | { | 136 | { |
122 | int time_left; | 137 | int time_left; |
@@ -243,7 +258,7 @@ static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid, | |||
243 | */ | 258 | */ |
244 | 259 | ||
245 | if (IS_AR7010_DEVICE(drv_info)) | 260 | if (IS_AR7010_DEVICE(drv_info)) |
246 | priv->htc->credits = 45; | 261 | priv->htc->credits = 48; |
247 | else | 262 | else |
248 | priv->htc->credits = 33; | 263 | priv->htc->credits = 33; |
249 | 264 | ||
@@ -753,6 +768,12 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv, | |||
753 | hw->queues = 4; | 768 | hw->queues = 4; |
754 | hw->channel_change_time = 5000; | 769 | hw->channel_change_time = 5000; |
755 | hw->max_listen_interval = 10; | 770 | hw->max_listen_interval = 10; |
771 | |||
772 | if (AR_SREV_9271(priv->ah)) | ||
773 | hw->max_tx_aggregation_subframes = MAX_TX_AMPDU_SUBFRAMES_9271; | ||
774 | else | ||
775 | hw->max_tx_aggregation_subframes = MAX_TX_AMPDU_SUBFRAMES_7010; | ||
776 | |||
756 | hw->vif_data_size = sizeof(struct ath9k_htc_vif); | 777 | hw->vif_data_size = sizeof(struct ath9k_htc_vif); |
757 | hw->sta_data_size = sizeof(struct ath9k_htc_sta); | 778 | hw->sta_data_size = sizeof(struct ath9k_htc_sta); |
758 | 779 | ||
@@ -802,6 +823,17 @@ static int ath9k_init_firmware_version(struct ath9k_htc_priv *priv) | |||
802 | priv->fw_version_major, | 823 | priv->fw_version_major, |
803 | priv->fw_version_minor); | 824 | priv->fw_version_minor); |
804 | 825 | ||
826 | /* | ||
827 | * Check if the available FW matches the driver's | ||
828 | * required version. | ||
829 | */ | ||
830 | if (priv->fw_version_major != MAJOR_VERSION_REQ || | ||
831 | priv->fw_version_minor != MINOR_VERSION_REQ) { | ||
832 | dev_err(priv->dev, "ath9k_htc: Please upgrade to FW version %d.%d\n", | ||
833 | MAJOR_VERSION_REQ, MINOR_VERSION_REQ); | ||
834 | return -EINVAL; | ||
835 | } | ||
836 | |||
805 | return 0; | 837 | return 0; |
806 | } | 838 | } |
807 | 839 | ||
@@ -846,6 +878,13 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv, | |||
846 | if (error != 0) | 878 | if (error != 0) |
847 | goto err_rx; | 879 | goto err_rx; |
848 | 880 | ||
881 | #ifdef CONFIG_MAC80211_LEDS | ||
882 | /* must be initialized before ieee80211_register_hw */ | ||
883 | priv->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(priv->hw, | ||
884 | IEEE80211_TPT_LEDTRIG_FL_RADIO, ath9k_htc_tpt_blink, | ||
885 | ARRAY_SIZE(ath9k_htc_tpt_blink)); | ||
886 | #endif | ||
887 | |||
849 | /* Register with mac80211 */ | 888 | /* Register with mac80211 */ |
850 | error = ieee80211_register_hw(hw); | 889 | error = ieee80211_register_hw(hw); |
851 | if (error) | 890 | if (error) |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 4de38643cb53..5aa104fe7eeb 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -332,6 +332,11 @@ static void __ath9k_htc_remove_monitor_interface(struct ath9k_htc_priv *priv) | |||
332 | memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN); | 332 | memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN); |
333 | hvif.index = priv->mon_vif_idx; | 333 | hvif.index = priv->mon_vif_idx; |
334 | WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif); | 334 | WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif); |
335 | if (ret) { | ||
336 | ath_err(common, "Unable to remove monitor interface at idx: %d\n", | ||
337 | priv->mon_vif_idx); | ||
338 | } | ||
339 | |||
335 | priv->nvifs--; | 340 | priv->nvifs--; |
336 | priv->vif_slot &= ~(1 << priv->mon_vif_idx); | 341 | priv->vif_slot &= ~(1 << priv->mon_vif_idx); |
337 | } | 342 | } |
@@ -462,6 +467,7 @@ static int ath9k_htc_add_station(struct ath9k_htc_priv *priv, | |||
462 | struct ath9k_htc_sta *ista; | 467 | struct ath9k_htc_sta *ista; |
463 | int ret, sta_idx; | 468 | int ret, sta_idx; |
464 | u8 cmd_rsp; | 469 | u8 cmd_rsp; |
470 | u16 maxampdu; | ||
465 | 471 | ||
466 | if (priv->nstations >= ATH9K_HTC_MAX_STA) | 472 | if (priv->nstations >= ATH9K_HTC_MAX_STA) |
467 | return -ENOBUFS; | 473 | return -ENOBUFS; |
@@ -485,7 +491,15 @@ static int ath9k_htc_add_station(struct ath9k_htc_priv *priv, | |||
485 | 491 | ||
486 | tsta.sta_index = sta_idx; | 492 | tsta.sta_index = sta_idx; |
487 | tsta.vif_index = avp->index; | 493 | tsta.vif_index = avp->index; |
488 | tsta.maxampdu = cpu_to_be16(0xffff); | 494 | |
495 | if (!sta) { | ||
496 | tsta.maxampdu = cpu_to_be16(0xffff); | ||
497 | } else { | ||
498 | maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + | ||
499 | sta->ht_cap.ampdu_factor); | ||
500 | tsta.maxampdu = cpu_to_be16(maxampdu); | ||
501 | } | ||
502 | |||
489 | if (sta && sta->ht_cap.ht_supported) | 503 | if (sta && sta->ht_cap.ht_supported) |
490 | tsta.flags = cpu_to_be16(ATH_HTC_STA_HT); | 504 | tsta.flags = cpu_to_be16(ATH_HTC_STA_HT); |
491 | 505 | ||
@@ -558,7 +572,8 @@ static int ath9k_htc_remove_station(struct ath9k_htc_priv *priv, | |||
558 | return 0; | 572 | return 0; |
559 | } | 573 | } |
560 | 574 | ||
561 | int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv) | 575 | int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv, |
576 | u8 enable_coex) | ||
562 | { | 577 | { |
563 | struct ath9k_htc_cap_target tcap; | 578 | struct ath9k_htc_cap_target tcap; |
564 | int ret; | 579 | int ret; |
@@ -566,13 +581,9 @@ int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv) | |||
566 | 581 | ||
567 | memset(&tcap, 0, sizeof(struct ath9k_htc_cap_target)); | 582 | memset(&tcap, 0, sizeof(struct ath9k_htc_cap_target)); |
568 | 583 | ||
569 | /* FIXME: Values are hardcoded */ | 584 | tcap.ampdu_limit = cpu_to_be32(0xffff); |
570 | tcap.flags = 0x240c40; | 585 | tcap.ampdu_subframes = priv->hw->max_tx_aggregation_subframes; |
571 | tcap.flags_ext = 0x80601000; | 586 | tcap.enable_coex = enable_coex; |
572 | tcap.ampdu_limit = 0xffff0000; | ||
573 | tcap.ampdu_subframes = 20; | ||
574 | tcap.tx_chainmask_legacy = priv->ah->caps.tx_chainmask; | ||
575 | tcap.protmode = 1; | ||
576 | tcap.tx_chainmask = priv->ah->caps.tx_chainmask; | 587 | tcap.tx_chainmask = priv->ah->caps.tx_chainmask; |
577 | 588 | ||
578 | WMI_CMD_BUF(WMI_TARGET_IC_UPDATE_CMDID, &tcap); | 589 | WMI_CMD_BUF(WMI_TARGET_IC_UPDATE_CMDID, &tcap); |
@@ -931,7 +942,7 @@ static int ath9k_htc_start(struct ieee80211_hw *hw) | |||
931 | 942 | ||
932 | ath9k_host_rx_init(priv); | 943 | ath9k_host_rx_init(priv); |
933 | 944 | ||
934 | ret = ath9k_htc_update_cap_target(priv); | 945 | ret = ath9k_htc_update_cap_target(priv, 0); |
935 | if (ret) | 946 | if (ret) |
936 | ath_dbg(common, ATH_DBG_CONFIG, | 947 | ath_dbg(common, ATH_DBG_CONFIG, |
937 | "Failed to update capability in target\n"); | 948 | "Failed to update capability in target\n"); |
@@ -964,7 +975,7 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw) | |||
964 | struct ath9k_htc_priv *priv = hw->priv; | 975 | struct ath9k_htc_priv *priv = hw->priv; |
965 | struct ath_hw *ah = priv->ah; | 976 | struct ath_hw *ah = priv->ah; |
966 | struct ath_common *common = ath9k_hw_common(ah); | 977 | struct ath_common *common = ath9k_hw_common(ah); |
967 | int ret = 0; | 978 | int ret __attribute__ ((unused)); |
968 | u8 cmd_rsp; | 979 | u8 cmd_rsp; |
969 | 980 | ||
970 | mutex_lock(&priv->mutex); | 981 | mutex_lock(&priv->mutex); |
@@ -992,9 +1003,11 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw) | |||
992 | /* Cancel all the running timers/work .. */ | 1003 | /* Cancel all the running timers/work .. */ |
993 | cancel_work_sync(&priv->fatal_work); | 1004 | cancel_work_sync(&priv->fatal_work); |
994 | cancel_work_sync(&priv->ps_work); | 1005 | cancel_work_sync(&priv->ps_work); |
995 | cancel_delayed_work_sync(&priv->ath9k_led_blink_work); | 1006 | |
1007 | #ifdef CONFIG_MAC80211_LEDS | ||
1008 | cancel_work_sync(&priv->led_work); | ||
1009 | #endif | ||
996 | ath9k_htc_stop_ani(priv); | 1010 | ath9k_htc_stop_ani(priv); |
997 | ath9k_led_stop_brightness(priv); | ||
998 | 1011 | ||
999 | mutex_lock(&priv->mutex); | 1012 | mutex_lock(&priv->mutex); |
1000 | 1013 | ||
@@ -1135,6 +1148,10 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw, | |||
1135 | memcpy(&hvif.myaddr, vif->addr, ETH_ALEN); | 1148 | memcpy(&hvif.myaddr, vif->addr, ETH_ALEN); |
1136 | hvif.index = avp->index; | 1149 | hvif.index = avp->index; |
1137 | WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif); | 1150 | WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif); |
1151 | if (ret) { | ||
1152 | ath_err(common, "Unable to remove interface at idx: %d\n", | ||
1153 | avp->index); | ||
1154 | } | ||
1138 | priv->nvifs--; | 1155 | priv->nvifs--; |
1139 | priv->vif_slot &= ~(1 << avp->index); | 1156 | priv->vif_slot &= ~(1 << avp->index); |
1140 | 1157 | ||
@@ -1567,6 +1584,7 @@ static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw, | |||
1567 | int ret = 0; | 1584 | int ret = 0; |
1568 | 1585 | ||
1569 | mutex_lock(&priv->mutex); | 1586 | mutex_lock(&priv->mutex); |
1587 | ath9k_htc_ps_wakeup(priv); | ||
1570 | 1588 | ||
1571 | switch (action) { | 1589 | switch (action) { |
1572 | case IEEE80211_AMPDU_RX_START: | 1590 | case IEEE80211_AMPDU_RX_START: |
@@ -1592,6 +1610,7 @@ static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw, | |||
1592 | ath_err(ath9k_hw_common(priv->ah), "Unknown AMPDU action\n"); | 1610 | ath_err(ath9k_hw_common(priv->ah), "Unknown AMPDU action\n"); |
1593 | } | 1611 | } |
1594 | 1612 | ||
1613 | ath9k_htc_ps_restore(priv); | ||
1595 | mutex_unlock(&priv->mutex); | 1614 | mutex_unlock(&priv->mutex); |
1596 | 1615 | ||
1597 | return ret; | 1616 | return ret; |
@@ -1642,6 +1661,55 @@ static void ath9k_htc_set_coverage_class(struct ieee80211_hw *hw, | |||
1642 | mutex_unlock(&priv->mutex); | 1661 | mutex_unlock(&priv->mutex); |
1643 | } | 1662 | } |
1644 | 1663 | ||
1664 | /* | ||
1665 | * Currently, this is used only for selecting the minimum rate | ||
1666 | * for management frames, rate selection for data frames remain | ||
1667 | * unaffected. | ||
1668 | */ | ||
1669 | static int ath9k_htc_set_bitrate_mask(struct ieee80211_hw *hw, | ||
1670 | struct ieee80211_vif *vif, | ||
1671 | const struct cfg80211_bitrate_mask *mask) | ||
1672 | { | ||
1673 | struct ath9k_htc_priv *priv = hw->priv; | ||
1674 | struct ath_common *common = ath9k_hw_common(priv->ah); | ||
1675 | struct ath9k_htc_target_rate_mask tmask; | ||
1676 | struct ath9k_htc_vif *avp = (void *)vif->drv_priv; | ||
1677 | int ret = 0; | ||
1678 | u8 cmd_rsp; | ||
1679 | |||
1680 | memset(&tmask, 0, sizeof(struct ath9k_htc_target_rate_mask)); | ||
1681 | |||
1682 | tmask.vif_index = avp->index; | ||
1683 | tmask.band = IEEE80211_BAND_2GHZ; | ||
1684 | tmask.mask = cpu_to_be32(mask->control[IEEE80211_BAND_2GHZ].legacy); | ||
1685 | |||
1686 | WMI_CMD_BUF(WMI_BITRATE_MASK_CMDID, &tmask); | ||
1687 | if (ret) { | ||
1688 | ath_err(common, | ||
1689 | "Unable to set 2G rate mask for " | ||
1690 | "interface at idx: %d\n", avp->index); | ||
1691 | goto out; | ||
1692 | } | ||
1693 | |||
1694 | tmask.band = IEEE80211_BAND_5GHZ; | ||
1695 | tmask.mask = cpu_to_be32(mask->control[IEEE80211_BAND_5GHZ].legacy); | ||
1696 | |||
1697 | WMI_CMD_BUF(WMI_BITRATE_MASK_CMDID, &tmask); | ||
1698 | if (ret) { | ||
1699 | ath_err(common, | ||
1700 | "Unable to set 5G rate mask for " | ||
1701 | "interface at idx: %d\n", avp->index); | ||
1702 | goto out; | ||
1703 | } | ||
1704 | |||
1705 | ath_dbg(common, ATH_DBG_CONFIG, | ||
1706 | "Set bitrate masks: 0x%x, 0x%x\n", | ||
1707 | mask->control[IEEE80211_BAND_2GHZ].legacy, | ||
1708 | mask->control[IEEE80211_BAND_5GHZ].legacy); | ||
1709 | out: | ||
1710 | return ret; | ||
1711 | } | ||
1712 | |||
1645 | struct ieee80211_ops ath9k_htc_ops = { | 1713 | struct ieee80211_ops ath9k_htc_ops = { |
1646 | .tx = ath9k_htc_tx, | 1714 | .tx = ath9k_htc_tx, |
1647 | .start = ath9k_htc_start, | 1715 | .start = ath9k_htc_start, |
@@ -1664,4 +1732,5 @@ struct ieee80211_ops ath9k_htc_ops = { | |||
1664 | .set_rts_threshold = ath9k_htc_set_rts_threshold, | 1732 | .set_rts_threshold = ath9k_htc_set_rts_threshold, |
1665 | .rfkill_poll = ath9k_htc_rfkill_poll_state, | 1733 | .rfkill_poll = ath9k_htc_rfkill_poll_state, |
1666 | .set_coverage_class = ath9k_htc_set_coverage_class, | 1734 | .set_coverage_class = ath9k_htc_set_coverage_class, |
1735 | .set_bitrate_mask = ath9k_htc_set_bitrate_mask, | ||
1667 | }; | 1736 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index 723a3a9c5cd9..a898dac22337 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | |||
@@ -446,7 +446,6 @@ static void ath9k_htc_tx_process(struct ath9k_htc_priv *priv, | |||
446 | struct ieee80211_tx_info *tx_info; | 446 | struct ieee80211_tx_info *tx_info; |
447 | struct ieee80211_tx_rate *rate; | 447 | struct ieee80211_tx_rate *rate; |
448 | struct ieee80211_conf *cur_conf = &priv->hw->conf; | 448 | struct ieee80211_conf *cur_conf = &priv->hw->conf; |
449 | struct ieee80211_supported_band *sband; | ||
450 | bool txok; | 449 | bool txok; |
451 | int slot; | 450 | int slot; |
452 | 451 | ||
@@ -461,7 +460,6 @@ static void ath9k_htc_tx_process(struct ath9k_htc_priv *priv, | |||
461 | tx_info = IEEE80211_SKB_CB(skb); | 460 | tx_info = IEEE80211_SKB_CB(skb); |
462 | vif = tx_info->control.vif; | 461 | vif = tx_info->control.vif; |
463 | rate = &tx_info->status.rates[0]; | 462 | rate = &tx_info->status.rates[0]; |
464 | sband = priv->hw->wiphy->bands[cur_conf->channel->band]; | ||
465 | 463 | ||
466 | memset(&tx_info->status, 0, sizeof(tx_info->status)); | 464 | memset(&tx_info->status, 0, sizeof(tx_info->status)); |
467 | 465 | ||
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.h b/drivers/net/wireless/ath/ath9k/htc_hst.h index cb9174ade53e..91a5305db95a 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.h +++ b/drivers/net/wireless/ath/ath9k/htc_hst.h | |||
@@ -83,21 +83,10 @@ struct htc_ep_callbacks { | |||
83 | void (*rx) (void *, struct sk_buff *, enum htc_endpoint_id); | 83 | void (*rx) (void *, struct sk_buff *, enum htc_endpoint_id); |
84 | }; | 84 | }; |
85 | 85 | ||
86 | #define HTC_TX_QUEUE_SIZE 256 | ||
87 | |||
88 | struct htc_txq { | ||
89 | struct sk_buff *buf[HTC_TX_QUEUE_SIZE]; | ||
90 | u32 txqdepth; | ||
91 | u16 txbuf_cnt; | ||
92 | u16 txq_head; | ||
93 | u16 txq_tail; | ||
94 | }; | ||
95 | |||
96 | struct htc_endpoint { | 86 | struct htc_endpoint { |
97 | u16 service_id; | 87 | u16 service_id; |
98 | 88 | ||
99 | struct htc_ep_callbacks ep_callbacks; | 89 | struct htc_ep_callbacks ep_callbacks; |
100 | struct htc_txq htc_txq; | ||
101 | u32 max_txqdepth; | 90 | u32 max_txqdepth; |
102 | int max_msglen; | 91 | int max_msglen; |
103 | 92 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 045abd557840..58f3d4210338 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -247,6 +247,17 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah) | |||
247 | { | 247 | { |
248 | u32 val; | 248 | u32 val; |
249 | 249 | ||
250 | switch (ah->hw_version.devid) { | ||
251 | case AR5416_AR9100_DEVID: | ||
252 | ah->hw_version.macVersion = AR_SREV_VERSION_9100; | ||
253 | break; | ||
254 | case AR9300_DEVID_AR9340: | ||
255 | ah->hw_version.macVersion = AR_SREV_VERSION_9340; | ||
256 | val = REG_READ(ah, AR_SREV); | ||
257 | ah->hw_version.macRev = MS(val, AR_SREV_REVISION2); | ||
258 | return; | ||
259 | } | ||
260 | |||
250 | val = REG_READ(ah, AR_SREV) & AR_SREV_ID; | 261 | val = REG_READ(ah, AR_SREV) & AR_SREV_ID; |
251 | 262 | ||
252 | if (val == 0xFF) { | 263 | if (val == 0xFF) { |
@@ -462,7 +473,7 @@ static int ath9k_hw_post_init(struct ath_hw *ah) | |||
462 | return ecode; | 473 | return ecode; |
463 | } | 474 | } |
464 | 475 | ||
465 | if (!AR_SREV_9100(ah)) { | 476 | if (!AR_SREV_9100(ah) && !AR_SREV_9340(ah)) { |
466 | ath9k_hw_ani_setup(ah); | 477 | ath9k_hw_ani_setup(ah); |
467 | ath9k_hw_ani_init(ah); | 478 | ath9k_hw_ani_init(ah); |
468 | } | 479 | } |
@@ -484,9 +495,6 @@ static int __ath9k_hw_init(struct ath_hw *ah) | |||
484 | struct ath_common *common = ath9k_hw_common(ah); | 495 | struct ath_common *common = ath9k_hw_common(ah); |
485 | int r = 0; | 496 | int r = 0; |
486 | 497 | ||
487 | if (ah->hw_version.devid == AR5416_AR9100_DEVID) | ||
488 | ah->hw_version.macVersion = AR_SREV_VERSION_9100; | ||
489 | |||
490 | ath9k_hw_read_revisions(ah); | 498 | ath9k_hw_read_revisions(ah); |
491 | 499 | ||
492 | /* | 500 | /* |
@@ -544,6 +552,7 @@ static int __ath9k_hw_init(struct ath_hw *ah) | |||
544 | case AR_SREV_VERSION_9271: | 552 | case AR_SREV_VERSION_9271: |
545 | case AR_SREV_VERSION_9300: | 553 | case AR_SREV_VERSION_9300: |
546 | case AR_SREV_VERSION_9485: | 554 | case AR_SREV_VERSION_9485: |
555 | case AR_SREV_VERSION_9340: | ||
547 | break; | 556 | break; |
548 | default: | 557 | default: |
549 | ath_err(common, | 558 | ath_err(common, |
@@ -552,7 +561,7 @@ static int __ath9k_hw_init(struct ath_hw *ah) | |||
552 | return -EOPNOTSUPP; | 561 | return -EOPNOTSUPP; |
553 | } | 562 | } |
554 | 563 | ||
555 | if (AR_SREV_9271(ah) || AR_SREV_9100(ah)) | 564 | if (AR_SREV_9271(ah) || AR_SREV_9100(ah) || AR_SREV_9340(ah)) |
556 | ah->is_pciexpress = false; | 565 | ah->is_pciexpress = false; |
557 | 566 | ||
558 | ah->hw_version.phyRev = REG_READ(ah, AR_PHY_CHIP_ID); | 567 | ah->hw_version.phyRev = REG_READ(ah, AR_PHY_CHIP_ID); |
@@ -621,6 +630,7 @@ int ath9k_hw_init(struct ath_hw *ah) | |||
621 | case AR2427_DEVID_PCIE: | 630 | case AR2427_DEVID_PCIE: |
622 | case AR9300_DEVID_PCIE: | 631 | case AR9300_DEVID_PCIE: |
623 | case AR9300_DEVID_AR9485_PCIE: | 632 | case AR9300_DEVID_AR9485_PCIE: |
633 | case AR9300_DEVID_AR9340: | ||
624 | break; | 634 | break; |
625 | default: | 635 | default: |
626 | if (common->bus_ops->ath_bus_type == ATH_USB) | 636 | if (common->bus_ops->ath_bus_type == ATH_USB) |
@@ -663,7 +673,7 @@ static void ath9k_hw_init_qos(struct ath_hw *ah) | |||
663 | REGWRITE_BUFFER_FLUSH(ah); | 673 | REGWRITE_BUFFER_FLUSH(ah); |
664 | } | 674 | } |
665 | 675 | ||
666 | unsigned long ar9003_get_pll_sqsum_dvc(struct ath_hw *ah) | 676 | u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah) |
667 | { | 677 | { |
668 | REG_CLR_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); | 678 | REG_CLR_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); |
669 | udelay(100); | 679 | udelay(100); |
@@ -676,7 +686,6 @@ unsigned long ar9003_get_pll_sqsum_dvc(struct ath_hw *ah) | |||
676 | } | 686 | } |
677 | EXPORT_SYMBOL(ar9003_get_pll_sqsum_dvc); | 687 | EXPORT_SYMBOL(ar9003_get_pll_sqsum_dvc); |
678 | 688 | ||
679 | #define DPLL3_PHASE_SHIFT_VAL 0x1 | ||
680 | static void ath9k_hw_init_pll(struct ath_hw *ah, | 689 | static void ath9k_hw_init_pll(struct ath_hw *ah, |
681 | struct ath9k_channel *chan) | 690 | struct ath9k_channel *chan) |
682 | { | 691 | { |
@@ -713,16 +722,48 @@ static void ath9k_hw_init_pll(struct ath_hw *ah, | |||
713 | REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2, | 722 | REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2, |
714 | AR_CH0_BB_DPLL2_PLL_PWD, 0x0); | 723 | AR_CH0_BB_DPLL2_PLL_PWD, 0x0); |
715 | udelay(1000); | 724 | udelay(1000); |
725 | } else if (AR_SREV_9340(ah)) { | ||
726 | u32 regval, pll2_divint, pll2_divfrac, refdiv; | ||
716 | 727 | ||
717 | REG_RMW_FIELD(ah, AR_CH0_BB_DPLL3, | 728 | REG_WRITE(ah, AR_RTC_PLL_CONTROL, 0x1142c); |
718 | AR_CH0_DPLL3_PHASE_SHIFT, DPLL3_PHASE_SHIFT_VAL); | 729 | udelay(1000); |
730 | |||
731 | REG_SET_BIT(ah, AR_PHY_PLL_MODE, 0x1 << 16); | ||
732 | udelay(100); | ||
733 | |||
734 | if (ah->is_clk_25mhz) { | ||
735 | pll2_divint = 0x54; | ||
736 | pll2_divfrac = 0x1eb85; | ||
737 | refdiv = 3; | ||
738 | } else { | ||
739 | pll2_divint = 88; | ||
740 | pll2_divfrac = 0; | ||
741 | refdiv = 5; | ||
742 | } | ||
743 | |||
744 | regval = REG_READ(ah, AR_PHY_PLL_MODE); | ||
745 | regval |= (0x1 << 16); | ||
746 | REG_WRITE(ah, AR_PHY_PLL_MODE, regval); | ||
747 | udelay(100); | ||
748 | |||
749 | REG_WRITE(ah, AR_PHY_PLL_CONTROL, (refdiv << 27) | | ||
750 | (pll2_divint << 18) | pll2_divfrac); | ||
751 | udelay(100); | ||
752 | |||
753 | regval = REG_READ(ah, AR_PHY_PLL_MODE); | ||
754 | regval = (regval & 0x80071fff) | (0x1 << 30) | (0x1 << 13) | | ||
755 | (0x4 << 26) | (0x18 << 19); | ||
756 | REG_WRITE(ah, AR_PHY_PLL_MODE, regval); | ||
757 | REG_WRITE(ah, AR_PHY_PLL_MODE, | ||
758 | REG_READ(ah, AR_PHY_PLL_MODE) & 0xfffeffff); | ||
759 | udelay(1000); | ||
719 | } | 760 | } |
720 | 761 | ||
721 | pll = ath9k_hw_compute_pll_control(ah, chan); | 762 | pll = ath9k_hw_compute_pll_control(ah, chan); |
722 | 763 | ||
723 | REG_WRITE(ah, AR_RTC_PLL_CONTROL, pll); | 764 | REG_WRITE(ah, AR_RTC_PLL_CONTROL, pll); |
724 | 765 | ||
725 | if (AR_SREV_9485(ah)) | 766 | if (AR_SREV_9485(ah) || AR_SREV_9340(ah)) |
726 | udelay(1000); | 767 | udelay(1000); |
727 | 768 | ||
728 | /* Switch the core clock for ar9271 to 117Mhz */ | 769 | /* Switch the core clock for ar9271 to 117Mhz */ |
@@ -734,17 +775,34 @@ static void ath9k_hw_init_pll(struct ath_hw *ah, | |||
734 | udelay(RTC_PLL_SETTLE_DELAY); | 775 | udelay(RTC_PLL_SETTLE_DELAY); |
735 | 776 | ||
736 | REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); | 777 | REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); |
778 | |||
779 | if (AR_SREV_9340(ah)) { | ||
780 | if (ah->is_clk_25mhz) { | ||
781 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); | ||
782 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); | ||
783 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); | ||
784 | } else { | ||
785 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); | ||
786 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); | ||
787 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); | ||
788 | } | ||
789 | udelay(100); | ||
790 | } | ||
737 | } | 791 | } |
738 | 792 | ||
739 | static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, | 793 | static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, |
740 | enum nl80211_iftype opmode) | 794 | enum nl80211_iftype opmode) |
741 | { | 795 | { |
796 | u32 sync_default = AR_INTR_SYNC_DEFAULT; | ||
742 | u32 imr_reg = AR_IMR_TXERR | | 797 | u32 imr_reg = AR_IMR_TXERR | |
743 | AR_IMR_TXURN | | 798 | AR_IMR_TXURN | |
744 | AR_IMR_RXERR | | 799 | AR_IMR_RXERR | |
745 | AR_IMR_RXORN | | 800 | AR_IMR_RXORN | |
746 | AR_IMR_BCNMISC; | 801 | AR_IMR_BCNMISC; |
747 | 802 | ||
803 | if (AR_SREV_9340(ah)) | ||
804 | sync_default &= ~AR_INTR_SYNC_HOST1_FATAL; | ||
805 | |||
748 | if (AR_SREV_9300_20_OR_LATER(ah)) { | 806 | if (AR_SREV_9300_20_OR_LATER(ah)) { |
749 | imr_reg |= AR_IMR_RXOK_HP; | 807 | imr_reg |= AR_IMR_RXOK_HP; |
750 | if (ah->config.rx_intr_mitigation) | 808 | if (ah->config.rx_intr_mitigation) |
@@ -775,7 +833,7 @@ static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, | |||
775 | 833 | ||
776 | if (!AR_SREV_9100(ah)) { | 834 | if (!AR_SREV_9100(ah)) { |
777 | REG_WRITE(ah, AR_INTR_SYNC_CAUSE, 0xFFFFFFFF); | 835 | REG_WRITE(ah, AR_INTR_SYNC_CAUSE, 0xFFFFFFFF); |
778 | REG_WRITE(ah, AR_INTR_SYNC_ENABLE, AR_INTR_SYNC_DEFAULT); | 836 | REG_WRITE(ah, AR_INTR_SYNC_ENABLE, sync_default); |
779 | REG_WRITE(ah, AR_INTR_SYNC_MASK, 0); | 837 | REG_WRITE(ah, AR_INTR_SYNC_MASK, 0); |
780 | } | 838 | } |
781 | 839 | ||
@@ -1487,7 +1545,9 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
1487 | REG_WRITE(ah, AR_CFG, AR_CFG_SWTD | AR_CFG_SWRD); | 1545 | REG_WRITE(ah, AR_CFG, AR_CFG_SWTD | AR_CFG_SWRD); |
1488 | } | 1546 | } |
1489 | #ifdef __BIG_ENDIAN | 1547 | #ifdef __BIG_ENDIAN |
1490 | else | 1548 | else if (AR_SREV_9340(ah)) |
1549 | REG_RMW(ah, AR_CFG, AR_CFG_SWRB | AR_CFG_SWTB, 0); | ||
1550 | else | ||
1491 | REG_WRITE(ah, AR_CFG, AR_CFG_SWTD | AR_CFG_SWRD); | 1551 | REG_WRITE(ah, AR_CFG, AR_CFG_SWTD | AR_CFG_SWRD); |
1492 | #endif | 1552 | #endif |
1493 | } | 1553 | } |
@@ -1793,7 +1853,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
1793 | struct ath_common *common = ath9k_hw_common(ah); | 1853 | struct ath_common *common = ath9k_hw_common(ah); |
1794 | struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; | 1854 | struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; |
1795 | 1855 | ||
1796 | u16 capField = 0, eeval; | 1856 | u16 eeval; |
1797 | u8 ant_div_ctl1, tx_chainmask, rx_chainmask; | 1857 | u8 ant_div_ctl1, tx_chainmask, rx_chainmask; |
1798 | 1858 | ||
1799 | eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_0); | 1859 | eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_0); |
@@ -1804,8 +1864,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
1804 | eeval |= AR9285_RDEXT_DEFAULT; | 1864 | eeval |= AR9285_RDEXT_DEFAULT; |
1805 | regulatory->current_rd_ext = eeval; | 1865 | regulatory->current_rd_ext = eeval; |
1806 | 1866 | ||
1807 | capField = ah->eep_ops->get_eeprom(ah, EEP_OP_CAP); | ||
1808 | |||
1809 | if (ah->opmode != NL80211_IFTYPE_AP && | 1867 | if (ah->opmode != NL80211_IFTYPE_AP && |
1810 | ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) { | 1868 | ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) { |
1811 | if (regulatory->current_rd == 0x64 || | 1869 | if (regulatory->current_rd == 0x64 || |
@@ -1898,15 +1956,23 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
1898 | else | 1956 | else |
1899 | pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS; | 1957 | pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS; |
1900 | 1958 | ||
1901 | if (AR_SREV_9280_20_OR_LATER(ah) && common->btcoex_enabled) { | 1959 | if (common->btcoex_enabled) { |
1902 | btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO; | 1960 | if (AR_SREV_9300_20_OR_LATER(ah)) { |
1903 | btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO; | ||
1904 | |||
1905 | if (AR_SREV_9285(ah)) { | ||
1906 | btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE; | 1961 | btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE; |
1907 | btcoex_hw->btpriority_gpio = ATH_BTPRIORITY_GPIO; | 1962 | btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300; |
1908 | } else { | 1963 | btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300; |
1909 | btcoex_hw->scheme = ATH_BTCOEX_CFG_2WIRE; | 1964 | btcoex_hw->btpriority_gpio = ATH_BTPRIORITY_GPIO_9300; |
1965 | } else if (AR_SREV_9280_20_OR_LATER(ah)) { | ||
1966 | btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9280; | ||
1967 | btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9280; | ||
1968 | |||
1969 | if (AR_SREV_9285(ah)) { | ||
1970 | btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE; | ||
1971 | btcoex_hw->btpriority_gpio = | ||
1972 | ATH_BTPRIORITY_GPIO_9285; | ||
1973 | } else { | ||
1974 | btcoex_hw->scheme = ATH_BTCOEX_CFG_2WIRE; | ||
1975 | } | ||
1910 | } | 1976 | } |
1911 | } else { | 1977 | } else { |
1912 | btcoex_hw->scheme = ATH_BTCOEX_CFG_NONE; | 1978 | btcoex_hw->scheme = ATH_BTCOEX_CFG_NONE; |
@@ -2359,11 +2425,11 @@ EXPORT_SYMBOL(ath_gen_timer_alloc); | |||
2359 | 2425 | ||
2360 | void ath9k_hw_gen_timer_start(struct ath_hw *ah, | 2426 | void ath9k_hw_gen_timer_start(struct ath_hw *ah, |
2361 | struct ath_gen_timer *timer, | 2427 | struct ath_gen_timer *timer, |
2362 | u32 timer_next, | 2428 | u32 trig_timeout, |
2363 | u32 timer_period) | 2429 | u32 timer_period) |
2364 | { | 2430 | { |
2365 | struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; | 2431 | struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; |
2366 | u32 tsf; | 2432 | u32 tsf, timer_next; |
2367 | 2433 | ||
2368 | BUG_ON(!timer_period); | 2434 | BUG_ON(!timer_period); |
2369 | 2435 | ||
@@ -2371,18 +2437,13 @@ void ath9k_hw_gen_timer_start(struct ath_hw *ah, | |||
2371 | 2437 | ||
2372 | tsf = ath9k_hw_gettsf32(ah); | 2438 | tsf = ath9k_hw_gettsf32(ah); |
2373 | 2439 | ||
2440 | timer_next = tsf + trig_timeout; | ||
2441 | |||
2374 | ath_dbg(ath9k_hw_common(ah), ATH_DBG_HWTIMER, | 2442 | ath_dbg(ath9k_hw_common(ah), ATH_DBG_HWTIMER, |
2375 | "current tsf %x period %x timer_next %x\n", | 2443 | "current tsf %x period %x timer_next %x\n", |
2376 | tsf, timer_period, timer_next); | 2444 | tsf, timer_period, timer_next); |
2377 | 2445 | ||
2378 | /* | 2446 | /* |
2379 | * Pull timer_next forward if the current TSF already passed it | ||
2380 | * because of software latency | ||
2381 | */ | ||
2382 | if (timer_next < tsf) | ||
2383 | timer_next = tsf + timer_period; | ||
2384 | |||
2385 | /* | ||
2386 | * Program generic timer registers | 2447 | * Program generic timer registers |
2387 | */ | 2448 | */ |
2388 | REG_WRITE(ah, gen_tmr_configuration[timer->index].next_addr, | 2449 | REG_WRITE(ah, gen_tmr_configuration[timer->index].next_addr, |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 1018d6cbd530..34ed1bd0e855 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -43,6 +43,7 @@ | |||
43 | #define AR9287_DEVID_PCI 0x002d | 43 | #define AR9287_DEVID_PCI 0x002d |
44 | #define AR9287_DEVID_PCIE 0x002e | 44 | #define AR9287_DEVID_PCIE 0x002e |
45 | #define AR9300_DEVID_PCIE 0x0030 | 45 | #define AR9300_DEVID_PCIE 0x0030 |
46 | #define AR9300_DEVID_AR9340 0x0031 | ||
46 | #define AR9300_DEVID_AR9485_PCIE 0x0032 | 47 | #define AR9300_DEVID_AR9485_PCIE 0x0032 |
47 | 48 | ||
48 | #define AR5416_AR9100_DEVID 0x000b | 49 | #define AR5416_AR9100_DEVID 0x000b |
@@ -55,6 +56,9 @@ | |||
55 | #define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa | 56 | #define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa |
56 | #define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab | 57 | #define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab |
57 | 58 | ||
59 | #define AR9300_NUM_BT_WEIGHTS 4 | ||
60 | #define AR9300_NUM_WLAN_WEIGHTS 4 | ||
61 | |||
58 | #define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1) | 62 | #define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1) |
59 | 63 | ||
60 | #define ATH_DEFAULT_NOISE_FLOOR -95 | 64 | #define ATH_DEFAULT_NOISE_FLOOR -95 |
@@ -121,7 +125,7 @@ | |||
121 | #define AR_GPIO_BIT(_gpio) (1 << (_gpio)) | 125 | #define AR_GPIO_BIT(_gpio) (1 << (_gpio)) |
122 | 126 | ||
123 | #define BASE_ACTIVATE_DELAY 100 | 127 | #define BASE_ACTIVATE_DELAY 100 |
124 | #define RTC_PLL_SETTLE_DELAY 100 | 128 | #define RTC_PLL_SETTLE_DELAY (AR_SREV_9340(ah) ? 1000 : 100) |
125 | #define COEF_SCALE_S 24 | 129 | #define COEF_SCALE_S 24 |
126 | #define HT40_CHANNEL_CENTER_SHIFT 10 | 130 | #define HT40_CHANNEL_CENTER_SHIFT 10 |
127 | 131 | ||
@@ -771,6 +775,8 @@ struct ath_hw { | |||
771 | 775 | ||
772 | /* Bluetooth coexistance */ | 776 | /* Bluetooth coexistance */ |
773 | struct ath_btcoex_hw btcoex_hw; | 777 | struct ath_btcoex_hw btcoex_hw; |
778 | u32 bt_coex_bt_weight[AR9300_NUM_BT_WEIGHTS]; | ||
779 | u32 bt_coex_wlan_weight[AR9300_NUM_WLAN_WEIGHTS]; | ||
774 | 780 | ||
775 | u32 intr_txqs; | 781 | u32 intr_txqs; |
776 | u8 txchainmask; | 782 | u8 txchainmask; |
@@ -799,6 +805,7 @@ struct ath_hw { | |||
799 | struct ar5416IniArray iniPcieSerdes; | 805 | struct ar5416IniArray iniPcieSerdes; |
800 | struct ar5416IniArray iniPcieSerdesLowPower; | 806 | struct ar5416IniArray iniPcieSerdesLowPower; |
801 | struct ar5416IniArray iniModesAdditional; | 807 | struct ar5416IniArray iniModesAdditional; |
808 | struct ar5416IniArray iniModesAdditional_40M; | ||
802 | struct ar5416IniArray iniModesRxGain; | 809 | struct ar5416IniArray iniModesRxGain; |
803 | struct ar5416IniArray iniModesTxGain; | 810 | struct ar5416IniArray iniModesTxGain; |
804 | struct ar5416IniArray iniModes_9271_1_0_only; | 811 | struct ar5416IniArray iniModes_9271_1_0_only; |
@@ -845,6 +852,8 @@ struct ath_hw { | |||
845 | 852 | ||
846 | /* Enterprise mode cap */ | 853 | /* Enterprise mode cap */ |
847 | u32 ent_mode; | 854 | u32 ent_mode; |
855 | |||
856 | bool is_clk_25mhz; | ||
848 | }; | 857 | }; |
849 | 858 | ||
850 | struct ath_bus_ops { | 859 | struct ath_bus_ops { |
@@ -928,7 +937,7 @@ void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); | |||
928 | void ath9k_hw_reset_tsf(struct ath_hw *ah); | 937 | void ath9k_hw_reset_tsf(struct ath_hw *ah); |
929 | void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting); | 938 | void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting); |
930 | void ath9k_hw_init_global_settings(struct ath_hw *ah); | 939 | void ath9k_hw_init_global_settings(struct ath_hw *ah); |
931 | unsigned long ar9003_get_pll_sqsum_dvc(struct ath_hw *ah); | 940 | u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah); |
932 | void ath9k_hw_set11nmac2040(struct ath_hw *ah); | 941 | void ath9k_hw_set11nmac2040(struct ath_hw *ah); |
933 | void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); | 942 | void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); |
934 | void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, | 943 | void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 1ac8318d82a3..b172d1509515 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -574,6 +574,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
574 | sc->sc_ah->gpio_mask = pdata->gpio_mask; | 574 | sc->sc_ah->gpio_mask = pdata->gpio_mask; |
575 | sc->sc_ah->gpio_val = pdata->gpio_val; | 575 | sc->sc_ah->gpio_val = pdata->gpio_val; |
576 | sc->sc_ah->led_pin = pdata->led_pin; | 576 | sc->sc_ah->led_pin = pdata->led_pin; |
577 | ah->is_clk_25mhz = pdata->is_clk_25mhz; | ||
577 | } | 578 | } |
578 | 579 | ||
579 | common = ath9k_hw_common(ah); | 580 | common = ath9k_hw_common(ah); |
@@ -800,6 +801,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
800 | 801 | ||
801 | INIT_WORK(&sc->hw_check_work, ath_hw_check); | 802 | INIT_WORK(&sc->hw_check_work, ath_hw_check); |
802 | INIT_WORK(&sc->paprd_work, ath_paprd_calibrate); | 803 | INIT_WORK(&sc->paprd_work, ath_paprd_calibrate); |
804 | INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work); | ||
803 | sc->last_rssi = ATH_RSSI_DUMMY_MARKER; | 805 | sc->last_rssi = ATH_RSSI_DUMMY_MARKER; |
804 | 806 | ||
805 | ath_init_leds(sc); | 807 | ath_init_leds(sc); |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 1968c67e3fab..9cf7a7d0e118 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -812,10 +812,14 @@ EXPORT_SYMBOL(ath9k_hw_disable_interrupts); | |||
812 | void ath9k_hw_enable_interrupts(struct ath_hw *ah) | 812 | void ath9k_hw_enable_interrupts(struct ath_hw *ah) |
813 | { | 813 | { |
814 | struct ath_common *common = ath9k_hw_common(ah); | 814 | struct ath_common *common = ath9k_hw_common(ah); |
815 | u32 sync_default = AR_INTR_SYNC_DEFAULT; | ||
815 | 816 | ||
816 | if (!(ah->imask & ATH9K_INT_GLOBAL)) | 817 | if (!(ah->imask & ATH9K_INT_GLOBAL)) |
817 | return; | 818 | return; |
818 | 819 | ||
820 | if (AR_SREV_9340(ah)) | ||
821 | sync_default &= ~AR_INTR_SYNC_HOST1_FATAL; | ||
822 | |||
819 | ath_dbg(common, ATH_DBG_INTERRUPT, "enable IER\n"); | 823 | ath_dbg(common, ATH_DBG_INTERRUPT, "enable IER\n"); |
820 | REG_WRITE(ah, AR_IER, AR_IER_ENABLE); | 824 | REG_WRITE(ah, AR_IER, AR_IER_ENABLE); |
821 | if (!AR_SREV_9100(ah)) { | 825 | if (!AR_SREV_9100(ah)) { |
@@ -824,10 +828,8 @@ void ath9k_hw_enable_interrupts(struct ath_hw *ah) | |||
824 | REG_WRITE(ah, AR_INTR_ASYNC_MASK, AR_INTR_MAC_IRQ); | 828 | REG_WRITE(ah, AR_INTR_ASYNC_MASK, AR_INTR_MAC_IRQ); |
825 | 829 | ||
826 | 830 | ||
827 | REG_WRITE(ah, AR_INTR_SYNC_ENABLE, | 831 | REG_WRITE(ah, AR_INTR_SYNC_ENABLE, sync_default); |
828 | AR_INTR_SYNC_DEFAULT); | 832 | REG_WRITE(ah, AR_INTR_SYNC_MASK, sync_default); |
829 | REG_WRITE(ah, AR_INTR_SYNC_MASK, | ||
830 | AR_INTR_SYNC_DEFAULT); | ||
831 | } | 833 | } |
832 | ath_dbg(common, ATH_DBG_INTERRUPT, "AR_IMR 0x%x IER 0x%x\n", | 834 | ath_dbg(common, ATH_DBG_INTERRUPT, "AR_IMR 0x%x IER 0x%x\n", |
833 | REG_READ(ah, AR_IMR), REG_READ(ah, AR_IER)); | 835 | REG_READ(ah, AR_IMR), REG_READ(ah, AR_IER)); |
@@ -883,6 +885,9 @@ void ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints) | |||
883 | mask |= AR_IMR_GENTMR; | 885 | mask |= AR_IMR_GENTMR; |
884 | } | 886 | } |
885 | 887 | ||
888 | if (ints & ATH9K_INT_GENTIMER) | ||
889 | mask |= AR_IMR_GENTMR; | ||
890 | |||
886 | if (ints & (ATH9K_INT_BMISC)) { | 891 | if (ints & (ATH9K_INT_BMISC)) { |
887 | mask |= AR_IMR_BCNMISC; | 892 | mask |= AR_IMR_BCNMISC; |
888 | if (ints & ATH9K_INT_TIM) | 893 | if (ints & ATH9K_INT_TIM) |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index a8d9009a76d5..c3dbf2661a3f 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -624,6 +624,43 @@ out: | |||
624 | ath9k_ps_restore(sc); | 624 | ath9k_ps_restore(sc); |
625 | } | 625 | } |
626 | 626 | ||
627 | static void ath_hw_pll_rx_hang_check(struct ath_softc *sc, u32 pll_sqsum) | ||
628 | { | ||
629 | static int count; | ||
630 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
631 | |||
632 | if (pll_sqsum >= 0x40000) { | ||
633 | count++; | ||
634 | if (count == 3) { | ||
635 | /* Rx is hung for more than 500ms. Reset it */ | ||
636 | ath_dbg(common, ATH_DBG_RESET, | ||
637 | "Possible RX hang, resetting"); | ||
638 | ath_reset(sc, true); | ||
639 | count = 0; | ||
640 | } | ||
641 | } else | ||
642 | count = 0; | ||
643 | } | ||
644 | |||
645 | void ath_hw_pll_work(struct work_struct *work) | ||
646 | { | ||
647 | struct ath_softc *sc = container_of(work, struct ath_softc, | ||
648 | hw_pll_work.work); | ||
649 | u32 pll_sqsum; | ||
650 | |||
651 | if (AR_SREV_9485(sc->sc_ah)) { | ||
652 | |||
653 | ath9k_ps_wakeup(sc); | ||
654 | pll_sqsum = ar9003_get_pll_sqsum_dvc(sc->sc_ah); | ||
655 | ath9k_ps_restore(sc); | ||
656 | |||
657 | ath_hw_pll_rx_hang_check(sc, pll_sqsum); | ||
658 | |||
659 | ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, HZ/5); | ||
660 | } | ||
661 | } | ||
662 | |||
663 | |||
627 | void ath9k_tasklet(unsigned long data) | 664 | void ath9k_tasklet(unsigned long data) |
628 | { | 665 | { |
629 | struct ath_softc *sc = (struct ath_softc *)data; | 666 | struct ath_softc *sc = (struct ath_softc *)data; |
@@ -1932,6 +1969,12 @@ static void ath9k_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif) | |||
1932 | "Bss Info ASSOC %d, bssid: %pM\n", | 1969 | "Bss Info ASSOC %d, bssid: %pM\n", |
1933 | bss_conf->aid, common->curbssid); | 1970 | bss_conf->aid, common->curbssid); |
1934 | ath_beacon_config(sc, vif); | 1971 | ath_beacon_config(sc, vif); |
1972 | /* | ||
1973 | * Request a re-configuration of Beacon related timers | ||
1974 | * on the receipt of the first Beacon frame (i.e., | ||
1975 | * after time sync with the AP). | ||
1976 | */ | ||
1977 | sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; | ||
1935 | /* Reset rssi stats */ | 1978 | /* Reset rssi stats */ |
1936 | sc->last_rssi = ATH_RSSI_DUMMY_MARKER; | 1979 | sc->last_rssi = ATH_RSSI_DUMMY_MARKER; |
1937 | sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; | 1980 | sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; |
@@ -2219,9 +2262,7 @@ static void ath9k_flush(struct ieee80211_hw *hw, bool drop) | |||
2219 | int timeout = 200; /* ms */ | 2262 | int timeout = 200; /* ms */ |
2220 | int i, j; | 2263 | int i, j; |
2221 | 2264 | ||
2222 | ath9k_ps_wakeup(sc); | ||
2223 | mutex_lock(&sc->mutex); | 2265 | mutex_lock(&sc->mutex); |
2224 | |||
2225 | cancel_delayed_work_sync(&sc->tx_complete_work); | 2266 | cancel_delayed_work_sync(&sc->tx_complete_work); |
2226 | 2267 | ||
2227 | if (drop) | 2268 | if (drop) |
@@ -2244,15 +2285,15 @@ static void ath9k_flush(struct ieee80211_hw *hw, bool drop) | |||
2244 | goto out; | 2285 | goto out; |
2245 | } | 2286 | } |
2246 | 2287 | ||
2288 | ath9k_ps_wakeup(sc); | ||
2247 | if (!ath_drain_all_txq(sc, false)) | 2289 | if (!ath_drain_all_txq(sc, false)) |
2248 | ath_reset(sc, false); | 2290 | ath_reset(sc, false); |
2249 | 2291 | ath9k_ps_restore(sc); | |
2250 | ieee80211_wake_queues(hw); | 2292 | ieee80211_wake_queues(hw); |
2251 | 2293 | ||
2252 | out: | 2294 | out: |
2253 | ieee80211_queue_delayed_work(hw, &sc->tx_complete_work, 0); | 2295 | ieee80211_queue_delayed_work(hw, &sc->tx_complete_work, 0); |
2254 | mutex_unlock(&sc->mutex); | 2296 | mutex_unlock(&sc->mutex); |
2255 | ath9k_ps_restore(sc); | ||
2256 | } | 2297 | } |
2257 | 2298 | ||
2258 | static bool ath9k_tx_frames_pending(struct ieee80211_hw *hw) | 2299 | static bool ath9k_tx_frames_pending(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/ath/ath9k/phy.h b/drivers/net/wireless/ath/ath9k/phy.h index 8e5fe9d7f174..9441bf8ca2fd 100644 --- a/drivers/net/wireless/ath/ath9k/phy.h +++ b/drivers/net/wireless/ath/ath9k/phy.h | |||
@@ -45,4 +45,7 @@ | |||
45 | #define AR_PHY_TIMING11_SPUR_FREQ_SD 0x3FF00000 | 45 | #define AR_PHY_TIMING11_SPUR_FREQ_SD 0x3FF00000 |
46 | #define AR_PHY_TIMING11_SPUR_FREQ_SD_S 20 | 46 | #define AR_PHY_TIMING11_SPUR_FREQ_SD_S 20 |
47 | 47 | ||
48 | #define AR_PHY_PLL_CONTROL 0x16180 | ||
49 | #define AR_PHY_PLL_MODE 0x16184 | ||
50 | |||
48 | #endif | 51 | #endif |
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index 18094094b298..4ccbf2ddb553 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -854,14 +854,13 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, | |||
854 | ath_rc_rate_set_rtscts(sc, rate_table, tx_info); | 854 | ath_rc_rate_set_rtscts(sc, rate_table, tx_info); |
855 | } | 855 | } |
856 | 856 | ||
857 | static bool ath_rc_update_per(struct ath_softc *sc, | 857 | static void ath_rc_update_per(struct ath_softc *sc, |
858 | const struct ath_rate_table *rate_table, | 858 | const struct ath_rate_table *rate_table, |
859 | struct ath_rate_priv *ath_rc_priv, | 859 | struct ath_rate_priv *ath_rc_priv, |
860 | struct ieee80211_tx_info *tx_info, | 860 | struct ieee80211_tx_info *tx_info, |
861 | int tx_rate, int xretries, int retries, | 861 | int tx_rate, int xretries, int retries, |
862 | u32 now_msec) | 862 | u32 now_msec) |
863 | { | 863 | { |
864 | bool state_change = false; | ||
865 | int count, n_bad_frames; | 864 | int count, n_bad_frames; |
866 | u8 last_per; | 865 | u8 last_per; |
867 | static const u32 nretry_to_per_lookup[10] = { | 866 | static const u32 nretry_to_per_lookup[10] = { |
@@ -992,8 +991,6 @@ static bool ath_rc_update_per(struct ath_softc *sc, | |||
992 | 991 | ||
993 | } | 992 | } |
994 | } | 993 | } |
995 | |||
996 | return state_change; | ||
997 | } | 994 | } |
998 | 995 | ||
999 | static void ath_debug_stat_retries(struct ath_rate_priv *rc, int rix, | 996 | static void ath_debug_stat_retries(struct ath_rate_priv *rc, int rix, |
@@ -1017,7 +1014,6 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1017 | u32 now_msec = jiffies_to_msecs(jiffies); | 1014 | u32 now_msec = jiffies_to_msecs(jiffies); |
1018 | int rate; | 1015 | int rate; |
1019 | u8 last_per; | 1016 | u8 last_per; |
1020 | bool state_change = false; | ||
1021 | const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; | 1017 | const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; |
1022 | int size = ath_rc_priv->rate_table_size; | 1018 | int size = ath_rc_priv->rate_table_size; |
1023 | 1019 | ||
@@ -1027,9 +1023,9 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1027 | last_per = ath_rc_priv->per[tx_rate]; | 1023 | last_per = ath_rc_priv->per[tx_rate]; |
1028 | 1024 | ||
1029 | /* Update PER first */ | 1025 | /* Update PER first */ |
1030 | state_change = ath_rc_update_per(sc, rate_table, ath_rc_priv, | 1026 | ath_rc_update_per(sc, rate_table, ath_rc_priv, |
1031 | tx_info, tx_rate, xretries, | 1027 | tx_info, tx_rate, xretries, |
1032 | retries, now_msec); | 1028 | retries, now_msec); |
1033 | 1029 | ||
1034 | /* | 1030 | /* |
1035 | * If this rate looks bad (high PER) then stop using it for | 1031 | * If this rate looks bad (high PER) then stop using it for |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index f69dcdf0e2e6..c5b7cbe59bfa 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -1339,7 +1339,7 @@ static void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs) | |||
1339 | struct ath_hw_antcomb_conf div_ant_conf; | 1339 | struct ath_hw_antcomb_conf div_ant_conf; |
1340 | struct ath_ant_comb *antcomb = &sc->ant_comb; | 1340 | struct ath_ant_comb *antcomb = &sc->ant_comb; |
1341 | int alt_ratio = 0, alt_rssi_avg = 0, main_rssi_avg = 0, curr_alt_set; | 1341 | int alt_ratio = 0, alt_rssi_avg = 0, main_rssi_avg = 0, curr_alt_set; |
1342 | int curr_main_set, curr_bias; | 1342 | int curr_main_set; |
1343 | int main_rssi = rs->rs_rssi_ctl0; | 1343 | int main_rssi = rs->rs_rssi_ctl0; |
1344 | int alt_rssi = rs->rs_rssi_ctl1; | 1344 | int alt_rssi = rs->rs_rssi_ctl1; |
1345 | int rx_ant_conf, main_ant_conf; | 1345 | int rx_ant_conf, main_ant_conf; |
@@ -1393,7 +1393,6 @@ static void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs) | |||
1393 | ath9k_hw_antdiv_comb_conf_get(sc->sc_ah, &div_ant_conf); | 1393 | ath9k_hw_antdiv_comb_conf_get(sc->sc_ah, &div_ant_conf); |
1394 | curr_alt_set = div_ant_conf.alt_lna_conf; | 1394 | curr_alt_set = div_ant_conf.alt_lna_conf; |
1395 | curr_main_set = div_ant_conf.main_lna_conf; | 1395 | curr_main_set = div_ant_conf.main_lna_conf; |
1396 | curr_bias = div_ant_conf.fast_div_bias; | ||
1397 | 1396 | ||
1398 | antcomb->count++; | 1397 | antcomb->count++; |
1399 | 1398 | ||
@@ -1743,7 +1742,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1743 | if ((sc->ps_flags & (PS_WAIT_FOR_BEACON | | 1742 | if ((sc->ps_flags & (PS_WAIT_FOR_BEACON | |
1744 | PS_WAIT_FOR_CAB | | 1743 | PS_WAIT_FOR_CAB | |
1745 | PS_WAIT_FOR_PSPOLL_DATA)) || | 1744 | PS_WAIT_FOR_PSPOLL_DATA)) || |
1746 | unlikely(ath9k_check_auto_sleep(sc))) | 1745 | ath9k_check_auto_sleep(sc)) |
1747 | ath_rx_ps(sc, skb); | 1746 | ath_rx_ps(sc, skb); |
1748 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | 1747 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); |
1749 | 1748 | ||
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h index 6acbf0e2240b..456f3ec20fef 100644 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ b/drivers/net/wireless/ath/ath9k/reg.h | |||
@@ -693,7 +693,7 @@ | |||
693 | #define AR_RC_APB 0x00000002 | 693 | #define AR_RC_APB 0x00000002 |
694 | #define AR_RC_HOSTIF 0x00000100 | 694 | #define AR_RC_HOSTIF 0x00000100 |
695 | 695 | ||
696 | #define AR_WA 0x4004 | 696 | #define AR_WA (AR_SREV_9340(ah) ? 0x40c4 : 0x4004) |
697 | #define AR_WA_BIT6 (1 << 6) | 697 | #define AR_WA_BIT6 (1 << 6) |
698 | #define AR_WA_BIT7 (1 << 7) | 698 | #define AR_WA_BIT7 (1 << 7) |
699 | #define AR_WA_BIT23 (1 << 23) | 699 | #define AR_WA_BIT23 (1 << 23) |
@@ -712,7 +712,7 @@ | |||
712 | #define AR_PM_STATE 0x4008 | 712 | #define AR_PM_STATE 0x4008 |
713 | #define AR_PM_STATE_PME_D3COLD_VAUX 0x00100000 | 713 | #define AR_PM_STATE_PME_D3COLD_VAUX 0x00100000 |
714 | 714 | ||
715 | #define AR_HOST_TIMEOUT 0x4018 | 715 | #define AR_HOST_TIMEOUT (AR_SREV_9340(ah) ? 0x4008 : 0x4018) |
716 | #define AR_HOST_TIMEOUT_APB_CNTR 0x0000FFFF | 716 | #define AR_HOST_TIMEOUT_APB_CNTR 0x0000FFFF |
717 | #define AR_HOST_TIMEOUT_APB_CNTR_S 0 | 717 | #define AR_HOST_TIMEOUT_APB_CNTR_S 0 |
718 | #define AR_HOST_TIMEOUT_LCL_CNTR 0xFFFF0000 | 718 | #define AR_HOST_TIMEOUT_LCL_CNTR 0xFFFF0000 |
@@ -742,7 +742,8 @@ | |||
742 | #define EEPROM_PROTECT_WP_1024_2047 0x8000 | 742 | #define EEPROM_PROTECT_WP_1024_2047 0x8000 |
743 | 743 | ||
744 | #define AR_SREV \ | 744 | #define AR_SREV \ |
745 | ((AR_SREV_9100(ah)) ? 0x0600 : 0x4020) | 745 | ((AR_SREV_9100(ah)) ? 0x0600 : (AR_SREV_9340(ah) \ |
746 | ? 0x400c : 0x4020)) | ||
746 | 747 | ||
747 | #define AR_SREV_ID \ | 748 | #define AR_SREV_ID \ |
748 | ((AR_SREV_9100(ah)) ? 0x00000FFF : 0x000000FF) | 749 | ((AR_SREV_9100(ah)) ? 0x00000FFF : 0x000000FF) |
@@ -790,6 +791,7 @@ | |||
790 | #define AR_SREV_VERSION_9485 0x240 | 791 | #define AR_SREV_VERSION_9485 0x240 |
791 | #define AR_SREV_REVISION_9485_10 0 | 792 | #define AR_SREV_REVISION_9485_10 0 |
792 | #define AR_SREV_REVISION_9485_11 1 | 793 | #define AR_SREV_REVISION_9485_11 1 |
794 | #define AR_SREV_VERSION_9340 0x300 | ||
793 | 795 | ||
794 | #define AR_SREV_5416(_ah) \ | 796 | #define AR_SREV_5416(_ah) \ |
795 | (((_ah)->hw_version.macVersion == AR_SREV_VERSION_5416_PCI) || \ | 797 | (((_ah)->hw_version.macVersion == AR_SREV_VERSION_5416_PCI) || \ |
@@ -868,6 +870,11 @@ | |||
868 | #define AR_SREV_9485_11(_ah) \ | 870 | #define AR_SREV_9485_11(_ah) \ |
869 | (AR_SREV_9485(_ah) && \ | 871 | (AR_SREV_9485(_ah) && \ |
870 | ((_ah)->hw_version.macRev == AR_SREV_REVISION_9485_11)) | 872 | ((_ah)->hw_version.macRev == AR_SREV_REVISION_9485_11)) |
873 | #define AR_SREV_9485_OR_LATER(_ah) \ | ||
874 | (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9485)) | ||
875 | |||
876 | #define AR_SREV_9340(_ah) \ | ||
877 | (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340)) | ||
871 | 878 | ||
872 | #define AR_SREV_9285E_20(_ah) \ | 879 | #define AR_SREV_9285E_20(_ah) \ |
873 | (AR_SREV_9285_12_OR_LATER(_ah) && \ | 880 | (AR_SREV_9285_12_OR_LATER(_ah) && \ |
@@ -910,11 +917,11 @@ enum ath_usb_dev { | |||
910 | #define AR_INTR_SPURIOUS 0xFFFFFFFF | 917 | #define AR_INTR_SPURIOUS 0xFFFFFFFF |
911 | 918 | ||
912 | 919 | ||
913 | #define AR_INTR_SYNC_CAUSE_CLR 0x4028 | 920 | #define AR_INTR_SYNC_CAUSE (AR_SREV_9340(ah) ? 0x4010 : 0x4028) |
921 | #define AR_INTR_SYNC_CAUSE_CLR (AR_SREV_9340(ah) ? 0x4010 : 0x4028) | ||
914 | 922 | ||
915 | #define AR_INTR_SYNC_CAUSE 0x4028 | ||
916 | 923 | ||
917 | #define AR_INTR_SYNC_ENABLE 0x402c | 924 | #define AR_INTR_SYNC_ENABLE (AR_SREV_9340(ah) ? 0x4014 : 0x402c) |
918 | #define AR_INTR_SYNC_ENABLE_GPIO 0xFFFC0000 | 925 | #define AR_INTR_SYNC_ENABLE_GPIO 0xFFFC0000 |
919 | #define AR_INTR_SYNC_ENABLE_GPIO_S 18 | 926 | #define AR_INTR_SYNC_ENABLE_GPIO_S 18 |
920 | 927 | ||
@@ -954,24 +961,24 @@ enum { | |||
954 | 961 | ||
955 | }; | 962 | }; |
956 | 963 | ||
957 | #define AR_INTR_ASYNC_MASK 0x4030 | 964 | #define AR_INTR_ASYNC_MASK (AR_SREV_9340(ah) ? 0x4018 : 0x4030) |
958 | #define AR_INTR_ASYNC_MASK_GPIO 0xFFFC0000 | 965 | #define AR_INTR_ASYNC_MASK_GPIO 0xFFFC0000 |
959 | #define AR_INTR_ASYNC_MASK_GPIO_S 18 | 966 | #define AR_INTR_ASYNC_MASK_GPIO_S 18 |
960 | 967 | ||
961 | #define AR_INTR_SYNC_MASK 0x4034 | 968 | #define AR_INTR_SYNC_MASK (AR_SREV_9340(ah) ? 0x401c : 0x4034) |
962 | #define AR_INTR_SYNC_MASK_GPIO 0xFFFC0000 | 969 | #define AR_INTR_SYNC_MASK_GPIO 0xFFFC0000 |
963 | #define AR_INTR_SYNC_MASK_GPIO_S 18 | 970 | #define AR_INTR_SYNC_MASK_GPIO_S 18 |
964 | 971 | ||
965 | #define AR_INTR_ASYNC_CAUSE_CLR 0x4038 | 972 | #define AR_INTR_ASYNC_CAUSE_CLR (AR_SREV_9340(ah) ? 0x4020 : 0x4038) |
966 | #define AR_INTR_ASYNC_CAUSE 0x4038 | 973 | #define AR_INTR_ASYNC_CAUSE (AR_SREV_9340(ah) ? 0x4020 : 0x4038) |
967 | 974 | ||
968 | #define AR_INTR_ASYNC_ENABLE 0x403c | 975 | #define AR_INTR_ASYNC_ENABLE (AR_SREV_9340(ah) ? 0x4024 : 0x403c) |
969 | #define AR_INTR_ASYNC_ENABLE_GPIO 0xFFFC0000 | 976 | #define AR_INTR_ASYNC_ENABLE_GPIO 0xFFFC0000 |
970 | #define AR_INTR_ASYNC_ENABLE_GPIO_S 18 | 977 | #define AR_INTR_ASYNC_ENABLE_GPIO_S 18 |
971 | 978 | ||
972 | #define AR_PCIE_SERDES 0x4040 | 979 | #define AR_PCIE_SERDES 0x4040 |
973 | #define AR_PCIE_SERDES2 0x4044 | 980 | #define AR_PCIE_SERDES2 0x4044 |
974 | #define AR_PCIE_PM_CTRL 0x4014 | 981 | #define AR_PCIE_PM_CTRL (AR_SREV_9340(ah) ? 0x4004 : 0x4014) |
975 | #define AR_PCIE_PM_CTRL_ENA 0x00080000 | 982 | #define AR_PCIE_PM_CTRL_ENA 0x00080000 |
976 | 983 | ||
977 | #define AR_NUM_GPIO 14 | 984 | #define AR_NUM_GPIO 14 |
@@ -982,7 +989,7 @@ enum { | |||
982 | #define AR9300_NUM_GPIO 17 | 989 | #define AR9300_NUM_GPIO 17 |
983 | #define AR7010_NUM_GPIO 16 | 990 | #define AR7010_NUM_GPIO 16 |
984 | 991 | ||
985 | #define AR_GPIO_IN_OUT 0x4048 | 992 | #define AR_GPIO_IN_OUT (AR_SREV_9340(ah) ? 0x4028 : 0x4048) |
986 | #define AR_GPIO_IN_VAL 0x0FFFC000 | 993 | #define AR_GPIO_IN_VAL 0x0FFFC000 |
987 | #define AR_GPIO_IN_VAL_S 14 | 994 | #define AR_GPIO_IN_VAL_S 14 |
988 | #define AR928X_GPIO_IN_VAL 0x000FFC00 | 995 | #define AR928X_GPIO_IN_VAL 0x000FFC00 |
@@ -996,11 +1003,12 @@ enum { | |||
996 | #define AR7010_GPIO_IN_VAL 0x0000FFFF | 1003 | #define AR7010_GPIO_IN_VAL 0x0000FFFF |
997 | #define AR7010_GPIO_IN_VAL_S 0 | 1004 | #define AR7010_GPIO_IN_VAL_S 0 |
998 | 1005 | ||
999 | #define AR_GPIO_IN 0x404c | 1006 | #define AR_GPIO_IN (AR_SREV_9340(ah) ? 0x402c : 0x404c) |
1000 | #define AR9300_GPIO_IN_VAL 0x0001FFFF | 1007 | #define AR9300_GPIO_IN_VAL 0x0001FFFF |
1001 | #define AR9300_GPIO_IN_VAL_S 0 | 1008 | #define AR9300_GPIO_IN_VAL_S 0 |
1002 | 1009 | ||
1003 | #define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c) | 1010 | #define AR_GPIO_OE_OUT (AR_SREV_9340(ah) ? 0x4030 : \ |
1011 | (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c)) | ||
1004 | #define AR_GPIO_OE_OUT_DRV 0x3 | 1012 | #define AR_GPIO_OE_OUT_DRV 0x3 |
1005 | #define AR_GPIO_OE_OUT_DRV_NO 0x0 | 1013 | #define AR_GPIO_OE_OUT_DRV_NO 0x0 |
1006 | #define AR_GPIO_OE_OUT_DRV_LOW 0x1 | 1014 | #define AR_GPIO_OE_OUT_DRV_LOW 0x1 |
@@ -1022,11 +1030,13 @@ enum { | |||
1022 | #define AR7010_GPIO_INT_MASK 0x52024 | 1030 | #define AR7010_GPIO_INT_MASK 0x52024 |
1023 | #define AR7010_GPIO_FUNCTION 0x52028 | 1031 | #define AR7010_GPIO_FUNCTION 0x52028 |
1024 | 1032 | ||
1025 | #define AR_GPIO_INTR_POL (AR_SREV_9300_20_OR_LATER(ah) ? 0x4058 : 0x4050) | 1033 | #define AR_GPIO_INTR_POL (AR_SREV_9340(ah) ? 0x4038 : \ |
1034 | (AR_SREV_9300_20_OR_LATER(ah) ? 0x4058 : 0x4050)) | ||
1026 | #define AR_GPIO_INTR_POL_VAL 0x0001FFFF | 1035 | #define AR_GPIO_INTR_POL_VAL 0x0001FFFF |
1027 | #define AR_GPIO_INTR_POL_VAL_S 0 | 1036 | #define AR_GPIO_INTR_POL_VAL_S 0 |
1028 | 1037 | ||
1029 | #define AR_GPIO_INPUT_EN_VAL (AR_SREV_9300_20_OR_LATER(ah) ? 0x405c : 0x4054) | 1038 | #define AR_GPIO_INPUT_EN_VAL (AR_SREV_9340(ah) ? 0x403c : \ |
1039 | (AR_SREV_9300_20_OR_LATER(ah) ? 0x405c : 0x4054)) | ||
1030 | #define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF 0x00000004 | 1040 | #define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF 0x00000004 |
1031 | #define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_S 2 | 1041 | #define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_S 2 |
1032 | #define AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF 0x00000008 | 1042 | #define AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF 0x00000008 |
@@ -1044,13 +1054,15 @@ enum { | |||
1044 | #define AR_GPIO_RTC_RESET_OVERRIDE_ENABLE 0x00010000 | 1054 | #define AR_GPIO_RTC_RESET_OVERRIDE_ENABLE 0x00010000 |
1045 | #define AR_GPIO_JTAG_DISABLE 0x00020000 | 1055 | #define AR_GPIO_JTAG_DISABLE 0x00020000 |
1046 | 1056 | ||
1047 | #define AR_GPIO_INPUT_MUX1 (AR_SREV_9300_20_OR_LATER(ah) ? 0x4060 : 0x4058) | 1057 | #define AR_GPIO_INPUT_MUX1 (AR_SREV_9340(ah) ? 0x4040 : \ |
1058 | (AR_SREV_9300_20_OR_LATER(ah) ? 0x4060 : 0x4058)) | ||
1048 | #define AR_GPIO_INPUT_MUX1_BT_ACTIVE 0x000f0000 | 1059 | #define AR_GPIO_INPUT_MUX1_BT_ACTIVE 0x000f0000 |
1049 | #define AR_GPIO_INPUT_MUX1_BT_ACTIVE_S 16 | 1060 | #define AR_GPIO_INPUT_MUX1_BT_ACTIVE_S 16 |
1050 | #define AR_GPIO_INPUT_MUX1_BT_PRIORITY 0x00000f00 | 1061 | #define AR_GPIO_INPUT_MUX1_BT_PRIORITY 0x00000f00 |
1051 | #define AR_GPIO_INPUT_MUX1_BT_PRIORITY_S 8 | 1062 | #define AR_GPIO_INPUT_MUX1_BT_PRIORITY_S 8 |
1052 | 1063 | ||
1053 | #define AR_GPIO_INPUT_MUX2 (AR_SREV_9300_20_OR_LATER(ah) ? 0x4064 : 0x405c) | 1064 | #define AR_GPIO_INPUT_MUX2 (AR_SREV_9340(ah) ? 0x4044 : \ |
1065 | (AR_SREV_9300_20_OR_LATER(ah) ? 0x4064 : 0x405c)) | ||
1054 | #define AR_GPIO_INPUT_MUX2_CLK25 0x0000000f | 1066 | #define AR_GPIO_INPUT_MUX2_CLK25 0x0000000f |
1055 | #define AR_GPIO_INPUT_MUX2_CLK25_S 0 | 1067 | #define AR_GPIO_INPUT_MUX2_CLK25_S 0 |
1056 | #define AR_GPIO_INPUT_MUX2_RFSILENT 0x000000f0 | 1068 | #define AR_GPIO_INPUT_MUX2_RFSILENT 0x000000f0 |
@@ -1058,13 +1070,18 @@ enum { | |||
1058 | #define AR_GPIO_INPUT_MUX2_RTC_RESET 0x00000f00 | 1070 | #define AR_GPIO_INPUT_MUX2_RTC_RESET 0x00000f00 |
1059 | #define AR_GPIO_INPUT_MUX2_RTC_RESET_S 8 | 1071 | #define AR_GPIO_INPUT_MUX2_RTC_RESET_S 8 |
1060 | 1072 | ||
1061 | #define AR_GPIO_OUTPUT_MUX1 (AR_SREV_9300_20_OR_LATER(ah) ? 0x4068 : 0x4060) | 1073 | #define AR_GPIO_OUTPUT_MUX1 (AR_SREV_9340(ah) ? 0x4048 : \ |
1062 | #define AR_GPIO_OUTPUT_MUX2 (AR_SREV_9300_20_OR_LATER(ah) ? 0x406c : 0x4064) | 1074 | (AR_SREV_9300_20_OR_LATER(ah) ? 0x4068 : 0x4060)) |
1063 | #define AR_GPIO_OUTPUT_MUX3 (AR_SREV_9300_20_OR_LATER(ah) ? 0x4070 : 0x4068) | 1075 | #define AR_GPIO_OUTPUT_MUX2 (AR_SREV_9340(ah) ? 0x404c : \ |
1076 | (AR_SREV_9300_20_OR_LATER(ah) ? 0x406c : 0x4064)) | ||
1077 | #define AR_GPIO_OUTPUT_MUX3 (AR_SREV_9340(ah) ? 0x4050 : \ | ||
1078 | (AR_SREV_9300_20_OR_LATER(ah) ? 0x4070 : 0x4068)) | ||
1064 | 1079 | ||
1065 | #define AR_INPUT_STATE (AR_SREV_9300_20_OR_LATER(ah) ? 0x4074 : 0x406c) | 1080 | #define AR_INPUT_STATE (AR_SREV_9340(ah) ? 0x4054 : \ |
1081 | (AR_SREV_9300_20_OR_LATER(ah) ? 0x4074 : 0x406c)) | ||
1066 | 1082 | ||
1067 | #define AR_EEPROM_STATUS_DATA (AR_SREV_9300_20_OR_LATER(ah) ? 0x4084 : 0x407c) | 1083 | #define AR_EEPROM_STATUS_DATA (AR_SREV_9340(ah) ? 0x40c8 : \ |
1084 | (AR_SREV_9300_20_OR_LATER(ah) ? 0x4084 : 0x407c)) | ||
1068 | #define AR_EEPROM_STATUS_DATA_VAL 0x0000ffff | 1085 | #define AR_EEPROM_STATUS_DATA_VAL 0x0000ffff |
1069 | #define AR_EEPROM_STATUS_DATA_VAL_S 0 | 1086 | #define AR_EEPROM_STATUS_DATA_VAL_S 0 |
1070 | #define AR_EEPROM_STATUS_DATA_BUSY 0x00010000 | 1087 | #define AR_EEPROM_STATUS_DATA_BUSY 0x00010000 |
@@ -1072,17 +1089,19 @@ enum { | |||
1072 | #define AR_EEPROM_STATUS_DATA_PROT_ACCESS 0x00040000 | 1089 | #define AR_EEPROM_STATUS_DATA_PROT_ACCESS 0x00040000 |
1073 | #define AR_EEPROM_STATUS_DATA_ABSENT_ACCESS 0x00080000 | 1090 | #define AR_EEPROM_STATUS_DATA_ABSENT_ACCESS 0x00080000 |
1074 | 1091 | ||
1075 | #define AR_OBS (AR_SREV_9300_20_OR_LATER(ah) ? 0x4088 : 0x4080) | 1092 | #define AR_OBS (AR_SREV_9340(ah) ? 0x405c : \ |
1093 | (AR_SREV_9300_20_OR_LATER(ah) ? 0x4088 : 0x4080)) | ||
1076 | 1094 | ||
1077 | #define AR_GPIO_PDPU (AR_SREV_9300_20_OR_LATER(ah) ? 0x4090 : 0x4088) | 1095 | #define AR_GPIO_PDPU (AR_SREV_9300_20_OR_LATER(ah) ? 0x4090 : 0x4088) |
1078 | 1096 | ||
1079 | #define AR_PCIE_MSI (AR_SREV_9300_20_OR_LATER(ah) ? 0x40a4 : 0x4094) | 1097 | #define AR_PCIE_MSI (AR_SREV_9340(ah) ? 0x40d8 : \ |
1098 | (AR_SREV_9300_20_OR_LATER(ah) ? 0x40a4 : 0x4094)) | ||
1080 | #define AR_PCIE_MSI_ENABLE 0x00000001 | 1099 | #define AR_PCIE_MSI_ENABLE 0x00000001 |
1081 | 1100 | ||
1082 | #define AR_INTR_PRIO_SYNC_ENABLE 0x40c4 | 1101 | #define AR_INTR_PRIO_SYNC_ENABLE (AR_SREV_9340(ah) ? 0x4088 : 0x40c4) |
1083 | #define AR_INTR_PRIO_ASYNC_MASK 0x40c8 | 1102 | #define AR_INTR_PRIO_ASYNC_MASK (AR_SREV_9340(ah) ? 0x408c : 0x40c8) |
1084 | #define AR_INTR_PRIO_SYNC_MASK 0x40cc | 1103 | #define AR_INTR_PRIO_SYNC_MASK (AR_SREV_9340(ah) ? 0x4090 : 0x40cc) |
1085 | #define AR_INTR_PRIO_ASYNC_ENABLE 0x40d4 | 1104 | #define AR_INTR_PRIO_ASYNC_ENABLE (AR_SREV_9340(ah) ? 0x4094 : 0x40d4) |
1086 | #define AR_ENT_OTP 0x40d8 | 1105 | #define AR_ENT_OTP 0x40d8 |
1087 | #define AR_ENT_OTP_CHAIN2_DISABLE 0x00020000 | 1106 | #define AR_ENT_OTP_CHAIN2_DISABLE 0x00020000 |
1088 | #define AR_ENT_OTP_MPSD 0x00800000 | 1107 | #define AR_ENT_OTP_MPSD 0x00800000 |
@@ -1163,6 +1182,7 @@ enum { | |||
1163 | #define AR_RTC_PLL_REFDIV_5 0x000000c0 | 1182 | #define AR_RTC_PLL_REFDIV_5 0x000000c0 |
1164 | #define AR_RTC_PLL_CLKSEL 0x00000300 | 1183 | #define AR_RTC_PLL_CLKSEL 0x00000300 |
1165 | #define AR_RTC_PLL_CLKSEL_S 8 | 1184 | #define AR_RTC_PLL_CLKSEL_S 8 |
1185 | #define AR_RTC_PLL_BYPASS 0x00010000 | ||
1166 | 1186 | ||
1167 | #define PLL3 0x16188 | 1187 | #define PLL3 0x16188 |
1168 | #define PLL3_DO_MEAS_MASK 0x40000000 | 1188 | #define PLL3_DO_MEAS_MASK 0x40000000 |
@@ -1209,7 +1229,8 @@ enum { | |||
1209 | 1229 | ||
1210 | /* RTC_DERIVED_* - only for AR9100 */ | 1230 | /* RTC_DERIVED_* - only for AR9100 */ |
1211 | 1231 | ||
1212 | #define AR_RTC_DERIVED_CLK (AR_RTC_BASE + 0x0038) | 1232 | #define AR_RTC_DERIVED_CLK \ |
1233 | (AR_SREV_9100(ah) ? (AR_RTC_BASE + 0x0038) : 0x7038) | ||
1213 | #define AR_RTC_DERIVED_CLK_PERIOD 0x0000fffe | 1234 | #define AR_RTC_DERIVED_CLK_PERIOD 0x0000fffe |
1214 | #define AR_RTC_DERIVED_CLK_PERIOD_S 1 | 1235 | #define AR_RTC_DERIVED_CLK_PERIOD_S 1 |
1215 | 1236 | ||
@@ -1688,6 +1709,22 @@ enum { | |||
1688 | #define AR_BTCOEX_WL_WGHT 0xffff0000 | 1709 | #define AR_BTCOEX_WL_WGHT 0xffff0000 |
1689 | #define AR_BTCOEX_WL_WGHT_S 16 | 1710 | #define AR_BTCOEX_WL_WGHT_S 16 |
1690 | 1711 | ||
1712 | #define AR_BT_COEX_WL_WEIGHTS0 0x8174 | ||
1713 | #define AR_BT_COEX_WL_WEIGHTS1 0x81c4 | ||
1714 | |||
1715 | #define AR_BT_COEX_BT_WEIGHTS0 0x83ac | ||
1716 | #define AR_BT_COEX_BT_WEIGHTS1 0x83b0 | ||
1717 | #define AR_BT_COEX_BT_WEIGHTS2 0x83b4 | ||
1718 | #define AR_BT_COEX_BT_WEIGHTS3 0x83b8 | ||
1719 | |||
1720 | #define AR9300_BT_WGHT 0xcccc4444 | ||
1721 | #define AR9300_STOMP_ALL_WLAN_WGHT0 0xfffffff0 | ||
1722 | #define AR9300_STOMP_ALL_WLAN_WGHT1 0xfffffff0 | ||
1723 | #define AR9300_STOMP_LOW_WLAN_WGHT0 0x88888880 | ||
1724 | #define AR9300_STOMP_LOW_WLAN_WGHT1 0x88888880 | ||
1725 | #define AR9300_STOMP_NONE_WLAN_WGHT0 0x00000000 | ||
1726 | #define AR9300_STOMP_NONE_WLAN_WGHT1 0x00000000 | ||
1727 | |||
1691 | #define AR_BT_COEX_MODE2 0x817c | 1728 | #define AR_BT_COEX_MODE2 0x817c |
1692 | #define AR_BT_BCN_MISS_THRESH 0x000000ff | 1729 | #define AR_BT_BCN_MISS_THRESH 0x000000ff |
1693 | #define AR_BT_BCN_MISS_THRESH_S 0 | 1730 | #define AR_BT_BCN_MISS_THRESH_S 0 |
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c index 8f095ad0a3db..f9b1eb4853c4 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.c +++ b/drivers/net/wireless/ath/ath9k/wmi.c | |||
@@ -79,8 +79,8 @@ static const char *wmi_cmd_to_name(enum wmi_cmd_id wmi_cmd) | |||
79 | return "WMI_TX_STATS_CMDID"; | 79 | return "WMI_TX_STATS_CMDID"; |
80 | case WMI_RX_STATS_CMDID: | 80 | case WMI_RX_STATS_CMDID: |
81 | return "WMI_RX_STATS_CMDID"; | 81 | return "WMI_RX_STATS_CMDID"; |
82 | case WMI_AGGR_LIMIT_CMD: | 82 | case WMI_BITRATE_MASK_CMDID: |
83 | return "WMI_AGGR_LIMIT_CMD"; | 83 | return "WMI_BITRATE_MASK_CMDID"; |
84 | } | 84 | } |
85 | 85 | ||
86 | return "Bogus"; | 86 | return "Bogus"; |
diff --git a/drivers/net/wireless/ath/ath9k/wmi.h b/drivers/net/wireless/ath/ath9k/wmi.h index 02ecb9f06db0..6095eeb6e025 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.h +++ b/drivers/net/wireless/ath/ath9k/wmi.h | |||
@@ -111,7 +111,7 @@ enum wmi_cmd_id { | |||
111 | WMI_INT_STATS_CMDID, | 111 | WMI_INT_STATS_CMDID, |
112 | WMI_TX_STATS_CMDID, | 112 | WMI_TX_STATS_CMDID, |
113 | WMI_RX_STATS_CMDID, | 113 | WMI_RX_STATS_CMDID, |
114 | WMI_AGGR_LIMIT_CMD = 0x0026, | 114 | WMI_BITRATE_MASK_CMDID, |
115 | }; | 115 | }; |
116 | 116 | ||
117 | enum wmi_event_id { | 117 | enum wmi_event_id { |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index e9e99f730ca8..7b91b2aa6240 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -2180,28 +2180,6 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) | |||
2180 | } | 2180 | } |
2181 | } | 2181 | } |
2182 | 2182 | ||
2183 | static void ath_hw_pll_work(struct work_struct *work) | ||
2184 | { | ||
2185 | struct ath_softc *sc = container_of(work, struct ath_softc, | ||
2186 | hw_pll_work.work); | ||
2187 | static int count; | ||
2188 | |||
2189 | if (AR_SREV_9485(sc->sc_ah)) { | ||
2190 | if (ar9003_get_pll_sqsum_dvc(sc->sc_ah) >= 0x40000) { | ||
2191 | count++; | ||
2192 | |||
2193 | if (count == 3) { | ||
2194 | /* Rx is hung for more than 500ms. Reset it */ | ||
2195 | ath_reset(sc, true); | ||
2196 | count = 0; | ||
2197 | } | ||
2198 | } else | ||
2199 | count = 0; | ||
2200 | |||
2201 | ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, HZ/5); | ||
2202 | } | ||
2203 | } | ||
2204 | |||
2205 | static void ath_tx_complete_poll_work(struct work_struct *work) | 2183 | static void ath_tx_complete_poll_work(struct work_struct *work) |
2206 | { | 2184 | { |
2207 | struct ath_softc *sc = container_of(work, struct ath_softc, | 2185 | struct ath_softc *sc = container_of(work, struct ath_softc, |
@@ -2396,7 +2374,6 @@ int ath_tx_init(struct ath_softc *sc, int nbufs) | |||
2396 | } | 2374 | } |
2397 | 2375 | ||
2398 | INIT_DELAYED_WORK(&sc->tx_complete_work, ath_tx_complete_poll_work); | 2376 | INIT_DELAYED_WORK(&sc->tx_complete_work, ath_tx_complete_poll_work); |
2399 | INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work); | ||
2400 | 2377 | ||
2401 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { | 2378 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { |
2402 | error = ath_tx_edma_init(sc); | 2379 | error = ath_tx_edma_init(sc); |