aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/hw.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/hw.h')
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h66
1 files changed, 28 insertions, 38 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 6650fd48415..a778b66f443 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -65,53 +65,49 @@
65 65
66/* Register read/write primitives */ 66/* Register read/write primitives */
67#define REG_WRITE(_ah, _reg, _val) \ 67#define REG_WRITE(_ah, _reg, _val) \
68 ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) 68 (_ah)->reg_ops.write((_ah), (_val), (_reg))
69 69
70#define REG_READ(_ah, _reg) \ 70#define REG_READ(_ah, _reg) \
71 ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) 71 (_ah)->reg_ops.read((_ah), (_reg))
72 72
73#define REG_READ_MULTI(_ah, _addr, _val, _cnt) \ 73#define REG_READ_MULTI(_ah, _addr, _val, _cnt) \
74 ath9k_hw_common(_ah)->ops->multi_read((_ah), (_addr), (_val), (_cnt)) 74 (_ah)->reg_ops.multi_read((_ah), (_addr), (_val), (_cnt))
75
76#define REG_RMW(_ah, _reg, _set, _clr) \
77 (_ah)->reg_ops.rmw((_ah), (_reg), (_set), (_clr))
75 78
76#define ENABLE_REGWRITE_BUFFER(_ah) \ 79#define ENABLE_REGWRITE_BUFFER(_ah) \
77 do { \ 80 do { \
78 if (ath9k_hw_common(_ah)->ops->enable_write_buffer) \ 81 if ((_ah)->reg_ops.enable_write_buffer) \
79 ath9k_hw_common(_ah)->ops->enable_write_buffer((_ah)); \ 82 (_ah)->reg_ops.enable_write_buffer((_ah)); \
80 } while (0) 83 } while (0)
81 84
82#define REGWRITE_BUFFER_FLUSH(_ah) \ 85#define REGWRITE_BUFFER_FLUSH(_ah) \
83 do { \ 86 do { \
84 if (ath9k_hw_common(_ah)->ops->write_flush) \ 87 if ((_ah)->reg_ops.write_flush) \
85 ath9k_hw_common(_ah)->ops->write_flush((_ah)); \ 88 (_ah)->reg_ops.write_flush((_ah)); \
86 } while (0) 89 } while (0)
87 90
88#define SM(_v, _f) (((_v) << _f##_S) & _f) 91#define SM(_v, _f) (((_v) << _f##_S) & _f)
89#define MS(_v, _f) (((_v) & _f) >> _f##_S) 92#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) \ 93#define REG_RMW_FIELD(_a, _r, _f, _v) \
93 REG_WRITE(_a, _r, \ 94 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) \ 95#define REG_READ_FIELD(_a, _r, _f) \
96 (((REG_READ(_a, _r) & _f) >> _f##_S)) 96 (((REG_READ(_a, _r) & _f) >> _f##_S))
97#define REG_SET_BIT(_a, _r, _f) \ 97#define REG_SET_BIT(_a, _r, _f) \
98 REG_WRITE(_a, _r, REG_READ(_a, _r) | (_f)) 98 REG_RMW(_a, _r, (_f), 0)
99#define REG_CLR_BIT(_a, _r, _f) \ 99#define REG_CLR_BIT(_a, _r, _f) \
100 REG_WRITE(_a, _r, REG_READ(_a, _r) & ~(_f)) 100 REG_RMW(_a, _r, 0, (_f))
101 101
102#define DO_DELAY(x) do { \ 102#define DO_DELAY(x) do { \
103 if ((++(x) % 64) == 0) \ 103 if (((++(x) % 64) == 0) && \
104 udelay(1); \ 104 (ath9k_hw_common(ah)->bus_ops->ath_bus_type \
105 != ATH_USB)) \
106 udelay(1); \
105 } while (0) 107 } while (0)
106 108
107#define REG_WRITE_ARRAY(iniarray, column, regWr) do { \ 109#define REG_WRITE_ARRAY(iniarray, column, regWr) \
108 int r; \ 110 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 111
116#define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0 112#define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0
117#define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1 113#define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
@@ -178,7 +174,6 @@ enum ath9k_hw_caps {
178 ATH9K_HW_CAP_HT = BIT(0), 174 ATH9K_HW_CAP_HT = BIT(0),
179 ATH9K_HW_CAP_RFSILENT = BIT(1), 175 ATH9K_HW_CAP_RFSILENT = BIT(1),
180 ATH9K_HW_CAP_CST = BIT(2), 176 ATH9K_HW_CAP_CST = BIT(2),
181 ATH9K_HW_CAP_ENHANCEDPM = BIT(3),
182 ATH9K_HW_CAP_AUTOSLEEP = BIT(4), 177 ATH9K_HW_CAP_AUTOSLEEP = BIT(4),
183 ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(5), 178 ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(5),
184 ATH9K_HW_CAP_EDMA = BIT(6), 179 ATH9K_HW_CAP_EDMA = BIT(6),
@@ -195,17 +190,11 @@ enum ath9k_hw_caps {
195 190
196struct ath9k_hw_capabilities { 191struct ath9k_hw_capabilities {
197 u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */ 192 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; 193 u16 rts_aggr_limit;
203 u8 tx_chainmask; 194 u8 tx_chainmask;
204 u8 rx_chainmask; 195 u8 rx_chainmask;
205 u8 max_txchains; 196 u8 max_txchains;
206 u8 max_rxchains; 197 u8 max_rxchains;
207 u16 tx_triglevel_max;
208 u16 reg_cap;
209 u8 num_gpio_pins; 198 u8 num_gpio_pins;
210 u8 rx_hp_qdepth; 199 u8 rx_hp_qdepth;
211 u8 rx_lp_qdepth; 200 u8 rx_lp_qdepth;
@@ -227,7 +216,6 @@ struct ath9k_ops_config {
227 u8 pcie_clock_req; 216 u8 pcie_clock_req;
228 u32 pcie_waen; 217 u32 pcie_waen;
229 u8 analog_shiftreg; 218 u8 analog_shiftreg;
230 u8 ht_enable;
231 u8 paprd_disable; 219 u8 paprd_disable;
232 u32 ofdm_trig_low; 220 u32 ofdm_trig_low;
233 u32 ofdm_trig_high; 221 u32 ofdm_trig_high;
@@ -412,8 +400,6 @@ struct ath9k_beacon_state {
412 u32 bs_nextdtim; 400 u32 bs_nextdtim;
413 u32 bs_intval; 401 u32 bs_intval;
414#define ATH9K_BEACON_PERIOD 0x0000ffff 402#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 */ 403#define ATH9K_TSFOOR_THRESHOLD 0x00004240 /* 16k us */
418 u32 bs_dtimperiod; 404 u32 bs_dtimperiod;
419 u16 bs_cfpperiod; 405 u16 bs_cfpperiod;
@@ -640,8 +626,6 @@ struct ath_hw_ops {
640 void (*clr11n_aggr)(struct ath_hw *ah, void *ds); 626 void (*clr11n_aggr)(struct ath_hw *ah, void *ds);
641 void (*set11n_burstduration)(struct ath_hw *ah, void *ds, 627 void (*set11n_burstduration)(struct ath_hw *ah, void *ds,
642 u32 burstDuration); 628 u32 burstDuration);
643 void (*set11n_virtualmorefrag)(struct ath_hw *ah, void *ds,
644 u32 vmf);
645}; 629};
646 630
647struct ath_nf_limits { 631struct ath_nf_limits {
@@ -655,6 +639,8 @@ struct ath_nf_limits {
655#define AH_UNPLUGGED 0x2 /* The card has been physically removed. */ 639#define AH_UNPLUGGED 0x2 /* The card has been physically removed. */
656 640
657struct ath_hw { 641struct ath_hw {
642 struct ath_ops reg_ops;
643
658 struct ieee80211_hw *hw; 644 struct ieee80211_hw *hw;
659 struct ath_common common; 645 struct ath_common common;
660 struct ath9k_hw_version hw_version; 646 struct ath9k_hw_version hw_version;
@@ -794,7 +780,9 @@ struct ath_hw {
794 u32 originalGain[22]; 780 u32 originalGain[22];
795 int initPDADC; 781 int initPDADC;
796 int PDADCdelta; 782 int PDADCdelta;
797 u8 led_pin; 783 int led_pin;
784 u32 gpio_mask;
785 u32 gpio_val;
798 786
799 struct ar5416IniArray iniModes; 787 struct ar5416IniArray iniModes;
800 struct ar5416IniArray iniCommon; 788 struct ar5416IniArray iniCommon;
@@ -907,8 +895,9 @@ void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah,
907 895
908/* General Operation */ 896/* General Operation */
909bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); 897bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
898void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array,
899 int column, unsigned int *writecnt);
910u32 ath9k_hw_reverse_bits(u32 val, u32 n); 900u32 ath9k_hw_reverse_bits(u32 val, u32 n);
911bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high);
912u16 ath9k_hw_computetxtime(struct ath_hw *ah, 901u16 ath9k_hw_computetxtime(struct ath_hw *ah,
913 u8 phy, int kbps, 902 u8 phy, int kbps,
914 u32 frameLen, u16 rateix, bool shortPreamble); 903 u32 frameLen, u16 rateix, bool shortPreamble);
@@ -924,6 +913,7 @@ void ath9k_hw_setopmode(struct ath_hw *ah);
924void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1); 913void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1);
925void ath9k_hw_setbssidmask(struct ath_hw *ah); 914void ath9k_hw_setbssidmask(struct ath_hw *ah);
926void ath9k_hw_write_associd(struct ath_hw *ah); 915void ath9k_hw_write_associd(struct ath_hw *ah);
916u32 ath9k_hw_gettsf32(struct ath_hw *ah);
927u64 ath9k_hw_gettsf64(struct ath_hw *ah); 917u64 ath9k_hw_gettsf64(struct ath_hw *ah);
928void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); 918void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64);
929void ath9k_hw_reset_tsf(struct ath_hw *ah); 919void ath9k_hw_reset_tsf(struct ath_hw *ah);