blob: c5b684622ed666a3919d7172cc735dedbbd54d71 [file] [log] [blame]
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001/*
Jes Sorenseneb188062016-04-14 16:37:14 -04002 * Copyright (c) 2014 - 2016 Jes Sorensen <Jes.Sorensen@redhat.com>
Jes Sorensen26f1fad2015-10-14 20:44:51 -04003 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * Register definitions taken from original Realtek rtl8723au driver
14 */
15
16#include <asm/byteorder.h>
17
18#define RTL8XXXU_DEBUG_REG_WRITE 0x01
19#define RTL8XXXU_DEBUG_REG_READ 0x02
20#define RTL8XXXU_DEBUG_RFREG_WRITE 0x04
21#define RTL8XXXU_DEBUG_RFREG_READ 0x08
22#define RTL8XXXU_DEBUG_CHANNEL 0x10
23#define RTL8XXXU_DEBUG_TX 0x20
24#define RTL8XXXU_DEBUG_TX_DUMP 0x40
25#define RTL8XXXU_DEBUG_RX 0x80
26#define RTL8XXXU_DEBUG_RX_DUMP 0x100
27#define RTL8XXXU_DEBUG_USB 0x200
28#define RTL8XXXU_DEBUG_KEY 0x400
29#define RTL8XXXU_DEBUG_H2C 0x800
30#define RTL8XXXU_DEBUG_ACTION 0x1000
31#define RTL8XXXU_DEBUG_EFUSE 0x2000
32
33#define RTW_USB_CONTROL_MSG_TIMEOUT 500
34#define RTL8XXXU_MAX_REG_POLL 500
35#define USB_INTR_CONTENT_LENGTH 56
36
Jes Sorensen35a741f2016-02-29 17:04:10 -050037#define RTL8XXXU_OUT_ENDPOINTS 4
Jes Sorensen26f1fad2015-10-14 20:44:51 -040038
39#define REALTEK_USB_READ 0xc0
40#define REALTEK_USB_WRITE 0x40
41#define REALTEK_USB_CMD_REQ 0x05
42#define REALTEK_USB_CMD_IDX 0x00
43
44#define TX_TOTAL_PAGE_NUM 0xf8
Jes Sorensen80805aa2016-04-07 14:19:18 -040045#define TX_TOTAL_PAGE_NUM_8192E 0xf3
Jes Sorensen44abaa02016-08-19 17:46:27 -040046#define TX_TOTAL_PAGE_NUM_8723B 0xf7
Jes Sorensen26f1fad2015-10-14 20:44:51 -040047/* (HPQ + LPQ + NPQ + PUBQ) = TX_TOTAL_PAGE_NUM */
48#define TX_PAGE_NUM_PUBQ 0xe7
49#define TX_PAGE_NUM_HI_PQ 0x0c
50#define TX_PAGE_NUM_LO_PQ 0x02
51#define TX_PAGE_NUM_NORM_PQ 0x02
52
Jes Sorensen89c2a092016-04-14 14:58:44 -040053#define TX_PAGE_NUM_PUBQ_8192E 0xe7
54#define TX_PAGE_NUM_HI_PQ_8192E 0x08
55#define TX_PAGE_NUM_LO_PQ_8192E 0x0c
56#define TX_PAGE_NUM_NORM_PQ_8192E 0x00
57
Jes Sorensen44abaa02016-08-19 17:46:27 -040058#define TX_PAGE_NUM_PUBQ_8723B 0xe7
59#define TX_PAGE_NUM_HI_PQ_8723B 0x0c
60#define TX_PAGE_NUM_LO_PQ_8723B 0x02
61#define TX_PAGE_NUM_NORM_PQ_8723B 0x02
62
Jes Sorensen26f1fad2015-10-14 20:44:51 -040063#define RTL_FW_PAGE_SIZE 4096
64#define RTL8XXXU_FIRMWARE_POLL_MAX 1000
65
66#define RTL8723A_CHANNEL_GROUPS 3
67#define RTL8723A_MAX_RF_PATHS 2
Jes Sorensen21db9972016-02-29 17:05:21 -050068#define RTL8723B_CHANNEL_GROUPS 6
Jes Sorensen3be26992016-02-29 17:05:22 -050069#define RTL8723B_TX_COUNT 4
Jes Sorensen4a0d7db2016-02-29 17:05:18 -050070#define RTL8723B_MAX_RF_PATHS 4
Jes Sorensen21db9972016-02-29 17:05:21 -050071#define RTL8XXXU_MAX_CHANNEL_GROUPS 6
Jes Sorensen26f1fad2015-10-14 20:44:51 -040072#define RF6052_MAX_TX_PWR 0x3f
73
Jes Sorensen3307d842016-02-29 17:03:59 -050074#define EFUSE_MAP_LEN 512
75#define EFUSE_MAX_SECTION_8723A 64
Jes Sorensen26f1fad2015-10-14 20:44:51 -040076#define EFUSE_REAL_CONTENT_LEN_8723A 512
77#define EFUSE_BT_MAP_LEN_8723A 1024
78#define EFUSE_MAX_WORD_UNIT 4
79
Jes Sorensenba17d822016-03-31 17:08:39 -040080enum rtl8xxxu_rtl_chip {
81 RTL8192S = 0x81920,
82 RTL8191S = 0x81910,
83 RTL8192C = 0x8192c,
84 RTL8191C = 0x8191c,
85 RTL8188C = 0x8188c,
86 RTL8188R = 0x81889,
87 RTL8192D = 0x8192d,
88 RTL8723A = 0x8723a,
89 RTL8188E = 0x8188e,
90 RTL8812 = 0x88120,
91 RTL8821 = 0x88210,
92 RTL8192E = 0x8192e,
93 RTL8191E = 0x8191e,
94 RTL8723B = 0x8723b,
95 RTL8814A = 0x8814a,
96 RTL8881A = 0x8881a,
97 RTL8821B = 0x8821b,
98 RTL8822B = 0x8822b,
99 RTL8703B = 0x8703b,
100 RTL8195A = 0x8195a,
101 RTL8188F = 0x8188f
102};
103
Jes Sorensenb18cdfd2016-02-29 17:04:47 -0500104enum rtl8xxxu_rx_type {
105 RX_TYPE_DATA_PKT = 0,
106 RX_TYPE_C2H = 1,
107 RX_TYPE_ERROR = -1
108};
109
Jes Sorensena49c7ce2016-04-14 14:58:52 -0400110struct rtl8xxxu_rxdesc16 {
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400111#ifdef __LITTLE_ENDIAN
112 u32 pktlen:14;
113 u32 crc32:1;
114 u32 icverr:1;
115 u32 drvinfo_sz:4;
116 u32 security:3;
117 u32 qos:1;
118 u32 shift:2;
119 u32 phy_stats:1;
120 u32 swdec:1;
121 u32 ls:1;
122 u32 fs:1;
123 u32 eor:1;
124 u32 own:1;
125
126 u32 macid:5;
127 u32 tid:4;
128 u32 hwrsvd:4;
129 u32 amsdu:1;
130 u32 paggr:1;
131 u32 faggr:1;
132 u32 a1fit:4;
133 u32 a2fit:4;
134 u32 pam:1;
135 u32 pwr:1;
136 u32 md:1;
137 u32 mf:1;
138 u32 type:2;
139 u32 mc:1;
140 u32 bc:1;
141
142 u32 seq:12;
143 u32 frag:4;
Jes Sorensen41892722016-06-27 12:32:02 -0400144 u32 pkt_cnt:8;
145 u32 reserved:6;
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400146 u32 nextind:1;
147 u32 reserved0:1;
148
149 u32 rxmcs:6;
150 u32 rxht:1;
151 u32 gf:1;
152 u32 splcp:1;
153 u32 bw:1;
154 u32 htc:1;
155 u32 eosp:1;
156 u32 bssidfit:2;
157 u32 reserved1:16;
158 u32 unicastwake:1;
159 u32 magicwake:1;
160
161 u32 pattern0match:1;
162 u32 pattern1match:1;
163 u32 pattern2match:1;
164 u32 pattern3match:1;
165 u32 pattern4match:1;
166 u32 pattern5match:1;
167 u32 pattern6match:1;
168 u32 pattern7match:1;
169 u32 pattern8match:1;
170 u32 pattern9match:1;
171 u32 patternamatch:1;
172 u32 patternbmatch:1;
173 u32 patterncmatch:1;
174 u32 reserved2:19;
175#else
176 u32 own:1;
177 u32 eor:1;
178 u32 fs:1;
179 u32 ls:1;
180 u32 swdec:1;
181 u32 phy_stats:1;
182 u32 shift:2;
183 u32 qos:1;
184 u32 security:3;
185 u32 drvinfo_sz:4;
186 u32 icverr:1;
187 u32 crc32:1;
188 u32 pktlen:14;
189
190 u32 bc:1;
191 u32 mc:1;
192 u32 type:2;
193 u32 mf:1;
194 u32 md:1;
195 u32 pwr:1;
196 u32 pam:1;
197 u32 a2fit:4;
198 u32 a1fit:4;
199 u32 faggr:1;
200 u32 paggr:1;
201 u32 amsdu:1;
202 u32 hwrsvd:4;
203 u32 tid:4;
204 u32 macid:5;
205
206 u32 reserved0:1;
207 u32 nextind:1;
Jes Sorensen41892722016-06-27 12:32:02 -0400208 u32 reserved:6;
209 u32 pkt_cnt:8;
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400210 u32 frag:4;
211 u32 seq:12;
212
213 u32 magicwake:1;
214 u32 unicastwake:1;
215 u32 reserved1:16;
216 u32 bssidfit:2;
217 u32 eosp:1;
218 u32 htc:1;
219 u32 bw:1;
220 u32 splcp:1;
221 u32 gf:1;
222 u32 rxht:1;
223 u32 rxmcs:6;
224
225 u32 reserved2:19;
226 u32 patterncmatch:1;
227 u32 patternbmatch:1;
228 u32 patternamatch:1;
229 u32 pattern9match:1;
230 u32 pattern8match:1;
231 u32 pattern7match:1;
232 u32 pattern6match:1;
233 u32 pattern5match:1;
234 u32 pattern4match:1;
235 u32 pattern3match:1;
236 u32 pattern2match:1;
237 u32 pattern1match:1;
238 u32 pattern0match:1;
239#endif
240 __le32 tsfl;
241#if 0
242 u32 bassn:12;
243 u32 bavld:1;
244 u32 reserved3:19;
245#endif
246};
247
Jes Sorensena49c7ce2016-04-14 14:58:52 -0400248struct rtl8xxxu_rxdesc24 {
Jes Sorensena6c80d22016-02-29 17:04:46 -0500249#ifdef __LITTLE_ENDIAN
250 u32 pktlen:14;
251 u32 crc32:1;
252 u32 icverr:1;
253 u32 drvinfo_sz:4;
254 u32 security:3;
255 u32 qos:1;
256 u32 shift:2;
257 u32 phy_stats:1;
258 u32 swdec:1;
259 u32 ls:1;
260 u32 fs:1;
261 u32 eor:1;
262 u32 own:1;
263
264 u32 macid:7;
265 u32 dummy1_0:1;
266 u32 tid:4;
267 u32 dummy1_1:1;
268 u32 amsdu:1;
269 u32 rxid_match:1;
270 u32 paggr:1;
271 u32 a1fit:4; /* 16 */
272 u32 chkerr:1;
273 u32 ipver:1;
274 u32 tcpudp:1;
275 u32 chkvld:1;
276 u32 pam:1;
277 u32 pwr:1;
278 u32 more_data:1;
279 u32 more_frag:1;
280 u32 type:2;
281 u32 mc:1;
282 u32 bc:1;
283
284 u32 seq:12;
285 u32 frag:4;
286 u32 rx_is_qos:1; /* 16 */
287 u32 dummy2_0:1;
288 u32 wlanhd_iv_len:6;
289 u32 dummy2_1:4;
290 u32 rpt_sel:1;
291 u32 dummy2_2:3;
292
293 u32 rxmcs:7;
294 u32 dummy3_0:3;
295 u32 htc:1;
296 u32 eosp:1;
297 u32 bssidfit:2;
298 u32 dummy3_1:2;
299 u32 usb_agg_pktnum:8; /* 16 */
300 u32 dummy3_2:5;
301 u32 pattern_match:1;
302 u32 unicast_match:1;
303 u32 magic_match:1;
304
305 u32 splcp:1;
306 u32 ldcp:1;
307 u32 stbc:1;
308 u32 dummy4_0:1;
309 u32 bw:2;
310 u32 dummy4_1:26;
311#else
312 u32 own:1;
313 u32 eor:1;
314 u32 fs:1;
315 u32 ls:1;
316 u32 swdec:1;
317 u32 phy_stats:1;
318 u32 shift:2;
319 u32 qos:1;
320 u32 security:3;
321 u32 drvinfo_sz:4;
322 u32 icverr:1;
323 u32 crc32:1;
324 u32 pktlen:14;
325
326 u32 bc:1;
327 u32 mc:1;
328 u32 type:2;
329 u32 mf:1;
330 u32 md:1;
331 u32 pwr:1;
332 u32 pam:1;
333 u32 a2fit:4;
334 u32 a1fit:4;
335 u32 faggr:1;
336 u32 paggr:1;
337 u32 amsdu:1;
338 u32 hwrsvd:4;
339 u32 tid:4;
340 u32 macid:5;
341
342 u32 dummy2_2:3;
343 u32 rpt_sel:1;
344 u32 dummy2_1:4;
345 u32 wlanhd_iv_len:6;
346 u32 dummy2_0:1;
347 u32 rx_is_qos:1;
348 u32 frag:4; /* 16 */
349 u32 seq:12;
350
351 u32 magic_match:1;
352 u32 unicast_match:1;
353 u32 pattern_match:1;
354 u32 dummy3_2:5;
355 u32 usb_agg_pktnum:8;
356 u32 dummy3_1:2; /* 16 */
357 u32 bssidfit:2;
358 u32 eosp:1;
359 u32 htc:1;
360 u32 dummy3_0:3;
361 u32 rxmcs:7;
362
363 u32 dumm4_1:26;
364 u32 bw:2;
365 u32 dummy4_0:1;
366 u32 stbc:1;
367 u32 ldcp:1;
368 u32 splcp:1;
369#endif
370 __le32 tsfl;
371};
372
Jes Sorensendbb28962016-03-31 17:08:33 -0400373struct rtl8xxxu_txdesc32 {
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400374 __le16 pkt_size;
375 u8 pkt_offset;
376 u8 txdw0;
377 __le32 txdw1;
378 __le32 txdw2;
379 __le32 txdw3;
380 __le32 txdw4;
381 __le32 txdw5;
382 __le32 txdw6;
383 __le16 csum;
384 __le16 txdw7;
385};
386
Jes Sorensendbb28962016-03-31 17:08:33 -0400387struct rtl8xxxu_txdesc40 {
Jes Sorensen80491a12016-02-29 17:05:26 -0500388 __le16 pkt_size;
389 u8 pkt_offset;
390 u8 txdw0;
391 __le32 txdw1;
392 __le32 txdw2;
393 __le32 txdw3;
394 __le32 txdw4;
395 __le32 txdw5;
396 __le32 txdw6;
397 __le16 csum;
398 __le16 txdw7;
399 __le32 txdw8;
400 __le32 txdw9;
401};
402
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400403/* CCK Rates, TxHT = 0 */
404#define DESC_RATE_1M 0x00
405#define DESC_RATE_2M 0x01
406#define DESC_RATE_5_5M 0x02
407#define DESC_RATE_11M 0x03
408
409/* OFDM Rates, TxHT = 0 */
410#define DESC_RATE_6M 0x04
411#define DESC_RATE_9M 0x05
412#define DESC_RATE_12M 0x06
413#define DESC_RATE_18M 0x07
414#define DESC_RATE_24M 0x08
415#define DESC_RATE_36M 0x09
416#define DESC_RATE_48M 0x0a
417#define DESC_RATE_54M 0x0b
418
419/* MCS Rates, TxHT = 1 */
420#define DESC_RATE_MCS0 0x0c
421#define DESC_RATE_MCS1 0x0d
422#define DESC_RATE_MCS2 0x0e
423#define DESC_RATE_MCS3 0x0f
424#define DESC_RATE_MCS4 0x10
425#define DESC_RATE_MCS5 0x11
426#define DESC_RATE_MCS6 0x12
427#define DESC_RATE_MCS7 0x13
428#define DESC_RATE_MCS8 0x14
429#define DESC_RATE_MCS9 0x15
430#define DESC_RATE_MCS10 0x16
431#define DESC_RATE_MCS11 0x17
432#define DESC_RATE_MCS12 0x18
433#define DESC_RATE_MCS13 0x19
434#define DESC_RATE_MCS14 0x1a
435#define DESC_RATE_MCS15 0x1b
436#define DESC_RATE_MCS15_SG 0x1c
437#define DESC_RATE_MCS32 0x20
438
439#define TXDESC_OFFSET_SZ 0
440#define TXDESC_OFFSET_SHT 16
441#if 0
442#define TXDESC_BMC BIT(24)
443#define TXDESC_LSG BIT(26)
444#define TXDESC_FSG BIT(27)
445#define TXDESC_OWN BIT(31)
446#else
447#define TXDESC_BROADMULTICAST BIT(0)
Jes Sorensen02492582016-02-29 17:05:29 -0500448#define TXDESC_HTC BIT(1)
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400449#define TXDESC_LAST_SEGMENT BIT(2)
450#define TXDESC_FIRST_SEGMENT BIT(3)
Jes Sorensen02492582016-02-29 17:05:29 -0500451#define TXDESC_LINIP BIT(4)
452#define TXDESC_NO_ACM BIT(5)
453#define TXDESC_GF BIT(6)
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400454#define TXDESC_OWN BIT(7)
455#endif
456
457/* Word 1 */
Jes Sorensence2d1db2016-02-29 17:05:30 -0500458/*
459 * Bits 0-7 differ dependent on chip generation. For 8723au bits 5/6 are
460 * aggregation enable and break respectively. For 8723bu, bits 0-7 are macid.
461 */
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400462#define TXDESC_PKT_OFFSET_SZ 0
Jes Sorensen33f37242016-03-31 17:08:34 -0400463#define TXDESC32_AGG_ENABLE BIT(5)
464#define TXDESC32_AGG_BREAK BIT(6)
465#define TXDESC40_MACID_SHIFT 0
466#define TXDESC40_MACID_MASK 0x00f0
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400467#define TXDESC_QUEUE_SHIFT 8
468#define TXDESC_QUEUE_MASK 0x1f00
469#define TXDESC_QUEUE_BK 0x2
470#define TXDESC_QUEUE_BE 0x0
471#define TXDESC_QUEUE_VI 0x5
472#define TXDESC_QUEUE_VO 0x7
473#define TXDESC_QUEUE_BEACON 0x10
474#define TXDESC_QUEUE_HIGH 0x11
475#define TXDESC_QUEUE_MGNT 0x12
476#define TXDESC_QUEUE_CMD 0x13
477#define TXDESC_QUEUE_MAX (TXDESC_QUEUE_CMD + 1)
Jes Sorensen33f37242016-03-31 17:08:34 -0400478#define TXDESC40_RDG_NAV_EXT BIT(13)
479#define TXDESC40_LSIG_TXOP_ENABLE BIT(14)
480#define TXDESC40_PIFS BIT(15)
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400481
482#define DESC_RATE_ID_SHIFT 16
483#define DESC_RATE_ID_MASK 0xf
484#define TXDESC_NAVUSEHDR BIT(20)
485#define TXDESC_SEC_RC4 0x00400000
486#define TXDESC_SEC_AES 0x00c00000
487#define TXDESC_PKT_OFFSET_SHIFT 26
488#define TXDESC_AGG_EN BIT(29)
489#define TXDESC_HWPC BIT(31)
490
491/* Word 2 */
Jes Sorensen33f37242016-03-31 17:08:34 -0400492#define TXDESC40_PAID_SHIFT 0
493#define TXDESC40_PAID_MASK 0x1ff
494#define TXDESC40_CCA_RTS_SHIFT 10
495#define TXDESC40_CCA_RTS_MASK 0xc00
496#define TXDESC40_AGG_ENABLE BIT(12)
497#define TXDESC40_RDG_ENABLE BIT(13)
498#define TXDESC40_AGG_BREAK BIT(16)
499#define TXDESC40_MORE_FRAG BIT(17)
500#define TXDESC40_RAW BIT(18)
501#define TXDESC32_ACK_REPORT BIT(19)
502#define TXDESC40_SPE_RPT BIT(19)
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400503#define TXDESC_AMPDU_DENSITY_SHIFT 20
Jes Sorensen33f37242016-03-31 17:08:34 -0400504#define TXDESC40_BT_INT BIT(23)
Jes Sorensen169bc5c2016-03-31 17:08:35 -0400505#define TXDESC40_GID_SHIFT 24
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400506
507/* Word 3 */
Jes Sorensen33f37242016-03-31 17:08:34 -0400508#define TXDESC40_USE_DRIVER_RATE BIT(8)
509#define TXDESC40_CTS_SELF_ENABLE BIT(11)
510#define TXDESC40_RTS_CTS_ENABLE BIT(12)
511#define TXDESC40_HW_RTS_ENABLE BIT(13)
512#define TXDESC32_SEQ_SHIFT 16
513#define TXDESC32_SEQ_MASK 0x0fff0000
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400514
515/* Word 4 */
Jes Sorensen33f37242016-03-31 17:08:34 -0400516#define TXDESC32_RTS_RATE_SHIFT 0
517#define TXDESC32_RTS_RATE_MASK 0x3f
518#define TXDESC32_QOS BIT(6)
519#define TXDESC32_HW_SEQ_ENABLE BIT(7)
520#define TXDESC32_USE_DRIVER_RATE BIT(8)
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400521#define TXDESC_DISABLE_DATA_FB BIT(10)
Jes Sorensen33f37242016-03-31 17:08:34 -0400522#define TXDESC32_CTS_SELF_ENABLE BIT(11)
523#define TXDESC32_RTS_CTS_ENABLE BIT(12)
524#define TXDESC32_HW_RTS_ENABLE BIT(13)
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400525#define TXDESC_PRIME_CH_OFF_LOWER BIT(20)
526#define TXDESC_PRIME_CH_OFF_UPPER BIT(21)
Jes Sorensen33f37242016-03-31 17:08:34 -0400527#define TXDESC32_SHORT_PREAMBLE BIT(24)
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400528#define TXDESC_DATA_BW BIT(25)
529#define TXDESC_RTS_DATA_BW BIT(27)
530#define TXDESC_RTS_PRIME_CH_OFF_LOWER BIT(28)
531#define TXDESC_RTS_PRIME_CH_OFF_UPPER BIT(29)
Jes Sorensen33f37242016-03-31 17:08:34 -0400532#define TXDESC40_DATA_RATE_FB_SHIFT 8
533#define TXDESC40_DATA_RATE_FB_MASK 0x00001f00
534#define TXDESC40_RETRY_LIMIT_ENABLE BIT(17)
535#define TXDESC40_RETRY_LIMIT_SHIFT 18
536#define TXDESC40_RETRY_LIMIT_MASK 0x00fc0000
537#define TXDESC40_RTS_RATE_SHIFT 24
538#define TXDESC40_RTS_RATE_MASK 0x3f000000
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400539
540/* Word 5 */
Jes Sorensen33f37242016-03-31 17:08:34 -0400541#define TXDESC40_SHORT_PREAMBLE BIT(4)
Jes Sorensen1df1de32016-03-31 17:08:36 -0400542#define TXDESC32_SHORT_GI BIT(6)
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400543#define TXDESC_CCX_TAG BIT(7)
Jes Sorensen33f37242016-03-31 17:08:34 -0400544#define TXDESC32_RETRY_LIMIT_ENABLE BIT(17)
545#define TXDESC32_RETRY_LIMIT_SHIFT 18
546#define TXDESC32_RETRY_LIMIT_MASK 0x00fc0000
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400547
548/* Word 6 */
549#define TXDESC_MAX_AGG_SHIFT 11
550
Jes Sorensen2098bfb2016-02-29 17:05:33 -0500551/* Word 8 */
Jes Sorensen33f37242016-03-31 17:08:34 -0400552#define TXDESC40_HW_SEQ_ENABLE BIT(15)
Jes Sorensen2098bfb2016-02-29 17:05:33 -0500553
Jes Sorensencc2646d2016-02-29 17:05:32 -0500554/* Word 9 */
Jes Sorensen33f37242016-03-31 17:08:34 -0400555#define TXDESC40_SEQ_SHIFT 12
556#define TXDESC40_SEQ_MASK 0x00fff000
Jes Sorensencc2646d2016-02-29 17:05:32 -0500557
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400558struct phy_rx_agc_info {
559#ifdef __LITTLE_ENDIAN
560 u8 gain:7, trsw:1;
561#else
562 u8 trsw:1, gain:7;
563#endif
564};
565
566struct rtl8723au_phy_stats {
567 struct phy_rx_agc_info path_agc[RTL8723A_MAX_RF_PATHS];
568 u8 ch_corr[RTL8723A_MAX_RF_PATHS];
569 u8 cck_sig_qual_ofdm_pwdb_all;
570 u8 cck_agc_rpt_ofdm_cfosho_a;
571 u8 cck_rpt_b_ofdm_cfosho_b;
572 u8 reserved_1;
573 u8 noise_power_db_msb;
574 u8 path_cfotail[RTL8723A_MAX_RF_PATHS];
575 u8 pcts_mask[RTL8723A_MAX_RF_PATHS];
576 s8 stream_rxevm[RTL8723A_MAX_RF_PATHS];
577 u8 path_rxsnr[RTL8723A_MAX_RF_PATHS];
578 u8 noise_power_db_lsb;
579 u8 reserved_2[3];
580 u8 stream_csi[RTL8723A_MAX_RF_PATHS];
581 u8 stream_target_csi[RTL8723A_MAX_RF_PATHS];
582 s8 sig_evm;
583 u8 reserved_3;
584
585#ifdef __LITTLE_ENDIAN
586 u8 antsel_rx_keep_2:1; /* ex_intf_flg:1; */
587 u8 sgi_en:1;
588 u8 rxsc:2;
589 u8 idle_long:1;
590 u8 r_ant_train_en:1;
591 u8 antenna_select_b:1;
592 u8 antenna_select:1;
593#else /* _BIG_ENDIAN_ */
594 u8 antenna_select:1;
595 u8 antenna_select_b:1;
596 u8 r_ant_train_en:1;
597 u8 idle_long:1;
598 u8 rxsc:2;
599 u8 sgi_en:1;
600 u8 antsel_rx_keep_2:1; /* ex_intf_flg:1; */
601#endif
602};
603
604/*
605 * Regs to backup
606 */
607#define RTL8XXXU_ADDA_REGS 16
608#define RTL8XXXU_MAC_REGS 4
609#define RTL8XXXU_BB_REGS 9
610
611struct rtl8xxxu_firmware_header {
612 __le16 signature; /* 92C0: test chip; 92C,
613 88C0: test chip;
614 88C1: MP A-cut;
615 92C1: MP A-cut */
616 u8 category; /* AP/NIC and USB/PCI */
617 u8 function;
618
619 __le16 major_version; /* FW Version */
620 u8 minor_version; /* FW Subversion, default 0x00 */
621 u8 reserved1;
622
623 u8 month; /* Release time Month field */
624 u8 date; /* Release time Date field */
625 u8 hour; /* Release time Hour field */
626 u8 minute; /* Release time Minute field */
627
628 __le16 ramcodesize; /* Size of RAM code */
629 u16 reserved2;
630
631 __le32 svn_idx; /* SVN entry index */
632 u32 reserved3;
633
634 u32 reserved4;
635 u32 reserved5;
636
637 u8 data[0];
638};
639
640/*
Jes Sorensen2fc0b8e2016-04-14 16:37:16 -0400641 * 8723au/8192cu/8188ru required base power index offset tables.
642 */
643struct rtl8xxxu_power_base {
644 u32 reg_0e00;
645 u32 reg_0e04;
646 u32 reg_0e08;
647 u32 reg_086c;
648
649 u32 reg_0e10;
650 u32 reg_0e14;
651 u32 reg_0e18;
652 u32 reg_0e1c;
653
654 u32 reg_0830;
655 u32 reg_0834;
656 u32 reg_0838;
657 u32 reg_086c_2;
658
659 u32 reg_083c;
660 u32 reg_0848;
661 u32 reg_084c;
662 u32 reg_0868;
663};
664
665/*
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400666 * The 8723au has 3 channel groups: 1-3, 4-9, and 10-14
667 */
668struct rtl8723au_idx {
669#ifdef __LITTLE_ENDIAN
670 int a:4;
671 int b:4;
672#else
673 int b:4;
674 int a:4;
675#endif
676} __attribute__((packed));
677
678struct rtl8723au_efuse {
679 __le16 rtl_id;
680 u8 res0[0xe];
681 u8 cck_tx_power_index_A[3]; /* 0x10 */
682 u8 cck_tx_power_index_B[3];
683 u8 ht40_1s_tx_power_index_A[3]; /* 0x16 */
684 u8 ht40_1s_tx_power_index_B[3];
685 /*
686 * The following entries are half-bytes split as:
687 * bits 0-3: path A, bits 4-7: path B, all values 4 bits signed
688 */
689 struct rtl8723au_idx ht20_tx_power_index_diff[3];
690 struct rtl8723au_idx ofdm_tx_power_index_diff[3];
691 struct rtl8723au_idx ht40_max_power_offset[3];
692 struct rtl8723au_idx ht20_max_power_offset[3];
693 u8 channel_plan; /* 0x28 */
694 u8 tssi_a;
695 u8 thermal_meter;
696 u8 rf_regulatory;
697 u8 rf_option_2;
698 u8 rf_option_3;
699 u8 rf_option_4;
700 u8 res7;
701 u8 version /* 0x30 */;
702 u8 customer_id_major;
703 u8 customer_id_minor;
704 u8 xtal_k;
705 u8 chipset; /* 0x34 */
706 u8 res8[0x82];
707 u8 vid; /* 0xb7 */
708 u8 res9;
709 u8 pid; /* 0xb9 */
710 u8 res10[0x0c];
711 u8 mac_addr[ETH_ALEN]; /* 0xc6 */
712 u8 res11[2];
713 u8 vendor_name[7];
714 u8 res12[2];
715 u8 device_name[0x29]; /* 0xd7 */
716};
717
718struct rtl8192cu_efuse {
719 __le16 rtl_id;
720 __le16 hpon;
721 u8 res0[2];
722 __le16 clk;
723 __le16 testr;
724 __le16 vid;
725 __le16 did;
726 __le16 svid;
727 __le16 smid; /* 0x10 */
728 u8 res1[4];
729 u8 mac_addr[ETH_ALEN]; /* 0x16 */
730 u8 res2[2];
731 u8 vendor_name[7];
732 u8 res3[3];
733 u8 device_name[0x14]; /* 0x28 */
734 u8 res4[0x1e]; /* 0x3c */
735 u8 cck_tx_power_index_A[3]; /* 0x5a */
736 u8 cck_tx_power_index_B[3];
737 u8 ht40_1s_tx_power_index_A[3]; /* 0x60 */
738 u8 ht40_1s_tx_power_index_B[3];
739 /*
740 * The following entries are half-bytes split as:
741 * bits 0-3: path A, bits 4-7: path B, all values 4 bits signed
742 */
743 struct rtl8723au_idx ht40_2s_tx_power_index_diff[3];
744 struct rtl8723au_idx ht20_tx_power_index_diff[3]; /* 0x69 */
745 struct rtl8723au_idx ofdm_tx_power_index_diff[3];
746 struct rtl8723au_idx ht40_max_power_offset[3]; /* 0x6f */
747 struct rtl8723au_idx ht20_max_power_offset[3];
748 u8 channel_plan; /* 0x75 */
749 u8 tssi_a;
750 u8 tssi_b;
751 u8 thermal_meter; /* xtal_k */ /* 0x78 */
752 u8 rf_regulatory;
753 u8 rf_option_2;
754 u8 rf_option_3;
755 u8 rf_option_4;
756 u8 res5[1]; /* 0x7d */
757 u8 version;
758 u8 customer_id;
759};
760
Jes Sorensen3be26992016-02-29 17:05:22 -0500761struct rtl8723bu_pwr_idx {
762#ifdef __LITTLE_ENDIAN
763 int ht20:4;
764 int ht40:4;
765 int ofdm:4;
766 int cck:4;
767#else
768 int cck:4;
769 int ofdm:4;
770 int ht40:4;
771 int ht20:4;
772#endif
773} __attribute__((packed));
774
Jes Sorensen4a0d7db2016-02-29 17:05:18 -0500775struct rtl8723bu_efuse_tx_power {
776 u8 cck_base[6];
777 u8 ht40_base[5];
778 struct rtl8723au_idx ht20_ofdm_1s_diff;
Jes Sorensen3be26992016-02-29 17:05:22 -0500779 struct rtl8723bu_pwr_idx pwr_diff[3];
Jes Sorensen4a0d7db2016-02-29 17:05:18 -0500780 u8 dummy5g[24]; /* max channel group (14) + power diff offset (10) */
781};
782
Jes Sorensen3c836d62016-02-29 17:04:11 -0500783struct rtl8723bu_efuse {
784 __le16 rtl_id;
785 u8 res0[0x0e];
Jes Sorensen4a0d7db2016-02-29 17:05:18 -0500786 struct rtl8723bu_efuse_tx_power tx_power_index_A; /* 0x10 */
787 struct rtl8723bu_efuse_tx_power tx_power_index_B; /* 0x3a */
788 struct rtl8723bu_efuse_tx_power tx_power_index_C; /* 0x64 */
789 struct rtl8723bu_efuse_tx_power tx_power_index_D; /* 0x8e */
Jes Sorensen3c836d62016-02-29 17:04:11 -0500790 u8 channel_plan; /* 0xb8 */
791 u8 xtal_k;
792 u8 thermal_meter;
793 u8 iqk_lck;
794 u8 pa_type; /* 0xbc */
795 u8 lna_type_2g; /* 0xbd */
796 u8 res2[3];
797 u8 rf_board_option;
798 u8 rf_feature_option;
799 u8 rf_bt_setting;
800 u8 eeprom_version;
801 u8 eeprom_customer_id;
802 u8 res3[2];
803 u8 tx_pwr_calibrate_rate;
804 u8 rf_antenna_option; /* 0xc9 */
805 u8 rfe_option;
806 u8 res4[9];
807 u8 usb_optional_function;
808 u8 res5[0x1e];
809 u8 res6[2];
810 u8 serial[0x0b]; /* 0xf5 */
811 u8 vid; /* 0x100 */
812 u8 res7;
813 u8 pid;
814 u8 res8[4];
815 u8 mac_addr[ETH_ALEN]; /* 0x107 */
816 u8 res9[2];
817 u8 vendor_name[0x07];
818 u8 res10[2];
Jes Sorensen22a31d42016-02-29 17:04:15 -0500819 u8 device_name[0x14];
820 u8 res11[0xcf];
821 u8 package_type; /* 0x1fb */
822 u8 res12[0x4];
Jes Sorensen3c836d62016-02-29 17:04:11 -0500823};
824
Jakub Sitnickie6f9a9c2016-02-29 17:04:39 -0500825struct rtl8192eu_efuse_tx_power {
826 u8 cck_base[6];
827 u8 ht40_base[5];
828 struct rtl8723au_idx ht20_ofdm_1s_diff;
Jes Sorensen9e247722016-04-07 14:19:23 -0400829 struct rtl8723bu_pwr_idx pwr_diff[3];
830 u8 dummy5g[24]; /* max channel group (14) + power diff offset (10) */
Jakub Sitnickie6f9a9c2016-02-29 17:04:39 -0500831};
832
Jes Sorensen3307d842016-02-29 17:03:59 -0500833struct rtl8192eu_efuse {
834 __le16 rtl_id;
835 u8 res0[0x0e];
Jakub Sitnickie6f9a9c2016-02-29 17:04:39 -0500836 struct rtl8192eu_efuse_tx_power tx_power_index_A; /* 0x10 */
Jes Sorensen9e247722016-04-07 14:19:23 -0400837 struct rtl8192eu_efuse_tx_power tx_power_index_B; /* 0x3a */
838 u8 res2[0x54];
Jes Sorensen3307d842016-02-29 17:03:59 -0500839 u8 channel_plan; /* 0xb8 */
840 u8 xtal_k;
841 u8 thermal_meter;
842 u8 iqk_lck;
843 u8 pa_type; /* 0xbc */
844 u8 lna_type_2g; /* 0xbd */
Jes Sorensen9e247722016-04-07 14:19:23 -0400845 u8 res3[1];
Jes Sorensen3307d842016-02-29 17:03:59 -0500846 u8 lna_type_5g; /* 0xbf */
Jes Sorensen9e247722016-04-07 14:19:23 -0400847 u8 res4[1];
Jes Sorensen3307d842016-02-29 17:03:59 -0500848 u8 rf_board_option;
849 u8 rf_feature_option;
850 u8 rf_bt_setting;
851 u8 eeprom_version;
852 u8 eeprom_customer_id;
Jes Sorensen9e247722016-04-07 14:19:23 -0400853 u8 res5[3];
Jes Sorensen3307d842016-02-29 17:03:59 -0500854 u8 rf_antenna_option; /* 0xc9 */
Jes Sorensen9e247722016-04-07 14:19:23 -0400855 u8 res6[6];
Jes Sorensen3307d842016-02-29 17:03:59 -0500856 u8 vid; /* 0xd0 */
Jes Sorensen9e247722016-04-07 14:19:23 -0400857 u8 res7[1];
Jes Sorensen3307d842016-02-29 17:03:59 -0500858 u8 pid; /* 0xd2 */
Jes Sorensen9e247722016-04-07 14:19:23 -0400859 u8 res8[1];
Jes Sorensen3307d842016-02-29 17:03:59 -0500860 u8 usb_optional_function;
Jes Sorensen3307d842016-02-29 17:03:59 -0500861 u8 res9[2];
Jes Sorensen9e247722016-04-07 14:19:23 -0400862 u8 mac_addr[ETH_ALEN]; /* 0xd7 */
Jes Sorensen3307d842016-02-29 17:03:59 -0500863 u8 res10[2];
Jes Sorensen9e247722016-04-07 14:19:23 -0400864 u8 vendor_name[7];
865 u8 res11[2];
866 u8 device_name[0x0b]; /* 0xe8 */
867 u8 res12[2];
Jes Sorensen3307d842016-02-29 17:03:59 -0500868 u8 serial[0x0b]; /* 0xf5 */
Jes Sorensen9e247722016-04-07 14:19:23 -0400869 u8 res13[0x30];
Jes Sorensen3307d842016-02-29 17:03:59 -0500870 u8 unknown[0x0d]; /* 0x130 */
Jes Sorensen9e247722016-04-07 14:19:23 -0400871 u8 res14[0xc3];
Jes Sorensen3307d842016-02-29 17:03:59 -0500872};
873
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400874struct rtl8xxxu_reg8val {
875 u16 reg;
876 u8 val;
877};
878
879struct rtl8xxxu_reg32val {
880 u16 reg;
881 u32 val;
882};
883
884struct rtl8xxxu_rfregval {
885 u8 reg;
886 u32 val;
887};
888
889enum rtl8xxxu_rfpath {
890 RF_A = 0,
891 RF_B = 1,
892};
893
894struct rtl8xxxu_rfregs {
895 u16 hssiparm1;
896 u16 hssiparm2;
897 u16 lssiparm;
898 u16 hspiread;
899 u16 lssiread;
900 u16 rf_sw_ctrl;
901};
902
903#define H2C_MAX_MBOX 4
904#define H2C_EXT BIT(7)
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400905#define H2C_JOIN_BSS_DISCONNECT 0
906#define H2C_JOIN_BSS_CONNECT 1
Jes Sorensend940c242016-02-29 17:04:22 -0500907
908/*
909 * H2C (firmware) commands differ between the older generation chips
910 * 8188[cr]u, 819[12]cu, and 8723au, and the more recent chips 8723bu,
911 * 8192[de]u, 8192eu, and 8812.
912 */
913enum h2c_cmd_8723a {
914 H2C_SET_POWER_MODE = 1,
915 H2C_JOIN_BSS_REPORT = 2,
916 H2C_SET_RSSI = 5,
917 H2C_SET_RATE_MASK = (6 | H2C_EXT),
918};
919
920enum h2c_cmd_8723b {
921 /*
922 * Common Class: 000
923 */
924 H2C_8723B_RSVD_PAGE = 0x00,
925 H2C_8723B_MEDIA_STATUS_RPT = 0x01,
926 H2C_8723B_SCAN_ENABLE = 0x02,
927 H2C_8723B_KEEP_ALIVE = 0x03,
928 H2C_8723B_DISCON_DECISION = 0x04,
929 H2C_8723B_PSD_OFFLOAD = 0x05,
930 H2C_8723B_AP_OFFLOAD = 0x08,
931 H2C_8723B_BCN_RSVDPAGE = 0x09,
932 H2C_8723B_PROBERSP_RSVDPAGE = 0x0A,
933 H2C_8723B_FCS_RSVDPAGE = 0x10,
934 H2C_8723B_FCS_INFO = 0x11,
935 H2C_8723B_AP_WOW_GPIO_CTRL = 0x13,
936
937 /*
938 * PoweSave Class: 001
939 */
940 H2C_8723B_SET_PWR_MODE = 0x20,
941 H2C_8723B_PS_TUNING_PARA = 0x21,
942 H2C_8723B_PS_TUNING_PARA2 = 0x22,
943 H2C_8723B_P2P_LPS_PARAM = 0x23,
944 H2C_8723B_P2P_PS_OFFLOAD = 0x24,
945 H2C_8723B_PS_SCAN_ENABLE = 0x25,
946 H2C_8723B_SAP_PS_ = 0x26,
947 H2C_8723B_INACTIVE_PS_ = 0x27,
948 H2C_8723B_FWLPS_IN_IPS_ = 0x28,
949
950 /*
951 * Dynamic Mechanism Class: 010
952 */
Jes Sorensen80b30b22016-02-29 17:05:37 -0500953 H2C_8723B_MACID_CFG_RAID = 0x40,
Jes Sorensend940c242016-02-29 17:04:22 -0500954 H2C_8723B_TXBF = 0x41,
955 H2C_8723B_RSSI_SETTING = 0x42,
956 H2C_8723B_AP_REQ_TXRPT = 0x43,
957 H2C_8723B_INIT_RATE_COLLECT = 0x44,
958
959 /*
960 * BT Class: 011
961 */
962 H2C_8723B_B_TYPE_TDMA = 0x60,
963 H2C_8723B_BT_INFO = 0x61,
964 H2C_8723B_FORCE_BT_TXPWR = 0x62,
965 H2C_8723B_BT_IGNORE_WLANACT = 0x63,
966 H2C_8723B_DAC_SWING_VALUE = 0x64,
967 H2C_8723B_ANT_SEL_RSV = 0x65,
968 H2C_8723B_WL_OPMODE = 0x66,
969 H2C_8723B_BT_MP_OPER = 0x67,
970 H2C_8723B_BT_CONTROL = 0x68,
971 H2C_8723B_BT_WIFI_CTRL = 0x69,
Jes Sorensenf37e9222016-02-29 17:04:41 -0500972 H2C_8723B_BT_FW_PATCH = 0x6a,
973 H2C_8723B_BT_WLAN_CALIBRATION = 0x6d,
974 H2C_8723B_BT_GRANT = 0x6e,
Jes Sorensend940c242016-02-29 17:04:22 -0500975
976 /*
977 * WOWLAN Class: 100
978 */
979 H2C_8723B_WOWLAN = 0x80,
980 H2C_8723B_REMOTE_WAKE_CTRL = 0x81,
981 H2C_8723B_AOAC_GLOBAL_INFO = 0x82,
982 H2C_8723B_AOAC_RSVD_PAGE = 0x83,
983 H2C_8723B_AOAC_RSVD_PAGE2 = 0x84,
984 H2C_8723B_D0_SCAN_OFFLOAD_CTRL = 0x85,
985 H2C_8723B_D0_SCAN_OFFLOAD_INFO = 0x86,
986 H2C_8723B_CHNL_SWITCH_OFFLOAD = 0x87,
987
988 H2C_8723B_RESET_TSF = 0xC0,
989};
990
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400991
992struct h2c_cmd {
993 union {
994 struct {
995 u8 cmd;
Jes Sorensened35d092016-02-29 17:04:19 -0500996 u8 data[7];
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400997 } __packed cmd;
998 struct {
999 __le32 data;
1000 __le16 ext;
1001 } __packed raw;
1002 struct {
Jes Sorensened35d092016-02-29 17:04:19 -05001003 __le32 data;
1004 __le32 ext;
1005 } __packed raw_wide;
1006 struct {
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001007 u8 cmd;
1008 u8 data;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001009 } __packed joinbss;
1010 struct {
1011 u8 cmd;
1012 __le16 mask_hi;
1013 u8 arg;
1014 __le16 mask_lo;
1015 } __packed ramask;
Jes Sorensenc7a5a192016-02-29 17:04:30 -05001016 struct {
1017 u8 cmd;
Jes Sorensen7d794ea2016-02-29 17:05:39 -05001018 u8 parm;
1019 u8 macid;
1020 u8 macid_end;
1021 } __packed media_status_rpt;
1022 struct {
1023 u8 cmd;
Jes Sorensenf653e692016-02-29 17:05:38 -05001024 u8 macid;
1025 /*
1026 * [0:4] - RAID
1027 * [7] - SGI
1028 */
Jes Sorensen3ca7b322016-02-29 17:04:43 -05001029 u8 data1;
Jes Sorensenf653e692016-02-29 17:05:38 -05001030 /*
1031 * [0:1] - Bandwidth
1032 * [3] - No Update
1033 * [4:5] - VHT enable
1034 * [6] - DISPT
1035 * [7] - DISRA
1036 */
Jes Sorensen3ca7b322016-02-29 17:04:43 -05001037 u8 data2;
Jes Sorensenf653e692016-02-29 17:05:38 -05001038 u8 ramask0;
Jes Sorensen80b30b22016-02-29 17:05:37 -05001039 u8 ramask1;
1040 u8 ramask2;
1041 u8 ramask3;
Jes Sorensen80b30b22016-02-29 17:05:37 -05001042 } __packed b_macid_cfg;
1043 struct {
1044 u8 cmd;
1045 u8 data1;
1046 u8 data2;
Jes Sorensen3ca7b322016-02-29 17:04:43 -05001047 u8 data3;
1048 u8 data4;
1049 u8 data5;
1050 } __packed b_type_dma;
1051 struct {
1052 u8 cmd;
Jes Sorensen6b9eae02016-02-29 17:04:50 -05001053 u8 data;
1054 } __packed bt_info;
1055 struct {
1056 u8 cmd;
Jes Sorensen394f1bd2016-02-29 17:04:49 -05001057 u8 operreq;
1058 u8 opcode;
1059 u8 data;
1060 u8 addr;
1061 } __packed bt_mp_oper;
1062 struct {
1063 u8 cmd;
Jes Sorensenc7a5a192016-02-29 17:04:30 -05001064 u8 data;
1065 } __packed bt_wlan_calibration;
Jes Sorensenf37e9222016-02-29 17:04:41 -05001066 struct {
1067 u8 cmd;
Jes Sorensen7297f492016-02-29 17:04:44 -05001068 u8 data;
1069 } __packed ignore_wlan;
1070 struct {
1071 u8 cmd;
Jes Sorensenf37e9222016-02-29 17:04:41 -05001072 u8 ant_inverse;
1073 u8 int_switch_type;
1074 } __packed ant_sel_rsv;
1075 struct {
1076 u8 cmd;
1077 u8 data;
1078 } __packed bt_grant;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001079 };
1080};
1081
Jes Sorensenb2b43b72016-02-29 17:04:48 -05001082enum c2h_evt_8723b {
1083 C2H_8723B_DEBUG = 0,
1084 C2H_8723B_TSF = 1,
1085 C2H_8723B_AP_RPT_RSP = 2,
1086 C2H_8723B_CCX_TX_RPT = 3,
1087 C2H_8723B_BT_RSSI = 4,
1088 C2H_8723B_BT_OP_MODE = 5,
1089 C2H_8723B_EXT_RA_RPT = 6,
1090 C2H_8723B_BT_INFO = 9,
Jes Sorensen394f1bd2016-02-29 17:04:49 -05001091 C2H_8723B_HW_INFO_EXCH = 0x0a,
1092 C2H_8723B_BT_MP_INFO = 0x0b,
Jes Sorensen55a18dd2016-02-29 17:05:41 -05001093 C2H_8723B_RA_REPORT = 0x0c,
Jes Sorensenb2b43b72016-02-29 17:04:48 -05001094 C2H_8723B_FW_DEBUG = 0xff,
1095};
1096
1097enum bt_info_src_8723b {
1098 BT_INFO_SRC_8723B_WIFI_FW = 0x0,
1099 BT_INFO_SRC_8723B_BT_RSP = 0x1,
1100 BT_INFO_SRC_8723B_BT_ACTIVE_SEND = 0x2,
1101};
1102
Jes Sorensen394f1bd2016-02-29 17:04:49 -05001103enum bt_mp_oper_opcode_8723b {
1104 BT_MP_OP_GET_BT_VERSION = 0x00,
1105 BT_MP_OP_RESET = 0x01,
1106 BT_MP_OP_TEST_CTRL = 0x02,
1107 BT_MP_OP_SET_BT_MODE = 0x03,
1108 BT_MP_OP_SET_CHNL_TX_GAIN = 0x04,
1109 BT_MP_OP_SET_PKT_TYPE_LEN = 0x05,
1110 BT_MP_OP_SET_PKT_CNT_L_PL_TYPE = 0x06,
1111 BT_MP_OP_SET_PKT_CNT_H_PKT_INTV = 0x07,
1112 BT_MP_OP_SET_PKT_HEADER = 0x08,
1113 BT_MP_OP_SET_WHITENCOEFF = 0x09,
1114 BT_MP_OP_SET_BD_ADDR_L = 0x0a,
1115 BT_MP_OP_SET_BD_ADDR_H = 0x0b,
1116 BT_MP_OP_WRITE_REG_ADDR = 0x0c,
1117 BT_MP_OP_WRITE_REG_VALUE = 0x0d,
1118 BT_MP_OP_GET_BT_STATUS = 0x0e,
1119 BT_MP_OP_GET_BD_ADDR_L = 0x0f,
1120 BT_MP_OP_GET_BD_ADDR_H = 0x10,
1121 BT_MP_OP_READ_REG = 0x11,
1122 BT_MP_OP_SET_TARGET_BD_ADDR_L = 0x12,
1123 BT_MP_OP_SET_TARGET_BD_ADDR_H = 0x13,
1124 BT_MP_OP_SET_TX_POWER_CALIBRATION = 0x14,
1125 BT_MP_OP_GET_RX_PKT_CNT_L = 0x15,
1126 BT_MP_OP_GET_RX_PKT_CNT_H = 0x16,
1127 BT_MP_OP_GET_RX_ERROR_BITS_L = 0x17,
1128 BT_MP_OP_GET_RX_ERROR_BITS_H = 0x18,
1129 BT_MP_OP_GET_RSSI = 0x19,
1130 BT_MP_OP_GET_CFO_HDR_QUALITY_L = 0x1a,
1131 BT_MP_OP_GET_CFO_HDR_QUALITY_H = 0x1b,
1132 BT_MP_OP_GET_TARGET_BD_ADDR_L = 0x1c,
1133 BT_MP_OP_GET_TARGET_BD_ADDR_H = 0x1d,
1134 BT_MP_OP_GET_AFH_MAP_L = 0x1e,
1135 BT_MP_OP_GET_AFH_MAP_M = 0x1f,
1136 BT_MP_OP_GET_AFH_MAP_H = 0x20,
1137 BT_MP_OP_GET_AFH_STATUS = 0x21,
1138 BT_MP_OP_SET_TRACKING_INTERVAL = 0x22,
1139 BT_MP_OP_SET_THERMAL_METER = 0x23,
1140 BT_MP_OP_ENABLE_CFO_TRACKING = 0x24,
1141};
1142
Jes Sorensenb2b43b72016-02-29 17:04:48 -05001143struct rtl8723bu_c2h {
1144 u8 id;
1145 u8 seq;
1146 union {
1147 struct {
1148 u8 payload[0];
1149 } __packed raw;
1150 struct {
Jes Sorensen394f1bd2016-02-29 17:04:49 -05001151 u8 ext_id;
1152 u8 status:4;
1153 u8 retlen:4;
1154 u8 opcode_ver:4;
1155 u8 req_num:4;
1156 u8 payload[2];
1157 } __packed bt_mp_info;
1158 struct {
Jes Sorensenb2b43b72016-02-29 17:04:48 -05001159 u8 response_source:4;
1160 u8 dummy0_0:4;
1161
1162 u8 bt_info;
1163
1164 u8 retry_count:4;
1165 u8 dummy2_0:1;
1166 u8 bt_page:1;
1167 u8 tx_rx_mask:1;
1168 u8 dummy2_2:1;
1169
1170 u8 rssi;
1171
1172 u8 basic_rate:1;
1173 u8 bt_has_reset:1;
1174 u8 dummy4_1:1;;
1175 u8 ignore_wlan:1;
1176 u8 auto_report:1;
1177 u8 dummy4_2:3;
1178
1179 u8 a4;
1180 u8 a5;
1181 } __packed bt_info;
Jes Sorensen55a18dd2016-02-29 17:05:41 -05001182 struct {
1183 u8 rate:7;
1184 u8 dummy0_0:1;
1185 u8 macid;
1186 u8 ldpc:1;
1187 u8 txbf:1;
1188 u8 noisy_state:1;
1189 u8 dummy2_0:5;
1190 u8 dummy3_0;
1191 } __packed ra_report;
Jes Sorensenb2b43b72016-02-29 17:04:48 -05001192 };
1193};
1194
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001195struct rtl8xxxu_fileops;
1196
1197struct rtl8xxxu_priv {
1198 struct ieee80211_hw *hw;
1199 struct usb_device *udev;
1200 struct rtl8xxxu_fileops *fops;
1201
1202 spinlock_t tx_urb_lock;
1203 struct list_head tx_urb_free_list;
1204 int tx_urb_free_count;
1205 bool tx_stopped;
1206
1207 spinlock_t rx_urb_lock;
1208 struct list_head rx_urb_pending_list;
1209 int rx_urb_pending_count;
1210 bool shutdown;
1211 struct work_struct rx_urb_wq;
1212
1213 u8 mac_addr[ETH_ALEN];
1214 char chip_name[8];
Jes Sorensen0e5d4352016-02-29 17:04:00 -05001215 char chip_vendor[8];
Jes Sorensen21db9972016-02-29 17:05:21 -05001216 u8 cck_tx_power_index_A[RTL8XXXU_MAX_CHANNEL_GROUPS];
1217 u8 cck_tx_power_index_B[RTL8XXXU_MAX_CHANNEL_GROUPS];
1218 u8 ht40_1s_tx_power_index_A[RTL8XXXU_MAX_CHANNEL_GROUPS];
1219 u8 ht40_1s_tx_power_index_B[RTL8XXXU_MAX_CHANNEL_GROUPS];
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001220 /*
1221 * The following entries are half-bytes split as:
1222 * bits 0-3: path A, bits 4-7: path B, all values 4 bits signed
1223 */
Jes Sorensen21db9972016-02-29 17:05:21 -05001224 struct rtl8723au_idx ht40_2s_tx_power_index_diff[
Jes Sorensen3be26992016-02-29 17:05:22 -05001225 RTL8723A_CHANNEL_GROUPS];
1226 struct rtl8723au_idx ht20_tx_power_index_diff[RTL8723A_CHANNEL_GROUPS];
1227 struct rtl8723au_idx ofdm_tx_power_index_diff[RTL8723A_CHANNEL_GROUPS];
1228 struct rtl8723au_idx ht40_max_power_offset[RTL8723A_CHANNEL_GROUPS];
1229 struct rtl8723au_idx ht20_max_power_offset[RTL8723A_CHANNEL_GROUPS];
1230 /*
1231 * Newer generation chips only keep power diffs per TX count,
1232 * not per channel group.
1233 */
1234 struct rtl8723au_idx ofdm_tx_power_diff[RTL8723B_TX_COUNT];
1235 struct rtl8723au_idx ht20_tx_power_diff[RTL8723B_TX_COUNT];
1236 struct rtl8723au_idx ht40_tx_power_diff[RTL8723B_TX_COUNT];
Jes Sorensen2fc0b8e2016-04-14 16:37:16 -04001237 struct rtl8xxxu_power_base *power_base;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001238 u32 chip_cut:4;
1239 u32 rom_rev:4;
Jakub Sitnicki38451992016-02-03 13:39:49 -05001240 u32 is_multi_func:1;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001241 u32 has_wifi:1;
1242 u32 has_bluetooth:1;
1243 u32 enable_bluetooth:1;
1244 u32 has_gps:1;
1245 u32 hi_pa:1;
1246 u32 vendor_umc:1;
Jes Sorensen0e5d4352016-02-29 17:04:00 -05001247 u32 vendor_smic:1;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001248 u32 has_polarity_ctrl:1;
1249 u32 has_eeprom:1;
1250 u32 boot_eeprom:1;
Jes Sorensen0e28b972016-02-29 17:04:13 -05001251 u32 usb_interrupts:1;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001252 u32 ep_tx_high_queue:1;
1253 u32 ep_tx_normal_queue:1;
1254 u32 ep_tx_low_queue:1;
Jes Sorensen4ef22eb2016-02-29 17:04:55 -05001255 u32 has_xtalk:1;
Jes Sorensen04319ae2016-06-27 12:32:04 -04001256 u32 rx_buf_aggregation:1;
Jes Sorensen4ef22eb2016-02-29 17:04:55 -05001257 u8 xtalk;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001258 unsigned int pipe_interrupt;
1259 unsigned int pipe_in;
1260 unsigned int pipe_out[TXDESC_QUEUE_MAX];
1261 u8 out_ep[RTL8XXXU_OUT_ENDPOINTS];
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001262 u8 ep_tx_count;
1263 u8 rf_paths;
1264 u8 rx_paths;
1265 u8 tx_paths;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001266 u32 rege94;
1267 u32 rege9c;
1268 u32 regeb4;
1269 u32 regebc;
1270 int next_mbox;
1271 int nr_out_eps;
1272
1273 struct mutex h2c_mutex;
1274
1275 struct usb_anchor rx_anchor;
1276 struct usb_anchor tx_anchor;
1277 struct usb_anchor int_anchor;
1278 struct rtl8xxxu_firmware_header *fw_data;
1279 size_t fw_size;
1280 struct mutex usb_buf_mutex;
1281 union {
1282 __le32 val32;
1283 __le16 val16;
1284 u8 val8;
1285 } usb_buf;
1286 union {
Jes Sorensen3307d842016-02-29 17:03:59 -05001287 u8 raw[EFUSE_MAP_LEN];
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001288 struct rtl8723au_efuse efuse8723;
Jes Sorensen3c836d62016-02-29 17:04:11 -05001289 struct rtl8723bu_efuse efuse8723bu;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001290 struct rtl8192cu_efuse efuse8192;
Jes Sorensen3307d842016-02-29 17:03:59 -05001291 struct rtl8192eu_efuse efuse8192eu;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001292 } efuse_wifi;
1293 u32 adda_backup[RTL8XXXU_ADDA_REGS];
1294 u32 mac_backup[RTL8XXXU_MAC_REGS];
1295 u32 bb_backup[RTL8XXXU_BB_REGS];
1296 u32 bb_recovery_backup[RTL8XXXU_BB_REGS];
Jes Sorensenba17d822016-03-31 17:08:39 -04001297 enum rtl8xxxu_rtl_chip rtl_chip;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001298 u8 pi_enabled:1;
Jes Sorensencabb5502016-04-14 16:37:17 -04001299 u8 no_pape:1;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001300 u8 int_buf[USB_INTR_CONTENT_LENGTH];
1301};
1302
1303struct rtl8xxxu_rx_urb {
1304 struct urb urb;
1305 struct ieee80211_hw *hw;
1306 struct list_head list;
1307};
1308
1309struct rtl8xxxu_tx_urb {
1310 struct urb urb;
1311 struct ieee80211_hw *hw;
1312 struct list_head list;
1313};
1314
1315struct rtl8xxxu_fileops {
1316 int (*parse_efuse) (struct rtl8xxxu_priv *priv);
1317 int (*load_firmware) (struct rtl8xxxu_priv *priv);
1318 int (*power_on) (struct rtl8xxxu_priv *priv);
Jes Sorensenfe37d5f2016-02-29 17:05:47 -05001319 void (*power_off) (struct rtl8xxxu_priv *priv);
Jes Sorensen7d4ccb82016-02-29 17:05:50 -05001320 void (*reset_8051) (struct rtl8xxxu_priv *priv);
Jes Sorensen74b99be2016-02-29 17:04:04 -05001321 int (*llt_init) (struct rtl8xxxu_priv *priv, u8 last_tx_page);
Jes Sorensencb877252016-04-14 14:58:57 -04001322 void (*init_phy_bb) (struct rtl8xxxu_priv *priv);
Jes Sorensen4062b8f2016-04-14 16:37:08 -04001323 int (*init_phy_rf) (struct rtl8xxxu_priv *priv);
Jes Sorensenf0d9f5e2016-02-29 17:04:16 -05001324 void (*phy_init_antenna_selection) (struct rtl8xxxu_priv *priv);
Jes Sorensene1547c52016-02-29 17:04:35 -05001325 void (*phy_iq_calibrate) (struct rtl8xxxu_priv *priv);
Jes Sorensenc3f95062016-02-29 17:04:40 -05001326 void (*config_channel) (struct ieee80211_hw *hw);
Jes Sorensen2db125d2016-06-27 12:32:01 -04001327 int (*parse_rx_desc) (struct rtl8xxxu_priv *priv, struct sk_buff *skb);
Jes Sorensen3e88ca42016-02-29 17:05:08 -05001328 void (*init_aggregation) (struct rtl8xxxu_priv *priv);
Jes Sorensen9c79bf92016-02-29 17:05:10 -05001329 void (*init_statistics) (struct rtl8xxxu_priv *priv);
Jes Sorensendb08de92016-02-29 17:05:17 -05001330 void (*enable_rf) (struct rtl8xxxu_priv *priv);
Jes Sorensenfc89a412016-02-29 17:05:46 -05001331 void (*disable_rf) (struct rtl8xxxu_priv *priv);
Jes Sorensen747bf232016-04-14 14:59:04 -04001332 void (*usb_quirks) (struct rtl8xxxu_priv *priv);
Jes Sorensene796dab2016-02-29 17:05:19 -05001333 void (*set_tx_power) (struct rtl8xxxu_priv *priv, int channel,
1334 bool ht40);
Jes Sorensenf653e692016-02-29 17:05:38 -05001335 void (*update_rate_mask) (struct rtl8xxxu_priv *priv,
1336 u32 ramask, int sgi);
Jes Sorensen7d794ea2016-02-29 17:05:39 -05001337 void (*report_connect) (struct rtl8xxxu_priv *priv,
1338 u8 macid, bool connect);
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001339 int writeN_block_size;
Jes Sorensen04319ae2016-06-27 12:32:04 -04001340 int rx_agg_buf_size;
Jes Sorensen179e1742016-02-29 17:05:27 -05001341 char tx_desc_size;
Jes Sorensena49c7ce2016-04-14 14:58:52 -04001342 char rx_desc_size;
Jes Sorensenee675cc2016-08-19 17:46:35 -04001343 u8 has_s0s1:1;
1344 u8 has_tx_report:1;
Jes Sorensen8634af52016-02-29 17:04:33 -05001345 u32 adda_1t_init;
1346 u32 adda_1t_path_on;
1347 u32 adda_2t_path_on_a;
1348 u32 adda_2t_path_on_b;
Jes Sorensen24e8e7e2016-04-14 14:59:01 -04001349 u16 trxff_boundary;
Jes Sorensen9b323ee2016-04-14 14:59:03 -04001350 u8 pbp_rx;
1351 u8 pbp_tx;
Jes Sorensenc606e662016-04-07 14:19:16 -04001352 struct rtl8xxxu_reg8val *mactable;
Jes Sorensen89c2a092016-04-14 14:58:44 -04001353 u8 total_page_num;
1354 u8 page_num_hi;
1355 u8 page_num_lo;
1356 u8 page_num_norm;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001357};
Jes Sorensen599119f2016-04-28 15:19:06 -04001358
1359extern int rtl8xxxu_debug;
1360
Jes Sorensen20e3b2e2016-04-28 15:19:08 -04001361extern struct rtl8xxxu_reg8val rtl8xxxu_gen1_mac_init_table[];
Jes Sorensen599119f2016-04-28 15:19:06 -04001362extern const u32 rtl8xxxu_iqk_phy_iq_bb_reg[];
1363u8 rtl8xxxu_read8(struct rtl8xxxu_priv *priv, u16 addr);
1364u16 rtl8xxxu_read16(struct rtl8xxxu_priv *priv, u16 addr);
1365u32 rtl8xxxu_read32(struct rtl8xxxu_priv *priv, u16 addr);
1366int rtl8xxxu_write8(struct rtl8xxxu_priv *priv, u16 addr, u8 val);
1367int rtl8xxxu_write16(struct rtl8xxxu_priv *priv, u16 addr, u16 val);
1368int rtl8xxxu_write32(struct rtl8xxxu_priv *priv, u16 addr, u32 val);
1369u32 rtl8xxxu_read_rfreg(struct rtl8xxxu_priv *priv,
1370 enum rtl8xxxu_rfpath path, u8 reg);
1371int rtl8xxxu_write_rfreg(struct rtl8xxxu_priv *priv,
1372 enum rtl8xxxu_rfpath path, u8 reg, u32 data);
1373void rtl8xxxu_save_regs(struct rtl8xxxu_priv *priv, const u32 *regs,
1374 u32 *backup, int count);
1375void rtl8xxxu_restore_regs(struct rtl8xxxu_priv *priv, const u32 *regs,
1376 u32 *backup, int count);
1377void rtl8xxxu_save_mac_regs(struct rtl8xxxu_priv *priv,
1378 const u32 *reg, u32 *backup);
1379void rtl8xxxu_restore_mac_regs(struct rtl8xxxu_priv *priv,
1380 const u32 *reg, u32 *backup);
1381void rtl8xxxu_path_adda_on(struct rtl8xxxu_priv *priv, const u32 *regs,
1382 bool path_a_on);
1383void rtl8xxxu_mac_calibration(struct rtl8xxxu_priv *priv,
1384 const u32 *regs, u32 *backup);
1385void rtl8xxxu_fill_iqk_matrix_a(struct rtl8xxxu_priv *priv, bool iqk_ok,
1386 int result[][8], int candidate, bool tx_only);
1387void rtl8xxxu_fill_iqk_matrix_b(struct rtl8xxxu_priv *priv, bool iqk_ok,
1388 int result[][8], int candidate, bool tx_only);
1389int rtl8xxxu_init_phy_rf(struct rtl8xxxu_priv *priv,
1390 struct rtl8xxxu_rfregval *table,
1391 enum rtl8xxxu_rfpath path);
1392int rtl8xxxu_init_phy_regs(struct rtl8xxxu_priv *priv,
1393 struct rtl8xxxu_reg32val *array);
1394int rtl8xxxu_load_firmware(struct rtl8xxxu_priv *priv, char *fw_name);
Jes Sorensen6c46ca32016-04-28 15:19:07 -04001395void rtl8xxxu_firmware_self_reset(struct rtl8xxxu_priv *priv);
Jes Sorensen599119f2016-04-28 15:19:06 -04001396void rtl8xxxu_power_off(struct rtl8xxxu_priv *priv);
1397void rtl8xxxu_reset_8051(struct rtl8xxxu_priv *priv);
1398int rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv, u8 last_tx_page);
Jes Sorensen27c7e892016-04-28 15:19:14 -04001399void rtl8xxxu_gen2_prepare_calibrate(struct rtl8xxxu_priv *priv, u8 start);
Jes Sorensen6c46ca32016-04-28 15:19:07 -04001400int rtl8xxxu_flush_fifo(struct rtl8xxxu_priv *priv);
Jes Sorensen9c0343d2016-04-28 15:19:13 -04001401int rtl8xxxu_gen2_h2c_cmd(struct rtl8xxxu_priv *priv,
1402 struct h2c_cmd *h2c, int len);
Jes Sorensen6c46ca32016-04-28 15:19:07 -04001403int rtl8xxxu_active_to_lps(struct rtl8xxxu_priv *priv);
Jes Sorensen993dd9b2016-04-28 15:19:12 -04001404void rtl8xxxu_disabled_to_emu(struct rtl8xxxu_priv *priv);
Jes Sorensen20e3b2e2016-04-28 15:19:08 -04001405int rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv, u8 last_tx_page);
1406void rtl8xxxu_gen1_phy_iq_calibrate(struct rtl8xxxu_priv *priv);
1407void rtl8xxxu_gen1_init_phy_bb(struct rtl8xxxu_priv *priv);
1408void rtl8xxxu_gen1_set_tx_power(struct rtl8xxxu_priv *priv,
1409 int channel, bool ht40);
1410void rtl8xxxu_gen1_config_channel(struct ieee80211_hw *hw);
Jes Sorensen599119f2016-04-28 15:19:06 -04001411void rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw);
Jes Sorensen20e3b2e2016-04-28 15:19:08 -04001412void rtl8xxxu_gen1_usb_quirks(struct rtl8xxxu_priv *priv);
Jes Sorensen599119f2016-04-28 15:19:06 -04001413void rtl8xxxu_gen2_usb_quirks(struct rtl8xxxu_priv *priv);
Jes Sorensen20e3b2e2016-04-28 15:19:08 -04001414void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv,
1415 u32 ramask, int sgi);
Jes Sorensen599119f2016-04-28 15:19:06 -04001416void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv,
1417 u32 ramask, int sgi);
Jes Sorensen20e3b2e2016-04-28 15:19:08 -04001418void rtl8xxxu_gen1_report_connect(struct rtl8xxxu_priv *priv,
1419 u8 macid, bool connect);
Jes Sorensen599119f2016-04-28 15:19:06 -04001420void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv,
1421 u8 macid, bool connect);
Jes Sorensen91dcbb72016-06-27 12:32:06 -04001422void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv);
Jes Sorensen20e3b2e2016-04-28 15:19:08 -04001423void rtl8xxxu_gen1_enable_rf(struct rtl8xxxu_priv *priv);
1424void rtl8xxxu_gen1_disable_rf(struct rtl8xxxu_priv *priv);
Jes Sorensen599119f2016-04-28 15:19:06 -04001425void rtl8xxxu_gen2_disable_rf(struct rtl8xxxu_priv *priv);
Jes Sorensen2db125d2016-06-27 12:32:01 -04001426int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb);
1427int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb);
Jes Sorensen599119f2016-04-28 15:19:06 -04001428int rtl8xxxu_gen2_channel_to_group(int channel);
1429bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv,
1430 int result[][8], int c1, int c2);
1431
Jes Sorensen181725d2016-04-28 15:19:09 -04001432extern struct rtl8xxxu_fileops rtl8192cu_fops;
Jes Sorensen599119f2016-04-28 15:19:06 -04001433extern struct rtl8xxxu_fileops rtl8192eu_fops;
Jes Sorensen20e3b2e2016-04-28 15:19:08 -04001434extern struct rtl8xxxu_fileops rtl8723au_fops;
Jes Sorensen6c46ca32016-04-28 15:19:07 -04001435extern struct rtl8xxxu_fileops rtl8723bu_fops;