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.h88
1 files changed, 70 insertions, 18 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index b8923457182..abaa2f09a3b 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -27,17 +27,24 @@
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
40#define AR5416_AR9100_DEVID 0x000b 44#define AR5416_AR9100_DEVID 0x000b
45
46#define AR9271_USB 0x9271
47
41#define AR_SUBVENDOR_ID_NOG 0x0e11 48#define AR_SUBVENDOR_ID_NOG 0x0e11
42#define AR_SUBVENDOR_ID_NEW_A 0x7065 49#define AR_SUBVENDOR_ID_NEW_A 0x7065
43#define AR5416_MAGIC 0x19641014 50#define AR5416_MAGIC 0x19641014
@@ -49,9 +56,18 @@
49#define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa 56#define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa
50#define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab 57#define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab
51 58
59#define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1)
60
61#define ATH_DEFAULT_NOISE_FLOOR -95
62
63#define ATH9K_RSSI_BAD 0x80
64
52/* Register read/write primitives */ 65/* Register read/write primitives */
53#define REG_WRITE(_ah, _reg, _val) ath9k_iowrite32((_ah), (_reg), (_val)) 66#define REG_WRITE(_ah, _reg, _val) \
54#define REG_READ(_ah, _reg) ath9k_ioread32((_ah), (_reg)) 67 ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg))
68
69#define REG_READ(_ah, _reg) \
70 ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
55 71
56#define SM(_v, _f) (((_v) << _f##_S) & _f) 72#define SM(_v, _f) (((_v) << _f##_S) & _f)
57#define MS(_v, _f) (((_v) & _f) >> _f##_S) 73#define MS(_v, _f) (((_v) & _f) >> _f##_S)
@@ -91,7 +107,7 @@
91#define AR_GPIO_BIT(_gpio) (1 << (_gpio)) 107#define AR_GPIO_BIT(_gpio) (1 << (_gpio))
92 108
93#define BASE_ACTIVATE_DELAY 100 109#define BASE_ACTIVATE_DELAY 100
94#define RTC_PLL_SETTLE_DELAY 1000 110#define RTC_PLL_SETTLE_DELAY 100
95#define COEF_SCALE_S 24 111#define COEF_SCALE_S 24
96#define HT40_CHANNEL_CENTER_SHIFT 10 112#define HT40_CHANNEL_CENTER_SHIFT 10
97 113
@@ -132,6 +148,15 @@ enum wireless_mode {
132 ATH9K_MODE_MAX, 148 ATH9K_MODE_MAX,
133}; 149};
134 150
151/**
152 * ath9k_ant_setting - transmit antenna settings
153 *
154 * Configures the antenna setting to use for transmit.
155 *
156 * @ATH9K_ANT_VARIABLE: this means transmit on all active antennas
157 * @ATH9K_ANT_FIXED_A: this means transmit on the first antenna only
158 * @ATH9K_ANT_FIXED_B: this means transmit on the second antenna only
159 */
135enum ath9k_ant_setting { 160enum ath9k_ant_setting {
136 ATH9K_ANT_VARIABLE = 0, 161 ATH9K_ANT_VARIABLE = 0,
137 ATH9K_ANT_FIXED_A, 162 ATH9K_ANT_FIXED_A,
@@ -407,7 +432,7 @@ struct ath9k_hw_version {
407 * Using de Bruijin sequence to to look up 1's index in a 32 bit number 432 * 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 433 * debruijn32 = 0000 0111 0111 1100 1011 0101 0011 0001
409 */ 434 */
410#define debruijn32 0x077CB531UL 435#define debruijn32 0x077CB531U
411 436
412struct ath_gen_timer_configuration { 437struct ath_gen_timer_configuration {
413 u32 next_addr; 438 u32 next_addr;
@@ -433,7 +458,8 @@ struct ath_gen_timer_table {
433}; 458};
434 459
435struct ath_hw { 460struct ath_hw {
436 struct ath_softc *ah_sc; 461 struct ieee80211_hw *hw;
462 struct ath_common common;
437 struct ath9k_hw_version hw_version; 463 struct ath9k_hw_version hw_version;
438 struct ath9k_ops_config config; 464 struct ath9k_ops_config config;
439 struct ath9k_hw_capabilities caps; 465 struct ath9k_hw_capabilities caps;
@@ -450,7 +476,6 @@ struct ath_hw {
450 476
451 bool sw_mgmt_crypto; 477 bool sw_mgmt_crypto;
452 bool is_pciexpress; 478 bool is_pciexpress;
453 u8 macaddr[ETH_ALEN];
454 u16 tx_trig_level; 479 u16 tx_trig_level;
455 u16 rfsilent; 480 u16 rfsilent;
456 u32 rfkill_gpio; 481 u32 rfkill_gpio;
@@ -523,7 +548,14 @@ struct ath_hw {
523 DONT_USE_32KHZ, 548 DONT_USE_32KHZ,
524 } enable_32kHz_clock; 549 } enable_32kHz_clock;
525 550
526 /* RF */ 551 /* Callback for radio frequency change */
552 int (*ath9k_hw_rf_set_freq)(struct ath_hw *ah, struct ath9k_channel *chan);
553
554 /* Callback for baseband spur frequency */
555 void (*ath9k_hw_spur_mitigate_freq)(struct ath_hw *ah,
556 struct ath9k_channel *chan);
557
558 /* Used to program the radio on non single-chip devices */
527 u32 *analogBank0Data; 559 u32 *analogBank0Data;
528 u32 *analogBank1Data; 560 u32 *analogBank1Data;
529 u32 *analogBank2Data; 561 u32 *analogBank2Data;
@@ -553,8 +585,10 @@ struct ath_hw {
553 int firpwr[5]; 585 int firpwr[5];
554 enum ath9k_ani_cmd ani_function; 586 enum ath9k_ani_cmd ani_function;
555 587
588 /* Bluetooth coexistance */
589 struct ath_btcoex_hw btcoex_hw;
590
556 u32 intr_txqs; 591 u32 intr_txqs;
557 enum ath9k_ht_extprotspacing extprotspacing;
558 u8 txchainmask; 592 u8 txchainmask;
559 u8 rxchainmask; 593 u8 rxchainmask;
560 594
@@ -578,17 +612,29 @@ struct ath_hw {
578 struct ar5416IniArray iniModesAdditional; 612 struct ar5416IniArray iniModesAdditional;
579 struct ar5416IniArray iniModesRxGain; 613 struct ar5416IniArray iniModesRxGain;
580 struct ar5416IniArray iniModesTxGain; 614 struct ar5416IniArray iniModesTxGain;
615 struct ar5416IniArray iniModes_9271_1_0_only;
616 struct ar5416IniArray iniCckfirNormal;
617 struct ar5416IniArray iniCckfirJapan2484;
581 618
582 u32 intr_gen_timer_trigger; 619 u32 intr_gen_timer_trigger;
583 u32 intr_gen_timer_thresh; 620 u32 intr_gen_timer_thresh;
584 struct ath_gen_timer_table hw_gen_timers; 621 struct ath_gen_timer_table hw_gen_timers;
585}; 622};
586 623
624static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah)
625{
626 return &ah->common;
627}
628
629static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah)
630{
631 return &(ath9k_hw_common(ah)->regulatory);
632}
633
587/* Initialization, Detach, Reset */ 634/* Initialization, Detach, Reset */
588const char *ath9k_hw_probe(u16 vendorid, u16 devid); 635const char *ath9k_hw_probe(u16 vendorid, u16 devid);
589void ath9k_hw_detach(struct ath_hw *ah); 636void ath9k_hw_detach(struct ath_hw *ah);
590int ath9k_hw_init(struct ath_hw *ah); 637int 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, 638int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
593 bool bChannelChange); 639 bool bChannelChange);
594void ath9k_hw_fill_cap_info(struct ath_hw *ah); 640void ath9k_hw_fill_cap_info(struct ath_hw *ah);
@@ -637,19 +683,21 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit);
637void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac); 683void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac);
638void ath9k_hw_setopmode(struct ath_hw *ah); 684void ath9k_hw_setopmode(struct ath_hw *ah);
639void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1); 685void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1);
640void ath9k_hw_setbssidmask(struct ath_softc *sc); 686void ath9k_hw_setbssidmask(struct ath_hw *ah);
641void ath9k_hw_write_associd(struct ath_softc *sc); 687void ath9k_hw_write_associd(struct ath_hw *ah);
642u64 ath9k_hw_gettsf64(struct ath_hw *ah); 688u64 ath9k_hw_gettsf64(struct ath_hw *ah);
643void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); 689void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64);
644void ath9k_hw_reset_tsf(struct ath_hw *ah); 690void ath9k_hw_reset_tsf(struct ath_hw *ah);
645void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting); 691void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting);
692u64 ath9k_hw_extend_tsf(struct ath_hw *ah, u32 rstamp);
646bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us); 693bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us);
647void ath9k_hw_set11nmac2040(struct ath_hw *ah, enum ath9k_ht_macmode mode); 694void ath9k_hw_set11nmac2040(struct ath_hw *ah);
648void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); 695void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period);
649void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, 696void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
650 const struct ath9k_beacon_state *bs); 697 const struct ath9k_beacon_state *bs);
651bool ath9k_hw_setpower(struct ath_hw *ah, 698
652 enum ath9k_power_mode mode); 699bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
700
653void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off); 701void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off);
654 702
655/* Interrupt Handling */ 703/* Interrupt Handling */
@@ -663,16 +711,20 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
663 void (*overflow)(void *), 711 void (*overflow)(void *),
664 void *arg, 712 void *arg,
665 u8 timer_index); 713 u8 timer_index);
666void ath_gen_timer_start(struct ath_hw *ah, struct ath_gen_timer *timer, 714void ath9k_hw_gen_timer_start(struct ath_hw *ah,
667 u32 timer_next, u32 timer_period); 715 struct ath_gen_timer *timer,
668void ath_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer); 716 u32 timer_next,
717 u32 timer_period);
718void ath9k_hw_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer);
719
669void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer); 720void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer);
670void ath_gen_timer_isr(struct ath_hw *hw); 721void ath_gen_timer_isr(struct ath_hw *hw);
671u32 ath9k_hw_gettsf32(struct ath_hw *ah); 722u32 ath9k_hw_gettsf32(struct ath_hw *ah);
672 723
724void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len);
725
673#define ATH_PCIE_CAP_LINK_CTRL 0x70 726#define ATH_PCIE_CAP_LINK_CTRL 0x70
674#define ATH_PCIE_CAP_LINK_L0S 1 727#define ATH_PCIE_CAP_LINK_L0S 1
675#define ATH_PCIE_CAP_LINK_L1 2 728#define ATH_PCIE_CAP_LINK_L1 2
676 729
677void ath_pcie_aspm_disable(struct ath_softc *sc);
678#endif 730#endif