blob: 92768f54ce55786ef7bcd456c6ab4d7079fc2731 [file] [log] [blame]
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001/*
2 * Copyright (c) 2014 - 2015 Jes Sorensen <Jes.Sorensen@redhat.com>
3 *
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
45/* (HPQ + LPQ + NPQ + PUBQ) = TX_TOTAL_PAGE_NUM */
46#define TX_PAGE_NUM_PUBQ 0xe7
47#define TX_PAGE_NUM_HI_PQ 0x0c
48#define TX_PAGE_NUM_LO_PQ 0x02
49#define TX_PAGE_NUM_NORM_PQ 0x02
50
51#define RTL_FW_PAGE_SIZE 4096
52#define RTL8XXXU_FIRMWARE_POLL_MAX 1000
53
54#define RTL8723A_CHANNEL_GROUPS 3
55#define RTL8723A_MAX_RF_PATHS 2
Jes Sorensen21db9972016-02-29 17:05:21 -050056#define RTL8723B_CHANNEL_GROUPS 6
Jes Sorensen4a0d7db2016-02-29 17:05:18 -050057#define RTL8723B_MAX_RF_PATHS 4
Jes Sorensen21db9972016-02-29 17:05:21 -050058#define RTL8XXXU_MAX_CHANNEL_GROUPS 6
Jes Sorensen26f1fad2015-10-14 20:44:51 -040059#define RF6052_MAX_TX_PWR 0x3f
60
Jes Sorensen3307d842016-02-29 17:03:59 -050061#define EFUSE_MAP_LEN 512
62#define EFUSE_MAX_SECTION_8723A 64
Jes Sorensen26f1fad2015-10-14 20:44:51 -040063#define EFUSE_REAL_CONTENT_LEN_8723A 512
64#define EFUSE_BT_MAP_LEN_8723A 1024
65#define EFUSE_MAX_WORD_UNIT 4
66
Jes Sorensenb18cdfd2016-02-29 17:04:47 -050067enum rtl8xxxu_rx_type {
68 RX_TYPE_DATA_PKT = 0,
69 RX_TYPE_C2H = 1,
70 RX_TYPE_ERROR = -1
71};
72
Jes Sorensen26f1fad2015-10-14 20:44:51 -040073struct rtl8xxxu_rx_desc {
74#ifdef __LITTLE_ENDIAN
75 u32 pktlen:14;
76 u32 crc32:1;
77 u32 icverr:1;
78 u32 drvinfo_sz:4;
79 u32 security:3;
80 u32 qos:1;
81 u32 shift:2;
82 u32 phy_stats:1;
83 u32 swdec:1;
84 u32 ls:1;
85 u32 fs:1;
86 u32 eor:1;
87 u32 own:1;
88
89 u32 macid:5;
90 u32 tid:4;
91 u32 hwrsvd:4;
92 u32 amsdu:1;
93 u32 paggr:1;
94 u32 faggr:1;
95 u32 a1fit:4;
96 u32 a2fit:4;
97 u32 pam:1;
98 u32 pwr:1;
99 u32 md:1;
100 u32 mf:1;
101 u32 type:2;
102 u32 mc:1;
103 u32 bc:1;
104
105 u32 seq:12;
106 u32 frag:4;
107 u32 nextpktlen:14;
108 u32 nextind:1;
109 u32 reserved0:1;
110
111 u32 rxmcs:6;
112 u32 rxht:1;
113 u32 gf:1;
114 u32 splcp:1;
115 u32 bw:1;
116 u32 htc:1;
117 u32 eosp:1;
118 u32 bssidfit:2;
119 u32 reserved1:16;
120 u32 unicastwake:1;
121 u32 magicwake:1;
122
123 u32 pattern0match:1;
124 u32 pattern1match:1;
125 u32 pattern2match:1;
126 u32 pattern3match:1;
127 u32 pattern4match:1;
128 u32 pattern5match:1;
129 u32 pattern6match:1;
130 u32 pattern7match:1;
131 u32 pattern8match:1;
132 u32 pattern9match:1;
133 u32 patternamatch:1;
134 u32 patternbmatch:1;
135 u32 patterncmatch:1;
136 u32 reserved2:19;
137#else
138 u32 own:1;
139 u32 eor:1;
140 u32 fs:1;
141 u32 ls:1;
142 u32 swdec:1;
143 u32 phy_stats:1;
144 u32 shift:2;
145 u32 qos:1;
146 u32 security:3;
147 u32 drvinfo_sz:4;
148 u32 icverr:1;
149 u32 crc32:1;
150 u32 pktlen:14;
151
152 u32 bc:1;
153 u32 mc:1;
154 u32 type:2;
155 u32 mf:1;
156 u32 md:1;
157 u32 pwr:1;
158 u32 pam:1;
159 u32 a2fit:4;
160 u32 a1fit:4;
161 u32 faggr:1;
162 u32 paggr:1;
163 u32 amsdu:1;
164 u32 hwrsvd:4;
165 u32 tid:4;
166 u32 macid:5;
167
168 u32 reserved0:1;
169 u32 nextind:1;
170 u32 nextpktlen:14;
171 u32 frag:4;
172 u32 seq:12;
173
174 u32 magicwake:1;
175 u32 unicastwake:1;
176 u32 reserved1:16;
177 u32 bssidfit:2;
178 u32 eosp:1;
179 u32 htc:1;
180 u32 bw:1;
181 u32 splcp:1;
182 u32 gf:1;
183 u32 rxht:1;
184 u32 rxmcs:6;
185
186 u32 reserved2:19;
187 u32 patterncmatch:1;
188 u32 patternbmatch:1;
189 u32 patternamatch:1;
190 u32 pattern9match:1;
191 u32 pattern8match:1;
192 u32 pattern7match:1;
193 u32 pattern6match:1;
194 u32 pattern5match:1;
195 u32 pattern4match:1;
196 u32 pattern3match:1;
197 u32 pattern2match:1;
198 u32 pattern1match:1;
199 u32 pattern0match:1;
200#endif
201 __le32 tsfl;
202#if 0
203 u32 bassn:12;
204 u32 bavld:1;
205 u32 reserved3:19;
206#endif
207};
208
Jes Sorensena6c80d22016-02-29 17:04:46 -0500209struct rtl8723bu_rx_desc {
210#ifdef __LITTLE_ENDIAN
211 u32 pktlen:14;
212 u32 crc32:1;
213 u32 icverr:1;
214 u32 drvinfo_sz:4;
215 u32 security:3;
216 u32 qos:1;
217 u32 shift:2;
218 u32 phy_stats:1;
219 u32 swdec:1;
220 u32 ls:1;
221 u32 fs:1;
222 u32 eor:1;
223 u32 own:1;
224
225 u32 macid:7;
226 u32 dummy1_0:1;
227 u32 tid:4;
228 u32 dummy1_1:1;
229 u32 amsdu:1;
230 u32 rxid_match:1;
231 u32 paggr:1;
232 u32 a1fit:4; /* 16 */
233 u32 chkerr:1;
234 u32 ipver:1;
235 u32 tcpudp:1;
236 u32 chkvld:1;
237 u32 pam:1;
238 u32 pwr:1;
239 u32 more_data:1;
240 u32 more_frag:1;
241 u32 type:2;
242 u32 mc:1;
243 u32 bc:1;
244
245 u32 seq:12;
246 u32 frag:4;
247 u32 rx_is_qos:1; /* 16 */
248 u32 dummy2_0:1;
249 u32 wlanhd_iv_len:6;
250 u32 dummy2_1:4;
251 u32 rpt_sel:1;
252 u32 dummy2_2:3;
253
254 u32 rxmcs:7;
255 u32 dummy3_0:3;
256 u32 htc:1;
257 u32 eosp:1;
258 u32 bssidfit:2;
259 u32 dummy3_1:2;
260 u32 usb_agg_pktnum:8; /* 16 */
261 u32 dummy3_2:5;
262 u32 pattern_match:1;
263 u32 unicast_match:1;
264 u32 magic_match:1;
265
266 u32 splcp:1;
267 u32 ldcp:1;
268 u32 stbc:1;
269 u32 dummy4_0:1;
270 u32 bw:2;
271 u32 dummy4_1:26;
272#else
273 u32 own:1;
274 u32 eor:1;
275 u32 fs:1;
276 u32 ls:1;
277 u32 swdec:1;
278 u32 phy_stats:1;
279 u32 shift:2;
280 u32 qos:1;
281 u32 security:3;
282 u32 drvinfo_sz:4;
283 u32 icverr:1;
284 u32 crc32:1;
285 u32 pktlen:14;
286
287 u32 bc:1;
288 u32 mc:1;
289 u32 type:2;
290 u32 mf:1;
291 u32 md:1;
292 u32 pwr:1;
293 u32 pam:1;
294 u32 a2fit:4;
295 u32 a1fit:4;
296 u32 faggr:1;
297 u32 paggr:1;
298 u32 amsdu:1;
299 u32 hwrsvd:4;
300 u32 tid:4;
301 u32 macid:5;
302
303 u32 dummy2_2:3;
304 u32 rpt_sel:1;
305 u32 dummy2_1:4;
306 u32 wlanhd_iv_len:6;
307 u32 dummy2_0:1;
308 u32 rx_is_qos:1;
309 u32 frag:4; /* 16 */
310 u32 seq:12;
311
312 u32 magic_match:1;
313 u32 unicast_match:1;
314 u32 pattern_match:1;
315 u32 dummy3_2:5;
316 u32 usb_agg_pktnum:8;
317 u32 dummy3_1:2; /* 16 */
318 u32 bssidfit:2;
319 u32 eosp:1;
320 u32 htc:1;
321 u32 dummy3_0:3;
322 u32 rxmcs:7;
323
324 u32 dumm4_1:26;
325 u32 bw:2;
326 u32 dummy4_0:1;
327 u32 stbc:1;
328 u32 ldcp:1;
329 u32 splcp:1;
330#endif
331 __le32 tsfl;
332};
333
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400334struct rtl8xxxu_tx_desc {
335 __le16 pkt_size;
336 u8 pkt_offset;
337 u8 txdw0;
338 __le32 txdw1;
339 __le32 txdw2;
340 __le32 txdw3;
341 __le32 txdw4;
342 __le32 txdw5;
343 __le32 txdw6;
344 __le16 csum;
345 __le16 txdw7;
346};
347
348/* CCK Rates, TxHT = 0 */
349#define DESC_RATE_1M 0x00
350#define DESC_RATE_2M 0x01
351#define DESC_RATE_5_5M 0x02
352#define DESC_RATE_11M 0x03
353
354/* OFDM Rates, TxHT = 0 */
355#define DESC_RATE_6M 0x04
356#define DESC_RATE_9M 0x05
357#define DESC_RATE_12M 0x06
358#define DESC_RATE_18M 0x07
359#define DESC_RATE_24M 0x08
360#define DESC_RATE_36M 0x09
361#define DESC_RATE_48M 0x0a
362#define DESC_RATE_54M 0x0b
363
364/* MCS Rates, TxHT = 1 */
365#define DESC_RATE_MCS0 0x0c
366#define DESC_RATE_MCS1 0x0d
367#define DESC_RATE_MCS2 0x0e
368#define DESC_RATE_MCS3 0x0f
369#define DESC_RATE_MCS4 0x10
370#define DESC_RATE_MCS5 0x11
371#define DESC_RATE_MCS6 0x12
372#define DESC_RATE_MCS7 0x13
373#define DESC_RATE_MCS8 0x14
374#define DESC_RATE_MCS9 0x15
375#define DESC_RATE_MCS10 0x16
376#define DESC_RATE_MCS11 0x17
377#define DESC_RATE_MCS12 0x18
378#define DESC_RATE_MCS13 0x19
379#define DESC_RATE_MCS14 0x1a
380#define DESC_RATE_MCS15 0x1b
381#define DESC_RATE_MCS15_SG 0x1c
382#define DESC_RATE_MCS32 0x20
383
384#define TXDESC_OFFSET_SZ 0
385#define TXDESC_OFFSET_SHT 16
386#if 0
387#define TXDESC_BMC BIT(24)
388#define TXDESC_LSG BIT(26)
389#define TXDESC_FSG BIT(27)
390#define TXDESC_OWN BIT(31)
391#else
392#define TXDESC_BROADMULTICAST BIT(0)
393#define TXDESC_LAST_SEGMENT BIT(2)
394#define TXDESC_FIRST_SEGMENT BIT(3)
395#define TXDESC_OWN BIT(7)
396#endif
397
398/* Word 1 */
399#define TXDESC_PKT_OFFSET_SZ 0
400#define TXDESC_AGG_ENABLE BIT(5)
401#define TXDESC_BK BIT(6)
402#define TXDESC_QUEUE_SHIFT 8
403#define TXDESC_QUEUE_MASK 0x1f00
404#define TXDESC_QUEUE_BK 0x2
405#define TXDESC_QUEUE_BE 0x0
406#define TXDESC_QUEUE_VI 0x5
407#define TXDESC_QUEUE_VO 0x7
408#define TXDESC_QUEUE_BEACON 0x10
409#define TXDESC_QUEUE_HIGH 0x11
410#define TXDESC_QUEUE_MGNT 0x12
411#define TXDESC_QUEUE_CMD 0x13
412#define TXDESC_QUEUE_MAX (TXDESC_QUEUE_CMD + 1)
413
414#define DESC_RATE_ID_SHIFT 16
415#define DESC_RATE_ID_MASK 0xf
416#define TXDESC_NAVUSEHDR BIT(20)
417#define TXDESC_SEC_RC4 0x00400000
418#define TXDESC_SEC_AES 0x00c00000
419#define TXDESC_PKT_OFFSET_SHIFT 26
420#define TXDESC_AGG_EN BIT(29)
421#define TXDESC_HWPC BIT(31)
422
423/* Word 2 */
424#define TXDESC_ACK_REPORT BIT(19)
425#define TXDESC_AMPDU_DENSITY_SHIFT 20
426
427/* Word 3 */
428#define TXDESC_SEQ_SHIFT 16
429#define TXDESC_SEQ_MASK 0x0fff0000
430
431/* Word 4 */
432#define TXDESC_QOS BIT(6)
433#define TXDESC_HW_SEQ_ENABLE BIT(7)
434#define TXDESC_USE_DRIVER_RATE BIT(8)
435#define TXDESC_DISABLE_DATA_FB BIT(10)
436#define TXDESC_CTS_SELF_ENABLE BIT(11)
437#define TXDESC_RTS_CTS_ENABLE BIT(12)
438#define TXDESC_HW_RTS_ENABLE BIT(13)
439#define TXDESC_PRIME_CH_OFF_LOWER BIT(20)
440#define TXDESC_PRIME_CH_OFF_UPPER BIT(21)
441#define TXDESC_SHORT_PREAMBLE BIT(24)
442#define TXDESC_DATA_BW BIT(25)
443#define TXDESC_RTS_DATA_BW BIT(27)
444#define TXDESC_RTS_PRIME_CH_OFF_LOWER BIT(28)
445#define TXDESC_RTS_PRIME_CH_OFF_UPPER BIT(29)
446
447/* Word 5 */
448#define TXDESC_RTS_RATE_SHIFT 0
449#define TXDESC_RTS_RATE_MASK 0x3f
450#define TXDESC_SHORT_GI BIT(6)
451#define TXDESC_CCX_TAG BIT(7)
452#define TXDESC_RETRY_LIMIT_ENABLE BIT(17)
453#define TXDESC_RETRY_LIMIT_SHIFT 18
454#define TXDESC_RETRY_LIMIT_MASK 0x00fc0000
455
456/* Word 6 */
457#define TXDESC_MAX_AGG_SHIFT 11
458
459struct phy_rx_agc_info {
460#ifdef __LITTLE_ENDIAN
461 u8 gain:7, trsw:1;
462#else
463 u8 trsw:1, gain:7;
464#endif
465};
466
467struct rtl8723au_phy_stats {
468 struct phy_rx_agc_info path_agc[RTL8723A_MAX_RF_PATHS];
469 u8 ch_corr[RTL8723A_MAX_RF_PATHS];
470 u8 cck_sig_qual_ofdm_pwdb_all;
471 u8 cck_agc_rpt_ofdm_cfosho_a;
472 u8 cck_rpt_b_ofdm_cfosho_b;
473 u8 reserved_1;
474 u8 noise_power_db_msb;
475 u8 path_cfotail[RTL8723A_MAX_RF_PATHS];
476 u8 pcts_mask[RTL8723A_MAX_RF_PATHS];
477 s8 stream_rxevm[RTL8723A_MAX_RF_PATHS];
478 u8 path_rxsnr[RTL8723A_MAX_RF_PATHS];
479 u8 noise_power_db_lsb;
480 u8 reserved_2[3];
481 u8 stream_csi[RTL8723A_MAX_RF_PATHS];
482 u8 stream_target_csi[RTL8723A_MAX_RF_PATHS];
483 s8 sig_evm;
484 u8 reserved_3;
485
486#ifdef __LITTLE_ENDIAN
487 u8 antsel_rx_keep_2:1; /* ex_intf_flg:1; */
488 u8 sgi_en:1;
489 u8 rxsc:2;
490 u8 idle_long:1;
491 u8 r_ant_train_en:1;
492 u8 antenna_select_b:1;
493 u8 antenna_select:1;
494#else /* _BIG_ENDIAN_ */
495 u8 antenna_select:1;
496 u8 antenna_select_b:1;
497 u8 r_ant_train_en:1;
498 u8 idle_long:1;
499 u8 rxsc:2;
500 u8 sgi_en:1;
501 u8 antsel_rx_keep_2:1; /* ex_intf_flg:1; */
502#endif
503};
504
505/*
506 * Regs to backup
507 */
508#define RTL8XXXU_ADDA_REGS 16
509#define RTL8XXXU_MAC_REGS 4
510#define RTL8XXXU_BB_REGS 9
511
512struct rtl8xxxu_firmware_header {
513 __le16 signature; /* 92C0: test chip; 92C,
514 88C0: test chip;
515 88C1: MP A-cut;
516 92C1: MP A-cut */
517 u8 category; /* AP/NIC and USB/PCI */
518 u8 function;
519
520 __le16 major_version; /* FW Version */
521 u8 minor_version; /* FW Subversion, default 0x00 */
522 u8 reserved1;
523
524 u8 month; /* Release time Month field */
525 u8 date; /* Release time Date field */
526 u8 hour; /* Release time Hour field */
527 u8 minute; /* Release time Minute field */
528
529 __le16 ramcodesize; /* Size of RAM code */
530 u16 reserved2;
531
532 __le32 svn_idx; /* SVN entry index */
533 u32 reserved3;
534
535 u32 reserved4;
536 u32 reserved5;
537
538 u8 data[0];
539};
540
541/*
542 * The 8723au has 3 channel groups: 1-3, 4-9, and 10-14
543 */
544struct rtl8723au_idx {
545#ifdef __LITTLE_ENDIAN
546 int a:4;
547 int b:4;
548#else
549 int b:4;
550 int a:4;
551#endif
552} __attribute__((packed));
553
554struct rtl8723au_efuse {
555 __le16 rtl_id;
556 u8 res0[0xe];
557 u8 cck_tx_power_index_A[3]; /* 0x10 */
558 u8 cck_tx_power_index_B[3];
559 u8 ht40_1s_tx_power_index_A[3]; /* 0x16 */
560 u8 ht40_1s_tx_power_index_B[3];
561 /*
562 * The following entries are half-bytes split as:
563 * bits 0-3: path A, bits 4-7: path B, all values 4 bits signed
564 */
565 struct rtl8723au_idx ht20_tx_power_index_diff[3];
566 struct rtl8723au_idx ofdm_tx_power_index_diff[3];
567 struct rtl8723au_idx ht40_max_power_offset[3];
568 struct rtl8723au_idx ht20_max_power_offset[3];
569 u8 channel_plan; /* 0x28 */
570 u8 tssi_a;
571 u8 thermal_meter;
572 u8 rf_regulatory;
573 u8 rf_option_2;
574 u8 rf_option_3;
575 u8 rf_option_4;
576 u8 res7;
577 u8 version /* 0x30 */;
578 u8 customer_id_major;
579 u8 customer_id_minor;
580 u8 xtal_k;
581 u8 chipset; /* 0x34 */
582 u8 res8[0x82];
583 u8 vid; /* 0xb7 */
584 u8 res9;
585 u8 pid; /* 0xb9 */
586 u8 res10[0x0c];
587 u8 mac_addr[ETH_ALEN]; /* 0xc6 */
588 u8 res11[2];
589 u8 vendor_name[7];
590 u8 res12[2];
591 u8 device_name[0x29]; /* 0xd7 */
592};
593
594struct rtl8192cu_efuse {
595 __le16 rtl_id;
596 __le16 hpon;
597 u8 res0[2];
598 __le16 clk;
599 __le16 testr;
600 __le16 vid;
601 __le16 did;
602 __le16 svid;
603 __le16 smid; /* 0x10 */
604 u8 res1[4];
605 u8 mac_addr[ETH_ALEN]; /* 0x16 */
606 u8 res2[2];
607 u8 vendor_name[7];
608 u8 res3[3];
609 u8 device_name[0x14]; /* 0x28 */
610 u8 res4[0x1e]; /* 0x3c */
611 u8 cck_tx_power_index_A[3]; /* 0x5a */
612 u8 cck_tx_power_index_B[3];
613 u8 ht40_1s_tx_power_index_A[3]; /* 0x60 */
614 u8 ht40_1s_tx_power_index_B[3];
615 /*
616 * The following entries are half-bytes split as:
617 * bits 0-3: path A, bits 4-7: path B, all values 4 bits signed
618 */
619 struct rtl8723au_idx ht40_2s_tx_power_index_diff[3];
620 struct rtl8723au_idx ht20_tx_power_index_diff[3]; /* 0x69 */
621 struct rtl8723au_idx ofdm_tx_power_index_diff[3];
622 struct rtl8723au_idx ht40_max_power_offset[3]; /* 0x6f */
623 struct rtl8723au_idx ht20_max_power_offset[3];
624 u8 channel_plan; /* 0x75 */
625 u8 tssi_a;
626 u8 tssi_b;
627 u8 thermal_meter; /* xtal_k */ /* 0x78 */
628 u8 rf_regulatory;
629 u8 rf_option_2;
630 u8 rf_option_3;
631 u8 rf_option_4;
632 u8 res5[1]; /* 0x7d */
633 u8 version;
634 u8 customer_id;
635};
636
Jes Sorensen4a0d7db2016-02-29 17:05:18 -0500637struct rtl8723bu_efuse_tx_power {
638 u8 cck_base[6];
639 u8 ht40_base[5];
640 struct rtl8723au_idx ht20_ofdm_1s_diff;
641 struct rtl8723au_idx ht40_ht20_2s_diff;
642 struct rtl8723au_idx ofdm_cck_2s_diff; /* not used */
643 struct rtl8723au_idx ht40_ht20_3s_diff;
644 struct rtl8723au_idx ofdm_cck_3s_diff; /* not used */
645 struct rtl8723au_idx ht40_ht20_4s_diff;
646 struct rtl8723au_idx ofdm_cck_4s_diff; /* not used */
647 u8 dummy5g[24]; /* max channel group (14) + power diff offset (10) */
648};
649
Jes Sorensen3c836d62016-02-29 17:04:11 -0500650struct rtl8723bu_efuse {
651 __le16 rtl_id;
652 u8 res0[0x0e];
Jes Sorensen4a0d7db2016-02-29 17:05:18 -0500653 struct rtl8723bu_efuse_tx_power tx_power_index_A; /* 0x10 */
654 struct rtl8723bu_efuse_tx_power tx_power_index_B; /* 0x3a */
655 struct rtl8723bu_efuse_tx_power tx_power_index_C; /* 0x64 */
656 struct rtl8723bu_efuse_tx_power tx_power_index_D; /* 0x8e */
Jes Sorensen3c836d62016-02-29 17:04:11 -0500657 u8 channel_plan; /* 0xb8 */
658 u8 xtal_k;
659 u8 thermal_meter;
660 u8 iqk_lck;
661 u8 pa_type; /* 0xbc */
662 u8 lna_type_2g; /* 0xbd */
663 u8 res2[3];
664 u8 rf_board_option;
665 u8 rf_feature_option;
666 u8 rf_bt_setting;
667 u8 eeprom_version;
668 u8 eeprom_customer_id;
669 u8 res3[2];
670 u8 tx_pwr_calibrate_rate;
671 u8 rf_antenna_option; /* 0xc9 */
672 u8 rfe_option;
673 u8 res4[9];
674 u8 usb_optional_function;
675 u8 res5[0x1e];
676 u8 res6[2];
677 u8 serial[0x0b]; /* 0xf5 */
678 u8 vid; /* 0x100 */
679 u8 res7;
680 u8 pid;
681 u8 res8[4];
682 u8 mac_addr[ETH_ALEN]; /* 0x107 */
683 u8 res9[2];
684 u8 vendor_name[0x07];
685 u8 res10[2];
Jes Sorensen22a31d42016-02-29 17:04:15 -0500686 u8 device_name[0x14];
687 u8 res11[0xcf];
688 u8 package_type; /* 0x1fb */
689 u8 res12[0x4];
Jes Sorensen3c836d62016-02-29 17:04:11 -0500690};
691
Jakub Sitnickie6f9a9c2016-02-29 17:04:39 -0500692struct rtl8192eu_efuse_tx_power {
693 u8 cck_base[6];
694 u8 ht40_base[5];
695 struct rtl8723au_idx ht20_ofdm_1s_diff;
696 struct rtl8723au_idx ht40_ht20_2s_diff;
697 struct rtl8723au_idx ofdm_cck_2s_diff; /* not used */
698 struct rtl8723au_idx ht40_ht20_3s_diff;
699 struct rtl8723au_idx ofdm_cck_3s_diff; /* not used */
700 struct rtl8723au_idx ht40_ht20_4s_diff;
701 struct rtl8723au_idx ofdm_cck_4s_diff; /* not used */
702};
703
Jes Sorensen3307d842016-02-29 17:03:59 -0500704struct rtl8192eu_efuse {
705 __le16 rtl_id;
706 u8 res0[0x0e];
Jakub Sitnickie6f9a9c2016-02-29 17:04:39 -0500707 struct rtl8192eu_efuse_tx_power tx_power_index_A; /* 0x10 */
708 struct rtl8192eu_efuse_tx_power tx_power_index_B; /* 0x22 */
709 struct rtl8192eu_efuse_tx_power tx_power_index_C; /* 0x34 */
710 struct rtl8192eu_efuse_tx_power tx_power_index_D; /* 0x46 */
711 u8 res1[0x60];
Jes Sorensen3307d842016-02-29 17:03:59 -0500712 u8 channel_plan; /* 0xb8 */
713 u8 xtal_k;
714 u8 thermal_meter;
715 u8 iqk_lck;
716 u8 pa_type; /* 0xbc */
717 u8 lna_type_2g; /* 0xbd */
718 u8 res2[1];
719 u8 lna_type_5g; /* 0xbf */
720 u8 res13[1];
721 u8 rf_board_option;
722 u8 rf_feature_option;
723 u8 rf_bt_setting;
724 u8 eeprom_version;
725 u8 eeprom_customer_id;
726 u8 res3[3];
727 u8 rf_antenna_option; /* 0xc9 */
728 u8 res4[6];
729 u8 vid; /* 0xd0 */
730 u8 res5[1];
731 u8 pid; /* 0xd2 */
732 u8 res6[1];
733 u8 usb_optional_function;
734 u8 res7[2];
735 u8 mac_addr[ETH_ALEN]; /* 0xd7 */
736 u8 res8[2];
737 u8 vendor_name[7];
738 u8 res9[2];
739 u8 device_name[0x0b]; /* 0xe8 */
740 u8 res10[2];
741 u8 serial[0x0b]; /* 0xf5 */
742 u8 res11[0x30];
743 u8 unknown[0x0d]; /* 0x130 */
744 u8 res12[0xc3];
745};
746
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400747struct rtl8xxxu_reg8val {
748 u16 reg;
749 u8 val;
750};
751
752struct rtl8xxxu_reg32val {
753 u16 reg;
754 u32 val;
755};
756
757struct rtl8xxxu_rfregval {
758 u8 reg;
759 u32 val;
760};
761
762enum rtl8xxxu_rfpath {
763 RF_A = 0,
764 RF_B = 1,
765};
766
767struct rtl8xxxu_rfregs {
768 u16 hssiparm1;
769 u16 hssiparm2;
770 u16 lssiparm;
771 u16 hspiread;
772 u16 lssiread;
773 u16 rf_sw_ctrl;
774};
775
776#define H2C_MAX_MBOX 4
777#define H2C_EXT BIT(7)
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400778#define H2C_JOIN_BSS_DISCONNECT 0
779#define H2C_JOIN_BSS_CONNECT 1
Jes Sorensend940c242016-02-29 17:04:22 -0500780
781/*
782 * H2C (firmware) commands differ between the older generation chips
783 * 8188[cr]u, 819[12]cu, and 8723au, and the more recent chips 8723bu,
784 * 8192[de]u, 8192eu, and 8812.
785 */
786enum h2c_cmd_8723a {
787 H2C_SET_POWER_MODE = 1,
788 H2C_JOIN_BSS_REPORT = 2,
789 H2C_SET_RSSI = 5,
790 H2C_SET_RATE_MASK = (6 | H2C_EXT),
791};
792
793enum h2c_cmd_8723b {
794 /*
795 * Common Class: 000
796 */
797 H2C_8723B_RSVD_PAGE = 0x00,
798 H2C_8723B_MEDIA_STATUS_RPT = 0x01,
799 H2C_8723B_SCAN_ENABLE = 0x02,
800 H2C_8723B_KEEP_ALIVE = 0x03,
801 H2C_8723B_DISCON_DECISION = 0x04,
802 H2C_8723B_PSD_OFFLOAD = 0x05,
803 H2C_8723B_AP_OFFLOAD = 0x08,
804 H2C_8723B_BCN_RSVDPAGE = 0x09,
805 H2C_8723B_PROBERSP_RSVDPAGE = 0x0A,
806 H2C_8723B_FCS_RSVDPAGE = 0x10,
807 H2C_8723B_FCS_INFO = 0x11,
808 H2C_8723B_AP_WOW_GPIO_CTRL = 0x13,
809
810 /*
811 * PoweSave Class: 001
812 */
813 H2C_8723B_SET_PWR_MODE = 0x20,
814 H2C_8723B_PS_TUNING_PARA = 0x21,
815 H2C_8723B_PS_TUNING_PARA2 = 0x22,
816 H2C_8723B_P2P_LPS_PARAM = 0x23,
817 H2C_8723B_P2P_PS_OFFLOAD = 0x24,
818 H2C_8723B_PS_SCAN_ENABLE = 0x25,
819 H2C_8723B_SAP_PS_ = 0x26,
820 H2C_8723B_INACTIVE_PS_ = 0x27,
821 H2C_8723B_FWLPS_IN_IPS_ = 0x28,
822
823 /*
824 * Dynamic Mechanism Class: 010
825 */
826 H2C_8723B_MACID_CFG = 0x40,
827 H2C_8723B_TXBF = 0x41,
828 H2C_8723B_RSSI_SETTING = 0x42,
829 H2C_8723B_AP_REQ_TXRPT = 0x43,
830 H2C_8723B_INIT_RATE_COLLECT = 0x44,
831
832 /*
833 * BT Class: 011
834 */
835 H2C_8723B_B_TYPE_TDMA = 0x60,
836 H2C_8723B_BT_INFO = 0x61,
837 H2C_8723B_FORCE_BT_TXPWR = 0x62,
838 H2C_8723B_BT_IGNORE_WLANACT = 0x63,
839 H2C_8723B_DAC_SWING_VALUE = 0x64,
840 H2C_8723B_ANT_SEL_RSV = 0x65,
841 H2C_8723B_WL_OPMODE = 0x66,
842 H2C_8723B_BT_MP_OPER = 0x67,
843 H2C_8723B_BT_CONTROL = 0x68,
844 H2C_8723B_BT_WIFI_CTRL = 0x69,
Jes Sorensenf37e9222016-02-29 17:04:41 -0500845 H2C_8723B_BT_FW_PATCH = 0x6a,
846 H2C_8723B_BT_WLAN_CALIBRATION = 0x6d,
847 H2C_8723B_BT_GRANT = 0x6e,
Jes Sorensend940c242016-02-29 17:04:22 -0500848
849 /*
850 * WOWLAN Class: 100
851 */
852 H2C_8723B_WOWLAN = 0x80,
853 H2C_8723B_REMOTE_WAKE_CTRL = 0x81,
854 H2C_8723B_AOAC_GLOBAL_INFO = 0x82,
855 H2C_8723B_AOAC_RSVD_PAGE = 0x83,
856 H2C_8723B_AOAC_RSVD_PAGE2 = 0x84,
857 H2C_8723B_D0_SCAN_OFFLOAD_CTRL = 0x85,
858 H2C_8723B_D0_SCAN_OFFLOAD_INFO = 0x86,
859 H2C_8723B_CHNL_SWITCH_OFFLOAD = 0x87,
860
861 H2C_8723B_RESET_TSF = 0xC0,
862};
863
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400864
865struct h2c_cmd {
866 union {
867 struct {
868 u8 cmd;
Jes Sorensened35d092016-02-29 17:04:19 -0500869 u8 data[7];
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400870 } __packed cmd;
871 struct {
872 __le32 data;
873 __le16 ext;
874 } __packed raw;
875 struct {
Jes Sorensened35d092016-02-29 17:04:19 -0500876 __le32 data;
877 __le32 ext;
878 } __packed raw_wide;
879 struct {
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400880 u8 cmd;
881 u8 data;
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400882 } __packed joinbss;
883 struct {
884 u8 cmd;
885 __le16 mask_hi;
886 u8 arg;
887 __le16 mask_lo;
888 } __packed ramask;
Jes Sorensenc7a5a192016-02-29 17:04:30 -0500889 struct {
890 u8 cmd;
Jes Sorensen3ca7b322016-02-29 17:04:43 -0500891 u8 data1;
892 u8 data2;
893 u8 data3;
894 u8 data4;
895 u8 data5;
896 } __packed b_type_dma;
897 struct {
898 u8 cmd;
Jes Sorensen6b9eae02016-02-29 17:04:50 -0500899 u8 data;
900 } __packed bt_info;
901 struct {
902 u8 cmd;
Jes Sorensen394f1bd2016-02-29 17:04:49 -0500903 u8 operreq;
904 u8 opcode;
905 u8 data;
906 u8 addr;
907 } __packed bt_mp_oper;
908 struct {
909 u8 cmd;
Jes Sorensenc7a5a192016-02-29 17:04:30 -0500910 u8 data;
911 } __packed bt_wlan_calibration;
Jes Sorensenf37e9222016-02-29 17:04:41 -0500912 struct {
913 u8 cmd;
Jes Sorensen7297f492016-02-29 17:04:44 -0500914 u8 data;
915 } __packed ignore_wlan;
916 struct {
917 u8 cmd;
Jes Sorensenf37e9222016-02-29 17:04:41 -0500918 u8 ant_inverse;
919 u8 int_switch_type;
920 } __packed ant_sel_rsv;
921 struct {
922 u8 cmd;
923 u8 data;
924 } __packed bt_grant;
Jes Sorensen26f1fad2015-10-14 20:44:51 -0400925 };
926};
927
Jes Sorensenb2b43b72016-02-29 17:04:48 -0500928enum c2h_evt_8723b {
929 C2H_8723B_DEBUG = 0,
930 C2H_8723B_TSF = 1,
931 C2H_8723B_AP_RPT_RSP = 2,
932 C2H_8723B_CCX_TX_RPT = 3,
933 C2H_8723B_BT_RSSI = 4,
934 C2H_8723B_BT_OP_MODE = 5,
935 C2H_8723B_EXT_RA_RPT = 6,
936 C2H_8723B_BT_INFO = 9,
Jes Sorensen394f1bd2016-02-29 17:04:49 -0500937 C2H_8723B_HW_INFO_EXCH = 0x0a,
938 C2H_8723B_BT_MP_INFO = 0x0b,
Jes Sorensenb2b43b72016-02-29 17:04:48 -0500939 C2H_8723B_FW_DEBUG = 0xff,
940};
941
942enum bt_info_src_8723b {
943 BT_INFO_SRC_8723B_WIFI_FW = 0x0,
944 BT_INFO_SRC_8723B_BT_RSP = 0x1,
945 BT_INFO_SRC_8723B_BT_ACTIVE_SEND = 0x2,
946};
947
Jes Sorensen394f1bd2016-02-29 17:04:49 -0500948enum bt_mp_oper_opcode_8723b {
949 BT_MP_OP_GET_BT_VERSION = 0x00,
950 BT_MP_OP_RESET = 0x01,
951 BT_MP_OP_TEST_CTRL = 0x02,
952 BT_MP_OP_SET_BT_MODE = 0x03,
953 BT_MP_OP_SET_CHNL_TX_GAIN = 0x04,
954 BT_MP_OP_SET_PKT_TYPE_LEN = 0x05,
955 BT_MP_OP_SET_PKT_CNT_L_PL_TYPE = 0x06,
956 BT_MP_OP_SET_PKT_CNT_H_PKT_INTV = 0x07,
957 BT_MP_OP_SET_PKT_HEADER = 0x08,
958 BT_MP_OP_SET_WHITENCOEFF = 0x09,
959 BT_MP_OP_SET_BD_ADDR_L = 0x0a,
960 BT_MP_OP_SET_BD_ADDR_H = 0x0b,
961 BT_MP_OP_WRITE_REG_ADDR = 0x0c,
962 BT_MP_OP_WRITE_REG_VALUE = 0x0d,
963 BT_MP_OP_GET_BT_STATUS = 0x0e,
964 BT_MP_OP_GET_BD_ADDR_L = 0x0f,
965 BT_MP_OP_GET_BD_ADDR_H = 0x10,
966 BT_MP_OP_READ_REG = 0x11,
967 BT_MP_OP_SET_TARGET_BD_ADDR_L = 0x12,
968 BT_MP_OP_SET_TARGET_BD_ADDR_H = 0x13,
969 BT_MP_OP_SET_TX_POWER_CALIBRATION = 0x14,
970 BT_MP_OP_GET_RX_PKT_CNT_L = 0x15,
971 BT_MP_OP_GET_RX_PKT_CNT_H = 0x16,
972 BT_MP_OP_GET_RX_ERROR_BITS_L = 0x17,
973 BT_MP_OP_GET_RX_ERROR_BITS_H = 0x18,
974 BT_MP_OP_GET_RSSI = 0x19,
975 BT_MP_OP_GET_CFO_HDR_QUALITY_L = 0x1a,
976 BT_MP_OP_GET_CFO_HDR_QUALITY_H = 0x1b,
977 BT_MP_OP_GET_TARGET_BD_ADDR_L = 0x1c,
978 BT_MP_OP_GET_TARGET_BD_ADDR_H = 0x1d,
979 BT_MP_OP_GET_AFH_MAP_L = 0x1e,
980 BT_MP_OP_GET_AFH_MAP_M = 0x1f,
981 BT_MP_OP_GET_AFH_MAP_H = 0x20,
982 BT_MP_OP_GET_AFH_STATUS = 0x21,
983 BT_MP_OP_SET_TRACKING_INTERVAL = 0x22,
984 BT_MP_OP_SET_THERMAL_METER = 0x23,
985 BT_MP_OP_ENABLE_CFO_TRACKING = 0x24,
986};
987
Jes Sorensenb2b43b72016-02-29 17:04:48 -0500988struct rtl8723bu_c2h {
989 u8 id;
990 u8 seq;
991 union {
992 struct {
993 u8 payload[0];
994 } __packed raw;
995 struct {
Jes Sorensen394f1bd2016-02-29 17:04:49 -0500996 u8 ext_id;
997 u8 status:4;
998 u8 retlen:4;
999 u8 opcode_ver:4;
1000 u8 req_num:4;
1001 u8 payload[2];
1002 } __packed bt_mp_info;
1003 struct {
Jes Sorensenb2b43b72016-02-29 17:04:48 -05001004 u8 response_source:4;
1005 u8 dummy0_0:4;
1006
1007 u8 bt_info;
1008
1009 u8 retry_count:4;
1010 u8 dummy2_0:1;
1011 u8 bt_page:1;
1012 u8 tx_rx_mask:1;
1013 u8 dummy2_2:1;
1014
1015 u8 rssi;
1016
1017 u8 basic_rate:1;
1018 u8 bt_has_reset:1;
1019 u8 dummy4_1:1;;
1020 u8 ignore_wlan:1;
1021 u8 auto_report:1;
1022 u8 dummy4_2:3;
1023
1024 u8 a4;
1025 u8 a5;
1026 } __packed bt_info;
1027 };
1028};
1029
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001030struct rtl8xxxu_fileops;
1031
1032struct rtl8xxxu_priv {
1033 struct ieee80211_hw *hw;
1034 struct usb_device *udev;
1035 struct rtl8xxxu_fileops *fops;
1036
1037 spinlock_t tx_urb_lock;
1038 struct list_head tx_urb_free_list;
1039 int tx_urb_free_count;
1040 bool tx_stopped;
1041
1042 spinlock_t rx_urb_lock;
1043 struct list_head rx_urb_pending_list;
1044 int rx_urb_pending_count;
1045 bool shutdown;
1046 struct work_struct rx_urb_wq;
1047
1048 u8 mac_addr[ETH_ALEN];
1049 char chip_name[8];
Jes Sorensen0e5d4352016-02-29 17:04:00 -05001050 char chip_vendor[8];
Jes Sorensen21db9972016-02-29 17:05:21 -05001051 u8 cck_tx_power_index_A[RTL8XXXU_MAX_CHANNEL_GROUPS];
1052 u8 cck_tx_power_index_B[RTL8XXXU_MAX_CHANNEL_GROUPS];
1053 u8 ht40_1s_tx_power_index_A[RTL8XXXU_MAX_CHANNEL_GROUPS];
1054 u8 ht40_1s_tx_power_index_B[RTL8XXXU_MAX_CHANNEL_GROUPS];
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001055 /*
1056 * The following entries are half-bytes split as:
1057 * bits 0-3: path A, bits 4-7: path B, all values 4 bits signed
1058 */
Jes Sorensen21db9972016-02-29 17:05:21 -05001059 struct rtl8723au_idx ht40_2s_tx_power_index_diff[
1060 RTL8XXXU_MAX_CHANNEL_GROUPS];
1061 struct rtl8723au_idx ht20_tx_power_index_diff[
1062 RTL8XXXU_MAX_CHANNEL_GROUPS];
1063 struct rtl8723au_idx ofdm_tx_power_index_diff[
1064 RTL8XXXU_MAX_CHANNEL_GROUPS];
1065 struct rtl8723au_idx ht40_max_power_offset[
1066 RTL8XXXU_MAX_CHANNEL_GROUPS];
1067 struct rtl8723au_idx ht20_max_power_offset[
1068 RTL8XXXU_MAX_CHANNEL_GROUPS];
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001069 u32 chip_cut:4;
1070 u32 rom_rev:4;
Jakub Sitnicki38451992016-02-03 13:39:49 -05001071 u32 is_multi_func:1;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001072 u32 has_wifi:1;
1073 u32 has_bluetooth:1;
1074 u32 enable_bluetooth:1;
1075 u32 has_gps:1;
1076 u32 hi_pa:1;
1077 u32 vendor_umc:1;
Jes Sorensen0e5d4352016-02-29 17:04:00 -05001078 u32 vendor_smic:1;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001079 u32 has_polarity_ctrl:1;
1080 u32 has_eeprom:1;
1081 u32 boot_eeprom:1;
Jes Sorensen0e28b972016-02-29 17:04:13 -05001082 u32 usb_interrupts:1;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001083 u32 ep_tx_high_queue:1;
1084 u32 ep_tx_normal_queue:1;
1085 u32 ep_tx_low_queue:1;
Jes Sorensen4ef22eb2016-02-29 17:04:55 -05001086 u32 has_xtalk:1;
1087 u8 xtalk;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001088 unsigned int pipe_interrupt;
1089 unsigned int pipe_in;
1090 unsigned int pipe_out[TXDESC_QUEUE_MAX];
1091 u8 out_ep[RTL8XXXU_OUT_ENDPOINTS];
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001092 u8 ep_tx_count;
1093 u8 rf_paths;
1094 u8 rx_paths;
1095 u8 tx_paths;
1096 u32 rf_mode_ag[2];
1097 u32 rege94;
1098 u32 rege9c;
1099 u32 regeb4;
1100 u32 regebc;
1101 int next_mbox;
1102 int nr_out_eps;
1103
1104 struct mutex h2c_mutex;
1105
1106 struct usb_anchor rx_anchor;
1107 struct usb_anchor tx_anchor;
1108 struct usb_anchor int_anchor;
1109 struct rtl8xxxu_firmware_header *fw_data;
1110 size_t fw_size;
1111 struct mutex usb_buf_mutex;
1112 union {
1113 __le32 val32;
1114 __le16 val16;
1115 u8 val8;
1116 } usb_buf;
1117 union {
Jes Sorensen3307d842016-02-29 17:03:59 -05001118 u8 raw[EFUSE_MAP_LEN];
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001119 struct rtl8723au_efuse efuse8723;
Jes Sorensen3c836d62016-02-29 17:04:11 -05001120 struct rtl8723bu_efuse efuse8723bu;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001121 struct rtl8192cu_efuse efuse8192;
Jes Sorensen3307d842016-02-29 17:03:59 -05001122 struct rtl8192eu_efuse efuse8192eu;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001123 } efuse_wifi;
1124 u32 adda_backup[RTL8XXXU_ADDA_REGS];
1125 u32 mac_backup[RTL8XXXU_MAC_REGS];
1126 u32 bb_backup[RTL8XXXU_BB_REGS];
1127 u32 bb_recovery_backup[RTL8XXXU_BB_REGS];
1128 u32 rtlchip;
1129 u8 pi_enabled:1;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001130 u8 int_buf[USB_INTR_CONTENT_LENGTH];
1131};
1132
1133struct rtl8xxxu_rx_urb {
1134 struct urb urb;
1135 struct ieee80211_hw *hw;
1136 struct list_head list;
1137};
1138
1139struct rtl8xxxu_tx_urb {
1140 struct urb urb;
1141 struct ieee80211_hw *hw;
1142 struct list_head list;
1143};
1144
1145struct rtl8xxxu_fileops {
1146 int (*parse_efuse) (struct rtl8xxxu_priv *priv);
1147 int (*load_firmware) (struct rtl8xxxu_priv *priv);
1148 int (*power_on) (struct rtl8xxxu_priv *priv);
Jes Sorensen74b99be2016-02-29 17:04:04 -05001149 int (*llt_init) (struct rtl8xxxu_priv *priv, u8 last_tx_page);
Jes Sorensenf0d9f5e2016-02-29 17:04:16 -05001150 void (*phy_init_antenna_selection) (struct rtl8xxxu_priv *priv);
Jes Sorensene1547c52016-02-29 17:04:35 -05001151 void (*phy_iq_calibrate) (struct rtl8xxxu_priv *priv);
Jes Sorensenc3f95062016-02-29 17:04:40 -05001152 void (*config_channel) (struct ieee80211_hw *hw);
Jes Sorensenf37e9222016-02-29 17:04:41 -05001153 void (*init_bt) (struct rtl8xxxu_priv *priv);
Jes Sorensenb18cdfd2016-02-29 17:04:47 -05001154 int (*parse_rx_desc) (struct rtl8xxxu_priv *priv, struct sk_buff *skb,
1155 struct ieee80211_rx_status *rx_status);
Jes Sorensen3e88ca42016-02-29 17:05:08 -05001156 void (*init_aggregation) (struct rtl8xxxu_priv *priv);
Jes Sorensen9c79bf92016-02-29 17:05:10 -05001157 void (*init_statistics) (struct rtl8xxxu_priv *priv);
Jes Sorensendb08de92016-02-29 17:05:17 -05001158 void (*enable_rf) (struct rtl8xxxu_priv *priv);
Jes Sorensene796dab2016-02-29 17:05:19 -05001159 void (*set_tx_power) (struct rtl8xxxu_priv *priv, int channel,
1160 bool ht40);
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001161 int writeN_block_size;
Jes Sorensened35d092016-02-29 17:04:19 -05001162 u16 mbox_ext_reg;
1163 char mbox_ext_width;
Jes Sorensen0d698de2016-02-29 17:04:36 -05001164 char has_s0s1;
Jes Sorensen8634af52016-02-29 17:04:33 -05001165 u32 adda_1t_init;
1166 u32 adda_1t_path_on;
1167 u32 adda_2t_path_on_a;
1168 u32 adda_2t_path_on_b;
Jes Sorensen26f1fad2015-10-14 20:44:51 -04001169};