diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/hw.h')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 103 |
1 files changed, 57 insertions, 46 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 6650fd48415c..7af2773d2bfc 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 |
@@ -65,53 +69,49 @@ | |||
65 | 69 | ||
66 | /* Register read/write primitives */ | 70 | /* Register read/write primitives */ |
67 | #define REG_WRITE(_ah, _reg, _val) \ | 71 | #define REG_WRITE(_ah, _reg, _val) \ |
68 | ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) | 72 | (_ah)->reg_ops.write((_ah), (_val), (_reg)) |
69 | 73 | ||
70 | #define REG_READ(_ah, _reg) \ | 74 | #define REG_READ(_ah, _reg) \ |
71 | ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) | 75 | (_ah)->reg_ops.read((_ah), (_reg)) |
72 | 76 | ||
73 | #define REG_READ_MULTI(_ah, _addr, _val, _cnt) \ | 77 | #define REG_READ_MULTI(_ah, _addr, _val, _cnt) \ |
74 | ath9k_hw_common(_ah)->ops->multi_read((_ah), (_addr), (_val), (_cnt)) | 78 | (_ah)->reg_ops.multi_read((_ah), (_addr), (_val), (_cnt)) |
79 | |||
80 | #define REG_RMW(_ah, _reg, _set, _clr) \ | ||
81 | (_ah)->reg_ops.rmw((_ah), (_reg), (_set), (_clr)) | ||
75 | 82 | ||
76 | #define ENABLE_REGWRITE_BUFFER(_ah) \ | 83 | #define ENABLE_REGWRITE_BUFFER(_ah) \ |
77 | do { \ | 84 | do { \ |
78 | if (ath9k_hw_common(_ah)->ops->enable_write_buffer) \ | 85 | if ((_ah)->reg_ops.enable_write_buffer) \ |
79 | ath9k_hw_common(_ah)->ops->enable_write_buffer((_ah)); \ | 86 | (_ah)->reg_ops.enable_write_buffer((_ah)); \ |
80 | } while (0) | 87 | } while (0) |
81 | 88 | ||
82 | #define REGWRITE_BUFFER_FLUSH(_ah) \ | 89 | #define REGWRITE_BUFFER_FLUSH(_ah) \ |
83 | do { \ | 90 | do { \ |
84 | if (ath9k_hw_common(_ah)->ops->write_flush) \ | 91 | if ((_ah)->reg_ops.write_flush) \ |
85 | ath9k_hw_common(_ah)->ops->write_flush((_ah)); \ | 92 | (_ah)->reg_ops.write_flush((_ah)); \ |
86 | } while (0) | 93 | } while (0) |
87 | 94 | ||
88 | #define SM(_v, _f) (((_v) << _f##_S) & _f) | 95 | #define SM(_v, _f) (((_v) << _f##_S) & _f) |
89 | #define MS(_v, _f) (((_v) & _f) >> _f##_S) | 96 | #define MS(_v, _f) (((_v) & _f) >> _f##_S) |
90 | #define REG_RMW(_a, _r, _set, _clr) \ | ||
91 | REG_WRITE(_a, _r, (REG_READ(_a, _r) & ~(_clr)) | (_set)) | ||
92 | #define REG_RMW_FIELD(_a, _r, _f, _v) \ | 97 | #define REG_RMW_FIELD(_a, _r, _f, _v) \ |
93 | REG_WRITE(_a, _r, \ | 98 | REG_RMW(_a, _r, (((_v) << _f##_S) & _f), (_f)) |
94 | (REG_READ(_a, _r) & ~_f) | (((_v) << _f##_S) & _f)) | ||
95 | #define REG_READ_FIELD(_a, _r, _f) \ | 99 | #define REG_READ_FIELD(_a, _r, _f) \ |
96 | (((REG_READ(_a, _r) & _f) >> _f##_S)) | 100 | (((REG_READ(_a, _r) & _f) >> _f##_S)) |
97 | #define REG_SET_BIT(_a, _r, _f) \ | 101 | #define REG_SET_BIT(_a, _r, _f) \ |
98 | REG_WRITE(_a, _r, REG_READ(_a, _r) | (_f)) | 102 | REG_RMW(_a, _r, (_f), 0) |
99 | #define REG_CLR_BIT(_a, _r, _f) \ | 103 | #define REG_CLR_BIT(_a, _r, _f) \ |
100 | REG_WRITE(_a, _r, REG_READ(_a, _r) & ~(_f)) | 104 | REG_RMW(_a, _r, 0, (_f)) |
101 | 105 | ||
102 | #define DO_DELAY(x) do { \ | 106 | #define DO_DELAY(x) do { \ |
103 | if ((++(x) % 64) == 0) \ | 107 | if (((++(x) % 64) == 0) && \ |
104 | udelay(1); \ | 108 | (ath9k_hw_common(ah)->bus_ops->ath_bus_type \ |
109 | != ATH_USB)) \ | ||
110 | udelay(1); \ | ||
105 | } while (0) | 111 | } while (0) |
106 | 112 | ||
107 | #define REG_WRITE_ARRAY(iniarray, column, regWr) do { \ | 113 | #define REG_WRITE_ARRAY(iniarray, column, regWr) \ |
108 | int r; \ | 114 | ath9k_hw_write_array(ah, iniarray, column, &(regWr)) |
109 | for (r = 0; r < ((iniarray)->ia_rows); r++) { \ | ||
110 | REG_WRITE(ah, INI_RA((iniarray), (r), 0), \ | ||
111 | INI_RA((iniarray), r, (column))); \ | ||
112 | DO_DELAY(regWr); \ | ||
113 | } \ | ||
114 | } while (0) | ||
115 | 115 | ||
116 | #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0 | 116 | #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0 |
117 | #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1 | 117 | #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1 |
@@ -125,7 +125,7 @@ | |||
125 | #define AR_GPIO_BIT(_gpio) (1 << (_gpio)) | 125 | #define AR_GPIO_BIT(_gpio) (1 << (_gpio)) |
126 | 126 | ||
127 | #define BASE_ACTIVATE_DELAY 100 | 127 | #define BASE_ACTIVATE_DELAY 100 |
128 | #define RTC_PLL_SETTLE_DELAY 100 | 128 | #define RTC_PLL_SETTLE_DELAY (AR_SREV_9340(ah) ? 1000 : 100) |
129 | #define COEF_SCALE_S 24 | 129 | #define COEF_SCALE_S 24 |
130 | #define HT40_CHANNEL_CENTER_SHIFT 10 | 130 | #define HT40_CHANNEL_CENTER_SHIFT 10 |
131 | 131 | ||
@@ -178,7 +178,6 @@ enum ath9k_hw_caps { | |||
178 | ATH9K_HW_CAP_HT = BIT(0), | 178 | ATH9K_HW_CAP_HT = BIT(0), |
179 | ATH9K_HW_CAP_RFSILENT = BIT(1), | 179 | ATH9K_HW_CAP_RFSILENT = BIT(1), |
180 | ATH9K_HW_CAP_CST = BIT(2), | 180 | ATH9K_HW_CAP_CST = BIT(2), |
181 | ATH9K_HW_CAP_ENHANCEDPM = BIT(3), | ||
182 | ATH9K_HW_CAP_AUTOSLEEP = BIT(4), | 181 | ATH9K_HW_CAP_AUTOSLEEP = BIT(4), |
183 | ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(5), | 182 | ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(5), |
184 | ATH9K_HW_CAP_EDMA = BIT(6), | 183 | ATH9K_HW_CAP_EDMA = BIT(6), |
@@ -195,17 +194,11 @@ enum ath9k_hw_caps { | |||
195 | 194 | ||
196 | struct ath9k_hw_capabilities { | 195 | struct ath9k_hw_capabilities { |
197 | u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */ | 196 | u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */ |
198 | u16 total_queues; | ||
199 | u16 keycache_size; | ||
200 | u16 low_5ghz_chan, high_5ghz_chan; | ||
201 | u16 low_2ghz_chan, high_2ghz_chan; | ||
202 | u16 rts_aggr_limit; | 197 | u16 rts_aggr_limit; |
203 | u8 tx_chainmask; | 198 | u8 tx_chainmask; |
204 | u8 rx_chainmask; | 199 | u8 rx_chainmask; |
205 | u8 max_txchains; | 200 | u8 max_txchains; |
206 | u8 max_rxchains; | 201 | u8 max_rxchains; |
207 | u16 tx_triglevel_max; | ||
208 | u16 reg_cap; | ||
209 | u8 num_gpio_pins; | 202 | u8 num_gpio_pins; |
210 | u8 rx_hp_qdepth; | 203 | u8 rx_hp_qdepth; |
211 | u8 rx_lp_qdepth; | 204 | u8 rx_lp_qdepth; |
@@ -227,7 +220,6 @@ struct ath9k_ops_config { | |||
227 | u8 pcie_clock_req; | 220 | u8 pcie_clock_req; |
228 | u32 pcie_waen; | 221 | u32 pcie_waen; |
229 | u8 analog_shiftreg; | 222 | u8 analog_shiftreg; |
230 | u8 ht_enable; | ||
231 | u8 paprd_disable; | 223 | u8 paprd_disable; |
232 | u32 ofdm_trig_low; | 224 | u32 ofdm_trig_low; |
233 | u32 ofdm_trig_high; | 225 | u32 ofdm_trig_high; |
@@ -412,8 +404,6 @@ struct ath9k_beacon_state { | |||
412 | u32 bs_nextdtim; | 404 | u32 bs_nextdtim; |
413 | u32 bs_intval; | 405 | u32 bs_intval; |
414 | #define ATH9K_BEACON_PERIOD 0x0000ffff | 406 | #define ATH9K_BEACON_PERIOD 0x0000ffff |
415 | #define ATH9K_BEACON_ENA 0x00800000 | ||
416 | #define ATH9K_BEACON_RESET_TSF 0x01000000 | ||
417 | #define ATH9K_TSFOOR_THRESHOLD 0x00004240 /* 16k us */ | 407 | #define ATH9K_TSFOOR_THRESHOLD 0x00004240 /* 16k us */ |
418 | u32 bs_dtimperiod; | 408 | u32 bs_dtimperiod; |
419 | u16 bs_cfpperiod; | 409 | u16 bs_cfpperiod; |
@@ -489,6 +479,10 @@ struct ath_hw_antcomb_conf { | |||
489 | u8 main_lna_conf; | 479 | u8 main_lna_conf; |
490 | u8 alt_lna_conf; | 480 | u8 alt_lna_conf; |
491 | u8 fast_div_bias; | 481 | u8 fast_div_bias; |
482 | u8 main_gaintb; | ||
483 | u8 alt_gaintb; | ||
484 | int lna1_lna2_delta; | ||
485 | u8 div_group; | ||
492 | }; | 486 | }; |
493 | 487 | ||
494 | /** | 488 | /** |
@@ -638,10 +632,12 @@ struct ath_hw_ops { | |||
638 | u32 numDelims); | 632 | u32 numDelims); |
639 | void (*set11n_aggr_last)(struct ath_hw *ah, void *ds); | 633 | void (*set11n_aggr_last)(struct ath_hw *ah, void *ds); |
640 | void (*clr11n_aggr)(struct ath_hw *ah, void *ds); | 634 | void (*clr11n_aggr)(struct ath_hw *ah, void *ds); |
641 | void (*set11n_burstduration)(struct ath_hw *ah, void *ds, | 635 | void (*set_clrdmask)(struct ath_hw *ah, void *ds, bool val); |
642 | u32 burstDuration); | 636 | void (*antdiv_comb_conf_get)(struct ath_hw *ah, |
643 | void (*set11n_virtualmorefrag)(struct ath_hw *ah, void *ds, | 637 | struct ath_hw_antcomb_conf *antconf); |
644 | u32 vmf); | 638 | void (*antdiv_comb_conf_set)(struct ath_hw *ah, |
639 | struct ath_hw_antcomb_conf *antconf); | ||
640 | |||
645 | }; | 641 | }; |
646 | 642 | ||
647 | struct ath_nf_limits { | 643 | struct ath_nf_limits { |
@@ -655,6 +651,8 @@ struct ath_nf_limits { | |||
655 | #define AH_UNPLUGGED 0x2 /* The card has been physically removed. */ | 651 | #define AH_UNPLUGGED 0x2 /* The card has been physically removed. */ |
656 | 652 | ||
657 | struct ath_hw { | 653 | struct ath_hw { |
654 | struct ath_ops reg_ops; | ||
655 | |||
658 | struct ieee80211_hw *hw; | 656 | struct ieee80211_hw *hw; |
659 | struct ath_common common; | 657 | struct ath_common common; |
660 | struct ath9k_hw_version hw_version; | 658 | struct ath9k_hw_version hw_version; |
@@ -784,6 +782,8 @@ struct ath_hw { | |||
784 | 782 | ||
785 | /* Bluetooth coexistance */ | 783 | /* Bluetooth coexistance */ |
786 | struct ath_btcoex_hw btcoex_hw; | 784 | struct ath_btcoex_hw btcoex_hw; |
785 | u32 bt_coex_bt_weight[AR9300_NUM_BT_WEIGHTS]; | ||
786 | u32 bt_coex_wlan_weight[AR9300_NUM_WLAN_WEIGHTS]; | ||
787 | 787 | ||
788 | u32 intr_txqs; | 788 | u32 intr_txqs; |
789 | u8 txchainmask; | 789 | u8 txchainmask; |
@@ -794,7 +794,9 @@ struct ath_hw { | |||
794 | u32 originalGain[22]; | 794 | u32 originalGain[22]; |
795 | int initPDADC; | 795 | int initPDADC; |
796 | int PDADCdelta; | 796 | int PDADCdelta; |
797 | u8 led_pin; | 797 | int led_pin; |
798 | u32 gpio_mask; | ||
799 | u32 gpio_val; | ||
798 | 800 | ||
799 | struct ar5416IniArray iniModes; | 801 | struct ar5416IniArray iniModes; |
800 | struct ar5416IniArray iniCommon; | 802 | struct ar5416IniArray iniCommon; |
@@ -810,6 +812,7 @@ struct ath_hw { | |||
810 | struct ar5416IniArray iniPcieSerdes; | 812 | struct ar5416IniArray iniPcieSerdes; |
811 | struct ar5416IniArray iniPcieSerdesLowPower; | 813 | struct ar5416IniArray iniPcieSerdesLowPower; |
812 | struct ar5416IniArray iniModesAdditional; | 814 | struct ar5416IniArray iniModesAdditional; |
815 | struct ar5416IniArray iniModesAdditional_40M; | ||
813 | struct ar5416IniArray iniModesRxGain; | 816 | struct ar5416IniArray iniModesRxGain; |
814 | struct ar5416IniArray iniModesTxGain; | 817 | struct ar5416IniArray iniModesTxGain; |
815 | struct ar5416IniArray iniModes_9271_1_0_only; | 818 | struct ar5416IniArray iniModes_9271_1_0_only; |
@@ -856,6 +859,16 @@ struct ath_hw { | |||
856 | 859 | ||
857 | /* Enterprise mode cap */ | 860 | /* Enterprise mode cap */ |
858 | u32 ent_mode; | 861 | u32 ent_mode; |
862 | |||
863 | bool is_clk_25mhz; | ||
864 | }; | ||
865 | |||
866 | struct ath_bus_ops { | ||
867 | enum ath_bus_type ath_bus_type; | ||
868 | void (*read_cachesize)(struct ath_common *common, int *csz); | ||
869 | bool (*eeprom_read)(struct ath_common *common, u32 off, u16 *data); | ||
870 | void (*bt_coex_prep)(struct ath_common *common); | ||
871 | void (*extn_synch_en)(struct ath_common *common); | ||
859 | }; | 872 | }; |
860 | 873 | ||
861 | static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah) | 874 | static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah) |
@@ -900,15 +913,12 @@ void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, | |||
900 | void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); | 913 | void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); |
901 | u32 ath9k_hw_getdefantenna(struct ath_hw *ah); | 914 | u32 ath9k_hw_getdefantenna(struct ath_hw *ah); |
902 | void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); | 915 | void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); |
903 | void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah, | ||
904 | struct ath_hw_antcomb_conf *antconf); | ||
905 | void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah, | ||
906 | struct ath_hw_antcomb_conf *antconf); | ||
907 | 916 | ||
908 | /* General Operation */ | 917 | /* General Operation */ |
909 | bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); | 918 | bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); |
919 | void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array, | ||
920 | int column, unsigned int *writecnt); | ||
910 | u32 ath9k_hw_reverse_bits(u32 val, u32 n); | 921 | u32 ath9k_hw_reverse_bits(u32 val, u32 n); |
911 | bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high); | ||
912 | u16 ath9k_hw_computetxtime(struct ath_hw *ah, | 922 | u16 ath9k_hw_computetxtime(struct ath_hw *ah, |
913 | u8 phy, int kbps, | 923 | u8 phy, int kbps, |
914 | u32 frameLen, u16 rateix, bool shortPreamble); | 924 | u32 frameLen, u16 rateix, bool shortPreamble); |
@@ -924,12 +934,13 @@ void ath9k_hw_setopmode(struct ath_hw *ah); | |||
924 | void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1); | 934 | void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1); |
925 | void ath9k_hw_setbssidmask(struct ath_hw *ah); | 935 | void ath9k_hw_setbssidmask(struct ath_hw *ah); |
926 | void ath9k_hw_write_associd(struct ath_hw *ah); | 936 | void ath9k_hw_write_associd(struct ath_hw *ah); |
937 | u32 ath9k_hw_gettsf32(struct ath_hw *ah); | ||
927 | u64 ath9k_hw_gettsf64(struct ath_hw *ah); | 938 | u64 ath9k_hw_gettsf64(struct ath_hw *ah); |
928 | void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); | 939 | void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); |
929 | void ath9k_hw_reset_tsf(struct ath_hw *ah); | 940 | void ath9k_hw_reset_tsf(struct ath_hw *ah); |
930 | void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting); | 941 | void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting); |
931 | void ath9k_hw_init_global_settings(struct ath_hw *ah); | 942 | void ath9k_hw_init_global_settings(struct ath_hw *ah); |
932 | unsigned long ar9003_get_pll_sqsum_dvc(struct ath_hw *ah); | 943 | u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah); |
933 | void ath9k_hw_set11nmac2040(struct ath_hw *ah); | 944 | void ath9k_hw_set11nmac2040(struct ath_hw *ah); |
934 | void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); | 945 | void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); |
935 | void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, | 946 | void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, |