xref: /openbmc/linux/drivers/net/wireless/ath/ath9k/hw.h (revision 656cd75c387383fe3a63e21204107abf5515ecfc)
1203c4805SLuis R. Rodriguez /*
25b68138eSSujith Manoharan  * Copyright (c) 2008-2011 Atheros Communications Inc.
3203c4805SLuis R. Rodriguez  *
4203c4805SLuis R. Rodriguez  * Permission to use, copy, modify, and/or distribute this software for any
5203c4805SLuis R. Rodriguez  * purpose with or without fee is hereby granted, provided that the above
6203c4805SLuis R. Rodriguez  * copyright notice and this permission notice appear in all copies.
7203c4805SLuis R. Rodriguez  *
8203c4805SLuis R. Rodriguez  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9203c4805SLuis R. Rodriguez  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10203c4805SLuis R. Rodriguez  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11203c4805SLuis R. Rodriguez  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12203c4805SLuis R. Rodriguez  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13203c4805SLuis R. Rodriguez  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14203c4805SLuis R. Rodriguez  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15203c4805SLuis R. Rodriguez  */
16203c4805SLuis R. Rodriguez 
17203c4805SLuis R. Rodriguez #ifndef HW_H
18203c4805SLuis R. Rodriguez #define HW_H
19203c4805SLuis R. Rodriguez 
20203c4805SLuis R. Rodriguez #include <linux/if_ether.h>
21203c4805SLuis R. Rodriguez #include <linux/delay.h>
22203c4805SLuis R. Rodriguez #include <linux/io.h>
23ab5c4f71SGabor Juhos #include <linux/firmware.h>
24203c4805SLuis R. Rodriguez 
25203c4805SLuis R. Rodriguez #include "mac.h"
26203c4805SLuis R. Rodriguez #include "ani.h"
27203c4805SLuis R. Rodriguez #include "eeprom.h"
28203c4805SLuis R. Rodriguez #include "calib.h"
29203c4805SLuis R. Rodriguez #include "reg.h"
30ae55099fSSujith Manoharan #include "reg_mci.h"
31203c4805SLuis R. Rodriguez #include "phy.h"
32af03abecSLuis R. Rodriguez #include "btcoex.h"
33c774d57fSLorenzo Bianconi #include "dynack.h"
34203c4805SLuis R. Rodriguez 
35203c4805SLuis R. Rodriguez #include "../regd.h"
36203c4805SLuis R. Rodriguez 
37203c4805SLuis R. Rodriguez #define ATHEROS_VENDOR_ID	0x168c
387976b426SLuis R. Rodriguez 
39203c4805SLuis R. Rodriguez #define AR5416_DEVID_PCI	0x0023
40203c4805SLuis R. Rodriguez #define AR5416_DEVID_PCIE	0x0024
41203c4805SLuis R. Rodriguez #define AR9160_DEVID_PCI	0x0027
42203c4805SLuis R. Rodriguez #define AR9280_DEVID_PCI	0x0029
43203c4805SLuis R. Rodriguez #define AR9280_DEVID_PCIE	0x002a
44203c4805SLuis R. Rodriguez #define AR9285_DEVID_PCIE	0x002b
455ffaf8a3SLuis R. Rodriguez #define AR2427_DEVID_PCIE	0x002c
46db3cc53aSSenthil Balasubramanian #define AR9287_DEVID_PCI	0x002d
47db3cc53aSSenthil Balasubramanian #define AR9287_DEVID_PCIE	0x002e
48db3cc53aSSenthil Balasubramanian #define AR9300_DEVID_PCIE	0x0030
49b99a7be4SVasanthakumar Thiagarajan #define AR9300_DEVID_AR9340	0x0031
503050c914SVasanthakumar Thiagarajan #define AR9300_DEVID_AR9485_PCIE 0x0032
515a63ef0fSLuis R. Rodriguez #define AR9300_DEVID_AR9580	0x0033
52423e38e8SRajkumar Manoharan #define AR9300_DEVID_AR9462	0x0034
5303689301SGabor Juhos #define AR9300_DEVID_AR9330	0x0035
54b1233779SGabor Juhos #define AR9300_DEVID_QCA955X	0x0038
55d4e5979cSMohammed Shafi Shajakhan #define AR9485_DEVID_AR1111	0x0037
5677fac465SSujith Manoharan #define AR9300_DEVID_AR9565     0x0036
57e6b1e46eSSujith Manoharan #define AR9300_DEVID_AR953X     0x003d
582131fabbSMiaoqing Pan #define AR9300_DEVID_QCA956X    0x003f
597976b426SLuis R. Rodriguez 
60203c4805SLuis R. Rodriguez #define AR5416_AR9100_DEVID	0x000b
617976b426SLuis R. Rodriguez 
62203c4805SLuis R. Rodriguez #define	AR_SUBVENDOR_ID_NOG	0x0e11
63203c4805SLuis R. Rodriguez #define AR_SUBVENDOR_ID_NEW_A	0x7065
64203c4805SLuis R. Rodriguez #define AR5416_MAGIC		0x19641014
65203c4805SLuis R. Rodriguez 
66fe12946eSVasanthakumar Thiagarajan #define AR9280_COEX2WIRE_SUBSYSID	0x309b
67fe12946eSVasanthakumar Thiagarajan #define AT9285_COEX3WIRE_SA_SUBSYSID	0x30aa
68fe12946eSVasanthakumar Thiagarajan #define AT9285_COEX3WIRE_DA_SUBSYSID	0x30ab
69fe12946eSVasanthakumar Thiagarajan 
70e3d01bfcSLuis R. Rodriguez #define ATH_AMPDU_LIMIT_MAX        (64 * 1024 - 1)
71e3d01bfcSLuis R. Rodriguez 
72cfe8cba9SLuis R. Rodriguez #define	ATH_DEFAULT_NOISE_FLOOR -95
73cfe8cba9SLuis R. Rodriguez 
7404658fbaSJohn W. Linville #define ATH9K_RSSI_BAD			-128
75990b70abSLuis R. Rodriguez 
76cac4220bSFelix Fietkau #define ATH9K_NUM_CHANNELS	38
77cac4220bSFelix Fietkau 
78203c4805SLuis R. Rodriguez /* Register read/write primitives */
799e4bffd2SLuis R. Rodriguez #define REG_WRITE(_ah, _reg, _val) \
80f9f84e96SFelix Fietkau 	(_ah)->reg_ops.write((_ah), (_val), (_reg))
819e4bffd2SLuis R. Rodriguez 
829e4bffd2SLuis R. Rodriguez #define REG_READ(_ah, _reg) \
83f9f84e96SFelix Fietkau 	(_ah)->reg_ops.read((_ah), (_reg))
84203c4805SLuis R. Rodriguez 
8509a525d3SSujith Manoharan #define REG_READ_MULTI(_ah, _addr, _val, _cnt)		\
86f9f84e96SFelix Fietkau 	(_ah)->reg_ops.multi_read((_ah), (_addr), (_val), (_cnt))
8709a525d3SSujith Manoharan 
88845e03c9SFelix Fietkau #define REG_RMW(_ah, _reg, _set, _clr) \
89845e03c9SFelix Fietkau 	(_ah)->reg_ops.rmw((_ah), (_reg), (_set), (_clr))
90845e03c9SFelix Fietkau 
9120b3efd9SSujith #define ENABLE_REGWRITE_BUFFER(_ah)					\
9220b3efd9SSujith 	do {								\
93f9f84e96SFelix Fietkau 		if ((_ah)->reg_ops.enable_write_buffer)	\
94f9f84e96SFelix Fietkau 			(_ah)->reg_ops.enable_write_buffer((_ah)); \
9520b3efd9SSujith 	} while (0)
9620b3efd9SSujith 
9720b3efd9SSujith #define REGWRITE_BUFFER_FLUSH(_ah)					\
9820b3efd9SSujith 	do {								\
99f9f84e96SFelix Fietkau 		if ((_ah)->reg_ops.write_flush)		\
100f9f84e96SFelix Fietkau 			(_ah)->reg_ops.write_flush((_ah));	\
10120b3efd9SSujith 	} while (0)
10220b3efd9SSujith 
10326526202SRajkumar Manoharan #define PR_EEP(_s, _val)						\
10426526202SRajkumar Manoharan 	do {								\
1055e88ba62SZefir Kurtisi 		len += scnprintf(buf + len, size - len, "%20s : %10d\n",\
10626526202SRajkumar Manoharan 				 _s, (_val));				\
10726526202SRajkumar Manoharan 	} while (0)
10826526202SRajkumar Manoharan 
109203c4805SLuis R. Rodriguez #define SM(_v, _f)  (((_v) << _f##_S) & _f)
110203c4805SLuis R. Rodriguez #define MS(_v, _f)  (((_v) & _f) >> _f##_S)
111203c4805SLuis R. Rodriguez #define REG_RMW_FIELD(_a, _r, _f, _v) \
112845e03c9SFelix Fietkau 	REG_RMW(_a, _r, (((_v) << _f##_S) & _f), (_f))
1131547da37SLuis R. Rodriguez #define REG_READ_FIELD(_a, _r, _f) \
1141547da37SLuis R. Rodriguez 	(((REG_READ(_a, _r) & _f) >> _f##_S))
115203c4805SLuis R. Rodriguez #define REG_SET_BIT(_a, _r, _f) \
116845e03c9SFelix Fietkau 	REG_RMW(_a, _r, (_f), 0)
117203c4805SLuis R. Rodriguez #define REG_CLR_BIT(_a, _r, _f) \
118845e03c9SFelix Fietkau 	REG_RMW(_a, _r, 0, (_f))
119203c4805SLuis R. Rodriguez 
120203c4805SLuis R. Rodriguez #define DO_DELAY(x) do {					\
121e7fc6338SRajkumar Manoharan 		if (((++(x) % 64) == 0) &&			\
122e7fc6338SRajkumar Manoharan 		    (ath9k_hw_common(ah)->bus_ops->ath_bus_type	\
123e7fc6338SRajkumar Manoharan 			!= ATH_USB))				\
124203c4805SLuis R. Rodriguez 			udelay(1);				\
125203c4805SLuis R. Rodriguez 	} while (0)
126203c4805SLuis R. Rodriguez 
127a9b6b256SFelix Fietkau #define REG_WRITE_ARRAY(iniarray, column, regWr) \
128a9b6b256SFelix Fietkau 	ath9k_hw_write_array(ah, iniarray, column, &(regWr))
129203c4805SLuis R. Rodriguez 
130203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT             0
131203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
132203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED     2
133203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_TX_FRAME           3
1341773912bSVasanthakumar Thiagarajan #define AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL  4
135203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED    5
136203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED      6
13793d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_DATA      0x16
13893d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_CLK       0x17
13993d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_MCI_BT_DATA        0x18
14093d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_MCI_BT_CLK         0x19
14193d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_WL_IN_TX           0x14
14293d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_WL_IN_RX           0x13
14393d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_BT_IN_TX           9
14493d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_BT_IN_RX           8
14593d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_RUCKUS_STROBE      0x1d
14693d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_RUCKUS_DATA        0x1e
147203c4805SLuis R. Rodriguez 
148203c4805SLuis R. Rodriguez #define AR_GPIOD_MASK               0x00001FFF
149203c4805SLuis R. Rodriguez #define AR_GPIO_BIT(_gpio)          (1 << (_gpio))
150203c4805SLuis R. Rodriguez 
151203c4805SLuis R. Rodriguez #define BASE_ACTIVATE_DELAY         100
1520b488ac6SVasanthakumar Thiagarajan #define RTC_PLL_SETTLE_DELAY        (AR_SREV_9340(ah) ? 1000 : 100)
153203c4805SLuis R. Rodriguez #define COEF_SCALE_S                24
154203c4805SLuis R. Rodriguez #define HT40_CHANNEL_CENTER_SHIFT   10
155203c4805SLuis R. Rodriguez 
156203c4805SLuis R. Rodriguez #define ATH9K_ANTENNA0_CHAINMASK    0x1
157203c4805SLuis R. Rodriguez #define ATH9K_ANTENNA1_CHAINMASK    0x2
158203c4805SLuis R. Rodriguez 
159203c4805SLuis R. Rodriguez #define ATH9K_NUM_DMA_DEBUG_REGS    8
160203c4805SLuis R. Rodriguez #define ATH9K_NUM_QUEUES            10
161203c4805SLuis R. Rodriguez 
162203c4805SLuis R. Rodriguez #define MAX_RATE_POWER              63
163203c4805SLuis R. Rodriguez #define AH_WAIT_TIMEOUT             100000 /* (us) */
164f9b604f6SGabor Juhos #define AH_TSF_WRITE_TIMEOUT        100    /* (us) */
165203c4805SLuis R. Rodriguez #define AH_TIME_QUANTUM             10
166203c4805SLuis R. Rodriguez #define AR_KEYTABLE_SIZE            128
167d8caa839SSujith #define POWER_UP_TIME               10000
168203c4805SLuis R. Rodriguez #define SPUR_RSSI_THRESH            40
169331c5ea2SMohammed Shafi Shajakhan #define UPPER_5G_SUB_BAND_START		5700
170331c5ea2SMohammed Shafi Shajakhan #define MID_5G_SUB_BAND_START		5400
171203c4805SLuis R. Rodriguez 
172203c4805SLuis R. Rodriguez #define CAB_TIMEOUT_VAL             10
173203c4805SLuis R. Rodriguez #define BEACON_TIMEOUT_VAL          10
174203c4805SLuis R. Rodriguez #define MIN_BEACON_TIMEOUT_VAL      1
1754ed15762SFelix Fietkau #define SLEEP_SLOP                  TU_TO_USEC(3)
176203c4805SLuis R. Rodriguez 
177203c4805SLuis R. Rodriguez #define INIT_CONFIG_STATUS          0x00000000
178203c4805SLuis R. Rodriguez #define INIT_RSSI_THR               0x00000700
179203c4805SLuis R. Rodriguez #define INIT_BCON_CNTRL_REG         0x00000000
180203c4805SLuis R. Rodriguez 
181203c4805SLuis R. Rodriguez #define TU_TO_USEC(_tu)             ((_tu) << 10)
182203c4805SLuis R. Rodriguez 
183ceb26445SVasanthakumar Thiagarajan #define ATH9K_HW_RX_HP_QDEPTH	16
184ceb26445SVasanthakumar Thiagarajan #define ATH9K_HW_RX_LP_QDEPTH	128
185ceb26445SVasanthakumar Thiagarajan 
186717f6bedSFelix Fietkau #define PAPRD_GAIN_TABLE_ENTRIES	32
187717f6bedSFelix Fietkau #define PAPRD_TABLE_SZ			24
1880e44d48cSMohammed Shafi Shajakhan #define PAPRD_IDEAL_AGC2_PWR_RANGE	0xe0
189717f6bedSFelix Fietkau 
19001c78533SMohammed Shafi Shajakhan /*
19101c78533SMohammed Shafi Shajakhan  * Wake on Wireless
19201c78533SMohammed Shafi Shajakhan  */
19301c78533SMohammed Shafi Shajakhan 
19401c78533SMohammed Shafi Shajakhan /* Keep Alive Frame */
19501c78533SMohammed Shafi Shajakhan #define KAL_FRAME_LEN		28
19601c78533SMohammed Shafi Shajakhan #define KAL_FRAME_TYPE		0x2	/* data frame */
19701c78533SMohammed Shafi Shajakhan #define KAL_FRAME_SUB_TYPE	0x4	/* null data frame */
19801c78533SMohammed Shafi Shajakhan #define KAL_DURATION_ID		0x3d
19901c78533SMohammed Shafi Shajakhan #define KAL_NUM_DATA_WORDS	6
20001c78533SMohammed Shafi Shajakhan #define KAL_NUM_DESC_WORDS	12
20101c78533SMohammed Shafi Shajakhan #define KAL_ANTENNA_MODE	1
20201c78533SMohammed Shafi Shajakhan #define KAL_TO_DS		1
20301c78533SMohammed Shafi Shajakhan #define KAL_DELAY		4	/* delay of 4ms between 2 KAL frames */
20401c78533SMohammed Shafi Shajakhan #define KAL_TIMEOUT		900
20501c78533SMohammed Shafi Shajakhan 
20601c78533SMohammed Shafi Shajakhan #define MAX_PATTERN_SIZE		256
20701c78533SMohammed Shafi Shajakhan #define MAX_PATTERN_MASK_SIZE		32
20812a44422SSujith Manoharan #define MAX_NUM_PATTERN			16
20912a44422SSujith Manoharan #define MAX_NUM_PATTERN_LEGACY		8
21001c78533SMohammed Shafi Shajakhan #define MAX_NUM_USER_PATTERN		6 /*  deducting the disassociate and
21101c78533SMohammed Shafi Shajakhan 					      deauthenticate packets */
21201c78533SMohammed Shafi Shajakhan 
21301c78533SMohammed Shafi Shajakhan /*
21401c78533SMohammed Shafi Shajakhan  * WoW trigger mapping to hardware code
21501c78533SMohammed Shafi Shajakhan  */
21601c78533SMohammed Shafi Shajakhan 
21701c78533SMohammed Shafi Shajakhan #define AH_WOW_USER_PATTERN_EN		BIT(0)
21801c78533SMohammed Shafi Shajakhan #define AH_WOW_MAGIC_PATTERN_EN		BIT(1)
21901c78533SMohammed Shafi Shajakhan #define AH_WOW_LINK_CHANGE		BIT(2)
22001c78533SMohammed Shafi Shajakhan #define AH_WOW_BEACON_MISS		BIT(3)
22101c78533SMohammed Shafi Shajakhan 
222066dae93SFelix Fietkau enum ath_hw_txq_subtype {
22378063d81SFelix Fietkau 	ATH_TXQ_AC_BK = 0,
22478063d81SFelix Fietkau 	ATH_TXQ_AC_BE = 1,
225066dae93SFelix Fietkau 	ATH_TXQ_AC_VI = 2,
226066dae93SFelix Fietkau 	ATH_TXQ_AC_VO = 3,
227066dae93SFelix Fietkau };
228066dae93SFelix Fietkau 
22913ce3e99SLuis R. Rodriguez enum ath_ini_subsys {
23013ce3e99SLuis R. Rodriguez 	ATH_INI_PRE = 0,
23113ce3e99SLuis R. Rodriguez 	ATH_INI_CORE,
23213ce3e99SLuis R. Rodriguez 	ATH_INI_POST,
23313ce3e99SLuis R. Rodriguez 	ATH_INI_NUM_SPLIT,
23413ce3e99SLuis R. Rodriguez };
23513ce3e99SLuis R. Rodriguez 
236203c4805SLuis R. Rodriguez enum ath9k_hw_caps {
237364734faSFelix Fietkau 	ATH9K_HW_CAP_HT                         = BIT(0),
238364734faSFelix Fietkau 	ATH9K_HW_CAP_RFSILENT                   = BIT(1),
2391b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_AUTOSLEEP                  = BIT(2),
2401b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_4KB_SPLITTRANS             = BIT(3),
2411b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_EDMA			= BIT(4),
2421b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_RAC_SUPPORTED		= BIT(5),
2431b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_LDPC			= BIT(6),
2441b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_FASTCLOCK			= BIT(7),
2451b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_SGI_20			= BIT(8),
2461b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_ANT_DIV_COMB		= BIT(10),
2471b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_2GHZ			= BIT(11),
2481b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_5GHZ			= BIT(12),
2491b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_APM			= BIT(13),
250935477edSFelix Fietkau #ifdef CONFIG_ATH9K_PCOEM
2511b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_RTT			= BIT(14),
2521b2538b2SMohammed Shafi Shajakhan 	ATH9K_HW_CAP_MCI			= BIT(15),
253935477edSFelix Fietkau 	ATH9K_HW_CAP_BT_ANT_DIV			= BIT(17),
254935477edSFelix Fietkau #else
255935477edSFelix Fietkau 	ATH9K_HW_CAP_RTT			= 0,
256935477edSFelix Fietkau 	ATH9K_HW_CAP_MCI			= 0,
257935477edSFelix Fietkau 	ATH9K_HW_CAP_BT_ANT_DIV			= 0,
258935477edSFelix Fietkau #endif
259935477edSFelix Fietkau 	ATH9K_HW_CAP_DFS			= BIT(18),
260935477edSFelix Fietkau 	ATH9K_HW_CAP_PAPRD			= BIT(19),
261935477edSFelix Fietkau 	ATH9K_HW_CAP_FCC_BAND_SWITCH		= BIT(20),
262203c4805SLuis R. Rodriguez };
263203c4805SLuis R. Rodriguez 
2648e981389SMohammed Shafi Shajakhan /*
2658e981389SMohammed Shafi Shajakhan  * WoW device capabilities
2668e981389SMohammed Shafi Shajakhan  * @ATH9K_HW_WOW_DEVICE_CAPABLE: device revision is capable of WoW.
2678e981389SMohammed Shafi Shajakhan  * @ATH9K_HW_WOW_PATTERN_MATCH_EXACT: device is capable of matching
2688e981389SMohammed Shafi Shajakhan  * an exact user defined pattern or de-authentication/disassoc pattern.
2698e981389SMohammed Shafi Shajakhan  * @ATH9K_HW_WOW_PATTERN_MATCH_DWORD: device requires the first four
2708e981389SMohammed Shafi Shajakhan  * bytes of the pattern for user defined pattern, de-authentication and
2718e981389SMohammed Shafi Shajakhan  * disassociation patterns for all types of possible frames recieved
2728e981389SMohammed Shafi Shajakhan  * of those types.
2738e981389SMohammed Shafi Shajakhan  */
2748e981389SMohammed Shafi Shajakhan 
27541fe8837SSujith Manoharan struct ath9k_hw_wow {
27641fe8837SSujith Manoharan 	u32 wow_event_mask;
277a28815dbSSujith Manoharan 	u32 wow_event_mask2;
27812a44422SSujith Manoharan 	u8 max_patterns;
27941fe8837SSujith Manoharan };
28041fe8837SSujith Manoharan 
281203c4805SLuis R. Rodriguez struct ath9k_hw_capabilities {
282203c4805SLuis R. Rodriguez 	u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */
283203c4805SLuis R. Rodriguez 	u16 rts_aggr_limit;
284203c4805SLuis R. Rodriguez 	u8 tx_chainmask;
285203c4805SLuis R. Rodriguez 	u8 rx_chainmask;
286ee79ccd9SSujith Manoharan 	u8 chip_chainmask;
28747c80de6SVasanthakumar Thiagarajan 	u8 max_txchains;
28847c80de6SVasanthakumar Thiagarajan 	u8 max_rxchains;
289203c4805SLuis R. Rodriguez 	u8 num_gpio_pins;
290ceb26445SVasanthakumar Thiagarajan 	u8 rx_hp_qdepth;
291ceb26445SVasanthakumar Thiagarajan 	u8 rx_lp_qdepth;
292ceb26445SVasanthakumar Thiagarajan 	u8 rx_status_len;
293162c3be3SVasanthakumar Thiagarajan 	u8 tx_desc_len;
2945088c2f1SVasanthakumar Thiagarajan 	u8 txs_len;
295203c4805SLuis R. Rodriguez };
296203c4805SLuis R. Rodriguez 
2974598702dSSujith Manoharan #define AR_NO_SPUR      	0x8000
2984598702dSSujith Manoharan #define AR_BASE_FREQ_2GHZ   	2300
2994598702dSSujith Manoharan #define AR_BASE_FREQ_5GHZ   	4900
3004598702dSSujith Manoharan #define AR_SPUR_FEEQ_BOUND_HT40 19
3014598702dSSujith Manoharan #define AR_SPUR_FEEQ_BOUND_HT20 10
3024598702dSSujith Manoharan 
3034598702dSSujith Manoharan enum ath9k_hw_hang_checks {
3044598702dSSujith Manoharan 	HW_BB_WATCHDOG            = BIT(0),
3054598702dSSujith Manoharan 	HW_PHYRESTART_CLC_WAR     = BIT(1),
3064598702dSSujith Manoharan 	HW_BB_RIFS_HANG           = BIT(2),
3074598702dSSujith Manoharan 	HW_BB_DFS_HANG            = BIT(3),
3084598702dSSujith Manoharan 	HW_BB_RX_CLEAR_STUCK_HANG = BIT(4),
3094598702dSSujith Manoharan 	HW_MAC_HANG               = BIT(5),
3104598702dSSujith Manoharan };
3114598702dSSujith Manoharan 
312e519f78fSSujith Manoharan #define AR_PCIE_PLL_PWRSAVE_CONTROL BIT(0)
313e519f78fSSujith Manoharan #define AR_PCIE_PLL_PWRSAVE_ON_D3   BIT(1)
314e519f78fSSujith Manoharan #define AR_PCIE_PLL_PWRSAVE_ON_D0   BIT(2)
315e519f78fSSujith Manoharan #define AR_PCIE_CDR_PWRSAVE_ON_D3   BIT(3)
316e519f78fSSujith Manoharan #define AR_PCIE_CDR_PWRSAVE_ON_D0   BIT(4)
317e519f78fSSujith Manoharan 
318203c4805SLuis R. Rodriguez struct ath9k_ops_config {
319203c4805SLuis R. Rodriguez 	int dma_beacon_response_time;
320203c4805SLuis R. Rodriguez 	int sw_beacon_response_time;
32141f3e54dSFelix Fietkau 	u32 cwm_ignore_extcca;
322203c4805SLuis R. Rodriguez 	u32 pcie_waen;
323203c4805SLuis R. Rodriguez 	u8 analog_shiftreg;
324203c4805SLuis R. Rodriguez 	u32 ofdm_trig_low;
325203c4805SLuis R. Rodriguez 	u32 ofdm_trig_high;
326203c4805SLuis R. Rodriguez 	u32 cck_trig_high;
327203c4805SLuis R. Rodriguez 	u32 cck_trig_low;
32874673db9SFelix Fietkau 	u32 enable_paprd;
329203c4805SLuis R. Rodriguez 	int serialize_regmode;
3300ce024cbSSujith 	bool rx_intr_mitigation;
33155e82df4SVasanthakumar Thiagarajan 	bool tx_intr_mitigation;
332f4709fdfSLuis R. Rodriguez 	u8 max_txtrig_level;
333e36b27afSLuis R. Rodriguez 	u16 ani_poll_interval; /* ANI poll interval in ms */
3344598702dSSujith Manoharan 	u16 hw_hang_checks;
335a64e1a45SSujith Manoharan 	u16 rimt_first;
336a64e1a45SSujith Manoharan 	u16 rimt_last;
3379b60b64bSSujith Manoharan 
3389b60b64bSSujith Manoharan 	/* Platform specific config */
339b380a43bSSujith Manoharan 	u32 aspm_l1_fix;
3409b60b64bSSujith Manoharan 	u32 xlna_gpio;
34131fd216dSSujith Manoharan 	u32 ant_ctrl_comm2g_switch_enable;
3429b60b64bSSujith Manoharan 	bool xatten_margin_cfg;
343e083a42eSSujith Manoharan 	bool alt_mingainidx;
344*656cd75cSSujith Manoharan 	u8 pll_pwrsave;
3450f978bfaSSujith Manoharan 	bool tx_gain_buffalo;
346aeeb2065SSujith Manoharan 	bool led_active_high;
347203c4805SLuis R. Rodriguez };
348203c4805SLuis R. Rodriguez 
349203c4805SLuis R. Rodriguez enum ath9k_int {
350203c4805SLuis R. Rodriguez 	ATH9K_INT_RX = 0x00000001,
351203c4805SLuis R. Rodriguez 	ATH9K_INT_RXDESC = 0x00000002,
352b5c80475SFelix Fietkau 	ATH9K_INT_RXHP = 0x00000001,
353b5c80475SFelix Fietkau 	ATH9K_INT_RXLP = 0x00000002,
354203c4805SLuis R. Rodriguez 	ATH9K_INT_RXNOFRM = 0x00000008,
355203c4805SLuis R. Rodriguez 	ATH9K_INT_RXEOL = 0x00000010,
356203c4805SLuis R. Rodriguez 	ATH9K_INT_RXORN = 0x00000020,
357203c4805SLuis R. Rodriguez 	ATH9K_INT_TX = 0x00000040,
358203c4805SLuis R. Rodriguez 	ATH9K_INT_TXDESC = 0x00000080,
359203c4805SLuis R. Rodriguez 	ATH9K_INT_TIM_TIMER = 0x00000100,
3602ee4bd1eSMohammed Shafi Shajakhan 	ATH9K_INT_MCI = 0x00000200,
361aea702b7SLuis R. Rodriguez 	ATH9K_INT_BB_WATCHDOG = 0x00000400,
362203c4805SLuis R. Rodriguez 	ATH9K_INT_TXURN = 0x00000800,
363203c4805SLuis R. Rodriguez 	ATH9K_INT_MIB = 0x00001000,
364203c4805SLuis R. Rodriguez 	ATH9K_INT_RXPHY = 0x00004000,
365203c4805SLuis R. Rodriguez 	ATH9K_INT_RXKCM = 0x00008000,
366203c4805SLuis R. Rodriguez 	ATH9K_INT_SWBA = 0x00010000,
367203c4805SLuis R. Rodriguez 	ATH9K_INT_BMISS = 0x00040000,
368203c4805SLuis R. Rodriguez 	ATH9K_INT_BNR = 0x00100000,
369203c4805SLuis R. Rodriguez 	ATH9K_INT_TIM = 0x00200000,
370203c4805SLuis R. Rodriguez 	ATH9K_INT_DTIM = 0x00400000,
371203c4805SLuis R. Rodriguez 	ATH9K_INT_DTIMSYNC = 0x00800000,
372203c4805SLuis R. Rodriguez 	ATH9K_INT_GPIO = 0x01000000,
373203c4805SLuis R. Rodriguez 	ATH9K_INT_CABEND = 0x02000000,
374203c4805SLuis R. Rodriguez 	ATH9K_INT_TSFOOR = 0x04000000,
375ff155a45SVasanthakumar Thiagarajan 	ATH9K_INT_GENTIMER = 0x08000000,
376203c4805SLuis R. Rodriguez 	ATH9K_INT_CST = 0x10000000,
377203c4805SLuis R. Rodriguez 	ATH9K_INT_GTT = 0x20000000,
378203c4805SLuis R. Rodriguez 	ATH9K_INT_FATAL = 0x40000000,
379203c4805SLuis R. Rodriguez 	ATH9K_INT_GLOBAL = 0x80000000,
380203c4805SLuis R. Rodriguez 	ATH9K_INT_BMISC = ATH9K_INT_TIM |
381203c4805SLuis R. Rodriguez 		ATH9K_INT_DTIM |
382203c4805SLuis R. Rodriguez 		ATH9K_INT_DTIMSYNC |
383203c4805SLuis R. Rodriguez 		ATH9K_INT_TSFOOR |
384203c4805SLuis R. Rodriguez 		ATH9K_INT_CABEND,
385203c4805SLuis R. Rodriguez 	ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM |
386203c4805SLuis R. Rodriguez 		ATH9K_INT_RXDESC |
387203c4805SLuis R. Rodriguez 		ATH9K_INT_RXEOL |
388203c4805SLuis R. Rodriguez 		ATH9K_INT_RXORN |
389203c4805SLuis R. Rodriguez 		ATH9K_INT_TXURN |
390203c4805SLuis R. Rodriguez 		ATH9K_INT_TXDESC |
391203c4805SLuis R. Rodriguez 		ATH9K_INT_MIB |
392203c4805SLuis R. Rodriguez 		ATH9K_INT_RXPHY |
393203c4805SLuis R. Rodriguez 		ATH9K_INT_RXKCM |
394203c4805SLuis R. Rodriguez 		ATH9K_INT_SWBA |
395203c4805SLuis R. Rodriguez 		ATH9K_INT_BMISS |
396203c4805SLuis R. Rodriguez 		ATH9K_INT_GPIO,
397203c4805SLuis R. Rodriguez 	ATH9K_INT_NOCARD = 0xffffffff
398203c4805SLuis R. Rodriguez };
399203c4805SLuis R. Rodriguez 
400324c74adSRajkumar Manoharan #define MAX_RTT_TABLE_ENTRY     6
4015f0c04eaSRajkumar Manoharan #define MAX_IQCAL_MEASUREMENT	8
40277a5a664SRajkumar Manoharan #define MAX_CL_TAB_ENTRY	16
40396da6fddSSujith Manoharan #define CL_TAB_ENTRY(reg_base)	(reg_base + (4 * j))
4045f0c04eaSRajkumar Manoharan 
4054b9b42bfSSujith Manoharan enum ath9k_cal_flags {
4064b9b42bfSSujith Manoharan 	RTT_DONE,
4074b9b42bfSSujith Manoharan 	PAPRD_PACKET_SENT,
4084b9b42bfSSujith Manoharan 	PAPRD_DONE,
4094b9b42bfSSujith Manoharan 	NFCAL_PENDING,
4104b9b42bfSSujith Manoharan 	NFCAL_INTF,
4114b9b42bfSSujith Manoharan 	TXIQCAL_DONE,
4124b9b42bfSSujith Manoharan 	TXCLCAL_DONE,
4133001f0d0SSujith Manoharan 	SW_PKDET_DONE,
4144b9b42bfSSujith Manoharan };
4154b9b42bfSSujith Manoharan 
41620bd2a09SFelix Fietkau struct ath9k_hw_cal_data {
417203c4805SLuis R. Rodriguez 	u16 channel;
4186b21fd20SFelix Fietkau 	u16 channelFlags;
4194b9b42bfSSujith Manoharan 	unsigned long cal_flags;
420203c4805SLuis R. Rodriguez 	int32_t CalValid;
421203c4805SLuis R. Rodriguez 	int8_t iCoff;
422203c4805SLuis R. Rodriguez 	int8_t qCoff;
4233001f0d0SSujith Manoharan 	u8 caldac[2];
424717f6bedSFelix Fietkau 	u16 small_signal_gain[AR9300_MAX_CHAINS];
425717f6bedSFelix Fietkau 	u32 pa_table[AR9300_MAX_CHAINS][PAPRD_TABLE_SZ];
4265f0c04eaSRajkumar Manoharan 	u32 num_measures[AR9300_MAX_CHAINS];
4275f0c04eaSRajkumar Manoharan 	int tx_corr_coeff[MAX_IQCAL_MEASUREMENT][AR9300_MAX_CHAINS];
42877a5a664SRajkumar Manoharan 	u32 tx_clcal[AR9300_MAX_CHAINS][MAX_CL_TAB_ENTRY];
4298a90555fSSujith Manoharan 	u32 rtt_table[AR9300_MAX_CHAINS][MAX_RTT_TABLE_ENTRY];
43020bd2a09SFelix Fietkau 	struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
43120bd2a09SFelix Fietkau };
43220bd2a09SFelix Fietkau 
43320bd2a09SFelix Fietkau struct ath9k_channel {
43420bd2a09SFelix Fietkau 	struct ieee80211_channel *chan;
43520bd2a09SFelix Fietkau 	u16 channel;
4366b21fd20SFelix Fietkau 	u16 channelFlags;
437d9891c78SFelix Fietkau 	s16 noisefloor;
438203c4805SLuis R. Rodriguez };
439203c4805SLuis R. Rodriguez 
4406b21fd20SFelix Fietkau #define CHANNEL_5GHZ		BIT(0)
4416b21fd20SFelix Fietkau #define CHANNEL_HALF		BIT(1)
4426b21fd20SFelix Fietkau #define CHANNEL_QUARTER		BIT(2)
4436b21fd20SFelix Fietkau #define CHANNEL_HT		BIT(3)
4446b21fd20SFelix Fietkau #define CHANNEL_HT40PLUS	BIT(4)
4456b21fd20SFelix Fietkau #define CHANNEL_HT40MINUS	BIT(5)
446203c4805SLuis R. Rodriguez 
4476b21fd20SFelix Fietkau #define IS_CHAN_5GHZ(_c) (!!((_c)->channelFlags & CHANNEL_5GHZ))
4486b21fd20SFelix Fietkau #define IS_CHAN_2GHZ(_c) (!IS_CHAN_5GHZ(_c))
4496b21fd20SFelix Fietkau 
4506b21fd20SFelix Fietkau #define IS_CHAN_HALF_RATE(_c) (!!((_c)->channelFlags & CHANNEL_HALF))
4516b21fd20SFelix Fietkau #define IS_CHAN_QUARTER_RATE(_c) (!!((_c)->channelFlags & CHANNEL_QUARTER))
4526b21fd20SFelix Fietkau #define IS_CHAN_A_FAST_CLOCK(_ah, _c)			\
4536b21fd20SFelix Fietkau 	(IS_CHAN_5GHZ(_c) && ((_ah)->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK))
4546b21fd20SFelix Fietkau 
4556b21fd20SFelix Fietkau #define IS_CHAN_HT(_c) ((_c)->channelFlags & CHANNEL_HT)
4566b21fd20SFelix Fietkau 
4576b21fd20SFelix Fietkau #define IS_CHAN_HT20(_c) (IS_CHAN_HT(_c) && !IS_CHAN_HT40(_c))
4586b21fd20SFelix Fietkau 
4596b21fd20SFelix Fietkau #define IS_CHAN_HT40(_c) \
4606b21fd20SFelix Fietkau 	(!!((_c)->channelFlags & (CHANNEL_HT40PLUS | CHANNEL_HT40MINUS)))
4616b21fd20SFelix Fietkau 
4626b21fd20SFelix Fietkau #define IS_CHAN_HT40PLUS(_c) ((_c)->channelFlags & CHANNEL_HT40PLUS)
4636b21fd20SFelix Fietkau #define IS_CHAN_HT40MINUS(_c) ((_c)->channelFlags & CHANNEL_HT40MINUS)
464203c4805SLuis R. Rodriguez 
465203c4805SLuis R. Rodriguez enum ath9k_power_mode {
466203c4805SLuis R. Rodriguez 	ATH9K_PM_AWAKE = 0,
467203c4805SLuis R. Rodriguez 	ATH9K_PM_FULL_SLEEP,
468203c4805SLuis R. Rodriguez 	ATH9K_PM_NETWORK_SLEEP,
469203c4805SLuis R. Rodriguez 	ATH9K_PM_UNDEFINED
470203c4805SLuis R. Rodriguez };
471203c4805SLuis R. Rodriguez 
472203c4805SLuis R. Rodriguez enum ser_reg_mode {
473203c4805SLuis R. Rodriguez 	SER_REG_MODE_OFF = 0,
474203c4805SLuis R. Rodriguez 	SER_REG_MODE_ON = 1,
475203c4805SLuis R. Rodriguez 	SER_REG_MODE_AUTO = 2,
476203c4805SLuis R. Rodriguez };
477203c4805SLuis R. Rodriguez 
478ad7b8060SVasanthakumar Thiagarajan enum ath9k_rx_qtype {
479ad7b8060SVasanthakumar Thiagarajan 	ATH9K_RX_QUEUE_HP,
480ad7b8060SVasanthakumar Thiagarajan 	ATH9K_RX_QUEUE_LP,
481ad7b8060SVasanthakumar Thiagarajan 	ATH9K_RX_QUEUE_MAX,
482ad7b8060SVasanthakumar Thiagarajan };
483ad7b8060SVasanthakumar Thiagarajan 
484203c4805SLuis R. Rodriguez struct ath9k_beacon_state {
485203c4805SLuis R. Rodriguez 	u32 bs_nexttbtt;
486203c4805SLuis R. Rodriguez 	u32 bs_nextdtim;
487203c4805SLuis R. Rodriguez 	u32 bs_intval;
488203c4805SLuis R. Rodriguez #define ATH9K_TSFOOR_THRESHOLD    0x00004240 /* 16k us */
489203c4805SLuis R. Rodriguez 	u32 bs_dtimperiod;
490203c4805SLuis R. Rodriguez 	u16 bs_bmissthreshold;
491203c4805SLuis R. Rodriguez 	u32 bs_sleepduration;
492203c4805SLuis R. Rodriguez 	u32 bs_tsfoor_threshold;
493203c4805SLuis R. Rodriguez };
494203c4805SLuis R. Rodriguez 
495203c4805SLuis R. Rodriguez struct chan_centers {
496203c4805SLuis R. Rodriguez 	u16 synth_center;
497203c4805SLuis R. Rodriguez 	u16 ctl_center;
498203c4805SLuis R. Rodriguez 	u16 ext_center;
499203c4805SLuis R. Rodriguez };
500203c4805SLuis R. Rodriguez 
501203c4805SLuis R. Rodriguez enum {
502203c4805SLuis R. Rodriguez 	ATH9K_RESET_POWER_ON,
503203c4805SLuis R. Rodriguez 	ATH9K_RESET_WARM,
504203c4805SLuis R. Rodriguez 	ATH9K_RESET_COLD,
505203c4805SLuis R. Rodriguez };
506203c4805SLuis R. Rodriguez 
507203c4805SLuis R. Rodriguez struct ath9k_hw_version {
508203c4805SLuis R. Rodriguez 	u32 magic;
509203c4805SLuis R. Rodriguez 	u16 devid;
510203c4805SLuis R. Rodriguez 	u16 subvendorid;
511203c4805SLuis R. Rodriguez 	u32 macVersion;
512203c4805SLuis R. Rodriguez 	u16 macRev;
513203c4805SLuis R. Rodriguez 	u16 phyRev;
514203c4805SLuis R. Rodriguez 	u16 analog5GhzRev;
515203c4805SLuis R. Rodriguez 	u16 analog2GhzRev;
5160b5ead91SSujith Manoharan 	enum ath_usb_dev usbdev;
517203c4805SLuis R. Rodriguez };
518203c4805SLuis R. Rodriguez 
519ff155a45SVasanthakumar Thiagarajan /* Generic TSF timer definitions */
520ff155a45SVasanthakumar Thiagarajan 
521ff155a45SVasanthakumar Thiagarajan #define ATH_MAX_GEN_TIMER	16
522ff155a45SVasanthakumar Thiagarajan 
523ff155a45SVasanthakumar Thiagarajan #define AR_GENTMR_BIT(_index)	(1 << (_index))
524ff155a45SVasanthakumar Thiagarajan 
525ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer_configuration {
526ff155a45SVasanthakumar Thiagarajan 	u32 next_addr;
527ff155a45SVasanthakumar Thiagarajan 	u32 period_addr;
528ff155a45SVasanthakumar Thiagarajan 	u32 mode_addr;
529ff155a45SVasanthakumar Thiagarajan 	u32 mode_mask;
530ff155a45SVasanthakumar Thiagarajan };
531ff155a45SVasanthakumar Thiagarajan 
532ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer {
533ff155a45SVasanthakumar Thiagarajan 	void (*trigger)(void *arg);
534ff155a45SVasanthakumar Thiagarajan 	void (*overflow)(void *arg);
535ff155a45SVasanthakumar Thiagarajan 	void *arg;
536ff155a45SVasanthakumar Thiagarajan 	u8 index;
537ff155a45SVasanthakumar Thiagarajan };
538ff155a45SVasanthakumar Thiagarajan 
539ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer_table {
540ff155a45SVasanthakumar Thiagarajan 	struct ath_gen_timer *timers[ATH_MAX_GEN_TIMER];
541c67ce339SFelix Fietkau 	u16 timer_mask;
542f4c34af4SSujith Manoharan 	bool tsf2_enabled;
543ff155a45SVasanthakumar Thiagarajan };
544ff155a45SVasanthakumar Thiagarajan 
54521cc630fSVasanthakumar Thiagarajan struct ath_hw_antcomb_conf {
54621cc630fSVasanthakumar Thiagarajan 	u8 main_lna_conf;
54721cc630fSVasanthakumar Thiagarajan 	u8 alt_lna_conf;
54821cc630fSVasanthakumar Thiagarajan 	u8 fast_div_bias;
549c6ba9febSMohammed Shafi Shajakhan 	u8 main_gaintb;
550c6ba9febSMohammed Shafi Shajakhan 	u8 alt_gaintb;
551c6ba9febSMohammed Shafi Shajakhan 	int lna1_lna2_delta;
552f96bd2adSSujith Manoharan 	int lna1_lna2_switch_delta;
5538afbcc8bSMohammed Shafi Shajakhan 	u8 div_group;
55421cc630fSVasanthakumar Thiagarajan };
55521cc630fSVasanthakumar Thiagarajan 
556d70357d5SLuis R. Rodriguez /**
5574e8c14e9SFelix Fietkau  * struct ath_hw_radar_conf - radar detection initialization parameters
5584e8c14e9SFelix Fietkau  *
5594e8c14e9SFelix Fietkau  * @pulse_inband: threshold for checking the ratio of in-band power
5604e8c14e9SFelix Fietkau  *	to total power for short radar pulses (half dB steps)
5614e8c14e9SFelix Fietkau  * @pulse_inband_step: threshold for checking an in-band power to total
5624e8c14e9SFelix Fietkau  *	power ratio increase for short radar pulses (half dB steps)
5634e8c14e9SFelix Fietkau  * @pulse_height: threshold for detecting the beginning of a short
5644e8c14e9SFelix Fietkau  *	radar pulse (dB step)
5654e8c14e9SFelix Fietkau  * @pulse_rssi: threshold for detecting if a short radar pulse is
5664e8c14e9SFelix Fietkau  *	gone (dB step)
5674e8c14e9SFelix Fietkau  * @pulse_maxlen: maximum pulse length (0.8 us steps)
5684e8c14e9SFelix Fietkau  *
5694e8c14e9SFelix Fietkau  * @radar_rssi: RSSI threshold for starting long radar detection (dB steps)
5704e8c14e9SFelix Fietkau  * @radar_inband: threshold for checking the ratio of in-band power
5714e8c14e9SFelix Fietkau  *	to total power for long radar pulses (half dB steps)
5724e8c14e9SFelix Fietkau  * @fir_power: threshold for detecting the end of a long radar pulse (dB)
5734e8c14e9SFelix Fietkau  *
5744e8c14e9SFelix Fietkau  * @ext_channel: enable extension channel radar detection
5754e8c14e9SFelix Fietkau  */
5764e8c14e9SFelix Fietkau struct ath_hw_radar_conf {
5774e8c14e9SFelix Fietkau 	unsigned int pulse_inband;
5784e8c14e9SFelix Fietkau 	unsigned int pulse_inband_step;
5794e8c14e9SFelix Fietkau 	unsigned int pulse_height;
5804e8c14e9SFelix Fietkau 	unsigned int pulse_rssi;
5814e8c14e9SFelix Fietkau 	unsigned int pulse_maxlen;
5824e8c14e9SFelix Fietkau 
5834e8c14e9SFelix Fietkau 	unsigned int radar_rssi;
5844e8c14e9SFelix Fietkau 	unsigned int radar_inband;
5854e8c14e9SFelix Fietkau 	int fir_power;
5864e8c14e9SFelix Fietkau 
5874e8c14e9SFelix Fietkau 	bool ext_channel;
5884e8c14e9SFelix Fietkau };
5894e8c14e9SFelix Fietkau 
5904e8c14e9SFelix Fietkau /**
591d70357d5SLuis R. Rodriguez  * struct ath_hw_private_ops - callbacks used internally by hardware code
592d70357d5SLuis R. Rodriguez  *
593d70357d5SLuis R. Rodriguez  * This structure contains private callbacks designed to only be used internally
594d70357d5SLuis R. Rodriguez  * by the hardware core.
595d70357d5SLuis R. Rodriguez  *
596795f5e2cSLuis R. Rodriguez  * @init_cal_settings: setup types of calibrations supported
597795f5e2cSLuis R. Rodriguez  * @init_cal: starts actual calibration
598795f5e2cSLuis R. Rodriguez  *
599991312d8SLuis R. Rodriguez  * @init_mode_gain_regs: Initialize TX/RX gain registers
6008fe65368SLuis R. Rodriguez  *
6018fe65368SLuis R. Rodriguez  * @rf_set_freq: change frequency
6028fe65368SLuis R. Rodriguez  * @spur_mitigate_freq: spur mitigation
6038fe65368SLuis R. Rodriguez  * @set_rf_regs:
60464773964SLuis R. Rodriguez  * @compute_pll_control: compute the PLL control value to use for
60564773964SLuis R. Rodriguez  *	AR_RTC_PLL_CONTROL for a given channel
606795f5e2cSLuis R. Rodriguez  * @setup_calibration: set up calibration
607795f5e2cSLuis R. Rodriguez  * @iscal_supported: used to query if a type of calibration is supported
608ac0bb767SLuis R. Rodriguez  *
609e36b27afSLuis R. Rodriguez  * @ani_cache_ini_regs: cache the values for ANI from the initial
610e36b27afSLuis R. Rodriguez  *	register settings through the register initialization.
611d70357d5SLuis R. Rodriguez  */
612d70357d5SLuis R. Rodriguez struct ath_hw_private_ops {
6134598702dSSujith Manoharan 	void (*init_hang_checks)(struct ath_hw *ah);
614990de2b2SSujith Manoharan 	bool (*detect_mac_hang)(struct ath_hw *ah);
615990de2b2SSujith Manoharan 	bool (*detect_bb_hang)(struct ath_hw *ah);
616990de2b2SSujith Manoharan 
617795f5e2cSLuis R. Rodriguez 	/* Calibration ops */
618d70357d5SLuis R. Rodriguez 	void (*init_cal_settings)(struct ath_hw *ah);
619795f5e2cSLuis R. Rodriguez 	bool (*init_cal)(struct ath_hw *ah, struct ath9k_channel *chan);
620795f5e2cSLuis R. Rodriguez 
621991312d8SLuis R. Rodriguez 	void (*init_mode_gain_regs)(struct ath_hw *ah);
622795f5e2cSLuis R. Rodriguez 	void (*setup_calibration)(struct ath_hw *ah,
623795f5e2cSLuis R. Rodriguez 				  struct ath9k_cal_list *currCal);
6248fe65368SLuis R. Rodriguez 
6258fe65368SLuis R. Rodriguez 	/* PHY ops */
6268fe65368SLuis R. Rodriguez 	int (*rf_set_freq)(struct ath_hw *ah,
6278fe65368SLuis R. Rodriguez 			   struct ath9k_channel *chan);
6288fe65368SLuis R. Rodriguez 	void (*spur_mitigate_freq)(struct ath_hw *ah,
6298fe65368SLuis R. Rodriguez 				   struct ath9k_channel *chan);
6308fe65368SLuis R. Rodriguez 	bool (*set_rf_regs)(struct ath_hw *ah,
6318fe65368SLuis R. Rodriguez 			    struct ath9k_channel *chan,
6328fe65368SLuis R. Rodriguez 			    u16 modesIndex);
6338fe65368SLuis R. Rodriguez 	void (*set_channel_regs)(struct ath_hw *ah, struct ath9k_channel *chan);
6348fe65368SLuis R. Rodriguez 	void (*init_bb)(struct ath_hw *ah,
6358fe65368SLuis R. Rodriguez 			struct ath9k_channel *chan);
6368fe65368SLuis R. Rodriguez 	int (*process_ini)(struct ath_hw *ah, struct ath9k_channel *chan);
6378fe65368SLuis R. Rodriguez 	void (*olc_init)(struct ath_hw *ah);
6388fe65368SLuis R. Rodriguez 	void (*set_rfmode)(struct ath_hw *ah, struct ath9k_channel *chan);
6398fe65368SLuis R. Rodriguez 	void (*mark_phy_inactive)(struct ath_hw *ah);
6408fe65368SLuis R. Rodriguez 	void (*set_delta_slope)(struct ath_hw *ah, struct ath9k_channel *chan);
6418fe65368SLuis R. Rodriguez 	bool (*rfbus_req)(struct ath_hw *ah);
6428fe65368SLuis R. Rodriguez 	void (*rfbus_done)(struct ath_hw *ah);
6438fe65368SLuis R. Rodriguez 	void (*restore_chainmask)(struct ath_hw *ah);
64464773964SLuis R. Rodriguez 	u32 (*compute_pll_control)(struct ath_hw *ah,
64564773964SLuis R. Rodriguez 				   struct ath9k_channel *chan);
646c16fcb49SFelix Fietkau 	bool (*ani_control)(struct ath_hw *ah, enum ath9k_ani_cmd cmd,
647c16fcb49SFelix Fietkau 			    int param);
648641d9921SFelix Fietkau 	void (*do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS]);
6494e8c14e9SFelix Fietkau 	void (*set_radar_params)(struct ath_hw *ah,
6504e8c14e9SFelix Fietkau 				 struct ath_hw_radar_conf *conf);
6515f0c04eaSRajkumar Manoharan 	int (*fast_chan_change)(struct ath_hw *ah, struct ath9k_channel *chan,
6525f0c04eaSRajkumar Manoharan 				u8 *ini_reloaded);
653ac0bb767SLuis R. Rodriguez 
654ac0bb767SLuis R. Rodriguez 	/* ANI */
655e36b27afSLuis R. Rodriguez 	void (*ani_cache_ini_regs)(struct ath_hw *ah);
656d70357d5SLuis R. Rodriguez };
657d70357d5SLuis R. Rodriguez 
658d70357d5SLuis R. Rodriguez /**
659e93d083fSSimon Wunderlich  * struct ath_spec_scan - parameters for Atheros spectral scan
660e93d083fSSimon Wunderlich  *
661e93d083fSSimon Wunderlich  * @enabled: enable/disable spectral scan
662e93d083fSSimon Wunderlich  * @short_repeat: controls whether the chip is in spectral scan mode
663e93d083fSSimon Wunderlich  *		  for 4 usec (enabled) or 204 usec (disabled)
664e93d083fSSimon Wunderlich  * @count: number of scan results requested. There are special meanings
665e93d083fSSimon Wunderlich  *	   in some chip revisions:
666e93d083fSSimon Wunderlich  *	   AR92xx: highest bit set (>=128) for endless mode
667e93d083fSSimon Wunderlich  *		   (spectral scan won't stopped until explicitly disabled)
668e93d083fSSimon Wunderlich  *	   AR9300 and newer: 0 for endless mode
669e93d083fSSimon Wunderlich  * @endless: true if endless mode is intended. Otherwise, count value is
670e93d083fSSimon Wunderlich  *           corrected to the next possible value.
671e93d083fSSimon Wunderlich  * @period: time duration between successive spectral scan entry points
672e93d083fSSimon Wunderlich  *	    (period*256*Tclk). Tclk = ath_common->clockrate
673e93d083fSSimon Wunderlich  * @fft_period: PHY passes FFT frames to MAC every (fft_period+1)*4uS
674e93d083fSSimon Wunderlich  *
675e93d083fSSimon Wunderlich  * Note: Tclk = 40MHz or 44MHz depending upon operating mode.
676e93d083fSSimon Wunderlich  *	 Typically it's 44MHz in 2/5GHz on later chips, but there's
677e93d083fSSimon Wunderlich  *	 a "fast clock" check for this in 5GHz.
678e93d083fSSimon Wunderlich  *
679e93d083fSSimon Wunderlich  */
680e93d083fSSimon Wunderlich struct ath_spec_scan {
681e93d083fSSimon Wunderlich 	bool enabled;
682e93d083fSSimon Wunderlich 	bool short_repeat;
683e93d083fSSimon Wunderlich 	bool endless;
684e93d083fSSimon Wunderlich 	u8 count;
685e93d083fSSimon Wunderlich 	u8 period;
686e93d083fSSimon Wunderlich 	u8 fft_period;
687e93d083fSSimon Wunderlich };
688e93d083fSSimon Wunderlich 
689e93d083fSSimon Wunderlich /**
690d70357d5SLuis R. Rodriguez  * struct ath_hw_ops - callbacks used by hardware code and driver code
691d70357d5SLuis R. Rodriguez  *
692d70357d5SLuis R. Rodriguez  * This structure contains callbacks designed to to be used internally by
693d70357d5SLuis R. Rodriguez  * hardware code and also by the lower level driver.
694d70357d5SLuis R. Rodriguez  *
695d70357d5SLuis R. Rodriguez  * @config_pci_powersave:
696795f5e2cSLuis R. Rodriguez  * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
697e93d083fSSimon Wunderlich  *
698e93d083fSSimon Wunderlich  * @spectral_scan_config: set parameters for spectral scan and enable/disable it
699e93d083fSSimon Wunderlich  * @spectral_scan_trigger: trigger a spectral scan run
700e93d083fSSimon Wunderlich  * @spectral_scan_wait: wait for a spectral scan run to finish
701d70357d5SLuis R. Rodriguez  */
702d70357d5SLuis R. Rodriguez struct ath_hw_ops {
703d70357d5SLuis R. Rodriguez 	void (*config_pci_powersave)(struct ath_hw *ah,
70484c87dc8SStanislaw Gruszka 				     bool power_off);
705cee1f625SVasanthakumar Thiagarajan 	void (*rx_enable)(struct ath_hw *ah);
70687d5efbbSVasanthakumar Thiagarajan 	void (*set_desc_link)(void *ds, u32 link);
7077b8aaeadSFelix Fietkau 	int (*calibrate)(struct ath_hw *ah, struct ath9k_channel *chan,
7087b8aaeadSFelix Fietkau 			 u8 rxchainmask, bool longcal);
7096a4d05dcSFelix Fietkau 	bool (*get_isr)(struct ath_hw *ah, enum ath9k_int *masked,
7106a4d05dcSFelix Fietkau 			u32 *sync_cause_p);
7112b63a41dSFelix Fietkau 	void (*set_txdesc)(struct ath_hw *ah, void *ds,
7122b63a41dSFelix Fietkau 			   struct ath_tx_info *i);
713cc610ac0SVasanthakumar Thiagarajan 	int (*proc_txdesc)(struct ath_hw *ah, void *ds,
714cc610ac0SVasanthakumar Thiagarajan 			   struct ath_tx_status *ts);
715315dd114SFelix Fietkau 	int (*get_duration)(struct ath_hw *ah, const void *ds, int index);
71669de3721SMohammed Shafi Shajakhan 	void (*antdiv_comb_conf_get)(struct ath_hw *ah,
71769de3721SMohammed Shafi Shajakhan 			struct ath_hw_antcomb_conf *antconf);
71869de3721SMohammed Shafi Shajakhan 	void (*antdiv_comb_conf_set)(struct ath_hw *ah,
71969de3721SMohammed Shafi Shajakhan 			struct ath_hw_antcomb_conf *antconf);
720e93d083fSSimon Wunderlich 	void (*spectral_scan_config)(struct ath_hw *ah,
721e93d083fSSimon Wunderlich 				     struct ath_spec_scan *param);
722e93d083fSSimon Wunderlich 	void (*spectral_scan_trigger)(struct ath_hw *ah);
723e93d083fSSimon Wunderlich 	void (*spectral_scan_wait)(struct ath_hw *ah);
72436e8825eSSujith Manoharan 
72589f927afSLuis R. Rodriguez 	void (*tx99_start)(struct ath_hw *ah, u32 qnum);
72689f927afSLuis R. Rodriguez 	void (*tx99_stop)(struct ath_hw *ah);
72789f927afSLuis R. Rodriguez 	void (*tx99_set_txpower)(struct ath_hw *ah, u8 power);
72889f927afSLuis R. Rodriguez 
72936e8825eSSujith Manoharan #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
73036e8825eSSujith Manoharan 	void (*set_bt_ant_diversity)(struct ath_hw *hw, bool enable);
73136e8825eSSujith Manoharan #endif
732d70357d5SLuis R. Rodriguez };
733d70357d5SLuis R. Rodriguez 
734f2552e28SFelix Fietkau struct ath_nf_limits {
735f2552e28SFelix Fietkau 	s16 max;
736f2552e28SFelix Fietkau 	s16 min;
737f2552e28SFelix Fietkau 	s16 nominal;
738f2552e28SFelix Fietkau };
739f2552e28SFelix Fietkau 
7408ad74c4dSRajkumar Manoharan enum ath_cal_list {
7418ad74c4dSRajkumar Manoharan 	TX_IQ_CAL         =	BIT(0),
7428ad74c4dSRajkumar Manoharan 	TX_IQ_ON_AGC_CAL  =	BIT(1),
7438ad74c4dSRajkumar Manoharan 	TX_CL_CAL         =	BIT(2),
7448ad74c4dSRajkumar Manoharan };
7458ad74c4dSRajkumar Manoharan 
74697dcec57SSujith Manoharan /* ah_flags */
74797dcec57SSujith Manoharan #define AH_USE_EEPROM   0x1
74897dcec57SSujith Manoharan #define AH_UNPLUGGED    0x2 /* The card has been physically removed. */
749a126ff51SRajkumar Manoharan #define AH_FASTCC       0x4
750a59dadbeSFelix Fietkau #define AH_NO_EEP_SWAP  0x8 /* Do not swap EEPROM data */
75197dcec57SSujith Manoharan 
752203c4805SLuis R. Rodriguez struct ath_hw {
753f9f84e96SFelix Fietkau 	struct ath_ops reg_ops;
754f9f84e96SFelix Fietkau 
755c1b976d2SFelix Fietkau 	struct device *dev;
756b002a4a9SLuis R. Rodriguez 	struct ieee80211_hw *hw;
75727c51f1aSLuis R. Rodriguez 	struct ath_common common;
758203c4805SLuis R. Rodriguez 	struct ath9k_hw_version hw_version;
759203c4805SLuis R. Rodriguez 	struct ath9k_ops_config config;
760203c4805SLuis R. Rodriguez 	struct ath9k_hw_capabilities caps;
761cac4220bSFelix Fietkau 	struct ath9k_channel channels[ATH9K_NUM_CHANNELS];
762203c4805SLuis R. Rodriguez 	struct ath9k_channel *curchan;
763203c4805SLuis R. Rodriguez 
764203c4805SLuis R. Rodriguez 	union {
765203c4805SLuis R. Rodriguez 		struct ar5416_eeprom_def def;
766203c4805SLuis R. Rodriguez 		struct ar5416_eeprom_4k map4k;
767475f5989SLuis R. Rodriguez 		struct ar9287_eeprom map9287;
76815c9ee7aSSenthil Balasubramanian 		struct ar9300_eeprom ar9300_eep;
769203c4805SLuis R. Rodriguez 	} eeprom;
770203c4805SLuis R. Rodriguez 	const struct eeprom_ops *eep_ops;
771203c4805SLuis R. Rodriguez 
772e6510b11SChun-Yeow Yeoh 	bool sw_mgmt_crypto_tx;
773e6510b11SChun-Yeow Yeoh 	bool sw_mgmt_crypto_rx;
774203c4805SLuis R. Rodriguez 	bool is_pciexpress;
775d4930086SStanislaw Gruszka 	bool aspm_enabled;
7765f841b41SRajkumar Manoharan 	bool is_monitoring;
7772eb46d9bSPavel Roskin 	bool need_an_top2_fixup;
778203c4805SLuis R. Rodriguez 	u16 tx_trig_level;
779f2552e28SFelix Fietkau 
780bbacee13SFelix Fietkau 	u32 nf_regs[6];
781f2552e28SFelix Fietkau 	struct ath_nf_limits nf_2g;
782f2552e28SFelix Fietkau 	struct ath_nf_limits nf_5g;
783203c4805SLuis R. Rodriguez 	u16 rfsilent;
784203c4805SLuis R. Rodriguez 	u32 rfkill_gpio;
785203c4805SLuis R. Rodriguez 	u32 rfkill_polarity;
786203c4805SLuis R. Rodriguez 	u32 ah_flags;
787203c4805SLuis R. Rodriguez 
788ceb26a60SFelix Fietkau 	bool reset_power_on;
789d7e7d229SLuis R. Rodriguez 	bool htc_reset_init;
790d7e7d229SLuis R. Rodriguez 
791203c4805SLuis R. Rodriguez 	enum nl80211_iftype opmode;
792203c4805SLuis R. Rodriguez 	enum ath9k_power_mode power_mode;
793203c4805SLuis R. Rodriguez 
794f23fba49SFelix Fietkau 	s8 noise;
79520bd2a09SFelix Fietkau 	struct ath9k_hw_cal_data *caldata;
796a13883b0SSujith 	struct ath9k_pacal_info pacal_info;
797203c4805SLuis R. Rodriguez 	struct ar5416Stats stats;
798203c4805SLuis R. Rodriguez 	struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES];
799203c4805SLuis R. Rodriguez 
8003069168cSPavel Roskin 	enum ath9k_int imask;
80174bad5cbSPavel Roskin 	u32 imrs2_reg;
802203c4805SLuis R. Rodriguez 	u32 txok_interrupt_mask;
803203c4805SLuis R. Rodriguez 	u32 txerr_interrupt_mask;
804203c4805SLuis R. Rodriguez 	u32 txdesc_interrupt_mask;
805203c4805SLuis R. Rodriguez 	u32 txeol_interrupt_mask;
806203c4805SLuis R. Rodriguez 	u32 txurn_interrupt_mask;
807e8fe7336SRajkumar Manoharan 	atomic_t intr_ref_cnt;
808203c4805SLuis R. Rodriguez 	bool chip_fullsleep;
8095f0c04eaSRajkumar Manoharan 	u32 modes_index;
810203c4805SLuis R. Rodriguez 
811203c4805SLuis R. Rodriguez 	/* Calibration */
8126497827fSFelix Fietkau 	u32 supp_cals;
813cbfe9468SSujith 	struct ath9k_cal_list iq_caldata;
814cbfe9468SSujith 	struct ath9k_cal_list adcgain_caldata;
815cbfe9468SSujith 	struct ath9k_cal_list adcdc_caldata;
816cbfe9468SSujith 	struct ath9k_cal_list *cal_list;
817cbfe9468SSujith 	struct ath9k_cal_list *cal_list_last;
818cbfe9468SSujith 	struct ath9k_cal_list *cal_list_curr;
819203c4805SLuis R. Rodriguez #define totalPowerMeasI meas0.unsign
820203c4805SLuis R. Rodriguez #define totalPowerMeasQ meas1.unsign
821203c4805SLuis R. Rodriguez #define totalIqCorrMeas meas2.sign
822203c4805SLuis R. Rodriguez #define totalAdcIOddPhase  meas0.unsign
823203c4805SLuis R. Rodriguez #define totalAdcIEvenPhase meas1.unsign
824203c4805SLuis R. Rodriguez #define totalAdcQOddPhase  meas2.unsign
825203c4805SLuis R. Rodriguez #define totalAdcQEvenPhase meas3.unsign
826203c4805SLuis R. Rodriguez #define totalAdcDcOffsetIOddPhase  meas0.sign
827203c4805SLuis R. Rodriguez #define totalAdcDcOffsetIEvenPhase meas1.sign
828203c4805SLuis R. Rodriguez #define totalAdcDcOffsetQOddPhase  meas2.sign
829203c4805SLuis R. Rodriguez #define totalAdcDcOffsetQEvenPhase meas3.sign
830203c4805SLuis R. Rodriguez 	union {
831203c4805SLuis R. Rodriguez 		u32 unsign[AR5416_MAX_CHAINS];
832203c4805SLuis R. Rodriguez 		int32_t sign[AR5416_MAX_CHAINS];
833203c4805SLuis R. Rodriguez 	} meas0;
834203c4805SLuis R. Rodriguez 	union {
835203c4805SLuis R. Rodriguez 		u32 unsign[AR5416_MAX_CHAINS];
836203c4805SLuis R. Rodriguez 		int32_t sign[AR5416_MAX_CHAINS];
837203c4805SLuis R. Rodriguez 	} meas1;
838203c4805SLuis R. Rodriguez 	union {
839203c4805SLuis R. Rodriguez 		u32 unsign[AR5416_MAX_CHAINS];
840203c4805SLuis R. Rodriguez 		int32_t sign[AR5416_MAX_CHAINS];
841203c4805SLuis R. Rodriguez 	} meas2;
842203c4805SLuis R. Rodriguez 	union {
843203c4805SLuis R. Rodriguez 		u32 unsign[AR5416_MAX_CHAINS];
844203c4805SLuis R. Rodriguez 		int32_t sign[AR5416_MAX_CHAINS];
845203c4805SLuis R. Rodriguez 	} meas3;
846203c4805SLuis R. Rodriguez 	u16 cal_samples;
8478ad74c4dSRajkumar Manoharan 	u8 enabled_cals;
848203c4805SLuis R. Rodriguez 
849203c4805SLuis R. Rodriguez 	u32 sta_id1_defaults;
850203c4805SLuis R. Rodriguez 	u32 misc_mode;
851203c4805SLuis R. Rodriguez 
852d70357d5SLuis R. Rodriguez 	/* Private to hardware code */
853d70357d5SLuis R. Rodriguez 	struct ath_hw_private_ops private_ops;
854d70357d5SLuis R. Rodriguez 	/* Accessed by the lower level driver */
855d70357d5SLuis R. Rodriguez 	struct ath_hw_ops ops;
856d70357d5SLuis R. Rodriguez 
857e68a060bSLuis R. Rodriguez 	/* Used to program the radio on non single-chip devices */
858203c4805SLuis R. Rodriguez 	u32 *analogBank6Data;
859203c4805SLuis R. Rodriguez 
860e239d859SFelix Fietkau 	int coverage_class;
861203c4805SLuis R. Rodriguez 	u32 slottime;
862203c4805SLuis R. Rodriguez 	u32 globaltxtimeout;
863203c4805SLuis R. Rodriguez 
864203c4805SLuis R. Rodriguez 	/* ANI */
865203c4805SLuis R. Rodriguez 	u32 aniperiod;
866203c4805SLuis R. Rodriguez 	enum ath9k_ani_cmd ani_function;
867424749c7SRajkumar Manoharan 	u32 ani_skip_count;
868c24bd362SSujith Manoharan 	struct ar5416AniState ani;
869203c4805SLuis R. Rodriguez 
870dbccdd1dSSujith Manoharan #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
871766ec4a9SLuis R. Rodriguez 	struct ath_btcoex_hw btcoex_hw;
872dbccdd1dSSujith Manoharan #endif
873af03abecSLuis R. Rodriguez 
874203c4805SLuis R. Rodriguez 	u32 intr_txqs;
875203c4805SLuis R. Rodriguez 	u8 txchainmask;
876203c4805SLuis R. Rodriguez 	u8 rxchainmask;
877203c4805SLuis R. Rodriguez 
878c5d0855aSFelix Fietkau 	struct ath_hw_radar_conf radar_conf;
879c5d0855aSFelix Fietkau 
880203c4805SLuis R. Rodriguez 	u32 originalGain[22];
881203c4805SLuis R. Rodriguez 	int initPDADC;
882203c4805SLuis R. Rodriguez 	int PDADCdelta;
8836de66dd9SFelix Fietkau 	int led_pin;
884691680b8SFelix Fietkau 	u32 gpio_mask;
885691680b8SFelix Fietkau 	u32 gpio_val;
886203c4805SLuis R. Rodriguez 
8874a878b9fSSujith Manoharan 	struct ar5416IniArray ini_dfs;
888203c4805SLuis R. Rodriguez 	struct ar5416IniArray iniModes;
889203c4805SLuis R. Rodriguez 	struct ar5416IniArray iniCommon;
890203c4805SLuis R. Rodriguez 	struct ar5416IniArray iniBB_RfGain;
891203c4805SLuis R. Rodriguez 	struct ar5416IniArray iniBank6;
892203c4805SLuis R. Rodriguez 	struct ar5416IniArray iniAddac;
893203c4805SLuis R. Rodriguez 	struct ar5416IniArray iniPcieSerdes;
89413ce3e99SLuis R. Rodriguez 	struct ar5416IniArray iniPcieSerdesLowPower;
895c7d36f9fSFelix Fietkau 	struct ar5416IniArray iniModesFastClock;
896c7d36f9fSFelix Fietkau 	struct ar5416IniArray iniAdditional;
897203c4805SLuis R. Rodriguez 	struct ar5416IniArray iniModesRxGain;
8988bc45c6bSGabor Juhos 	struct ar5416IniArray ini_modes_rx_gain_bounds;
899203c4805SLuis R. Rodriguez 	struct ar5416IniArray iniModesTxGain;
900193cd458SSujith 	struct ar5416IniArray iniCckfirNormal;
901193cd458SSujith 	struct ar5416IniArray iniCckfirJapan2484;
90270807e99SSujith 	struct ar5416IniArray iniModes_9271_ANI_reg;
903ce407afcSSenthil Balasubramanian 	struct ar5416IniArray ini_radio_post_sys2ant;
90451dbd0a8SSujith Manoharan 	struct ar5416IniArray ini_modes_rxgain_5g_xlna;
905c177fabeSSujith Manoharan 	struct ar5416IniArray ini_modes_rxgain_bb_core;
906c177fabeSSujith Manoharan 	struct ar5416IniArray ini_modes_rxgain_bb_postamble;
907ff155a45SVasanthakumar Thiagarajan 
90813ce3e99SLuis R. Rodriguez 	struct ar5416IniArray iniMac[ATH_INI_NUM_SPLIT];
90913ce3e99SLuis R. Rodriguez 	struct ar5416IniArray iniBB[ATH_INI_NUM_SPLIT];
91013ce3e99SLuis R. Rodriguez 	struct ar5416IniArray iniRadio[ATH_INI_NUM_SPLIT];
91113ce3e99SLuis R. Rodriguez 	struct ar5416IniArray iniSOC[ATH_INI_NUM_SPLIT];
91213ce3e99SLuis R. Rodriguez 
913ff155a45SVasanthakumar Thiagarajan 	u32 intr_gen_timer_trigger;
914ff155a45SVasanthakumar Thiagarajan 	u32 intr_gen_timer_thresh;
915ff155a45SVasanthakumar Thiagarajan 	struct ath_gen_timer_table hw_gen_timers;
916744d4025SVasanthakumar Thiagarajan 
917744d4025SVasanthakumar Thiagarajan 	struct ar9003_txs *ts_ring;
918744d4025SVasanthakumar Thiagarajan 	u32 ts_paddr_start;
919744d4025SVasanthakumar Thiagarajan 	u32 ts_paddr_end;
920744d4025SVasanthakumar Thiagarajan 	u16 ts_tail;
921016c2177SRajkumar Manoharan 	u16 ts_size;
922aea702b7SLuis R. Rodriguez 
923aea702b7SLuis R. Rodriguez 	u32 bb_watchdog_last_status;
924aea702b7SLuis R. Rodriguez 	u32 bb_watchdog_timeout_ms; /* in ms, 0 to disable */
92551ac8cbbSRajkumar Manoharan 	u8 bb_hang_rx_ofdm; /* true if bb hang due to rx_ofdm */
926717f6bedSFelix Fietkau 
9271bf38661SFelix Fietkau 	unsigned int paprd_target_power;
9281bf38661SFelix Fietkau 	unsigned int paprd_training_power;
9297072bf62SVasanthakumar Thiagarajan 	unsigned int paprd_ratemask;
930f1a8abb0SFelix Fietkau 	unsigned int paprd_ratemask_ht40;
93145ef6a0bSVasanthakumar Thiagarajan 	bool paprd_table_write_done;
932717f6bedSFelix Fietkau 	u32 paprd_gain_table_entries[PAPRD_GAIN_TABLE_ENTRIES];
933717f6bedSFelix Fietkau 	u8 paprd_gain_table_index[PAPRD_GAIN_TABLE_ENTRIES];
9349a658d2bSLuis R. Rodriguez 	/*
9359a658d2bSLuis R. Rodriguez 	 * Store the permanent value of Reg 0x4004in WARegVal
9369a658d2bSLuis R. Rodriguez 	 * so we dont have to R/M/W. We should not be reading
9379a658d2bSLuis R. Rodriguez 	 * this register when in sleep states.
9389a658d2bSLuis R. Rodriguez 	 */
9399a658d2bSLuis R. Rodriguez 	u32 WARegVal;
9406ee63f55SSenthil Balasubramanian 
9416ee63f55SSenthil Balasubramanian 	/* Enterprise mode cap */
9426ee63f55SSenthil Balasubramanian 	u32 ent_mode;
943f2f5f2a1SVasanthakumar Thiagarajan 
944e60001e7SSujith Manoharan #ifdef CONFIG_ATH9K_WOW
94541fe8837SSujith Manoharan 	struct ath9k_hw_wow wow;
94601c78533SMohammed Shafi Shajakhan #endif
947f2f5f2a1SVasanthakumar Thiagarajan 	bool is_clk_25mhz;
9483762561aSGabor Juhos 	int (*get_mac_revision)(void);
9497d95847cSGabor Juhos 	int (*external_reset)(void);
9503468968eSFelix Fietkau 	bool disable_2ghz;
9513468968eSFelix Fietkau 	bool disable_5ghz;
952ab5c4f71SGabor Juhos 
953ab5c4f71SGabor Juhos 	const struct firmware *eeprom_blob;
954c774d57fSLorenzo Bianconi 
955c774d57fSLorenzo Bianconi 	struct ath_dynack dynack;
95623f53dd3SLorenzo Bianconi 
95723f53dd3SLorenzo Bianconi 	bool tpc_enabled;
95823f53dd3SLorenzo Bianconi 	u8 tx_power[Ar5416RateSize];
95923f53dd3SLorenzo Bianconi 	u8 tx_power_stbc[Ar5416RateSize];
960203c4805SLuis R. Rodriguez };
961203c4805SLuis R. Rodriguez 
9620cb9e06bSFelix Fietkau struct ath_bus_ops {
9630cb9e06bSFelix Fietkau 	enum ath_bus_type ath_bus_type;
9640cb9e06bSFelix Fietkau 	void (*read_cachesize)(struct ath_common *common, int *csz);
9650cb9e06bSFelix Fietkau 	bool (*eeprom_read)(struct ath_common *common, u32 off, u16 *data);
9660cb9e06bSFelix Fietkau 	void (*bt_coex_prep)(struct ath_common *common);
967d4930086SStanislaw Gruszka 	void (*aspm_init)(struct ath_common *common);
9680cb9e06bSFelix Fietkau };
9690cb9e06bSFelix Fietkau 
9709e4bffd2SLuis R. Rodriguez static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah)
9719e4bffd2SLuis R. Rodriguez {
9729e4bffd2SLuis R. Rodriguez 	return &ah->common;
9739e4bffd2SLuis R. Rodriguez }
9749e4bffd2SLuis R. Rodriguez 
9759e4bffd2SLuis R. Rodriguez static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah)
9769e4bffd2SLuis R. Rodriguez {
9779e4bffd2SLuis R. Rodriguez 	return &(ath9k_hw_common(ah)->regulatory);
9789e4bffd2SLuis R. Rodriguez }
9799e4bffd2SLuis R. Rodriguez 
980d70357d5SLuis R. Rodriguez static inline struct ath_hw_private_ops *ath9k_hw_private_ops(struct ath_hw *ah)
981d70357d5SLuis R. Rodriguez {
982d70357d5SLuis R. Rodriguez 	return &ah->private_ops;
983d70357d5SLuis R. Rodriguez }
984d70357d5SLuis R. Rodriguez 
985d70357d5SLuis R. Rodriguez static inline struct ath_hw_ops *ath9k_hw_ops(struct ath_hw *ah)
986d70357d5SLuis R. Rodriguez {
987d70357d5SLuis R. Rodriguez 	return &ah->ops;
988d70357d5SLuis R. Rodriguez }
989d70357d5SLuis R. Rodriguez 
990895ad7ebSVasanthakumar Thiagarajan static inline u8 get_streams(int mask)
991895ad7ebSVasanthakumar Thiagarajan {
992895ad7ebSVasanthakumar Thiagarajan 	return !!(mask & BIT(0)) + !!(mask & BIT(1)) + !!(mask & BIT(2));
993895ad7ebSVasanthakumar Thiagarajan }
994895ad7ebSVasanthakumar Thiagarajan 
995f637cfd6SLuis R. Rodriguez /* Initialization, Detach, Reset */
996285f2ddaSSujith void ath9k_hw_deinit(struct ath_hw *ah);
997f637cfd6SLuis R. Rodriguez int ath9k_hw_init(struct ath_hw *ah);
998203c4805SLuis R. Rodriguez int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
999caed6579SSujith Manoharan 		   struct ath9k_hw_cal_data *caldata, bool fastcc);
1000a9a29ce6SGabor Juhos int ath9k_hw_fill_cap_info(struct ath_hw *ah);
10018fe65368SLuis R. Rodriguez u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan);
1002203c4805SLuis R. Rodriguez 
1003203c4805SLuis R. Rodriguez /* GPIO / RFKILL / Antennae */
1004203c4805SLuis R. Rodriguez void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio);
1005203c4805SLuis R. Rodriguez u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio);
1006203c4805SLuis R. Rodriguez void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio,
1007203c4805SLuis R. Rodriguez 			 u32 ah_signal_type);
1008203c4805SLuis R. Rodriguez void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val);
1009203c4805SLuis R. Rodriguez void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
1010203c4805SLuis R. Rodriguez 
1011203c4805SLuis R. Rodriguez /* General Operation */
10127c5adc8dSFelix Fietkau void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan,
10137c5adc8dSFelix Fietkau 			  int hw_delay);
1014203c4805SLuis R. Rodriguez bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
10150166b4beSFelix Fietkau void ath9k_hw_write_array(struct ath_hw *ah, const struct ar5416IniArray *array,
1016a9b6b256SFelix Fietkau 			  int column, unsigned int *writecnt);
1017203c4805SLuis R. Rodriguez u32 ath9k_hw_reverse_bits(u32 val, u32 n);
10184f0fc7c3SLuis R. Rodriguez u16 ath9k_hw_computetxtime(struct ath_hw *ah,
1019545750d3SFelix Fietkau 			   u8 phy, int kbps,
1020203c4805SLuis R. Rodriguez 			   u32 frameLen, u16 rateix, bool shortPreamble);
1021203c4805SLuis R. Rodriguez void ath9k_hw_get_channel_centers(struct ath_hw *ah,
1022203c4805SLuis R. Rodriguez 				  struct ath9k_channel *chan,
1023203c4805SLuis R. Rodriguez 				  struct chan_centers *centers);
1024203c4805SLuis R. Rodriguez u32 ath9k_hw_getrxfilter(struct ath_hw *ah);
1025203c4805SLuis R. Rodriguez void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits);
1026203c4805SLuis R. Rodriguez bool ath9k_hw_phy_disable(struct ath_hw *ah);
1027203c4805SLuis R. Rodriguez bool ath9k_hw_disable(struct ath_hw *ah);
1028de40f316SFelix Fietkau void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test);
1029203c4805SLuis R. Rodriguez void ath9k_hw_setopmode(struct ath_hw *ah);
1030203c4805SLuis R. Rodriguez void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1);
1031f2b2143eSLuis R. Rodriguez void ath9k_hw_write_associd(struct ath_hw *ah);
1032dd347f2fSFelix Fietkau u32 ath9k_hw_gettsf32(struct ath_hw *ah);
1033203c4805SLuis R. Rodriguez u64 ath9k_hw_gettsf64(struct ath_hw *ah);
1034203c4805SLuis R. Rodriguez void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64);
1035203c4805SLuis R. Rodriguez void ath9k_hw_reset_tsf(struct ath_hw *ah);
10368d7e09ddSFelix Fietkau u32 ath9k_hw_get_tsf_offset(struct timespec *last, struct timespec *cur);
103760ca9f87SSujith Manoharan void ath9k_hw_set_tsfadjust(struct ath_hw *ah, bool set);
10380005baf4SFelix Fietkau void ath9k_hw_init_global_settings(struct ath_hw *ah);
1039b84628ebSSenthil Balasubramanian u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah);
1040e4744ec7SFelix Fietkau void ath9k_hw_set11nmac2040(struct ath_hw *ah, struct ath9k_channel *chan);
1041203c4805SLuis R. Rodriguez void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period);
1042203c4805SLuis R. Rodriguez void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
1043203c4805SLuis R. Rodriguez 				    const struct ath9k_beacon_state *bs);
10441e516ca7SSujith Manoharan void ath9k_hw_check_nav(struct ath_hw *ah);
1045c9c99e5eSFelix Fietkau bool ath9k_hw_check_alive(struct ath_hw *ah);
1046a91d75aeSLuis R. Rodriguez 
10479ecdef4bSLuis R. Rodriguez bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
1048a91d75aeSLuis R. Rodriguez 
1049ff155a45SVasanthakumar Thiagarajan /* Generic hw timer primitives */
1050ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
1051ff155a45SVasanthakumar Thiagarajan 					  void (*trigger)(void *),
1052ff155a45SVasanthakumar Thiagarajan 					  void (*overflow)(void *),
1053ff155a45SVasanthakumar Thiagarajan 					  void *arg,
1054ff155a45SVasanthakumar Thiagarajan 					  u8 timer_index);
1055cd9bf689SLuis R. Rodriguez void ath9k_hw_gen_timer_start(struct ath_hw *ah,
1056cd9bf689SLuis R. Rodriguez 			      struct ath_gen_timer *timer,
1057cd9bf689SLuis R. Rodriguez 			      u32 timer_next,
1058cd9bf689SLuis R. Rodriguez 			      u32 timer_period);
1059f4c34af4SSujith Manoharan void ath9k_hw_gen_timer_start_tsf2(struct ath_hw *ah);
1060cd9bf689SLuis R. Rodriguez void ath9k_hw_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer);
1061cd9bf689SLuis R. Rodriguez 
1062ff155a45SVasanthakumar Thiagarajan void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer);
1063ff155a45SVasanthakumar Thiagarajan void ath_gen_timer_isr(struct ath_hw *hw);
1064ff155a45SVasanthakumar Thiagarajan 
1065f934c4d9SLuis R. Rodriguez void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len);
10662da4f01aSLuis R. Rodriguez 
10678fe65368SLuis R. Rodriguez /* PHY */
10688fe65368SLuis R. Rodriguez void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
10698fe65368SLuis R. Rodriguez 				   u32 *coef_mantissa, u32 *coef_exponent);
107064ea57d0SGabor Juhos void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan,
107164ea57d0SGabor Juhos 			    bool test);
10728fe65368SLuis R. Rodriguez 
1073ebd5a14aSLuis R. Rodriguez /*
1074ebd5a14aSLuis R. Rodriguez  * Code Specific to AR5008, AR9001 or AR9002,
1075ebd5a14aSLuis R. Rodriguez  * we stuff these here to avoid callbacks for AR9003.
1076ebd5a14aSLuis R. Rodriguez  */
1077ebd5a14aSLuis R. Rodriguez int ar9002_hw_rf_claim(struct ath_hw *ah);
107878ec2677SLuis R. Rodriguez void ar9002_hw_enable_async_fifo(struct ath_hw *ah);
1079d8f492b7SLuis R. Rodriguez 
1080641d9921SFelix Fietkau /*
1081aea702b7SLuis R. Rodriguez  * Code specific to AR9003, we stuff these here to avoid callbacks
1082641d9921SFelix Fietkau  * for older families
1083641d9921SFelix Fietkau  */
1084d88527d3SSujith Manoharan bool ar9003_hw_bb_watchdog_check(struct ath_hw *ah);
1085aea702b7SLuis R. Rodriguez void ar9003_hw_bb_watchdog_config(struct ath_hw *ah);
1086aea702b7SLuis R. Rodriguez void ar9003_hw_bb_watchdog_read(struct ath_hw *ah);
1087aea702b7SLuis R. Rodriguez void ar9003_hw_bb_watchdog_dbg_info(struct ath_hw *ah);
108851ac8cbbSRajkumar Manoharan void ar9003_hw_disable_phy_restart(struct ath_hw *ah);
1089717f6bedSFelix Fietkau void ar9003_paprd_enable(struct ath_hw *ah, bool val);
1090717f6bedSFelix Fietkau void ar9003_paprd_populate_single_table(struct ath_hw *ah,
109120bd2a09SFelix Fietkau 					struct ath9k_hw_cal_data *caldata,
1092717f6bedSFelix Fietkau 					int chain);
109320bd2a09SFelix Fietkau int ar9003_paprd_create_curve(struct ath_hw *ah,
109420bd2a09SFelix Fietkau 			      struct ath9k_hw_cal_data *caldata, int chain);
109536d2943bSSujith Manoharan void ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain);
1096717f6bedSFelix Fietkau int ar9003_paprd_init_table(struct ath_hw *ah);
1097717f6bedSFelix Fietkau bool ar9003_paprd_is_done(struct ath_hw *ah);
10980f21ee8dSSujith Manoharan bool ar9003_is_paprd_enabled(struct ath_hw *ah);
10994a8f1995SFelix Fietkau void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx);
110023f53dd3SLorenzo Bianconi void ar9003_hw_init_rate_txpower(struct ath_hw *ah, u8 *rate_array,
110123f53dd3SLorenzo Bianconi 				 struct ath9k_channel *chan);
1102c08267dcSLorenzo Bianconi void ar5008_hw_init_rate_txpower(struct ath_hw *ah, int16_t *rate_array,
1103c08267dcSLorenzo Bianconi 				 struct ath9k_channel *chan, int ht40_delta);
1104641d9921SFelix Fietkau 
1105641d9921SFelix Fietkau /* Hardware family op attach helpers */
1106c1b976d2SFelix Fietkau int ar5008_hw_attach_phy_ops(struct ath_hw *ah);
11078525f280SLuis R. Rodriguez void ar9002_hw_attach_phy_ops(struct ath_hw *ah);
11088525f280SLuis R. Rodriguez void ar9003_hw_attach_phy_ops(struct ath_hw *ah);
11098fe65368SLuis R. Rodriguez 
1110795f5e2cSLuis R. Rodriguez void ar9002_hw_attach_calib_ops(struct ath_hw *ah);
1111795f5e2cSLuis R. Rodriguez void ar9003_hw_attach_calib_ops(struct ath_hw *ah);
1112795f5e2cSLuis R. Rodriguez 
1113c1b976d2SFelix Fietkau int ar9002_hw_attach_ops(struct ath_hw *ah);
1114b3950e6aSLuis R. Rodriguez void ar9003_hw_attach_ops(struct ath_hw *ah);
1115b3950e6aSLuis R. Rodriguez 
1116c2ba3342SRajkumar Manoharan void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan);
11176790ae7aSFelix Fietkau 
11188eb4980cSFelix Fietkau void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning);
111995792178SFelix Fietkau void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan);
1120ac0bb767SLuis R. Rodriguez 
11218e15e094SLorenzo Bianconi void ath9k_hw_set_ack_timeout(struct ath_hw *ah, u32 us);
11228e15e094SLorenzo Bianconi void ath9k_hw_set_cts_timeout(struct ath_hw *ah, u32 us);
11238e15e094SLorenzo Bianconi void ath9k_hw_setslottime(struct ath_hw *ah, u32 us);
11248e15e094SLorenzo Bianconi 
11258a309305SFelix Fietkau #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
1126dbccdd1dSSujith Manoharan static inline bool ath9k_hw_btcoex_is_enabled(struct ath_hw *ah)
1127dbccdd1dSSujith Manoharan {
1128dbccdd1dSSujith Manoharan 	return ah->btcoex_hw.enabled;
1129dbccdd1dSSujith Manoharan }
11305955b2b0SSujith Manoharan static inline bool ath9k_hw_mci_is_enabled(struct ath_hw *ah)
11315955b2b0SSujith Manoharan {
1132e1ecad78SRajkumar Manoharan 	return ah->common.btcoex_enabled &&
1133e1ecad78SRajkumar Manoharan 	       (ah->caps.hw_caps & ATH9K_HW_CAP_MCI);
11345955b2b0SSujith Manoharan 
11355955b2b0SSujith Manoharan }
1136dbccdd1dSSujith Manoharan void ath9k_hw_btcoex_enable(struct ath_hw *ah);
11378a309305SFelix Fietkau static inline enum ath_btcoex_scheme
11388a309305SFelix Fietkau ath9k_hw_get_btcoex_scheme(struct ath_hw *ah)
11398a309305SFelix Fietkau {
11408a309305SFelix Fietkau 	return ah->btcoex_hw.scheme;
11418a309305SFelix Fietkau }
11428a309305SFelix Fietkau #else
1143dbccdd1dSSujith Manoharan static inline bool ath9k_hw_btcoex_is_enabled(struct ath_hw *ah)
1144dbccdd1dSSujith Manoharan {
1145dbccdd1dSSujith Manoharan 	return false;
1146dbccdd1dSSujith Manoharan }
11475955b2b0SSujith Manoharan static inline bool ath9k_hw_mci_is_enabled(struct ath_hw *ah)
11485955b2b0SSujith Manoharan {
11495955b2b0SSujith Manoharan 	return false;
11505955b2b0SSujith Manoharan }
1151dbccdd1dSSujith Manoharan static inline void ath9k_hw_btcoex_enable(struct ath_hw *ah)
1152dbccdd1dSSujith Manoharan {
1153dbccdd1dSSujith Manoharan }
1154dbccdd1dSSujith Manoharan static inline enum ath_btcoex_scheme
1155dbccdd1dSSujith Manoharan ath9k_hw_get_btcoex_scheme(struct ath_hw *ah)
1156dbccdd1dSSujith Manoharan {
1157dbccdd1dSSujith Manoharan 	return ATH_BTCOEX_CFG_NONE;
1158dbccdd1dSSujith Manoharan }
115964ab38dfSSujith Manoharan #endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */
11608a309305SFelix Fietkau 
116164875c63SMohammed Shafi Shajakhan 
1162e60001e7SSujith Manoharan #ifdef CONFIG_ATH9K_WOW
11636af75e4dSSujith Manoharan int ath9k_hw_wow_apply_pattern(struct ath_hw *ah, u8 *user_pattern,
116464875c63SMohammed Shafi Shajakhan 			       u8 *user_mask, int pattern_count,
116564875c63SMohammed Shafi Shajakhan 			       int pattern_len);
116664875c63SMohammed Shafi Shajakhan u32 ath9k_hw_wow_wakeup(struct ath_hw *ah);
116764875c63SMohammed Shafi Shajakhan void ath9k_hw_wow_enable(struct ath_hw *ah, u32 pattern_enable);
116864875c63SMohammed Shafi Shajakhan #else
11696af75e4dSSujith Manoharan static inline int ath9k_hw_wow_apply_pattern(struct ath_hw *ah,
117064875c63SMohammed Shafi Shajakhan 					     u8 *user_pattern,
117164875c63SMohammed Shafi Shajakhan 					     u8 *user_mask,
117264875c63SMohammed Shafi Shajakhan 					     int pattern_count,
117364875c63SMohammed Shafi Shajakhan 					     int pattern_len)
117464875c63SMohammed Shafi Shajakhan {
11756af75e4dSSujith Manoharan 	return 0;
117664875c63SMohammed Shafi Shajakhan }
117764875c63SMohammed Shafi Shajakhan static inline u32 ath9k_hw_wow_wakeup(struct ath_hw *ah)
117864875c63SMohammed Shafi Shajakhan {
117964875c63SMohammed Shafi Shajakhan 	return 0;
118064875c63SMohammed Shafi Shajakhan }
118164875c63SMohammed Shafi Shajakhan static inline void ath9k_hw_wow_enable(struct ath_hw *ah, u32 pattern_enable)
118264875c63SMohammed Shafi Shajakhan {
118364875c63SMohammed Shafi Shajakhan }
118464875c63SMohammed Shafi Shajakhan #endif
118564875c63SMohammed Shafi Shajakhan 
118673377256SLuis R. Rodriguez #define ATH9K_CLOCK_RATE_CCK		22
118773377256SLuis R. Rodriguez #define ATH9K_CLOCK_RATE_5GHZ_OFDM	40
118873377256SLuis R. Rodriguez #define ATH9K_CLOCK_RATE_2GHZ_OFDM	44
118973377256SLuis R. Rodriguez #define ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM 44
119073377256SLuis R. Rodriguez 
1191203c4805SLuis R. Rodriguez #endif
1192