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.h108
1 files changed, 69 insertions, 39 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index b89234571829..dbbf7ca5f97d 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -27,17 +27,25 @@
27#include "calib.h" 27#include "calib.h"
28#include "reg.h" 28#include "reg.h"
29#include "phy.h" 29#include "phy.h"
30#include "btcoex.h"
30 31
31#include "../regd.h" 32#include "../regd.h"
33#include "../debug.h"
32 34
33#define ATHEROS_VENDOR_ID 0x168c 35#define ATHEROS_VENDOR_ID 0x168c
36
34#define AR5416_DEVID_PCI 0x0023 37#define AR5416_DEVID_PCI 0x0023
35#define AR5416_DEVID_PCIE 0x0024 38#define AR5416_DEVID_PCIE 0x0024
36#define AR9160_DEVID_PCI 0x0027 39#define AR9160_DEVID_PCI 0x0027
37#define AR9280_DEVID_PCI 0x0029 40#define AR9280_DEVID_PCI 0x0029
38#define AR9280_DEVID_PCIE 0x002a 41#define AR9280_DEVID_PCIE 0x002a
39#define AR9285_DEVID_PCIE 0x002b 42#define AR9285_DEVID_PCIE 0x002b
43#define AR2427_DEVID_PCIE 0x002c
44
40#define AR5416_AR9100_DEVID 0x000b 45#define AR5416_AR9100_DEVID 0x000b
46
47#define AR9271_USB 0x9271
48
41#define AR_SUBVENDOR_ID_NOG 0x0e11 49#define AR_SUBVENDOR_ID_NOG 0x0e11
42#define AR_SUBVENDOR_ID_NEW_A 0x7065 50#define AR_SUBVENDOR_ID_NEW_A 0x7065
43#define AR5416_MAGIC 0x19641014 51#define AR5416_MAGIC 0x19641014
@@ -49,9 +57,18 @@
49#define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa 57#define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa
50#define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab 58#define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab
51 59
60#define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1)
61
62#define ATH_DEFAULT_NOISE_FLOOR -95
63
64#define ATH9K_RSSI_BAD -128
65
52/* Register read/write primitives */ 66/* Register read/write primitives */
53#define REG_WRITE(_ah, _reg, _val) ath9k_iowrite32((_ah), (_reg), (_val)) 67#define REG_WRITE(_ah, _reg, _val) \
54#define REG_READ(_ah, _reg) ath9k_ioread32((_ah), (_reg)) 68 ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg))
69
70#define REG_READ(_ah, _reg) \
71 ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
55 72
56#define SM(_v, _f) (((_v) << _f##_S) & _f) 73#define SM(_v, _f) (((_v) << _f##_S) & _f)
57#define MS(_v, _f) (((_v) & _f) >> _f##_S) 74#define MS(_v, _f) (((_v) & _f) >> _f##_S)
@@ -91,7 +108,7 @@
91#define AR_GPIO_BIT(_gpio) (1 << (_gpio)) 108#define AR_GPIO_BIT(_gpio) (1 << (_gpio))
92 109
93#define BASE_ACTIVATE_DELAY 100 110#define BASE_ACTIVATE_DELAY 100
94#define RTC_PLL_SETTLE_DELAY 1000 111#define RTC_PLL_SETTLE_DELAY 100
95#define COEF_SCALE_S 24 112#define COEF_SCALE_S 24
96#define HT40_CHANNEL_CENTER_SHIFT 10 113#define HT40_CHANNEL_CENTER_SHIFT 10
97 114
@@ -132,12 +149,6 @@ enum wireless_mode {
132 ATH9K_MODE_MAX, 149 ATH9K_MODE_MAX,
133}; 150};
134 151
135enum ath9k_ant_setting {
136 ATH9K_ANT_VARIABLE = 0,
137 ATH9K_ANT_FIXED_A,
138 ATH9K_ANT_FIXED_B
139};
140
141enum ath9k_hw_caps { 152enum ath9k_hw_caps {
142 ATH9K_HW_CAP_MIC_AESCCM = BIT(0), 153 ATH9K_HW_CAP_MIC_AESCCM = BIT(0),
143 ATH9K_HW_CAP_MIC_CKIP = BIT(1), 154 ATH9K_HW_CAP_MIC_CKIP = BIT(1),
@@ -201,10 +212,8 @@ struct ath9k_ops_config {
201 u32 cck_trig_high; 212 u32 cck_trig_high;
202 u32 cck_trig_low; 213 u32 cck_trig_low;
203 u32 enable_ani; 214 u32 enable_ani;
204 enum ath9k_ant_setting diversity_control;
205 u16 antenna_switch_swap;
206 int serialize_regmode; 215 int serialize_regmode;
207 bool intr_mitigation; 216 bool rx_intr_mitigation;
208#define SPUR_DISABLE 0 217#define SPUR_DISABLE 0
209#define SPUR_ENABLE_IOCTL 1 218#define SPUR_ENABLE_IOCTL 1
210#define SPUR_ENABLE_EEPROM 2 219#define SPUR_ENABLE_EEPROM 2
@@ -218,6 +227,7 @@ struct ath9k_ops_config {
218#define AR_SPUR_FEEQ_BOUND_HT20 10 227#define AR_SPUR_FEEQ_BOUND_HT20 10
219 int spurmode; 228 int spurmode;
220 u16 spurchans[AR_EEPROM_MODAL_SPURS][2]; 229 u16 spurchans[AR_EEPROM_MODAL_SPURS][2];
230 u8 max_txtrig_level;
221}; 231};
222 232
223enum ath9k_int { 233enum ath9k_int {
@@ -407,7 +417,7 @@ struct ath9k_hw_version {
407 * Using de Bruijin sequence to to look up 1's index in a 32 bit number 417 * Using de Bruijin sequence to to look up 1's index in a 32 bit number
408 * debruijn32 = 0000 0111 0111 1100 1011 0101 0011 0001 418 * debruijn32 = 0000 0111 0111 1100 1011 0101 0011 0001
409 */ 419 */
410#define debruijn32 0x077CB531UL 420#define debruijn32 0x077CB531U
411 421
412struct ath_gen_timer_configuration { 422struct ath_gen_timer_configuration {
413 u32 next_addr; 423 u32 next_addr;
@@ -433,7 +443,8 @@ struct ath_gen_timer_table {
433}; 443};
434 444
435struct ath_hw { 445struct ath_hw {
436 struct ath_softc *ah_sc; 446 struct ieee80211_hw *hw;
447 struct ath_common common;
437 struct ath9k_hw_version hw_version; 448 struct ath9k_hw_version hw_version;
438 struct ath9k_ops_config config; 449 struct ath9k_ops_config config;
439 struct ath9k_hw_capabilities caps; 450 struct ath9k_hw_capabilities caps;
@@ -450,7 +461,6 @@ struct ath_hw {
450 461
451 bool sw_mgmt_crypto; 462 bool sw_mgmt_crypto;
452 bool is_pciexpress; 463 bool is_pciexpress;
453 u8 macaddr[ETH_ALEN];
454 u16 tx_trig_level; 464 u16 tx_trig_level;
455 u16 rfsilent; 465 u16 rfsilent;
456 u32 rfkill_gpio; 466 u32 rfkill_gpio;
@@ -523,7 +533,14 @@ struct ath_hw {
523 DONT_USE_32KHZ, 533 DONT_USE_32KHZ,
524 } enable_32kHz_clock; 534 } enable_32kHz_clock;
525 535
526 /* RF */ 536 /* Callback for radio frequency change */
537 int (*ath9k_hw_rf_set_freq)(struct ath_hw *ah, struct ath9k_channel *chan);
538
539 /* Callback for baseband spur frequency */
540 void (*ath9k_hw_spur_mitigate_freq)(struct ath_hw *ah,
541 struct ath9k_channel *chan);
542
543 /* Used to program the radio on non single-chip devices */
527 u32 *analogBank0Data; 544 u32 *analogBank0Data;
528 u32 *analogBank1Data; 545 u32 *analogBank1Data;
529 u32 *analogBank2Data; 546 u32 *analogBank2Data;
@@ -535,12 +552,10 @@ struct ath_hw {
535 u32 *bank6Temp; 552 u32 *bank6Temp;
536 553
537 int16_t txpower_indexoffset; 554 int16_t txpower_indexoffset;
555 int coverage_class;
538 u32 beacon_interval; 556 u32 beacon_interval;
539 u32 slottime; 557 u32 slottime;
540 u32 acktimeout;
541 u32 ctstimeout;
542 u32 globaltxtimeout; 558 u32 globaltxtimeout;
543 u8 gbeacon_rate;
544 559
545 /* ANI */ 560 /* ANI */
546 u32 proc_phyerr; 561 u32 proc_phyerr;
@@ -553,8 +568,10 @@ struct ath_hw {
553 int firpwr[5]; 568 int firpwr[5];
554 enum ath9k_ani_cmd ani_function; 569 enum ath9k_ani_cmd ani_function;
555 570
571 /* Bluetooth coexistance */
572 struct ath_btcoex_hw btcoex_hw;
573
556 u32 intr_txqs; 574 u32 intr_txqs;
557 enum ath9k_ht_extprotspacing extprotspacing;
558 u8 txchainmask; 575 u8 txchainmask;
559 u8 rxchainmask; 576 u8 rxchainmask;
560 577
@@ -578,20 +595,32 @@ struct ath_hw {
578 struct ar5416IniArray iniModesAdditional; 595 struct ar5416IniArray iniModesAdditional;
579 struct ar5416IniArray iniModesRxGain; 596 struct ar5416IniArray iniModesRxGain;
580 struct ar5416IniArray iniModesTxGain; 597 struct ar5416IniArray iniModesTxGain;
598 struct ar5416IniArray iniModes_9271_1_0_only;
599 struct ar5416IniArray iniCckfirNormal;
600 struct ar5416IniArray iniCckfirJapan2484;
581 601
582 u32 intr_gen_timer_trigger; 602 u32 intr_gen_timer_trigger;
583 u32 intr_gen_timer_thresh; 603 u32 intr_gen_timer_thresh;
584 struct ath_gen_timer_table hw_gen_timers; 604 struct ath_gen_timer_table hw_gen_timers;
585}; 605};
586 606
607static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah)
608{
609 return &ah->common;
610}
611
612static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah)
613{
614 return &(ath9k_hw_common(ah)->regulatory);
615}
616
587/* Initialization, Detach, Reset */ 617/* Initialization, Detach, Reset */
588const char *ath9k_hw_probe(u16 vendorid, u16 devid); 618const char *ath9k_hw_probe(u16 vendorid, u16 devid);
589void ath9k_hw_detach(struct ath_hw *ah); 619void ath9k_hw_deinit(struct ath_hw *ah);
590int ath9k_hw_init(struct ath_hw *ah); 620int ath9k_hw_init(struct ath_hw *ah);
591void ath9k_hw_rf_free(struct ath_hw *ah);
592int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, 621int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
593 bool bChannelChange); 622 bool bChannelChange);
594void ath9k_hw_fill_cap_info(struct ath_hw *ah); 623int ath9k_hw_fill_cap_info(struct ath_hw *ah);
595bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type, 624bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type,
596 u32 capability, u32 *result); 625 u32 capability, u32 *result);
597bool ath9k_hw_setcapability(struct ath_hw *ah, enum ath9k_capability_type type, 626bool ath9k_hw_setcapability(struct ath_hw *ah, enum ath9k_capability_type type,
@@ -613,18 +642,13 @@ void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio,
613void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); 642void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val);
614u32 ath9k_hw_getdefantenna(struct ath_hw *ah); 643u32 ath9k_hw_getdefantenna(struct ath_hw *ah);
615void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); 644void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
616bool ath9k_hw_setantennaswitch(struct ath_hw *ah,
617 enum ath9k_ant_setting settings,
618 struct ath9k_channel *chan,
619 u8 *tx_chainmask, u8 *rx_chainmask,
620 u8 *antenna_cfgd);
621 645
622/* General Operation */ 646/* General Operation */
623bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); 647bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
624u32 ath9k_hw_reverse_bits(u32 val, u32 n); 648u32 ath9k_hw_reverse_bits(u32 val, u32 n);
625bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high); 649bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high);
626u16 ath9k_hw_computetxtime(struct ath_hw *ah, 650u16 ath9k_hw_computetxtime(struct ath_hw *ah,
627 const struct ath_rate_table *rates, 651 u8 phy, int kbps,
628 u32 frameLen, u16 rateix, bool shortPreamble); 652 u32 frameLen, u16 rateix, bool shortPreamble);
629void ath9k_hw_get_channel_centers(struct ath_hw *ah, 653void ath9k_hw_get_channel_centers(struct ath_hw *ah,
630 struct ath9k_channel *chan, 654 struct ath9k_channel *chan,
@@ -637,19 +661,21 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit);
637void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac); 661void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac);
638void ath9k_hw_setopmode(struct ath_hw *ah); 662void ath9k_hw_setopmode(struct ath_hw *ah);
639void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1); 663void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1);
640void ath9k_hw_setbssidmask(struct ath_softc *sc); 664void ath9k_hw_setbssidmask(struct ath_hw *ah);
641void ath9k_hw_write_associd(struct ath_softc *sc); 665void ath9k_hw_write_associd(struct ath_hw *ah);
642u64 ath9k_hw_gettsf64(struct ath_hw *ah); 666u64 ath9k_hw_gettsf64(struct ath_hw *ah);
643void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); 667void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64);
644void ath9k_hw_reset_tsf(struct ath_hw *ah); 668void ath9k_hw_reset_tsf(struct ath_hw *ah);
645void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting); 669void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting);
646bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us); 670u64 ath9k_hw_extend_tsf(struct ath_hw *ah, u32 rstamp);
647void ath9k_hw_set11nmac2040(struct ath_hw *ah, enum ath9k_ht_macmode mode); 671void ath9k_hw_init_global_settings(struct ath_hw *ah);
672void ath9k_hw_set11nmac2040(struct ath_hw *ah);
648void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); 673void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period);
649void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, 674void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
650 const struct ath9k_beacon_state *bs); 675 const struct ath9k_beacon_state *bs);
651bool ath9k_hw_setpower(struct ath_hw *ah, 676
652 enum ath9k_power_mode mode); 677bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
678
653void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off); 679void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off);
654 680
655/* Interrupt Handling */ 681/* Interrupt Handling */
@@ -663,16 +689,20 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
663 void (*overflow)(void *), 689 void (*overflow)(void *),
664 void *arg, 690 void *arg,
665 u8 timer_index); 691 u8 timer_index);
666void ath_gen_timer_start(struct ath_hw *ah, struct ath_gen_timer *timer, 692void ath9k_hw_gen_timer_start(struct ath_hw *ah,
667 u32 timer_next, u32 timer_period); 693 struct ath_gen_timer *timer,
668void ath_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer); 694 u32 timer_next,
695 u32 timer_period);
696void ath9k_hw_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer);
697
669void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer); 698void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer);
670void ath_gen_timer_isr(struct ath_hw *hw); 699void ath_gen_timer_isr(struct ath_hw *hw);
671u32 ath9k_hw_gettsf32(struct ath_hw *ah); 700u32 ath9k_hw_gettsf32(struct ath_hw *ah);
672 701
702void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len);
703
673#define ATH_PCIE_CAP_LINK_CTRL 0x70 704#define ATH_PCIE_CAP_LINK_CTRL 0x70
674#define ATH_PCIE_CAP_LINK_L0S 1 705#define ATH_PCIE_CAP_LINK_L0S 1
675#define ATH_PCIE_CAP_LINK_L1 2 706#define ATH_PCIE_CAP_LINK_L1 2
676 707
677void ath_pcie_aspm_disable(struct ath_softc *sc);
678#endif 708#endif