18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2014 - 2017 Jes Sorensen <Jes.Sorensen@gmail.com>
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Register definitions taken from original Realtek rtl8723au driver
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <asm/byteorder.h>
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_REG_WRITE	0x01
118c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_REG_READ		0x02
128c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_RFREG_WRITE	0x04
138c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_RFREG_READ	0x08
148c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_CHANNEL		0x10
158c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_TX		0x20
168c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_TX_DUMP		0x40
178c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_RX		0x80
188c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_RX_DUMP		0x100
198c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_USB		0x200
208c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_KEY		0x400
218c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_H2C		0x800
228c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_ACTION		0x1000
238c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_EFUSE		0x2000
248c2ecf20Sopenharmony_ci#define RTL8XXXU_DEBUG_INTERRUPT	0x4000
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define RTW_USB_CONTROL_MSG_TIMEOUT	500
278c2ecf20Sopenharmony_ci#define RTL8XXXU_MAX_REG_POLL		500
288c2ecf20Sopenharmony_ci#define	USB_INTR_CONTENT_LENGTH		56
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define RTL8XXXU_OUT_ENDPOINTS		4
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define REALTEK_USB_READ		0xc0
338c2ecf20Sopenharmony_ci#define REALTEK_USB_WRITE		0x40
348c2ecf20Sopenharmony_ci#define REALTEK_USB_CMD_REQ		0x05
358c2ecf20Sopenharmony_ci#define REALTEK_USB_CMD_IDX		0x00
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define TX_TOTAL_PAGE_NUM		0xf8
388c2ecf20Sopenharmony_ci#define TX_TOTAL_PAGE_NUM_8192E		0xf3
398c2ecf20Sopenharmony_ci#define TX_TOTAL_PAGE_NUM_8723B		0xf7
408c2ecf20Sopenharmony_ci/* (HPQ + LPQ + NPQ + PUBQ) = TX_TOTAL_PAGE_NUM */
418c2ecf20Sopenharmony_ci#define TX_PAGE_NUM_PUBQ		0xe7
428c2ecf20Sopenharmony_ci#define TX_PAGE_NUM_HI_PQ		0x0c
438c2ecf20Sopenharmony_ci#define TX_PAGE_NUM_LO_PQ		0x02
448c2ecf20Sopenharmony_ci#define TX_PAGE_NUM_NORM_PQ		0x02
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define TX_PAGE_NUM_PUBQ_8192E		0xe7
478c2ecf20Sopenharmony_ci#define TX_PAGE_NUM_HI_PQ_8192E		0x08
488c2ecf20Sopenharmony_ci#define TX_PAGE_NUM_LO_PQ_8192E		0x0c
498c2ecf20Sopenharmony_ci#define TX_PAGE_NUM_NORM_PQ_8192E	0x00
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#define TX_PAGE_NUM_PUBQ_8723B		0xe7
528c2ecf20Sopenharmony_ci#define TX_PAGE_NUM_HI_PQ_8723B		0x0c
538c2ecf20Sopenharmony_ci#define TX_PAGE_NUM_LO_PQ_8723B		0x02
548c2ecf20Sopenharmony_ci#define TX_PAGE_NUM_NORM_PQ_8723B	0x02
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#define RTL_FW_PAGE_SIZE		4096
578c2ecf20Sopenharmony_ci#define RTL8XXXU_FIRMWARE_POLL_MAX	1000
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define RTL8723A_CHANNEL_GROUPS		3
608c2ecf20Sopenharmony_ci#define RTL8723A_MAX_RF_PATHS		2
618c2ecf20Sopenharmony_ci#define RTL8723B_CHANNEL_GROUPS		6
628c2ecf20Sopenharmony_ci#define RTL8723B_TX_COUNT		4
638c2ecf20Sopenharmony_ci#define RTL8723B_MAX_RF_PATHS		4
648c2ecf20Sopenharmony_ci#define RTL8XXXU_MAX_CHANNEL_GROUPS	6
658c2ecf20Sopenharmony_ci#define RF6052_MAX_TX_PWR		0x3f
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define EFUSE_MAP_LEN			512
688c2ecf20Sopenharmony_ci#define EFUSE_MAX_SECTION_8723A		64
698c2ecf20Sopenharmony_ci#define EFUSE_REAL_CONTENT_LEN_8723A	512
708c2ecf20Sopenharmony_ci#define EFUSE_BT_MAP_LEN_8723A		1024
718c2ecf20Sopenharmony_ci#define EFUSE_MAX_WORD_UNIT		4
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cienum rtl8xxxu_rtl_chip {
748c2ecf20Sopenharmony_ci	RTL8192S = 0x81920,
758c2ecf20Sopenharmony_ci	RTL8191S = 0x81910,
768c2ecf20Sopenharmony_ci	RTL8192C = 0x8192c,
778c2ecf20Sopenharmony_ci	RTL8191C = 0x8191c,
788c2ecf20Sopenharmony_ci	RTL8188C = 0x8188c,
798c2ecf20Sopenharmony_ci	RTL8188R = 0x81889,
808c2ecf20Sopenharmony_ci	RTL8192D = 0x8192d,
818c2ecf20Sopenharmony_ci	RTL8723A = 0x8723a,
828c2ecf20Sopenharmony_ci	RTL8188E = 0x8188e,
838c2ecf20Sopenharmony_ci	RTL8812  = 0x88120,
848c2ecf20Sopenharmony_ci	RTL8821  = 0x88210,
858c2ecf20Sopenharmony_ci	RTL8192E = 0x8192e,
868c2ecf20Sopenharmony_ci	RTL8191E = 0x8191e,
878c2ecf20Sopenharmony_ci	RTL8723B = 0x8723b,
888c2ecf20Sopenharmony_ci	RTL8814A = 0x8814a,
898c2ecf20Sopenharmony_ci	RTL8881A = 0x8881a,
908c2ecf20Sopenharmony_ci	RTL8821B = 0x8821b,
918c2ecf20Sopenharmony_ci	RTL8822B = 0x8822b,
928c2ecf20Sopenharmony_ci	RTL8703B = 0x8703b,
938c2ecf20Sopenharmony_ci	RTL8195A = 0x8195a,
948c2ecf20Sopenharmony_ci	RTL8188F = 0x8188f
958c2ecf20Sopenharmony_ci};
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_cienum rtl8xxxu_rx_type {
988c2ecf20Sopenharmony_ci	RX_TYPE_DATA_PKT = 0,
998c2ecf20Sopenharmony_ci	RX_TYPE_C2H = 1,
1008c2ecf20Sopenharmony_ci	RX_TYPE_ERROR = -1
1018c2ecf20Sopenharmony_ci};
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_cistruct rtl8xxxu_rxdesc16 {
1048c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN
1058c2ecf20Sopenharmony_ci	u32 pktlen:14;
1068c2ecf20Sopenharmony_ci	u32 crc32:1;
1078c2ecf20Sopenharmony_ci	u32 icverr:1;
1088c2ecf20Sopenharmony_ci	u32 drvinfo_sz:4;
1098c2ecf20Sopenharmony_ci	u32 security:3;
1108c2ecf20Sopenharmony_ci	u32 qos:1;
1118c2ecf20Sopenharmony_ci	u32 shift:2;
1128c2ecf20Sopenharmony_ci	u32 phy_stats:1;
1138c2ecf20Sopenharmony_ci	u32 swdec:1;
1148c2ecf20Sopenharmony_ci	u32 ls:1;
1158c2ecf20Sopenharmony_ci	u32 fs:1;
1168c2ecf20Sopenharmony_ci	u32 eor:1;
1178c2ecf20Sopenharmony_ci	u32 own:1;
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci	u32 macid:5;
1208c2ecf20Sopenharmony_ci	u32 tid:4;
1218c2ecf20Sopenharmony_ci	u32 hwrsvd:4;
1228c2ecf20Sopenharmony_ci	u32 amsdu:1;
1238c2ecf20Sopenharmony_ci	u32 paggr:1;
1248c2ecf20Sopenharmony_ci	u32 faggr:1;
1258c2ecf20Sopenharmony_ci	u32 a1fit:4;
1268c2ecf20Sopenharmony_ci	u32 a2fit:4;
1278c2ecf20Sopenharmony_ci	u32 pam:1;
1288c2ecf20Sopenharmony_ci	u32 pwr:1;
1298c2ecf20Sopenharmony_ci	u32 md:1;
1308c2ecf20Sopenharmony_ci	u32 mf:1;
1318c2ecf20Sopenharmony_ci	u32 type:2;
1328c2ecf20Sopenharmony_ci	u32 mc:1;
1338c2ecf20Sopenharmony_ci	u32 bc:1;
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci	u32 seq:12;
1368c2ecf20Sopenharmony_ci	u32 frag:4;
1378c2ecf20Sopenharmony_ci	u32 pkt_cnt:8;
1388c2ecf20Sopenharmony_ci	u32 reserved:6;
1398c2ecf20Sopenharmony_ci	u32 nextind:1;
1408c2ecf20Sopenharmony_ci	u32 reserved0:1;
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci	u32 rxmcs:6;
1438c2ecf20Sopenharmony_ci	u32 rxht:1;
1448c2ecf20Sopenharmony_ci	u32 gf:1;
1458c2ecf20Sopenharmony_ci	u32 splcp:1;
1468c2ecf20Sopenharmony_ci	u32 bw:1;
1478c2ecf20Sopenharmony_ci	u32 htc:1;
1488c2ecf20Sopenharmony_ci	u32 eosp:1;
1498c2ecf20Sopenharmony_ci	u32 bssidfit:2;
1508c2ecf20Sopenharmony_ci	u32 reserved1:16;
1518c2ecf20Sopenharmony_ci	u32 unicastwake:1;
1528c2ecf20Sopenharmony_ci	u32 magicwake:1;
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci	u32 pattern0match:1;
1558c2ecf20Sopenharmony_ci	u32 pattern1match:1;
1568c2ecf20Sopenharmony_ci	u32 pattern2match:1;
1578c2ecf20Sopenharmony_ci	u32 pattern3match:1;
1588c2ecf20Sopenharmony_ci	u32 pattern4match:1;
1598c2ecf20Sopenharmony_ci	u32 pattern5match:1;
1608c2ecf20Sopenharmony_ci	u32 pattern6match:1;
1618c2ecf20Sopenharmony_ci	u32 pattern7match:1;
1628c2ecf20Sopenharmony_ci	u32 pattern8match:1;
1638c2ecf20Sopenharmony_ci	u32 pattern9match:1;
1648c2ecf20Sopenharmony_ci	u32 patternamatch:1;
1658c2ecf20Sopenharmony_ci	u32 patternbmatch:1;
1668c2ecf20Sopenharmony_ci	u32 patterncmatch:1;
1678c2ecf20Sopenharmony_ci	u32 reserved2:19;
1688c2ecf20Sopenharmony_ci#else
1698c2ecf20Sopenharmony_ci	u32 own:1;
1708c2ecf20Sopenharmony_ci	u32 eor:1;
1718c2ecf20Sopenharmony_ci	u32 fs:1;
1728c2ecf20Sopenharmony_ci	u32 ls:1;
1738c2ecf20Sopenharmony_ci	u32 swdec:1;
1748c2ecf20Sopenharmony_ci	u32 phy_stats:1;
1758c2ecf20Sopenharmony_ci	u32 shift:2;
1768c2ecf20Sopenharmony_ci	u32 qos:1;
1778c2ecf20Sopenharmony_ci	u32 security:3;
1788c2ecf20Sopenharmony_ci	u32 drvinfo_sz:4;
1798c2ecf20Sopenharmony_ci	u32 icverr:1;
1808c2ecf20Sopenharmony_ci	u32 crc32:1;
1818c2ecf20Sopenharmony_ci	u32 pktlen:14;
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci	u32 bc:1;
1848c2ecf20Sopenharmony_ci	u32 mc:1;
1858c2ecf20Sopenharmony_ci	u32 type:2;
1868c2ecf20Sopenharmony_ci	u32 mf:1;
1878c2ecf20Sopenharmony_ci	u32 md:1;
1888c2ecf20Sopenharmony_ci	u32 pwr:1;
1898c2ecf20Sopenharmony_ci	u32 pam:1;
1908c2ecf20Sopenharmony_ci	u32 a2fit:4;
1918c2ecf20Sopenharmony_ci	u32 a1fit:4;
1928c2ecf20Sopenharmony_ci	u32 faggr:1;
1938c2ecf20Sopenharmony_ci	u32 paggr:1;
1948c2ecf20Sopenharmony_ci	u32 amsdu:1;
1958c2ecf20Sopenharmony_ci	u32 hwrsvd:4;
1968c2ecf20Sopenharmony_ci	u32 tid:4;
1978c2ecf20Sopenharmony_ci	u32 macid:5;
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci	u32 reserved0:1;
2008c2ecf20Sopenharmony_ci	u32 nextind:1;
2018c2ecf20Sopenharmony_ci	u32 reserved:6;
2028c2ecf20Sopenharmony_ci	u32 pkt_cnt:8;
2038c2ecf20Sopenharmony_ci	u32 frag:4;
2048c2ecf20Sopenharmony_ci	u32 seq:12;
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci	u32 magicwake:1;
2078c2ecf20Sopenharmony_ci	u32 unicastwake:1;
2088c2ecf20Sopenharmony_ci	u32 reserved1:16;
2098c2ecf20Sopenharmony_ci	u32 bssidfit:2;
2108c2ecf20Sopenharmony_ci	u32 eosp:1;
2118c2ecf20Sopenharmony_ci	u32 htc:1;
2128c2ecf20Sopenharmony_ci	u32 bw:1;
2138c2ecf20Sopenharmony_ci	u32 splcp:1;
2148c2ecf20Sopenharmony_ci	u32 gf:1;
2158c2ecf20Sopenharmony_ci	u32 rxht:1;
2168c2ecf20Sopenharmony_ci	u32 rxmcs:6;
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci	u32 reserved2:19;
2198c2ecf20Sopenharmony_ci	u32 patterncmatch:1;
2208c2ecf20Sopenharmony_ci	u32 patternbmatch:1;
2218c2ecf20Sopenharmony_ci	u32 patternamatch:1;
2228c2ecf20Sopenharmony_ci	u32 pattern9match:1;
2238c2ecf20Sopenharmony_ci	u32 pattern8match:1;
2248c2ecf20Sopenharmony_ci	u32 pattern7match:1;
2258c2ecf20Sopenharmony_ci	u32 pattern6match:1;
2268c2ecf20Sopenharmony_ci	u32 pattern5match:1;
2278c2ecf20Sopenharmony_ci	u32 pattern4match:1;
2288c2ecf20Sopenharmony_ci	u32 pattern3match:1;
2298c2ecf20Sopenharmony_ci	u32 pattern2match:1;
2308c2ecf20Sopenharmony_ci	u32 pattern1match:1;
2318c2ecf20Sopenharmony_ci	u32 pattern0match:1;
2328c2ecf20Sopenharmony_ci#endif
2338c2ecf20Sopenharmony_ci	u32 tsfl;
2348c2ecf20Sopenharmony_ci#if 0
2358c2ecf20Sopenharmony_ci	u32 bassn:12;
2368c2ecf20Sopenharmony_ci	u32 bavld:1;
2378c2ecf20Sopenharmony_ci	u32 reserved3:19;
2388c2ecf20Sopenharmony_ci#endif
2398c2ecf20Sopenharmony_ci};
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_cistruct rtl8xxxu_rxdesc24 {
2428c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN
2438c2ecf20Sopenharmony_ci	u32 pktlen:14;
2448c2ecf20Sopenharmony_ci	u32 crc32:1;
2458c2ecf20Sopenharmony_ci	u32 icverr:1;
2468c2ecf20Sopenharmony_ci	u32 drvinfo_sz:4;
2478c2ecf20Sopenharmony_ci	u32 security:3;
2488c2ecf20Sopenharmony_ci	u32 qos:1;
2498c2ecf20Sopenharmony_ci	u32 shift:2;
2508c2ecf20Sopenharmony_ci	u32 phy_stats:1;
2518c2ecf20Sopenharmony_ci	u32 swdec:1;
2528c2ecf20Sopenharmony_ci	u32 ls:1;
2538c2ecf20Sopenharmony_ci	u32 fs:1;
2548c2ecf20Sopenharmony_ci	u32 eor:1;
2558c2ecf20Sopenharmony_ci	u32 own:1;
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci	u32 macid:7;
2588c2ecf20Sopenharmony_ci	u32 dummy1_0:1;
2598c2ecf20Sopenharmony_ci	u32 tid:4;
2608c2ecf20Sopenharmony_ci	u32 dummy1_1:1;
2618c2ecf20Sopenharmony_ci	u32 amsdu:1;
2628c2ecf20Sopenharmony_ci	u32 rxid_match:1;
2638c2ecf20Sopenharmony_ci	u32 paggr:1;
2648c2ecf20Sopenharmony_ci	u32 a1fit:4;	/* 16 */
2658c2ecf20Sopenharmony_ci	u32 chkerr:1;
2668c2ecf20Sopenharmony_ci	u32 ipver:1;
2678c2ecf20Sopenharmony_ci	u32 tcpudp:1;
2688c2ecf20Sopenharmony_ci	u32 chkvld:1;
2698c2ecf20Sopenharmony_ci	u32 pam:1;
2708c2ecf20Sopenharmony_ci	u32 pwr:1;
2718c2ecf20Sopenharmony_ci	u32 more_data:1;
2728c2ecf20Sopenharmony_ci	u32 more_frag:1;
2738c2ecf20Sopenharmony_ci	u32 type:2;
2748c2ecf20Sopenharmony_ci	u32 mc:1;
2758c2ecf20Sopenharmony_ci	u32 bc:1;
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci	u32 seq:12;
2788c2ecf20Sopenharmony_ci	u32 frag:4;
2798c2ecf20Sopenharmony_ci	u32 rx_is_qos:1;	/* 16 */
2808c2ecf20Sopenharmony_ci	u32 dummy2_0:1;
2818c2ecf20Sopenharmony_ci	u32 wlanhd_iv_len:6;
2828c2ecf20Sopenharmony_ci	u32 dummy2_1:4;
2838c2ecf20Sopenharmony_ci	u32 rpt_sel:1;
2848c2ecf20Sopenharmony_ci	u32 dummy2_2:3;
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci	u32 rxmcs:7;
2878c2ecf20Sopenharmony_ci	u32 dummy3_0:3;
2888c2ecf20Sopenharmony_ci	u32 htc:1;
2898c2ecf20Sopenharmony_ci	u32 eosp:1;
2908c2ecf20Sopenharmony_ci	u32 bssidfit:2;
2918c2ecf20Sopenharmony_ci	u32 dummy3_1:2;
2928c2ecf20Sopenharmony_ci	u32 usb_agg_pktnum:8;	/* 16 */
2938c2ecf20Sopenharmony_ci	u32 dummy3_2:5;
2948c2ecf20Sopenharmony_ci	u32 pattern_match:1;
2958c2ecf20Sopenharmony_ci	u32 unicast_match:1;
2968c2ecf20Sopenharmony_ci	u32 magic_match:1;
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci	u32 splcp:1;
2998c2ecf20Sopenharmony_ci	u32 ldcp:1;
3008c2ecf20Sopenharmony_ci	u32 stbc:1;
3018c2ecf20Sopenharmony_ci	u32 dummy4_0:1;
3028c2ecf20Sopenharmony_ci	u32 bw:2;
3038c2ecf20Sopenharmony_ci	u32 dummy4_1:26;
3048c2ecf20Sopenharmony_ci#else
3058c2ecf20Sopenharmony_ci	u32 own:1;
3068c2ecf20Sopenharmony_ci	u32 eor:1;
3078c2ecf20Sopenharmony_ci	u32 fs:1;
3088c2ecf20Sopenharmony_ci	u32 ls:1;
3098c2ecf20Sopenharmony_ci	u32 swdec:1;
3108c2ecf20Sopenharmony_ci	u32 phy_stats:1;
3118c2ecf20Sopenharmony_ci	u32 shift:2;
3128c2ecf20Sopenharmony_ci	u32 qos:1;
3138c2ecf20Sopenharmony_ci	u32 security:3;
3148c2ecf20Sopenharmony_ci	u32 drvinfo_sz:4;
3158c2ecf20Sopenharmony_ci	u32 icverr:1;
3168c2ecf20Sopenharmony_ci	u32 crc32:1;
3178c2ecf20Sopenharmony_ci	u32 pktlen:14;
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci	u32 bc:1;
3208c2ecf20Sopenharmony_ci	u32 mc:1;
3218c2ecf20Sopenharmony_ci	u32 type:2;
3228c2ecf20Sopenharmony_ci	u32 mf:1;
3238c2ecf20Sopenharmony_ci	u32 md:1;
3248c2ecf20Sopenharmony_ci	u32 pwr:1;
3258c2ecf20Sopenharmony_ci	u32 pam:1;
3268c2ecf20Sopenharmony_ci	u32 a2fit:4;
3278c2ecf20Sopenharmony_ci	u32 a1fit:4;
3288c2ecf20Sopenharmony_ci	u32 faggr:1;
3298c2ecf20Sopenharmony_ci	u32 paggr:1;
3308c2ecf20Sopenharmony_ci	u32 amsdu:1;
3318c2ecf20Sopenharmony_ci	u32 hwrsvd:4;
3328c2ecf20Sopenharmony_ci	u32 tid:4;
3338c2ecf20Sopenharmony_ci	u32 macid:5;
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci	u32 dummy2_2:3;
3368c2ecf20Sopenharmony_ci	u32 rpt_sel:1;
3378c2ecf20Sopenharmony_ci	u32 dummy2_1:4;
3388c2ecf20Sopenharmony_ci	u32 wlanhd_iv_len:6;
3398c2ecf20Sopenharmony_ci	u32 dummy2_0:1;
3408c2ecf20Sopenharmony_ci	u32 rx_is_qos:1;
3418c2ecf20Sopenharmony_ci	u32 frag:4;		/* 16 */
3428c2ecf20Sopenharmony_ci	u32 seq:12;
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci	u32 magic_match:1;
3458c2ecf20Sopenharmony_ci	u32 unicast_match:1;
3468c2ecf20Sopenharmony_ci	u32 pattern_match:1;
3478c2ecf20Sopenharmony_ci	u32 dummy3_2:5;
3488c2ecf20Sopenharmony_ci	u32 usb_agg_pktnum:8;
3498c2ecf20Sopenharmony_ci	u32 dummy3_1:2;		/* 16 */
3508c2ecf20Sopenharmony_ci	u32 bssidfit:2;
3518c2ecf20Sopenharmony_ci	u32 eosp:1;
3528c2ecf20Sopenharmony_ci	u32 htc:1;
3538c2ecf20Sopenharmony_ci	u32 dummy3_0:3;
3548c2ecf20Sopenharmony_ci	u32 rxmcs:7;
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci	u32 dumm4_1:26;
3578c2ecf20Sopenharmony_ci	u32 bw:2;
3588c2ecf20Sopenharmony_ci	u32 dummy4_0:1;
3598c2ecf20Sopenharmony_ci	u32 stbc:1;
3608c2ecf20Sopenharmony_ci	u32 ldcp:1;
3618c2ecf20Sopenharmony_ci	u32 splcp:1;
3628c2ecf20Sopenharmony_ci#endif
3638c2ecf20Sopenharmony_ci	u32 tsfl;
3648c2ecf20Sopenharmony_ci};
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_cistruct rtl8xxxu_txdesc32 {
3678c2ecf20Sopenharmony_ci	__le16 pkt_size;
3688c2ecf20Sopenharmony_ci	u8 pkt_offset;
3698c2ecf20Sopenharmony_ci	u8 txdw0;
3708c2ecf20Sopenharmony_ci	__le32 txdw1;
3718c2ecf20Sopenharmony_ci	__le32 txdw2;
3728c2ecf20Sopenharmony_ci	__le32 txdw3;
3738c2ecf20Sopenharmony_ci	__le32 txdw4;
3748c2ecf20Sopenharmony_ci	__le32 txdw5;
3758c2ecf20Sopenharmony_ci	__le32 txdw6;
3768c2ecf20Sopenharmony_ci	__le16 csum;
3778c2ecf20Sopenharmony_ci	__le16 txdw7;
3788c2ecf20Sopenharmony_ci};
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_cistruct rtl8xxxu_txdesc40 {
3818c2ecf20Sopenharmony_ci	__le16 pkt_size;
3828c2ecf20Sopenharmony_ci	u8 pkt_offset;
3838c2ecf20Sopenharmony_ci	u8 txdw0;
3848c2ecf20Sopenharmony_ci	__le32 txdw1;
3858c2ecf20Sopenharmony_ci	__le32 txdw2;
3868c2ecf20Sopenharmony_ci	__le32 txdw3;
3878c2ecf20Sopenharmony_ci	__le32 txdw4;
3888c2ecf20Sopenharmony_ci	__le32 txdw5;
3898c2ecf20Sopenharmony_ci	__le32 txdw6;
3908c2ecf20Sopenharmony_ci	__le16 csum;
3918c2ecf20Sopenharmony_ci	__le16 txdw7;
3928c2ecf20Sopenharmony_ci	__le32 txdw8;
3938c2ecf20Sopenharmony_ci	__le32 txdw9;
3948c2ecf20Sopenharmony_ci};
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_ci/*  CCK Rates, TxHT = 0 */
3978c2ecf20Sopenharmony_ci#define DESC_RATE_1M			0x00
3988c2ecf20Sopenharmony_ci#define DESC_RATE_2M			0x01
3998c2ecf20Sopenharmony_ci#define DESC_RATE_5_5M			0x02
4008c2ecf20Sopenharmony_ci#define DESC_RATE_11M			0x03
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ci/*  OFDM Rates, TxHT = 0 */
4038c2ecf20Sopenharmony_ci#define DESC_RATE_6M			0x04
4048c2ecf20Sopenharmony_ci#define DESC_RATE_9M			0x05
4058c2ecf20Sopenharmony_ci#define DESC_RATE_12M			0x06
4068c2ecf20Sopenharmony_ci#define DESC_RATE_18M			0x07
4078c2ecf20Sopenharmony_ci#define DESC_RATE_24M			0x08
4088c2ecf20Sopenharmony_ci#define DESC_RATE_36M			0x09
4098c2ecf20Sopenharmony_ci#define DESC_RATE_48M			0x0a
4108c2ecf20Sopenharmony_ci#define DESC_RATE_54M			0x0b
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_ci/*  MCS Rates, TxHT = 1 */
4138c2ecf20Sopenharmony_ci#define DESC_RATE_MCS0			0x0c
4148c2ecf20Sopenharmony_ci#define DESC_RATE_MCS1			0x0d
4158c2ecf20Sopenharmony_ci#define DESC_RATE_MCS2			0x0e
4168c2ecf20Sopenharmony_ci#define DESC_RATE_MCS3			0x0f
4178c2ecf20Sopenharmony_ci#define DESC_RATE_MCS4			0x10
4188c2ecf20Sopenharmony_ci#define DESC_RATE_MCS5			0x11
4198c2ecf20Sopenharmony_ci#define DESC_RATE_MCS6			0x12
4208c2ecf20Sopenharmony_ci#define DESC_RATE_MCS7			0x13
4218c2ecf20Sopenharmony_ci#define DESC_RATE_MCS8			0x14
4228c2ecf20Sopenharmony_ci#define DESC_RATE_MCS9			0x15
4238c2ecf20Sopenharmony_ci#define DESC_RATE_MCS10			0x16
4248c2ecf20Sopenharmony_ci#define DESC_RATE_MCS11			0x17
4258c2ecf20Sopenharmony_ci#define DESC_RATE_MCS12			0x18
4268c2ecf20Sopenharmony_ci#define DESC_RATE_MCS13			0x19
4278c2ecf20Sopenharmony_ci#define DESC_RATE_MCS14			0x1a
4288c2ecf20Sopenharmony_ci#define DESC_RATE_MCS15			0x1b
4298c2ecf20Sopenharmony_ci#define DESC_RATE_MCS15_SG		0x1c
4308c2ecf20Sopenharmony_ci#define DESC_RATE_MCS32			0x20
4318c2ecf20Sopenharmony_ci
4328c2ecf20Sopenharmony_ci#define TXDESC_OFFSET_SZ		0
4338c2ecf20Sopenharmony_ci#define TXDESC_OFFSET_SHT		16
4348c2ecf20Sopenharmony_ci#if 0
4358c2ecf20Sopenharmony_ci#define TXDESC_BMC			BIT(24)
4368c2ecf20Sopenharmony_ci#define TXDESC_LSG			BIT(26)
4378c2ecf20Sopenharmony_ci#define TXDESC_FSG			BIT(27)
4388c2ecf20Sopenharmony_ci#define TXDESC_OWN			BIT(31)
4398c2ecf20Sopenharmony_ci#else
4408c2ecf20Sopenharmony_ci#define TXDESC_BROADMULTICAST		BIT(0)
4418c2ecf20Sopenharmony_ci#define TXDESC_HTC			BIT(1)
4428c2ecf20Sopenharmony_ci#define TXDESC_LAST_SEGMENT		BIT(2)
4438c2ecf20Sopenharmony_ci#define TXDESC_FIRST_SEGMENT		BIT(3)
4448c2ecf20Sopenharmony_ci#define TXDESC_LINIP			BIT(4)
4458c2ecf20Sopenharmony_ci#define TXDESC_NO_ACM			BIT(5)
4468c2ecf20Sopenharmony_ci#define TXDESC_GF			BIT(6)
4478c2ecf20Sopenharmony_ci#define TXDESC_OWN			BIT(7)
4488c2ecf20Sopenharmony_ci#endif
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_ci/* Word 1 */
4518c2ecf20Sopenharmony_ci/*
4528c2ecf20Sopenharmony_ci * Bits 0-7 differ dependent on chip generation. For 8723au bits 5/6 are
4538c2ecf20Sopenharmony_ci * aggregation enable and break respectively. For 8723bu, bits 0-7 are macid.
4548c2ecf20Sopenharmony_ci */
4558c2ecf20Sopenharmony_ci#define TXDESC_PKT_OFFSET_SZ		0
4568c2ecf20Sopenharmony_ci#define TXDESC32_AGG_ENABLE		BIT(5)
4578c2ecf20Sopenharmony_ci#define TXDESC32_AGG_BREAK		BIT(6)
4588c2ecf20Sopenharmony_ci#define TXDESC40_MACID_SHIFT		0
4598c2ecf20Sopenharmony_ci#define TXDESC40_MACID_MASK		0x00f0
4608c2ecf20Sopenharmony_ci#define TXDESC_QUEUE_SHIFT		8
4618c2ecf20Sopenharmony_ci#define TXDESC_QUEUE_MASK		0x1f00
4628c2ecf20Sopenharmony_ci#define TXDESC_QUEUE_BK			0x2
4638c2ecf20Sopenharmony_ci#define TXDESC_QUEUE_BE			0x0
4648c2ecf20Sopenharmony_ci#define TXDESC_QUEUE_VI			0x5
4658c2ecf20Sopenharmony_ci#define TXDESC_QUEUE_VO			0x7
4668c2ecf20Sopenharmony_ci#define TXDESC_QUEUE_BEACON		0x10
4678c2ecf20Sopenharmony_ci#define TXDESC_QUEUE_HIGH		0x11
4688c2ecf20Sopenharmony_ci#define TXDESC_QUEUE_MGNT		0x12
4698c2ecf20Sopenharmony_ci#define TXDESC_QUEUE_CMD		0x13
4708c2ecf20Sopenharmony_ci#define TXDESC_QUEUE_MAX		(TXDESC_QUEUE_CMD + 1)
4718c2ecf20Sopenharmony_ci#define TXDESC40_RDG_NAV_EXT		BIT(13)
4728c2ecf20Sopenharmony_ci#define TXDESC40_LSIG_TXOP_ENABLE	BIT(14)
4738c2ecf20Sopenharmony_ci#define TXDESC40_PIFS			BIT(15)
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ci#define DESC_RATE_ID_SHIFT		16
4768c2ecf20Sopenharmony_ci#define DESC_RATE_ID_MASK		0xf
4778c2ecf20Sopenharmony_ci#define TXDESC_NAVUSEHDR		BIT(20)
4788c2ecf20Sopenharmony_ci#define TXDESC_SEC_RC4			0x00400000
4798c2ecf20Sopenharmony_ci#define TXDESC_SEC_AES			0x00c00000
4808c2ecf20Sopenharmony_ci#define TXDESC_PKT_OFFSET_SHIFT		26
4818c2ecf20Sopenharmony_ci#define TXDESC_AGG_EN			BIT(29)
4828c2ecf20Sopenharmony_ci#define TXDESC_HWPC			BIT(31)
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_ci/* Word 2 */
4858c2ecf20Sopenharmony_ci#define TXDESC40_PAID_SHIFT		0
4868c2ecf20Sopenharmony_ci#define TXDESC40_PAID_MASK		0x1ff
4878c2ecf20Sopenharmony_ci#define TXDESC40_CCA_RTS_SHIFT		10
4888c2ecf20Sopenharmony_ci#define TXDESC40_CCA_RTS_MASK		0xc00
4898c2ecf20Sopenharmony_ci#define TXDESC40_AGG_ENABLE		BIT(12)
4908c2ecf20Sopenharmony_ci#define TXDESC40_RDG_ENABLE		BIT(13)
4918c2ecf20Sopenharmony_ci#define TXDESC40_AGG_BREAK		BIT(16)
4928c2ecf20Sopenharmony_ci#define TXDESC40_MORE_FRAG		BIT(17)
4938c2ecf20Sopenharmony_ci#define TXDESC40_RAW			BIT(18)
4948c2ecf20Sopenharmony_ci#define TXDESC32_ACK_REPORT		BIT(19)
4958c2ecf20Sopenharmony_ci#define TXDESC40_SPE_RPT		BIT(19)
4968c2ecf20Sopenharmony_ci#define TXDESC_AMPDU_DENSITY_SHIFT	20
4978c2ecf20Sopenharmony_ci#define TXDESC40_BT_INT			BIT(23)
4988c2ecf20Sopenharmony_ci#define TXDESC40_GID_SHIFT		24
4998c2ecf20Sopenharmony_ci
5008c2ecf20Sopenharmony_ci/* Word 3 */
5018c2ecf20Sopenharmony_ci#define TXDESC40_USE_DRIVER_RATE	BIT(8)
5028c2ecf20Sopenharmony_ci#define TXDESC40_CTS_SELF_ENABLE	BIT(11)
5038c2ecf20Sopenharmony_ci#define TXDESC40_RTS_CTS_ENABLE		BIT(12)
5048c2ecf20Sopenharmony_ci#define TXDESC40_HW_RTS_ENABLE		BIT(13)
5058c2ecf20Sopenharmony_ci#define TXDESC32_SEQ_SHIFT		16
5068c2ecf20Sopenharmony_ci#define TXDESC32_SEQ_MASK		0x0fff0000
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_ci/* Word 4 */
5098c2ecf20Sopenharmony_ci#define TXDESC32_RTS_RATE_SHIFT		0
5108c2ecf20Sopenharmony_ci#define TXDESC32_RTS_RATE_MASK		0x3f
5118c2ecf20Sopenharmony_ci#define TXDESC32_QOS			BIT(6)
5128c2ecf20Sopenharmony_ci#define TXDESC32_HW_SEQ_ENABLE		BIT(7)
5138c2ecf20Sopenharmony_ci#define TXDESC32_USE_DRIVER_RATE	BIT(8)
5148c2ecf20Sopenharmony_ci#define TXDESC_DISABLE_DATA_FB		BIT(10)
5158c2ecf20Sopenharmony_ci#define TXDESC32_CTS_SELF_ENABLE	BIT(11)
5168c2ecf20Sopenharmony_ci#define TXDESC32_RTS_CTS_ENABLE		BIT(12)
5178c2ecf20Sopenharmony_ci#define TXDESC32_HW_RTS_ENABLE		BIT(13)
5188c2ecf20Sopenharmony_ci#define TXDESC_PRIME_CH_OFF_LOWER	BIT(20)
5198c2ecf20Sopenharmony_ci#define TXDESC_PRIME_CH_OFF_UPPER	BIT(21)
5208c2ecf20Sopenharmony_ci#define TXDESC32_SHORT_PREAMBLE		BIT(24)
5218c2ecf20Sopenharmony_ci#define TXDESC_DATA_BW			BIT(25)
5228c2ecf20Sopenharmony_ci#define TXDESC_RTS_DATA_BW		BIT(27)
5238c2ecf20Sopenharmony_ci#define TXDESC_RTS_PRIME_CH_OFF_LOWER	BIT(28)
5248c2ecf20Sopenharmony_ci#define TXDESC_RTS_PRIME_CH_OFF_UPPER	BIT(29)
5258c2ecf20Sopenharmony_ci#define TXDESC40_DATA_RATE_FB_SHIFT	8
5268c2ecf20Sopenharmony_ci#define TXDESC40_DATA_RATE_FB_MASK	0x00001f00
5278c2ecf20Sopenharmony_ci#define TXDESC40_RETRY_LIMIT_ENABLE	BIT(17)
5288c2ecf20Sopenharmony_ci#define TXDESC40_RETRY_LIMIT_SHIFT	18
5298c2ecf20Sopenharmony_ci#define TXDESC40_RETRY_LIMIT_MASK	0x00fc0000
5308c2ecf20Sopenharmony_ci#define TXDESC40_RTS_RATE_SHIFT		24
5318c2ecf20Sopenharmony_ci#define TXDESC40_RTS_RATE_MASK		0x3f000000
5328c2ecf20Sopenharmony_ci
5338c2ecf20Sopenharmony_ci/* Word 5 */
5348c2ecf20Sopenharmony_ci#define TXDESC40_SHORT_PREAMBLE		BIT(4)
5358c2ecf20Sopenharmony_ci#define TXDESC32_SHORT_GI		BIT(6)
5368c2ecf20Sopenharmony_ci#define TXDESC_CCX_TAG			BIT(7)
5378c2ecf20Sopenharmony_ci#define TXDESC32_RETRY_LIMIT_ENABLE	BIT(17)
5388c2ecf20Sopenharmony_ci#define TXDESC32_RETRY_LIMIT_SHIFT	18
5398c2ecf20Sopenharmony_ci#define TXDESC32_RETRY_LIMIT_MASK	0x00fc0000
5408c2ecf20Sopenharmony_ci
5418c2ecf20Sopenharmony_ci/* Word 6 */
5428c2ecf20Sopenharmony_ci#define TXDESC_MAX_AGG_SHIFT		11
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_ci/* Word 8 */
5458c2ecf20Sopenharmony_ci#define TXDESC40_HW_SEQ_ENABLE		BIT(15)
5468c2ecf20Sopenharmony_ci
5478c2ecf20Sopenharmony_ci/* Word 9 */
5488c2ecf20Sopenharmony_ci#define TXDESC40_SEQ_SHIFT		12
5498c2ecf20Sopenharmony_ci#define TXDESC40_SEQ_MASK		0x00fff000
5508c2ecf20Sopenharmony_ci
5518c2ecf20Sopenharmony_cistruct phy_rx_agc_info {
5528c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN
5538c2ecf20Sopenharmony_ci	u8	gain:7, trsw:1;
5548c2ecf20Sopenharmony_ci#else
5558c2ecf20Sopenharmony_ci	u8	trsw:1, gain:7;
5568c2ecf20Sopenharmony_ci#endif
5578c2ecf20Sopenharmony_ci};
5588c2ecf20Sopenharmony_ci
5598c2ecf20Sopenharmony_cistruct rtl8723au_phy_stats {
5608c2ecf20Sopenharmony_ci	struct phy_rx_agc_info path_agc[RTL8723A_MAX_RF_PATHS];
5618c2ecf20Sopenharmony_ci	u8	ch_corr[RTL8723A_MAX_RF_PATHS];
5628c2ecf20Sopenharmony_ci	u8	cck_sig_qual_ofdm_pwdb_all;
5638c2ecf20Sopenharmony_ci	u8	cck_agc_rpt_ofdm_cfosho_a;
5648c2ecf20Sopenharmony_ci	u8	cck_rpt_b_ofdm_cfosho_b;
5658c2ecf20Sopenharmony_ci	u8	reserved_1;
5668c2ecf20Sopenharmony_ci	u8	noise_power_db_msb;
5678c2ecf20Sopenharmony_ci	u8	path_cfotail[RTL8723A_MAX_RF_PATHS];
5688c2ecf20Sopenharmony_ci	u8	pcts_mask[RTL8723A_MAX_RF_PATHS];
5698c2ecf20Sopenharmony_ci	s8	stream_rxevm[RTL8723A_MAX_RF_PATHS];
5708c2ecf20Sopenharmony_ci	u8	path_rxsnr[RTL8723A_MAX_RF_PATHS];
5718c2ecf20Sopenharmony_ci	u8	noise_power_db_lsb;
5728c2ecf20Sopenharmony_ci	u8	reserved_2[3];
5738c2ecf20Sopenharmony_ci	u8	stream_csi[RTL8723A_MAX_RF_PATHS];
5748c2ecf20Sopenharmony_ci	u8	stream_target_csi[RTL8723A_MAX_RF_PATHS];
5758c2ecf20Sopenharmony_ci	s8	sig_evm;
5768c2ecf20Sopenharmony_ci	u8	reserved_3;
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN
5798c2ecf20Sopenharmony_ci	u8	antsel_rx_keep_2:1;	/* ex_intf_flg:1; */
5808c2ecf20Sopenharmony_ci	u8	sgi_en:1;
5818c2ecf20Sopenharmony_ci	u8	rxsc:2;
5828c2ecf20Sopenharmony_ci	u8	idle_long:1;
5838c2ecf20Sopenharmony_ci	u8	r_ant_train_en:1;
5848c2ecf20Sopenharmony_ci	u8	antenna_select_b:1;
5858c2ecf20Sopenharmony_ci	u8	antenna_select:1;
5868c2ecf20Sopenharmony_ci#else	/*  _BIG_ENDIAN_ */
5878c2ecf20Sopenharmony_ci	u8	antenna_select:1;
5888c2ecf20Sopenharmony_ci	u8	antenna_select_b:1;
5898c2ecf20Sopenharmony_ci	u8	r_ant_train_en:1;
5908c2ecf20Sopenharmony_ci	u8	idle_long:1;
5918c2ecf20Sopenharmony_ci	u8	rxsc:2;
5928c2ecf20Sopenharmony_ci	u8	sgi_en:1;
5938c2ecf20Sopenharmony_ci	u8	antsel_rx_keep_2:1;	/* ex_intf_flg:1; */
5948c2ecf20Sopenharmony_ci#endif
5958c2ecf20Sopenharmony_ci};
5968c2ecf20Sopenharmony_ci
5978c2ecf20Sopenharmony_ci/*
5988c2ecf20Sopenharmony_ci * Regs to backup
5998c2ecf20Sopenharmony_ci */
6008c2ecf20Sopenharmony_ci#define RTL8XXXU_ADDA_REGS		16
6018c2ecf20Sopenharmony_ci#define RTL8XXXU_MAC_REGS		4
6028c2ecf20Sopenharmony_ci#define RTL8XXXU_BB_REGS		9
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_cistruct rtl8xxxu_firmware_header {
6058c2ecf20Sopenharmony_ci	__le16	signature;		/*  92C0: test chip; 92C,
6068c2ecf20Sopenharmony_ci					    88C0: test chip;
6078c2ecf20Sopenharmony_ci					    88C1: MP A-cut;
6088c2ecf20Sopenharmony_ci					    92C1: MP A-cut */
6098c2ecf20Sopenharmony_ci	u8	category;		/*  AP/NIC and USB/PCI */
6108c2ecf20Sopenharmony_ci	u8	function;
6118c2ecf20Sopenharmony_ci
6128c2ecf20Sopenharmony_ci	__le16	major_version;		/*  FW Version */
6138c2ecf20Sopenharmony_ci	u8	minor_version;		/*  FW Subversion, default 0x00 */
6148c2ecf20Sopenharmony_ci	u8	reserved1;
6158c2ecf20Sopenharmony_ci
6168c2ecf20Sopenharmony_ci	u8	month;			/*  Release time Month field */
6178c2ecf20Sopenharmony_ci	u8	date;			/*  Release time Date field */
6188c2ecf20Sopenharmony_ci	u8	hour;			/*  Release time Hour field */
6198c2ecf20Sopenharmony_ci	u8	minute;			/*  Release time Minute field */
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ci	__le16	ramcodesize;		/*  Size of RAM code */
6228c2ecf20Sopenharmony_ci	u16	reserved2;
6238c2ecf20Sopenharmony_ci
6248c2ecf20Sopenharmony_ci	__le32	svn_idx;		/*  SVN entry index */
6258c2ecf20Sopenharmony_ci	u32	reserved3;
6268c2ecf20Sopenharmony_ci
6278c2ecf20Sopenharmony_ci	u32	reserved4;
6288c2ecf20Sopenharmony_ci	u32	reserved5;
6298c2ecf20Sopenharmony_ci
6308c2ecf20Sopenharmony_ci	u8	data[];
6318c2ecf20Sopenharmony_ci};
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_ci/*
6348c2ecf20Sopenharmony_ci * 8723au/8192cu/8188ru required base power index offset tables.
6358c2ecf20Sopenharmony_ci */
6368c2ecf20Sopenharmony_cistruct rtl8xxxu_power_base {
6378c2ecf20Sopenharmony_ci	u32 reg_0e00;
6388c2ecf20Sopenharmony_ci	u32 reg_0e04;
6398c2ecf20Sopenharmony_ci	u32 reg_0e08;
6408c2ecf20Sopenharmony_ci	u32 reg_086c;
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_ci	u32 reg_0e10;
6438c2ecf20Sopenharmony_ci	u32 reg_0e14;
6448c2ecf20Sopenharmony_ci	u32 reg_0e18;
6458c2ecf20Sopenharmony_ci	u32 reg_0e1c;
6468c2ecf20Sopenharmony_ci
6478c2ecf20Sopenharmony_ci	u32 reg_0830;
6488c2ecf20Sopenharmony_ci	u32 reg_0834;
6498c2ecf20Sopenharmony_ci	u32 reg_0838;
6508c2ecf20Sopenharmony_ci	u32 reg_086c_2;
6518c2ecf20Sopenharmony_ci
6528c2ecf20Sopenharmony_ci	u32 reg_083c;
6538c2ecf20Sopenharmony_ci	u32 reg_0848;
6548c2ecf20Sopenharmony_ci	u32 reg_084c;
6558c2ecf20Sopenharmony_ci	u32 reg_0868;
6568c2ecf20Sopenharmony_ci};
6578c2ecf20Sopenharmony_ci
6588c2ecf20Sopenharmony_ci/*
6598c2ecf20Sopenharmony_ci * The 8723au has 3 channel groups: 1-3, 4-9, and 10-14
6608c2ecf20Sopenharmony_ci */
6618c2ecf20Sopenharmony_cistruct rtl8723au_idx {
6628c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN
6638c2ecf20Sopenharmony_ci	int	a:4;
6648c2ecf20Sopenharmony_ci	int	b:4;
6658c2ecf20Sopenharmony_ci#else
6668c2ecf20Sopenharmony_ci	int	b:4;
6678c2ecf20Sopenharmony_ci	int	a:4;
6688c2ecf20Sopenharmony_ci#endif
6698c2ecf20Sopenharmony_ci} __attribute__((packed));
6708c2ecf20Sopenharmony_ci
6718c2ecf20Sopenharmony_cistruct rtl8723au_efuse {
6728c2ecf20Sopenharmony_ci	__le16 rtl_id;
6738c2ecf20Sopenharmony_ci	u8 res0[0xe];
6748c2ecf20Sopenharmony_ci	u8 cck_tx_power_index_A[3];	/* 0x10 */
6758c2ecf20Sopenharmony_ci	u8 cck_tx_power_index_B[3];
6768c2ecf20Sopenharmony_ci	u8 ht40_1s_tx_power_index_A[3];	/* 0x16 */
6778c2ecf20Sopenharmony_ci	u8 ht40_1s_tx_power_index_B[3];
6788c2ecf20Sopenharmony_ci	/*
6798c2ecf20Sopenharmony_ci	 * The following entries are half-bytes split as:
6808c2ecf20Sopenharmony_ci	 * bits 0-3: path A, bits 4-7: path B, all values 4 bits signed
6818c2ecf20Sopenharmony_ci	 */
6828c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht20_tx_power_index_diff[3];
6838c2ecf20Sopenharmony_ci	struct rtl8723au_idx ofdm_tx_power_index_diff[3];
6848c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht40_max_power_offset[3];
6858c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht20_max_power_offset[3];
6868c2ecf20Sopenharmony_ci	u8 channel_plan;		/* 0x28 */
6878c2ecf20Sopenharmony_ci	u8 tssi_a;
6888c2ecf20Sopenharmony_ci	u8 thermal_meter;
6898c2ecf20Sopenharmony_ci	u8 rf_regulatory;
6908c2ecf20Sopenharmony_ci	u8 rf_option_2;
6918c2ecf20Sopenharmony_ci	u8 rf_option_3;
6928c2ecf20Sopenharmony_ci	u8 rf_option_4;
6938c2ecf20Sopenharmony_ci	u8 res7;
6948c2ecf20Sopenharmony_ci	u8 version			/* 0x30 */;
6958c2ecf20Sopenharmony_ci	u8 customer_id_major;
6968c2ecf20Sopenharmony_ci	u8 customer_id_minor;
6978c2ecf20Sopenharmony_ci	u8 xtal_k;
6988c2ecf20Sopenharmony_ci	u8 chipset;			/* 0x34 */
6998c2ecf20Sopenharmony_ci	u8 res8[0x82];
7008c2ecf20Sopenharmony_ci	u8 vid;				/* 0xb7 */
7018c2ecf20Sopenharmony_ci	u8 res9;
7028c2ecf20Sopenharmony_ci	u8 pid;				/* 0xb9 */
7038c2ecf20Sopenharmony_ci	u8 res10[0x0c];
7048c2ecf20Sopenharmony_ci	u8 mac_addr[ETH_ALEN];		/* 0xc6 */
7058c2ecf20Sopenharmony_ci	u8 res11[2];
7068c2ecf20Sopenharmony_ci	u8 vendor_name[7];
7078c2ecf20Sopenharmony_ci	u8 res12[2];
7088c2ecf20Sopenharmony_ci	u8 device_name[0x29];		/* 0xd7 */
7098c2ecf20Sopenharmony_ci};
7108c2ecf20Sopenharmony_ci
7118c2ecf20Sopenharmony_cistruct rtl8192cu_efuse {
7128c2ecf20Sopenharmony_ci	__le16 rtl_id;
7138c2ecf20Sopenharmony_ci	__le16 hpon;
7148c2ecf20Sopenharmony_ci	u8 res0[2];
7158c2ecf20Sopenharmony_ci	__le16 clk;
7168c2ecf20Sopenharmony_ci	__le16 testr;
7178c2ecf20Sopenharmony_ci	__le16 vid;
7188c2ecf20Sopenharmony_ci	__le16 did;
7198c2ecf20Sopenharmony_ci	__le16 svid;
7208c2ecf20Sopenharmony_ci	__le16 smid;						/* 0x10 */
7218c2ecf20Sopenharmony_ci	u8 res1[4];
7228c2ecf20Sopenharmony_ci	u8 mac_addr[ETH_ALEN];					/* 0x16 */
7238c2ecf20Sopenharmony_ci	u8 res2[2];
7248c2ecf20Sopenharmony_ci	u8 vendor_name[7];
7258c2ecf20Sopenharmony_ci	u8 res3[3];
7268c2ecf20Sopenharmony_ci	u8 device_name[0x14];					/* 0x28 */
7278c2ecf20Sopenharmony_ci	u8 res4[0x1e];						/* 0x3c */
7288c2ecf20Sopenharmony_ci	u8 cck_tx_power_index_A[3];				/* 0x5a */
7298c2ecf20Sopenharmony_ci	u8 cck_tx_power_index_B[3];
7308c2ecf20Sopenharmony_ci	u8 ht40_1s_tx_power_index_A[3];				/* 0x60 */
7318c2ecf20Sopenharmony_ci	u8 ht40_1s_tx_power_index_B[3];
7328c2ecf20Sopenharmony_ci	/*
7338c2ecf20Sopenharmony_ci	 * The following entries are half-bytes split as:
7348c2ecf20Sopenharmony_ci	 * bits 0-3: path A, bits 4-7: path B, all values 4 bits signed
7358c2ecf20Sopenharmony_ci	 */
7368c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht40_2s_tx_power_index_diff[3];
7378c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht20_tx_power_index_diff[3];	/* 0x69 */
7388c2ecf20Sopenharmony_ci	struct rtl8723au_idx ofdm_tx_power_index_diff[3];
7398c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht40_max_power_offset[3];		/* 0x6f */
7408c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht20_max_power_offset[3];
7418c2ecf20Sopenharmony_ci	u8 channel_plan;					/* 0x75 */
7428c2ecf20Sopenharmony_ci	u8 tssi_a;
7438c2ecf20Sopenharmony_ci	u8 tssi_b;
7448c2ecf20Sopenharmony_ci	u8 thermal_meter;	/* xtal_k */			/* 0x78 */
7458c2ecf20Sopenharmony_ci	u8 rf_regulatory;
7468c2ecf20Sopenharmony_ci	u8 rf_option_2;
7478c2ecf20Sopenharmony_ci	u8 rf_option_3;
7488c2ecf20Sopenharmony_ci	u8 rf_option_4;
7498c2ecf20Sopenharmony_ci	u8 res5[1];						/* 0x7d */
7508c2ecf20Sopenharmony_ci	u8 version;
7518c2ecf20Sopenharmony_ci	u8 customer_id;
7528c2ecf20Sopenharmony_ci};
7538c2ecf20Sopenharmony_ci
7548c2ecf20Sopenharmony_cistruct rtl8723bu_pwr_idx {
7558c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN
7568c2ecf20Sopenharmony_ci	int	ht20:4;
7578c2ecf20Sopenharmony_ci	int	ht40:4;
7588c2ecf20Sopenharmony_ci	int	ofdm:4;
7598c2ecf20Sopenharmony_ci	int	cck:4;
7608c2ecf20Sopenharmony_ci#else
7618c2ecf20Sopenharmony_ci	int	cck:4;
7628c2ecf20Sopenharmony_ci	int	ofdm:4;
7638c2ecf20Sopenharmony_ci	int	ht40:4;
7648c2ecf20Sopenharmony_ci	int	ht20:4;
7658c2ecf20Sopenharmony_ci#endif
7668c2ecf20Sopenharmony_ci} __attribute__((packed));
7678c2ecf20Sopenharmony_ci
7688c2ecf20Sopenharmony_cistruct rtl8723bu_efuse_tx_power {
7698c2ecf20Sopenharmony_ci	u8 cck_base[6];
7708c2ecf20Sopenharmony_ci	u8 ht40_base[5];
7718c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht20_ofdm_1s_diff;
7728c2ecf20Sopenharmony_ci	struct rtl8723bu_pwr_idx pwr_diff[3];
7738c2ecf20Sopenharmony_ci	u8 dummy5g[24]; /* max channel group (14) + power diff offset (10) */
7748c2ecf20Sopenharmony_ci};
7758c2ecf20Sopenharmony_ci
7768c2ecf20Sopenharmony_cistruct rtl8723bu_efuse {
7778c2ecf20Sopenharmony_ci	__le16 rtl_id;
7788c2ecf20Sopenharmony_ci	u8 res0[0x0e];
7798c2ecf20Sopenharmony_ci	struct rtl8723bu_efuse_tx_power tx_power_index_A;	/* 0x10 */
7808c2ecf20Sopenharmony_ci	struct rtl8723bu_efuse_tx_power tx_power_index_B;	/* 0x3a */
7818c2ecf20Sopenharmony_ci	struct rtl8723bu_efuse_tx_power tx_power_index_C;	/* 0x64 */
7828c2ecf20Sopenharmony_ci	struct rtl8723bu_efuse_tx_power tx_power_index_D;	/* 0x8e */
7838c2ecf20Sopenharmony_ci	u8 channel_plan;		/* 0xb8 */
7848c2ecf20Sopenharmony_ci	u8 xtal_k;
7858c2ecf20Sopenharmony_ci	u8 thermal_meter;
7868c2ecf20Sopenharmony_ci	u8 iqk_lck;
7878c2ecf20Sopenharmony_ci	u8 pa_type;			/* 0xbc */
7888c2ecf20Sopenharmony_ci	u8 lna_type_2g;			/* 0xbd */
7898c2ecf20Sopenharmony_ci	u8 res2[3];
7908c2ecf20Sopenharmony_ci	u8 rf_board_option;
7918c2ecf20Sopenharmony_ci	u8 rf_feature_option;
7928c2ecf20Sopenharmony_ci	u8 rf_bt_setting;
7938c2ecf20Sopenharmony_ci	u8 eeprom_version;
7948c2ecf20Sopenharmony_ci	u8 eeprom_customer_id;
7958c2ecf20Sopenharmony_ci	u8 res3[2];
7968c2ecf20Sopenharmony_ci	u8 tx_pwr_calibrate_rate;
7978c2ecf20Sopenharmony_ci	u8 rf_antenna_option;		/* 0xc9 */
7988c2ecf20Sopenharmony_ci	u8 rfe_option;
7998c2ecf20Sopenharmony_ci	u8 res4[9];
8008c2ecf20Sopenharmony_ci	u8 usb_optional_function;
8018c2ecf20Sopenharmony_ci	u8 res5[0x1e];
8028c2ecf20Sopenharmony_ci	u8 res6[2];
8038c2ecf20Sopenharmony_ci	u8 serial[0x0b];		/* 0xf5 */
8048c2ecf20Sopenharmony_ci	u8 vid;				/* 0x100 */
8058c2ecf20Sopenharmony_ci	u8 res7;
8068c2ecf20Sopenharmony_ci	u8 pid;
8078c2ecf20Sopenharmony_ci	u8 res8[4];
8088c2ecf20Sopenharmony_ci	u8 mac_addr[ETH_ALEN];		/* 0x107 */
8098c2ecf20Sopenharmony_ci	u8 res9[2];
8108c2ecf20Sopenharmony_ci	u8 vendor_name[0x07];
8118c2ecf20Sopenharmony_ci	u8 res10[2];
8128c2ecf20Sopenharmony_ci	u8 device_name[0x14];
8138c2ecf20Sopenharmony_ci	u8 res11[0xcf];
8148c2ecf20Sopenharmony_ci	u8 package_type;		/* 0x1fb */
8158c2ecf20Sopenharmony_ci	u8 res12[0x4];
8168c2ecf20Sopenharmony_ci};
8178c2ecf20Sopenharmony_ci
8188c2ecf20Sopenharmony_cistruct rtl8192eu_efuse_tx_power {
8198c2ecf20Sopenharmony_ci	u8 cck_base[6];
8208c2ecf20Sopenharmony_ci	u8 ht40_base[5];
8218c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht20_ofdm_1s_diff;
8228c2ecf20Sopenharmony_ci	struct rtl8723bu_pwr_idx pwr_diff[3];
8238c2ecf20Sopenharmony_ci	u8 dummy5g[24]; /* max channel group (14) + power diff offset (10) */
8248c2ecf20Sopenharmony_ci};
8258c2ecf20Sopenharmony_ci
8268c2ecf20Sopenharmony_cistruct rtl8192eu_efuse {
8278c2ecf20Sopenharmony_ci	__le16 rtl_id;
8288c2ecf20Sopenharmony_ci	u8 res0[0x0e];
8298c2ecf20Sopenharmony_ci	struct rtl8192eu_efuse_tx_power tx_power_index_A;	/* 0x10 */
8308c2ecf20Sopenharmony_ci	struct rtl8192eu_efuse_tx_power tx_power_index_B;	/* 0x3a */
8318c2ecf20Sopenharmony_ci	u8 res2[0x54];
8328c2ecf20Sopenharmony_ci	u8 channel_plan;		/* 0xb8 */
8338c2ecf20Sopenharmony_ci	u8 xtal_k;
8348c2ecf20Sopenharmony_ci	u8 thermal_meter;
8358c2ecf20Sopenharmony_ci	u8 iqk_lck;
8368c2ecf20Sopenharmony_ci	u8 pa_type;			/* 0xbc */
8378c2ecf20Sopenharmony_ci	u8 lna_type_2g;			/* 0xbd */
8388c2ecf20Sopenharmony_ci	u8 res3[1];
8398c2ecf20Sopenharmony_ci	u8 lna_type_5g;			/* 0xbf */
8408c2ecf20Sopenharmony_ci	u8 res4[1];
8418c2ecf20Sopenharmony_ci	u8 rf_board_option;
8428c2ecf20Sopenharmony_ci	u8 rf_feature_option;
8438c2ecf20Sopenharmony_ci	u8 rf_bt_setting;
8448c2ecf20Sopenharmony_ci	u8 eeprom_version;
8458c2ecf20Sopenharmony_ci	u8 eeprom_customer_id;
8468c2ecf20Sopenharmony_ci	u8 res5[3];
8478c2ecf20Sopenharmony_ci	u8 rf_antenna_option;		/* 0xc9 */
8488c2ecf20Sopenharmony_ci	u8 res6[6];
8498c2ecf20Sopenharmony_ci	u8 vid;				/* 0xd0 */
8508c2ecf20Sopenharmony_ci	u8 res7[1];
8518c2ecf20Sopenharmony_ci	u8 pid;				/* 0xd2 */
8528c2ecf20Sopenharmony_ci	u8 res8[1];
8538c2ecf20Sopenharmony_ci	u8 usb_optional_function;
8548c2ecf20Sopenharmony_ci	u8 res9[2];
8558c2ecf20Sopenharmony_ci	u8 mac_addr[ETH_ALEN];		/* 0xd7 */
8568c2ecf20Sopenharmony_ci	u8 device_info[80];
8578c2ecf20Sopenharmony_ci	u8 res11[3];
8588c2ecf20Sopenharmony_ci	u8 unknown[0x0d];		/* 0x130 */
8598c2ecf20Sopenharmony_ci	u8 res12[0xc3];
8608c2ecf20Sopenharmony_ci};
8618c2ecf20Sopenharmony_ci
8628c2ecf20Sopenharmony_cistruct rtl8xxxu_reg8val {
8638c2ecf20Sopenharmony_ci	u16 reg;
8648c2ecf20Sopenharmony_ci	u8 val;
8658c2ecf20Sopenharmony_ci};
8668c2ecf20Sopenharmony_ci
8678c2ecf20Sopenharmony_cistruct rtl8xxxu_reg32val {
8688c2ecf20Sopenharmony_ci	u16 reg;
8698c2ecf20Sopenharmony_ci	u32 val;
8708c2ecf20Sopenharmony_ci};
8718c2ecf20Sopenharmony_ci
8728c2ecf20Sopenharmony_cistruct rtl8xxxu_rfregval {
8738c2ecf20Sopenharmony_ci	u8 reg;
8748c2ecf20Sopenharmony_ci	u32 val;
8758c2ecf20Sopenharmony_ci};
8768c2ecf20Sopenharmony_ci
8778c2ecf20Sopenharmony_cienum rtl8xxxu_rfpath {
8788c2ecf20Sopenharmony_ci	RF_A = 0,
8798c2ecf20Sopenharmony_ci	RF_B = 1,
8808c2ecf20Sopenharmony_ci};
8818c2ecf20Sopenharmony_ci
8828c2ecf20Sopenharmony_cistruct rtl8xxxu_rfregs {
8838c2ecf20Sopenharmony_ci	u16 hssiparm1;
8848c2ecf20Sopenharmony_ci	u16 hssiparm2;
8858c2ecf20Sopenharmony_ci	u16 lssiparm;
8868c2ecf20Sopenharmony_ci	u16 hspiread;
8878c2ecf20Sopenharmony_ci	u16 lssiread;
8888c2ecf20Sopenharmony_ci	u16 rf_sw_ctrl;
8898c2ecf20Sopenharmony_ci};
8908c2ecf20Sopenharmony_ci
8918c2ecf20Sopenharmony_ci#define H2C_MAX_MBOX			4
8928c2ecf20Sopenharmony_ci#define H2C_EXT				BIT(7)
8938c2ecf20Sopenharmony_ci#define  H2C_JOIN_BSS_DISCONNECT	0
8948c2ecf20Sopenharmony_ci#define  H2C_JOIN_BSS_CONNECT		1
8958c2ecf20Sopenharmony_ci
8968c2ecf20Sopenharmony_ci/*
8978c2ecf20Sopenharmony_ci * H2C (firmware) commands differ between the older generation chips
8988c2ecf20Sopenharmony_ci * 8188[cr]u, 819[12]cu, and 8723au, and the more recent chips 8723bu,
8998c2ecf20Sopenharmony_ci * 8192[de]u, 8192eu, and 8812.
9008c2ecf20Sopenharmony_ci */
9018c2ecf20Sopenharmony_cienum h2c_cmd_8723a {
9028c2ecf20Sopenharmony_ci	H2C_SET_POWER_MODE = 1,
9038c2ecf20Sopenharmony_ci	H2C_JOIN_BSS_REPORT = 2,
9048c2ecf20Sopenharmony_ci	H2C_SET_RSSI = 5,
9058c2ecf20Sopenharmony_ci	H2C_SET_RATE_MASK = (6 | H2C_EXT),
9068c2ecf20Sopenharmony_ci};
9078c2ecf20Sopenharmony_ci
9088c2ecf20Sopenharmony_cienum h2c_cmd_8723b {
9098c2ecf20Sopenharmony_ci	/*
9108c2ecf20Sopenharmony_ci	 * Common Class: 000
9118c2ecf20Sopenharmony_ci	 */
9128c2ecf20Sopenharmony_ci	H2C_8723B_RSVD_PAGE = 0x00,
9138c2ecf20Sopenharmony_ci	H2C_8723B_MEDIA_STATUS_RPT = 0x01,
9148c2ecf20Sopenharmony_ci	H2C_8723B_SCAN_ENABLE = 0x02,
9158c2ecf20Sopenharmony_ci	H2C_8723B_KEEP_ALIVE = 0x03,
9168c2ecf20Sopenharmony_ci	H2C_8723B_DISCON_DECISION = 0x04,
9178c2ecf20Sopenharmony_ci	H2C_8723B_PSD_OFFLOAD = 0x05,
9188c2ecf20Sopenharmony_ci	H2C_8723B_AP_OFFLOAD = 0x08,
9198c2ecf20Sopenharmony_ci	H2C_8723B_BCN_RSVDPAGE = 0x09,
9208c2ecf20Sopenharmony_ci	H2C_8723B_PROBERSP_RSVDPAGE = 0x0A,
9218c2ecf20Sopenharmony_ci	H2C_8723B_FCS_RSVDPAGE = 0x10,
9228c2ecf20Sopenharmony_ci	H2C_8723B_FCS_INFO = 0x11,
9238c2ecf20Sopenharmony_ci	H2C_8723B_AP_WOW_GPIO_CTRL = 0x13,
9248c2ecf20Sopenharmony_ci
9258c2ecf20Sopenharmony_ci	/*
9268c2ecf20Sopenharmony_ci	 * PoweSave Class: 001
9278c2ecf20Sopenharmony_ci	 */
9288c2ecf20Sopenharmony_ci	H2C_8723B_SET_PWR_MODE = 0x20,
9298c2ecf20Sopenharmony_ci	H2C_8723B_PS_TUNING_PARA = 0x21,
9308c2ecf20Sopenharmony_ci	H2C_8723B_PS_TUNING_PARA2 = 0x22,
9318c2ecf20Sopenharmony_ci	H2C_8723B_P2P_LPS_PARAM = 0x23,
9328c2ecf20Sopenharmony_ci	H2C_8723B_P2P_PS_OFFLOAD = 0x24,
9338c2ecf20Sopenharmony_ci	H2C_8723B_PS_SCAN_ENABLE = 0x25,
9348c2ecf20Sopenharmony_ci	H2C_8723B_SAP_PS_ = 0x26,
9358c2ecf20Sopenharmony_ci	H2C_8723B_INACTIVE_PS_ = 0x27,
9368c2ecf20Sopenharmony_ci	H2C_8723B_FWLPS_IN_IPS_ = 0x28,
9378c2ecf20Sopenharmony_ci
9388c2ecf20Sopenharmony_ci	/*
9398c2ecf20Sopenharmony_ci	 * Dynamic Mechanism Class: 010
9408c2ecf20Sopenharmony_ci	 */
9418c2ecf20Sopenharmony_ci	H2C_8723B_MACID_CFG_RAID = 0x40,
9428c2ecf20Sopenharmony_ci	H2C_8723B_TXBF = 0x41,
9438c2ecf20Sopenharmony_ci	H2C_8723B_RSSI_SETTING = 0x42,
9448c2ecf20Sopenharmony_ci	H2C_8723B_AP_REQ_TXRPT = 0x43,
9458c2ecf20Sopenharmony_ci	H2C_8723B_INIT_RATE_COLLECT = 0x44,
9468c2ecf20Sopenharmony_ci
9478c2ecf20Sopenharmony_ci	/*
9488c2ecf20Sopenharmony_ci	 * BT Class: 011
9498c2ecf20Sopenharmony_ci	 */
9508c2ecf20Sopenharmony_ci	H2C_8723B_B_TYPE_TDMA = 0x60,
9518c2ecf20Sopenharmony_ci	H2C_8723B_BT_INFO = 0x61,
9528c2ecf20Sopenharmony_ci	H2C_8723B_FORCE_BT_TXPWR = 0x62,
9538c2ecf20Sopenharmony_ci	H2C_8723B_BT_IGNORE_WLANACT = 0x63,
9548c2ecf20Sopenharmony_ci	H2C_8723B_DAC_SWING_VALUE = 0x64,
9558c2ecf20Sopenharmony_ci	H2C_8723B_ANT_SEL_RSV = 0x65,
9568c2ecf20Sopenharmony_ci	H2C_8723B_WL_OPMODE = 0x66,
9578c2ecf20Sopenharmony_ci	H2C_8723B_BT_MP_OPER = 0x67,
9588c2ecf20Sopenharmony_ci	H2C_8723B_BT_CONTROL = 0x68,
9598c2ecf20Sopenharmony_ci	H2C_8723B_BT_WIFI_CTRL = 0x69,
9608c2ecf20Sopenharmony_ci	H2C_8723B_BT_FW_PATCH = 0x6a,
9618c2ecf20Sopenharmony_ci	H2C_8723B_BT_WLAN_CALIBRATION = 0x6d,
9628c2ecf20Sopenharmony_ci	H2C_8723B_BT_GRANT = 0x6e,
9638c2ecf20Sopenharmony_ci
9648c2ecf20Sopenharmony_ci	/*
9658c2ecf20Sopenharmony_ci	 * WOWLAN Class: 100
9668c2ecf20Sopenharmony_ci	 */
9678c2ecf20Sopenharmony_ci	H2C_8723B_WOWLAN = 0x80,
9688c2ecf20Sopenharmony_ci	H2C_8723B_REMOTE_WAKE_CTRL = 0x81,
9698c2ecf20Sopenharmony_ci	H2C_8723B_AOAC_GLOBAL_INFO = 0x82,
9708c2ecf20Sopenharmony_ci	H2C_8723B_AOAC_RSVD_PAGE = 0x83,
9718c2ecf20Sopenharmony_ci	H2C_8723B_AOAC_RSVD_PAGE2 = 0x84,
9728c2ecf20Sopenharmony_ci	H2C_8723B_D0_SCAN_OFFLOAD_CTRL = 0x85,
9738c2ecf20Sopenharmony_ci	H2C_8723B_D0_SCAN_OFFLOAD_INFO = 0x86,
9748c2ecf20Sopenharmony_ci	H2C_8723B_CHNL_SWITCH_OFFLOAD = 0x87,
9758c2ecf20Sopenharmony_ci
9768c2ecf20Sopenharmony_ci	H2C_8723B_RESET_TSF = 0xC0,
9778c2ecf20Sopenharmony_ci};
9788c2ecf20Sopenharmony_ci
9798c2ecf20Sopenharmony_ci
9808c2ecf20Sopenharmony_cistruct h2c_cmd {
9818c2ecf20Sopenharmony_ci	union {
9828c2ecf20Sopenharmony_ci		struct {
9838c2ecf20Sopenharmony_ci			u8 cmd;
9848c2ecf20Sopenharmony_ci			u8 data[7];
9858c2ecf20Sopenharmony_ci		} __packed cmd;
9868c2ecf20Sopenharmony_ci		struct {
9878c2ecf20Sopenharmony_ci			__le32 data;
9888c2ecf20Sopenharmony_ci			__le16 ext;
9898c2ecf20Sopenharmony_ci		} __packed raw;
9908c2ecf20Sopenharmony_ci		struct {
9918c2ecf20Sopenharmony_ci			__le32 data;
9928c2ecf20Sopenharmony_ci			__le32 ext;
9938c2ecf20Sopenharmony_ci		} __packed raw_wide;
9948c2ecf20Sopenharmony_ci		struct {
9958c2ecf20Sopenharmony_ci			u8 cmd;
9968c2ecf20Sopenharmony_ci			u8 data;
9978c2ecf20Sopenharmony_ci		} __packed joinbss;
9988c2ecf20Sopenharmony_ci		struct {
9998c2ecf20Sopenharmony_ci			u8 cmd;
10008c2ecf20Sopenharmony_ci			__le16 mask_hi;
10018c2ecf20Sopenharmony_ci			u8 arg;
10028c2ecf20Sopenharmony_ci			__le16 mask_lo;
10038c2ecf20Sopenharmony_ci		} __packed ramask;
10048c2ecf20Sopenharmony_ci		struct {
10058c2ecf20Sopenharmony_ci			u8 cmd;
10068c2ecf20Sopenharmony_ci			u8 parm;
10078c2ecf20Sopenharmony_ci			u8 macid;
10088c2ecf20Sopenharmony_ci			u8 macid_end;
10098c2ecf20Sopenharmony_ci		} __packed media_status_rpt;
10108c2ecf20Sopenharmony_ci		struct {
10118c2ecf20Sopenharmony_ci			u8 cmd;
10128c2ecf20Sopenharmony_ci			u8 macid;
10138c2ecf20Sopenharmony_ci			/*
10148c2ecf20Sopenharmony_ci			 * [0:4] - RAID
10158c2ecf20Sopenharmony_ci			 * [7]   - SGI
10168c2ecf20Sopenharmony_ci			 */
10178c2ecf20Sopenharmony_ci			u8 data1;
10188c2ecf20Sopenharmony_ci			/*
10198c2ecf20Sopenharmony_ci			 * [0:1] - Bandwidth
10208c2ecf20Sopenharmony_ci			 * [3]   - No Update
10218c2ecf20Sopenharmony_ci			 * [4:5] - VHT enable
10228c2ecf20Sopenharmony_ci			 * [6]   - DISPT
10238c2ecf20Sopenharmony_ci			 * [7]   - DISRA
10248c2ecf20Sopenharmony_ci			 */
10258c2ecf20Sopenharmony_ci			u8 data2;
10268c2ecf20Sopenharmony_ci			u8 ramask0;
10278c2ecf20Sopenharmony_ci			u8 ramask1;
10288c2ecf20Sopenharmony_ci			u8 ramask2;
10298c2ecf20Sopenharmony_ci			u8 ramask3;
10308c2ecf20Sopenharmony_ci		} __packed b_macid_cfg;
10318c2ecf20Sopenharmony_ci		struct {
10328c2ecf20Sopenharmony_ci			u8 cmd;
10338c2ecf20Sopenharmony_ci			u8 data1;
10348c2ecf20Sopenharmony_ci			u8 data2;
10358c2ecf20Sopenharmony_ci			u8 data3;
10368c2ecf20Sopenharmony_ci			u8 data4;
10378c2ecf20Sopenharmony_ci			u8 data5;
10388c2ecf20Sopenharmony_ci		} __packed b_type_dma;
10398c2ecf20Sopenharmony_ci		struct {
10408c2ecf20Sopenharmony_ci			u8 cmd;
10418c2ecf20Sopenharmony_ci			u8 data;
10428c2ecf20Sopenharmony_ci		} __packed bt_info;
10438c2ecf20Sopenharmony_ci		struct {
10448c2ecf20Sopenharmony_ci			u8 cmd;
10458c2ecf20Sopenharmony_ci			u8 operreq;
10468c2ecf20Sopenharmony_ci			u8 opcode;
10478c2ecf20Sopenharmony_ci			u8 data;
10488c2ecf20Sopenharmony_ci			u8 addr;
10498c2ecf20Sopenharmony_ci		} __packed bt_mp_oper;
10508c2ecf20Sopenharmony_ci		struct {
10518c2ecf20Sopenharmony_ci			u8 cmd;
10528c2ecf20Sopenharmony_ci			u8 data;
10538c2ecf20Sopenharmony_ci		} __packed bt_wlan_calibration;
10548c2ecf20Sopenharmony_ci		struct {
10558c2ecf20Sopenharmony_ci			u8 cmd;
10568c2ecf20Sopenharmony_ci			u8 data;
10578c2ecf20Sopenharmony_ci		} __packed ignore_wlan;
10588c2ecf20Sopenharmony_ci		struct {
10598c2ecf20Sopenharmony_ci			u8 cmd;
10608c2ecf20Sopenharmony_ci			u8 ant_inverse;
10618c2ecf20Sopenharmony_ci			u8 int_switch_type;
10628c2ecf20Sopenharmony_ci		} __packed ant_sel_rsv;
10638c2ecf20Sopenharmony_ci		struct {
10648c2ecf20Sopenharmony_ci			u8 cmd;
10658c2ecf20Sopenharmony_ci			u8 data;
10668c2ecf20Sopenharmony_ci		} __packed bt_grant;
10678c2ecf20Sopenharmony_ci	};
10688c2ecf20Sopenharmony_ci};
10698c2ecf20Sopenharmony_ci
10708c2ecf20Sopenharmony_cienum c2h_evt_8723b {
10718c2ecf20Sopenharmony_ci	C2H_8723B_DEBUG = 0,
10728c2ecf20Sopenharmony_ci	C2H_8723B_TSF = 1,
10738c2ecf20Sopenharmony_ci	C2H_8723B_AP_RPT_RSP = 2,
10748c2ecf20Sopenharmony_ci	C2H_8723B_CCX_TX_RPT = 3,
10758c2ecf20Sopenharmony_ci	C2H_8723B_BT_RSSI = 4,
10768c2ecf20Sopenharmony_ci	C2H_8723B_BT_OP_MODE = 5,
10778c2ecf20Sopenharmony_ci	C2H_8723B_EXT_RA_RPT = 6,
10788c2ecf20Sopenharmony_ci	C2H_8723B_BT_INFO = 9,
10798c2ecf20Sopenharmony_ci	C2H_8723B_HW_INFO_EXCH = 0x0a,
10808c2ecf20Sopenharmony_ci	C2H_8723B_BT_MP_INFO = 0x0b,
10818c2ecf20Sopenharmony_ci	C2H_8723B_RA_REPORT = 0x0c,
10828c2ecf20Sopenharmony_ci	C2H_8723B_FW_DEBUG = 0xff,
10838c2ecf20Sopenharmony_ci};
10848c2ecf20Sopenharmony_ci
10858c2ecf20Sopenharmony_cienum bt_info_src_8723b {
10868c2ecf20Sopenharmony_ci	BT_INFO_SRC_8723B_WIFI_FW = 0x0,
10878c2ecf20Sopenharmony_ci        BT_INFO_SRC_8723B_BT_RSP = 0x1,
10888c2ecf20Sopenharmony_ci        BT_INFO_SRC_8723B_BT_ACTIVE_SEND = 0x2,
10898c2ecf20Sopenharmony_ci};
10908c2ecf20Sopenharmony_ci
10918c2ecf20Sopenharmony_cienum bt_mp_oper_opcode_8723b {
10928c2ecf20Sopenharmony_ci	BT_MP_OP_GET_BT_VERSION	= 0x00,
10938c2ecf20Sopenharmony_ci	BT_MP_OP_RESET = 0x01,
10948c2ecf20Sopenharmony_ci	BT_MP_OP_TEST_CTRL = 0x02,
10958c2ecf20Sopenharmony_ci	BT_MP_OP_SET_BT_MODE = 0x03,
10968c2ecf20Sopenharmony_ci	BT_MP_OP_SET_CHNL_TX_GAIN = 0x04,
10978c2ecf20Sopenharmony_ci	BT_MP_OP_SET_PKT_TYPE_LEN = 0x05,
10988c2ecf20Sopenharmony_ci	BT_MP_OP_SET_PKT_CNT_L_PL_TYPE = 0x06,
10998c2ecf20Sopenharmony_ci	BT_MP_OP_SET_PKT_CNT_H_PKT_INTV = 0x07,
11008c2ecf20Sopenharmony_ci	BT_MP_OP_SET_PKT_HEADER = 0x08,
11018c2ecf20Sopenharmony_ci	BT_MP_OP_SET_WHITENCOEFF = 0x09,
11028c2ecf20Sopenharmony_ci	BT_MP_OP_SET_BD_ADDR_L = 0x0a,
11038c2ecf20Sopenharmony_ci	BT_MP_OP_SET_BD_ADDR_H = 0x0b,
11048c2ecf20Sopenharmony_ci	BT_MP_OP_WRITE_REG_ADDR = 0x0c,
11058c2ecf20Sopenharmony_ci	BT_MP_OP_WRITE_REG_VALUE = 0x0d,
11068c2ecf20Sopenharmony_ci	BT_MP_OP_GET_BT_STATUS = 0x0e,
11078c2ecf20Sopenharmony_ci	BT_MP_OP_GET_BD_ADDR_L = 0x0f,
11088c2ecf20Sopenharmony_ci	BT_MP_OP_GET_BD_ADDR_H = 0x10,
11098c2ecf20Sopenharmony_ci	BT_MP_OP_READ_REG = 0x11,
11108c2ecf20Sopenharmony_ci	BT_MP_OP_SET_TARGET_BD_ADDR_L = 0x12,
11118c2ecf20Sopenharmony_ci	BT_MP_OP_SET_TARGET_BD_ADDR_H = 0x13,
11128c2ecf20Sopenharmony_ci	BT_MP_OP_SET_TX_POWER_CALIBRATION = 0x14,
11138c2ecf20Sopenharmony_ci	BT_MP_OP_GET_RX_PKT_CNT_L = 0x15,
11148c2ecf20Sopenharmony_ci	BT_MP_OP_GET_RX_PKT_CNT_H = 0x16,
11158c2ecf20Sopenharmony_ci	BT_MP_OP_GET_RX_ERROR_BITS_L = 0x17,
11168c2ecf20Sopenharmony_ci	BT_MP_OP_GET_RX_ERROR_BITS_H = 0x18,
11178c2ecf20Sopenharmony_ci	BT_MP_OP_GET_RSSI = 0x19,
11188c2ecf20Sopenharmony_ci	BT_MP_OP_GET_CFO_HDR_QUALITY_L = 0x1a,
11198c2ecf20Sopenharmony_ci	BT_MP_OP_GET_CFO_HDR_QUALITY_H = 0x1b,
11208c2ecf20Sopenharmony_ci	BT_MP_OP_GET_TARGET_BD_ADDR_L = 0x1c,
11218c2ecf20Sopenharmony_ci	BT_MP_OP_GET_TARGET_BD_ADDR_H = 0x1d,
11228c2ecf20Sopenharmony_ci	BT_MP_OP_GET_AFH_MAP_L = 0x1e,
11238c2ecf20Sopenharmony_ci	BT_MP_OP_GET_AFH_MAP_M = 0x1f,
11248c2ecf20Sopenharmony_ci	BT_MP_OP_GET_AFH_MAP_H = 0x20,
11258c2ecf20Sopenharmony_ci	BT_MP_OP_GET_AFH_STATUS = 0x21,
11268c2ecf20Sopenharmony_ci	BT_MP_OP_SET_TRACKING_INTERVAL = 0x22,
11278c2ecf20Sopenharmony_ci	BT_MP_OP_SET_THERMAL_METER = 0x23,
11288c2ecf20Sopenharmony_ci	BT_MP_OP_ENABLE_CFO_TRACKING = 0x24,
11298c2ecf20Sopenharmony_ci};
11308c2ecf20Sopenharmony_ci
11318c2ecf20Sopenharmony_cienum rtl8xxxu_bw_mode {
11328c2ecf20Sopenharmony_ci	RTL8XXXU_CHANNEL_WIDTH_20 = 0,
11338c2ecf20Sopenharmony_ci	RTL8XXXU_CHANNEL_WIDTH_40 = 1,
11348c2ecf20Sopenharmony_ci	RTL8XXXU_CHANNEL_WIDTH_80 = 2,
11358c2ecf20Sopenharmony_ci	RTL8XXXU_CHANNEL_WIDTH_160 = 3,
11368c2ecf20Sopenharmony_ci	RTL8XXXU_CHANNEL_WIDTH_80_80 = 4,
11378c2ecf20Sopenharmony_ci	RTL8XXXU_CHANNEL_WIDTH_MAX = 5,
11388c2ecf20Sopenharmony_ci};
11398c2ecf20Sopenharmony_ci
11408c2ecf20Sopenharmony_cistruct rtl8723bu_c2h {
11418c2ecf20Sopenharmony_ci	u8 id;
11428c2ecf20Sopenharmony_ci	u8 seq;
11438c2ecf20Sopenharmony_ci	union {
11448c2ecf20Sopenharmony_ci		struct {
11458c2ecf20Sopenharmony_ci			u8 payload[0];
11468c2ecf20Sopenharmony_ci		} __packed raw;
11478c2ecf20Sopenharmony_ci		struct {
11488c2ecf20Sopenharmony_ci			u8 ext_id;
11498c2ecf20Sopenharmony_ci			u8 status:4;
11508c2ecf20Sopenharmony_ci			u8 retlen:4;
11518c2ecf20Sopenharmony_ci			u8 opcode_ver:4;
11528c2ecf20Sopenharmony_ci			u8 req_num:4;
11538c2ecf20Sopenharmony_ci			u8 payload[2];
11548c2ecf20Sopenharmony_ci		} __packed bt_mp_info;
11558c2ecf20Sopenharmony_ci		struct {
11568c2ecf20Sopenharmony_ci			u8 response_source:4;
11578c2ecf20Sopenharmony_ci			u8 dummy0_0:4;
11588c2ecf20Sopenharmony_ci
11598c2ecf20Sopenharmony_ci			u8 bt_info;
11608c2ecf20Sopenharmony_ci
11618c2ecf20Sopenharmony_ci			u8 retry_count:4;
11628c2ecf20Sopenharmony_ci			u8 dummy2_0:1;
11638c2ecf20Sopenharmony_ci			u8 bt_page:1;
11648c2ecf20Sopenharmony_ci			u8 tx_rx_mask:1;
11658c2ecf20Sopenharmony_ci			u8 dummy2_2:1;
11668c2ecf20Sopenharmony_ci
11678c2ecf20Sopenharmony_ci			u8 rssi;
11688c2ecf20Sopenharmony_ci
11698c2ecf20Sopenharmony_ci			u8 basic_rate:1;
11708c2ecf20Sopenharmony_ci			u8 bt_has_reset:1;
11718c2ecf20Sopenharmony_ci			u8 dummy4_1:1;
11728c2ecf20Sopenharmony_ci			u8 ignore_wlan:1;
11738c2ecf20Sopenharmony_ci			u8 auto_report:1;
11748c2ecf20Sopenharmony_ci			u8 dummy4_2:3;
11758c2ecf20Sopenharmony_ci
11768c2ecf20Sopenharmony_ci			u8 a4;
11778c2ecf20Sopenharmony_ci			u8 a5;
11788c2ecf20Sopenharmony_ci		} __packed bt_info;
11798c2ecf20Sopenharmony_ci		struct {
11808c2ecf20Sopenharmony_ci			u8 rate:7;
11818c2ecf20Sopenharmony_ci			u8 sgi:1;
11828c2ecf20Sopenharmony_ci			u8 macid;
11838c2ecf20Sopenharmony_ci			u8 ldpc:1;
11848c2ecf20Sopenharmony_ci			u8 txbf:1;
11858c2ecf20Sopenharmony_ci			u8 noisy_state:1;
11868c2ecf20Sopenharmony_ci			u8 dummy2_0:5;
11878c2ecf20Sopenharmony_ci			u8 dummy3_0;
11888c2ecf20Sopenharmony_ci			u8 dummy4_0;
11898c2ecf20Sopenharmony_ci			u8 dummy5_0;
11908c2ecf20Sopenharmony_ci			u8 bw;
11918c2ecf20Sopenharmony_ci		} __packed ra_report;
11928c2ecf20Sopenharmony_ci	};
11938c2ecf20Sopenharmony_ci} __packed;
11948c2ecf20Sopenharmony_ci
11958c2ecf20Sopenharmony_cistruct rtl8xxxu_fileops;
11968c2ecf20Sopenharmony_ci
11978c2ecf20Sopenharmony_ci/*mlme related.*/
11988c2ecf20Sopenharmony_cienum wireless_mode {
11998c2ecf20Sopenharmony_ci	WIRELESS_MODE_UNKNOWN = 0,
12008c2ecf20Sopenharmony_ci	/* Sub-Element */
12018c2ecf20Sopenharmony_ci	WIRELESS_MODE_B = BIT(0),
12028c2ecf20Sopenharmony_ci	WIRELESS_MODE_G = BIT(1),
12038c2ecf20Sopenharmony_ci	WIRELESS_MODE_A = BIT(2),
12048c2ecf20Sopenharmony_ci	WIRELESS_MODE_N_24G = BIT(3),
12058c2ecf20Sopenharmony_ci	WIRELESS_MODE_N_5G = BIT(4),
12068c2ecf20Sopenharmony_ci	WIRELESS_AUTO = BIT(5),
12078c2ecf20Sopenharmony_ci	WIRELESS_MODE_AC = BIT(6),
12088c2ecf20Sopenharmony_ci	WIRELESS_MODE_MAX = 0x7F,
12098c2ecf20Sopenharmony_ci};
12108c2ecf20Sopenharmony_ci
12118c2ecf20Sopenharmony_ci/* from rtlwifi/wifi.h */
12128c2ecf20Sopenharmony_cienum ratr_table_mode_new {
12138c2ecf20Sopenharmony_ci	RATEID_IDX_BGN_40M_2SS = 0,
12148c2ecf20Sopenharmony_ci	RATEID_IDX_BGN_40M_1SS = 1,
12158c2ecf20Sopenharmony_ci	RATEID_IDX_BGN_20M_2SS_BN = 2,
12168c2ecf20Sopenharmony_ci	RATEID_IDX_BGN_20M_1SS_BN = 3,
12178c2ecf20Sopenharmony_ci	RATEID_IDX_GN_N2SS = 4,
12188c2ecf20Sopenharmony_ci	RATEID_IDX_GN_N1SS = 5,
12198c2ecf20Sopenharmony_ci	RATEID_IDX_BG = 6,
12208c2ecf20Sopenharmony_ci	RATEID_IDX_G = 7,
12218c2ecf20Sopenharmony_ci	RATEID_IDX_B = 8,
12228c2ecf20Sopenharmony_ci	RATEID_IDX_VHT_2SS = 9,
12238c2ecf20Sopenharmony_ci	RATEID_IDX_VHT_1SS = 10,
12248c2ecf20Sopenharmony_ci	RATEID_IDX_MIX1 = 11,
12258c2ecf20Sopenharmony_ci	RATEID_IDX_MIX2 = 12,
12268c2ecf20Sopenharmony_ci	RATEID_IDX_VHT_3SS = 13,
12278c2ecf20Sopenharmony_ci	RATEID_IDX_BGN_3SS = 14,
12288c2ecf20Sopenharmony_ci};
12298c2ecf20Sopenharmony_ci
12308c2ecf20Sopenharmony_ci#define BT_INFO_8723B_1ANT_B_FTP		BIT(7)
12318c2ecf20Sopenharmony_ci#define BT_INFO_8723B_1ANT_B_A2DP		BIT(6)
12328c2ecf20Sopenharmony_ci#define BT_INFO_8723B_1ANT_B_HID		BIT(5)
12338c2ecf20Sopenharmony_ci#define BT_INFO_8723B_1ANT_B_SCO_BUSY		BIT(4)
12348c2ecf20Sopenharmony_ci#define BT_INFO_8723B_1ANT_B_ACL_BUSY		BIT(3)
12358c2ecf20Sopenharmony_ci#define BT_INFO_8723B_1ANT_B_INQ_PAGE		BIT(2)
12368c2ecf20Sopenharmony_ci#define BT_INFO_8723B_1ANT_B_SCO_ESCO		BIT(1)
12378c2ecf20Sopenharmony_ci#define BT_INFO_8723B_1ANT_B_CONNECTION	BIT(0)
12388c2ecf20Sopenharmony_ci
12398c2ecf20Sopenharmony_cienum _BT_8723B_1ANT_STATUS {
12408c2ecf20Sopenharmony_ci	BT_8723B_1ANT_STATUS_NON_CONNECTED_IDLE      = 0x0,
12418c2ecf20Sopenharmony_ci	BT_8723B_1ANT_STATUS_CONNECTED_IDLE          = 0x1,
12428c2ecf20Sopenharmony_ci	BT_8723B_1ANT_STATUS_INQ_PAGE                = 0x2,
12438c2ecf20Sopenharmony_ci	BT_8723B_1ANT_STATUS_ACL_BUSY                = 0x3,
12448c2ecf20Sopenharmony_ci	BT_8723B_1ANT_STATUS_SCO_BUSY                = 0x4,
12458c2ecf20Sopenharmony_ci	BT_8723B_1ANT_STATUS_ACL_SCO_BUSY            = 0x5,
12468c2ecf20Sopenharmony_ci	BT_8723B_1ANT_STATUS_MAX
12478c2ecf20Sopenharmony_ci};
12488c2ecf20Sopenharmony_ci
12498c2ecf20Sopenharmony_cistruct rtl8xxxu_btcoex {
12508c2ecf20Sopenharmony_ci	u8      bt_status;
12518c2ecf20Sopenharmony_ci	bool	bt_busy;
12528c2ecf20Sopenharmony_ci	bool	has_sco;
12538c2ecf20Sopenharmony_ci	bool	has_a2dp;
12548c2ecf20Sopenharmony_ci	bool    has_hid;
12558c2ecf20Sopenharmony_ci	bool    has_pan;
12568c2ecf20Sopenharmony_ci	bool	hid_only;
12578c2ecf20Sopenharmony_ci	bool	a2dp_only;
12588c2ecf20Sopenharmony_ci	bool    c2h_bt_inquiry;
12598c2ecf20Sopenharmony_ci};
12608c2ecf20Sopenharmony_ci
12618c2ecf20Sopenharmony_ci#define RTL8XXXU_RATR_STA_INIT 0
12628c2ecf20Sopenharmony_ci#define RTL8XXXU_RATR_STA_HIGH 1
12638c2ecf20Sopenharmony_ci#define RTL8XXXU_RATR_STA_MID  2
12648c2ecf20Sopenharmony_ci#define RTL8XXXU_RATR_STA_LOW  3
12658c2ecf20Sopenharmony_ci
12668c2ecf20Sopenharmony_ci#define RTL8XXXU_NOISE_FLOOR_MIN	-100
12678c2ecf20Sopenharmony_ci#define RTL8XXXU_SNR_THRESH_HIGH	50
12688c2ecf20Sopenharmony_ci#define RTL8XXXU_SNR_THRESH_LOW	20
12698c2ecf20Sopenharmony_ci
12708c2ecf20Sopenharmony_cistruct rtl8xxxu_ra_report {
12718c2ecf20Sopenharmony_ci	struct rate_info txrate;
12728c2ecf20Sopenharmony_ci	u32 bit_rate;
12738c2ecf20Sopenharmony_ci	u8 desc_rate;
12748c2ecf20Sopenharmony_ci};
12758c2ecf20Sopenharmony_ci
12768c2ecf20Sopenharmony_cistruct rtl8xxxu_priv {
12778c2ecf20Sopenharmony_ci	struct ieee80211_hw *hw;
12788c2ecf20Sopenharmony_ci	struct usb_device *udev;
12798c2ecf20Sopenharmony_ci	struct rtl8xxxu_fileops *fops;
12808c2ecf20Sopenharmony_ci
12818c2ecf20Sopenharmony_ci	spinlock_t tx_urb_lock;
12828c2ecf20Sopenharmony_ci	struct list_head tx_urb_free_list;
12838c2ecf20Sopenharmony_ci	int tx_urb_free_count;
12848c2ecf20Sopenharmony_ci	bool tx_stopped;
12858c2ecf20Sopenharmony_ci
12868c2ecf20Sopenharmony_ci	spinlock_t rx_urb_lock;
12878c2ecf20Sopenharmony_ci	struct list_head rx_urb_pending_list;
12888c2ecf20Sopenharmony_ci	int rx_urb_pending_count;
12898c2ecf20Sopenharmony_ci	bool shutdown;
12908c2ecf20Sopenharmony_ci	struct work_struct rx_urb_wq;
12918c2ecf20Sopenharmony_ci
12928c2ecf20Sopenharmony_ci	u8 mac_addr[ETH_ALEN];
12938c2ecf20Sopenharmony_ci	char chip_name[8];
12948c2ecf20Sopenharmony_ci	char chip_vendor[8];
12958c2ecf20Sopenharmony_ci	u8 cck_tx_power_index_A[RTL8XXXU_MAX_CHANNEL_GROUPS];
12968c2ecf20Sopenharmony_ci	u8 cck_tx_power_index_B[RTL8XXXU_MAX_CHANNEL_GROUPS];
12978c2ecf20Sopenharmony_ci	u8 ht40_1s_tx_power_index_A[RTL8XXXU_MAX_CHANNEL_GROUPS];
12988c2ecf20Sopenharmony_ci	u8 ht40_1s_tx_power_index_B[RTL8XXXU_MAX_CHANNEL_GROUPS];
12998c2ecf20Sopenharmony_ci	/*
13008c2ecf20Sopenharmony_ci	 * The following entries are half-bytes split as:
13018c2ecf20Sopenharmony_ci	 * bits 0-3: path A, bits 4-7: path B, all values 4 bits signed
13028c2ecf20Sopenharmony_ci	 */
13038c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht40_2s_tx_power_index_diff[
13048c2ecf20Sopenharmony_ci		RTL8723A_CHANNEL_GROUPS];
13058c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht20_tx_power_index_diff[RTL8723A_CHANNEL_GROUPS];
13068c2ecf20Sopenharmony_ci	struct rtl8723au_idx ofdm_tx_power_index_diff[RTL8723A_CHANNEL_GROUPS];
13078c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht40_max_power_offset[RTL8723A_CHANNEL_GROUPS];
13088c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht20_max_power_offset[RTL8723A_CHANNEL_GROUPS];
13098c2ecf20Sopenharmony_ci	/*
13108c2ecf20Sopenharmony_ci	 * Newer generation chips only keep power diffs per TX count,
13118c2ecf20Sopenharmony_ci	 * not per channel group.
13128c2ecf20Sopenharmony_ci	 */
13138c2ecf20Sopenharmony_ci	struct rtl8723au_idx ofdm_tx_power_diff[RTL8723B_TX_COUNT];
13148c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht20_tx_power_diff[RTL8723B_TX_COUNT];
13158c2ecf20Sopenharmony_ci	struct rtl8723au_idx ht40_tx_power_diff[RTL8723B_TX_COUNT];
13168c2ecf20Sopenharmony_ci	struct rtl8xxxu_power_base *power_base;
13178c2ecf20Sopenharmony_ci	u32 chip_cut:4;
13188c2ecf20Sopenharmony_ci	u32 rom_rev:4;
13198c2ecf20Sopenharmony_ci	u32 is_multi_func:1;
13208c2ecf20Sopenharmony_ci	u32 has_wifi:1;
13218c2ecf20Sopenharmony_ci	u32 has_bluetooth:1;
13228c2ecf20Sopenharmony_ci	u32 enable_bluetooth:1;
13238c2ecf20Sopenharmony_ci	u32 has_gps:1;
13248c2ecf20Sopenharmony_ci	u32 hi_pa:1;
13258c2ecf20Sopenharmony_ci	u32 vendor_umc:1;
13268c2ecf20Sopenharmony_ci	u32 vendor_smic:1;
13278c2ecf20Sopenharmony_ci	u32 has_polarity_ctrl:1;
13288c2ecf20Sopenharmony_ci	u32 has_eeprom:1;
13298c2ecf20Sopenharmony_ci	u32 boot_eeprom:1;
13308c2ecf20Sopenharmony_ci	u32 usb_interrupts:1;
13318c2ecf20Sopenharmony_ci	u32 ep_tx_high_queue:1;
13328c2ecf20Sopenharmony_ci	u32 ep_tx_normal_queue:1;
13338c2ecf20Sopenharmony_ci	u32 ep_tx_low_queue:1;
13348c2ecf20Sopenharmony_ci	u32 has_xtalk:1;
13358c2ecf20Sopenharmony_ci	u32 rx_buf_aggregation:1;
13368c2ecf20Sopenharmony_ci	u8 xtalk;
13378c2ecf20Sopenharmony_ci	unsigned int pipe_interrupt;
13388c2ecf20Sopenharmony_ci	unsigned int pipe_in;
13398c2ecf20Sopenharmony_ci	unsigned int pipe_out[TXDESC_QUEUE_MAX];
13408c2ecf20Sopenharmony_ci	u8 out_ep[RTL8XXXU_OUT_ENDPOINTS];
13418c2ecf20Sopenharmony_ci	u8 ep_tx_count;
13428c2ecf20Sopenharmony_ci	u8 rf_paths;
13438c2ecf20Sopenharmony_ci	u8 rx_paths;
13448c2ecf20Sopenharmony_ci	u8 tx_paths;
13458c2ecf20Sopenharmony_ci	u32 rege94;
13468c2ecf20Sopenharmony_ci	u32 rege9c;
13478c2ecf20Sopenharmony_ci	u32 regeb4;
13488c2ecf20Sopenharmony_ci	u32 regebc;
13498c2ecf20Sopenharmony_ci	u32 regrcr;
13508c2ecf20Sopenharmony_ci	int next_mbox;
13518c2ecf20Sopenharmony_ci	int nr_out_eps;
13528c2ecf20Sopenharmony_ci
13538c2ecf20Sopenharmony_ci	struct mutex h2c_mutex;
13548c2ecf20Sopenharmony_ci
13558c2ecf20Sopenharmony_ci	struct usb_anchor rx_anchor;
13568c2ecf20Sopenharmony_ci	struct usb_anchor tx_anchor;
13578c2ecf20Sopenharmony_ci	struct usb_anchor int_anchor;
13588c2ecf20Sopenharmony_ci	struct rtl8xxxu_firmware_header *fw_data;
13598c2ecf20Sopenharmony_ci	size_t fw_size;
13608c2ecf20Sopenharmony_ci	struct mutex usb_buf_mutex;
13618c2ecf20Sopenharmony_ci	union {
13628c2ecf20Sopenharmony_ci		__le32 val32;
13638c2ecf20Sopenharmony_ci		__le16 val16;
13648c2ecf20Sopenharmony_ci		u8 val8;
13658c2ecf20Sopenharmony_ci	} usb_buf;
13668c2ecf20Sopenharmony_ci	union {
13678c2ecf20Sopenharmony_ci		u8 raw[EFUSE_MAP_LEN];
13688c2ecf20Sopenharmony_ci		struct rtl8723au_efuse efuse8723;
13698c2ecf20Sopenharmony_ci		struct rtl8723bu_efuse efuse8723bu;
13708c2ecf20Sopenharmony_ci		struct rtl8192cu_efuse efuse8192;
13718c2ecf20Sopenharmony_ci		struct rtl8192eu_efuse efuse8192eu;
13728c2ecf20Sopenharmony_ci	} efuse_wifi;
13738c2ecf20Sopenharmony_ci	u32 adda_backup[RTL8XXXU_ADDA_REGS];
13748c2ecf20Sopenharmony_ci	u32 mac_backup[RTL8XXXU_MAC_REGS];
13758c2ecf20Sopenharmony_ci	u32 bb_backup[RTL8XXXU_BB_REGS];
13768c2ecf20Sopenharmony_ci	u32 bb_recovery_backup[RTL8XXXU_BB_REGS];
13778c2ecf20Sopenharmony_ci	enum rtl8xxxu_rtl_chip rtl_chip;
13788c2ecf20Sopenharmony_ci	u8 pi_enabled:1;
13798c2ecf20Sopenharmony_ci	u8 no_pape:1;
13808c2ecf20Sopenharmony_ci	u8 int_buf[USB_INTR_CONTENT_LENGTH];
13818c2ecf20Sopenharmony_ci	u8 rssi_level;
13828c2ecf20Sopenharmony_ci	DECLARE_BITMAP(tx_aggr_started, IEEE80211_NUM_TIDS);
13838c2ecf20Sopenharmony_ci	DECLARE_BITMAP(tid_tx_operational, IEEE80211_NUM_TIDS);
13848c2ecf20Sopenharmony_ci	/*
13858c2ecf20Sopenharmony_ci	 * Only one virtual interface permitted because only STA mode
13868c2ecf20Sopenharmony_ci	 * is supported and no iface_combinations are provided.
13878c2ecf20Sopenharmony_ci	 */
13888c2ecf20Sopenharmony_ci	struct ieee80211_vif *vif;
13898c2ecf20Sopenharmony_ci	struct delayed_work ra_watchdog;
13908c2ecf20Sopenharmony_ci	struct work_struct c2hcmd_work;
13918c2ecf20Sopenharmony_ci	struct sk_buff_head c2hcmd_queue;
13928c2ecf20Sopenharmony_ci	spinlock_t c2hcmd_lock;
13938c2ecf20Sopenharmony_ci	struct rtl8xxxu_btcoex bt_coex;
13948c2ecf20Sopenharmony_ci	struct rtl8xxxu_ra_report ra_report;
13958c2ecf20Sopenharmony_ci};
13968c2ecf20Sopenharmony_ci
13978c2ecf20Sopenharmony_cistruct rtl8xxxu_rx_urb {
13988c2ecf20Sopenharmony_ci	struct urb urb;
13998c2ecf20Sopenharmony_ci	struct ieee80211_hw *hw;
14008c2ecf20Sopenharmony_ci	struct list_head list;
14018c2ecf20Sopenharmony_ci};
14028c2ecf20Sopenharmony_ci
14038c2ecf20Sopenharmony_cistruct rtl8xxxu_tx_urb {
14048c2ecf20Sopenharmony_ci	struct urb urb;
14058c2ecf20Sopenharmony_ci	struct ieee80211_hw *hw;
14068c2ecf20Sopenharmony_ci	struct list_head list;
14078c2ecf20Sopenharmony_ci};
14088c2ecf20Sopenharmony_ci
14098c2ecf20Sopenharmony_cistruct rtl8xxxu_fileops {
14108c2ecf20Sopenharmony_ci	int (*parse_efuse) (struct rtl8xxxu_priv *priv);
14118c2ecf20Sopenharmony_ci	int (*load_firmware) (struct rtl8xxxu_priv *priv);
14128c2ecf20Sopenharmony_ci	int (*power_on) (struct rtl8xxxu_priv *priv);
14138c2ecf20Sopenharmony_ci	void (*power_off) (struct rtl8xxxu_priv *priv);
14148c2ecf20Sopenharmony_ci	void (*reset_8051) (struct rtl8xxxu_priv *priv);
14158c2ecf20Sopenharmony_ci	int (*llt_init) (struct rtl8xxxu_priv *priv);
14168c2ecf20Sopenharmony_ci	void (*init_phy_bb) (struct rtl8xxxu_priv *priv);
14178c2ecf20Sopenharmony_ci	int (*init_phy_rf) (struct rtl8xxxu_priv *priv);
14188c2ecf20Sopenharmony_ci	void (*phy_init_antenna_selection) (struct rtl8xxxu_priv *priv);
14198c2ecf20Sopenharmony_ci	void (*phy_iq_calibrate) (struct rtl8xxxu_priv *priv);
14208c2ecf20Sopenharmony_ci	void (*config_channel) (struct ieee80211_hw *hw);
14218c2ecf20Sopenharmony_ci	int (*parse_rx_desc) (struct rtl8xxxu_priv *priv, struct sk_buff *skb);
14228c2ecf20Sopenharmony_ci	void (*init_aggregation) (struct rtl8xxxu_priv *priv);
14238c2ecf20Sopenharmony_ci	void (*init_statistics) (struct rtl8xxxu_priv *priv);
14248c2ecf20Sopenharmony_ci	void (*enable_rf) (struct rtl8xxxu_priv *priv);
14258c2ecf20Sopenharmony_ci	void (*disable_rf) (struct rtl8xxxu_priv *priv);
14268c2ecf20Sopenharmony_ci	void (*usb_quirks) (struct rtl8xxxu_priv *priv);
14278c2ecf20Sopenharmony_ci	void (*set_tx_power) (struct rtl8xxxu_priv *priv, int channel,
14288c2ecf20Sopenharmony_ci			      bool ht40);
14298c2ecf20Sopenharmony_ci	void (*update_rate_mask) (struct rtl8xxxu_priv *priv,
14308c2ecf20Sopenharmony_ci				  u32 ramask, u8 rateid, int sgi);
14318c2ecf20Sopenharmony_ci	void (*report_connect) (struct rtl8xxxu_priv *priv,
14328c2ecf20Sopenharmony_ci				u8 macid, bool connect);
14338c2ecf20Sopenharmony_ci	void (*fill_txdesc) (struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
14348c2ecf20Sopenharmony_ci			     struct ieee80211_tx_info *tx_info,
14358c2ecf20Sopenharmony_ci			     struct rtl8xxxu_txdesc32 *tx_desc, bool sgi,
14368c2ecf20Sopenharmony_ci			     bool short_preamble, bool ampdu_enable,
14378c2ecf20Sopenharmony_ci			     u32 rts_rate);
14388c2ecf20Sopenharmony_ci	int writeN_block_size;
14398c2ecf20Sopenharmony_ci	int rx_agg_buf_size;
14408c2ecf20Sopenharmony_ci	char tx_desc_size;
14418c2ecf20Sopenharmony_ci	char rx_desc_size;
14428c2ecf20Sopenharmony_ci	u8 has_s0s1:1;
14438c2ecf20Sopenharmony_ci	u8 has_tx_report:1;
14448c2ecf20Sopenharmony_ci	u8 gen2_thermal_meter:1;
14458c2ecf20Sopenharmony_ci	u8 needs_full_init:1;
14468c2ecf20Sopenharmony_ci	u32 adda_1t_init;
14478c2ecf20Sopenharmony_ci	u32 adda_1t_path_on;
14488c2ecf20Sopenharmony_ci	u32 adda_2t_path_on_a;
14498c2ecf20Sopenharmony_ci	u32 adda_2t_path_on_b;
14508c2ecf20Sopenharmony_ci	u16 trxff_boundary;
14518c2ecf20Sopenharmony_ci	u8 pbp_rx;
14528c2ecf20Sopenharmony_ci	u8 pbp_tx;
14538c2ecf20Sopenharmony_ci	struct rtl8xxxu_reg8val *mactable;
14548c2ecf20Sopenharmony_ci	u8 total_page_num;
14558c2ecf20Sopenharmony_ci	u8 page_num_hi;
14568c2ecf20Sopenharmony_ci	u8 page_num_lo;
14578c2ecf20Sopenharmony_ci	u8 page_num_norm;
14588c2ecf20Sopenharmony_ci};
14598c2ecf20Sopenharmony_ci
14608c2ecf20Sopenharmony_ciextern int rtl8xxxu_debug;
14618c2ecf20Sopenharmony_ci
14628c2ecf20Sopenharmony_ciextern struct rtl8xxxu_reg8val rtl8xxxu_gen1_mac_init_table[];
14638c2ecf20Sopenharmony_ciextern const u32 rtl8xxxu_iqk_phy_iq_bb_reg[];
14648c2ecf20Sopenharmony_ciu8 rtl8xxxu_read8(struct rtl8xxxu_priv *priv, u16 addr);
14658c2ecf20Sopenharmony_ciu16 rtl8xxxu_read16(struct rtl8xxxu_priv *priv, u16 addr);
14668c2ecf20Sopenharmony_ciu32 rtl8xxxu_read32(struct rtl8xxxu_priv *priv, u16 addr);
14678c2ecf20Sopenharmony_ciint rtl8xxxu_write8(struct rtl8xxxu_priv *priv, u16 addr, u8 val);
14688c2ecf20Sopenharmony_ciint rtl8xxxu_write16(struct rtl8xxxu_priv *priv, u16 addr, u16 val);
14698c2ecf20Sopenharmony_ciint rtl8xxxu_write32(struct rtl8xxxu_priv *priv, u16 addr, u32 val);
14708c2ecf20Sopenharmony_ciu32 rtl8xxxu_read_rfreg(struct rtl8xxxu_priv *priv,
14718c2ecf20Sopenharmony_ci			enum rtl8xxxu_rfpath path, u8 reg);
14728c2ecf20Sopenharmony_ciint rtl8xxxu_write_rfreg(struct rtl8xxxu_priv *priv,
14738c2ecf20Sopenharmony_ci			 enum rtl8xxxu_rfpath path, u8 reg, u32 data);
14748c2ecf20Sopenharmony_civoid rtl8xxxu_save_regs(struct rtl8xxxu_priv *priv, const u32 *regs,
14758c2ecf20Sopenharmony_ci			u32 *backup, int count);
14768c2ecf20Sopenharmony_civoid rtl8xxxu_restore_regs(struct rtl8xxxu_priv *priv, const u32 *regs,
14778c2ecf20Sopenharmony_ci			   u32 *backup, int count);
14788c2ecf20Sopenharmony_civoid rtl8xxxu_save_mac_regs(struct rtl8xxxu_priv *priv,
14798c2ecf20Sopenharmony_ci			    const u32 *reg, u32 *backup);
14808c2ecf20Sopenharmony_civoid rtl8xxxu_restore_mac_regs(struct rtl8xxxu_priv *priv,
14818c2ecf20Sopenharmony_ci			       const u32 *reg, u32 *backup);
14828c2ecf20Sopenharmony_civoid rtl8xxxu_path_adda_on(struct rtl8xxxu_priv *priv, const u32 *regs,
14838c2ecf20Sopenharmony_ci			   bool path_a_on);
14848c2ecf20Sopenharmony_civoid rtl8xxxu_mac_calibration(struct rtl8xxxu_priv *priv,
14858c2ecf20Sopenharmony_ci			      const u32 *regs, u32 *backup);
14868c2ecf20Sopenharmony_civoid rtl8xxxu_fill_iqk_matrix_a(struct rtl8xxxu_priv *priv, bool iqk_ok,
14878c2ecf20Sopenharmony_ci				int result[][8], int candidate, bool tx_only);
14888c2ecf20Sopenharmony_civoid rtl8xxxu_fill_iqk_matrix_b(struct rtl8xxxu_priv *priv, bool iqk_ok,
14898c2ecf20Sopenharmony_ci				int result[][8], int candidate, bool tx_only);
14908c2ecf20Sopenharmony_ciint rtl8xxxu_init_phy_rf(struct rtl8xxxu_priv *priv,
14918c2ecf20Sopenharmony_ci			 struct rtl8xxxu_rfregval *table,
14928c2ecf20Sopenharmony_ci			 enum rtl8xxxu_rfpath path);
14938c2ecf20Sopenharmony_ciint rtl8xxxu_init_phy_regs(struct rtl8xxxu_priv *priv,
14948c2ecf20Sopenharmony_ci			   struct rtl8xxxu_reg32val *array);
14958c2ecf20Sopenharmony_ciint rtl8xxxu_load_firmware(struct rtl8xxxu_priv *priv, char *fw_name);
14968c2ecf20Sopenharmony_civoid rtl8xxxu_firmware_self_reset(struct rtl8xxxu_priv *priv);
14978c2ecf20Sopenharmony_civoid rtl8xxxu_power_off(struct rtl8xxxu_priv *priv);
14988c2ecf20Sopenharmony_civoid rtl8xxxu_reset_8051(struct rtl8xxxu_priv *priv);
14998c2ecf20Sopenharmony_ciint rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv);
15008c2ecf20Sopenharmony_civoid rtl8xxxu_gen2_prepare_calibrate(struct rtl8xxxu_priv *priv, u8 start);
15018c2ecf20Sopenharmony_ciint rtl8xxxu_flush_fifo(struct rtl8xxxu_priv *priv);
15028c2ecf20Sopenharmony_ciint rtl8xxxu_gen2_h2c_cmd(struct rtl8xxxu_priv *priv,
15038c2ecf20Sopenharmony_ci			  struct h2c_cmd *h2c, int len);
15048c2ecf20Sopenharmony_ciint rtl8xxxu_active_to_lps(struct rtl8xxxu_priv *priv);
15058c2ecf20Sopenharmony_civoid rtl8xxxu_disabled_to_emu(struct rtl8xxxu_priv *priv);
15068c2ecf20Sopenharmony_ciint rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv);
15078c2ecf20Sopenharmony_civoid rtl8xxxu_gen1_phy_iq_calibrate(struct rtl8xxxu_priv *priv);
15088c2ecf20Sopenharmony_civoid rtl8xxxu_gen1_init_phy_bb(struct rtl8xxxu_priv *priv);
15098c2ecf20Sopenharmony_civoid rtl8xxxu_gen1_set_tx_power(struct rtl8xxxu_priv *priv,
15108c2ecf20Sopenharmony_ci				int channel, bool ht40);
15118c2ecf20Sopenharmony_civoid rtl8xxxu_gen1_config_channel(struct ieee80211_hw *hw);
15128c2ecf20Sopenharmony_civoid rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw);
15138c2ecf20Sopenharmony_civoid rtl8xxxu_gen1_usb_quirks(struct rtl8xxxu_priv *priv);
15148c2ecf20Sopenharmony_civoid rtl8xxxu_gen2_usb_quirks(struct rtl8xxxu_priv *priv);
15158c2ecf20Sopenharmony_civoid rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv,
15168c2ecf20Sopenharmony_ci			       u32 ramask, u8 rateid, int sgi);
15178c2ecf20Sopenharmony_civoid rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv,
15188c2ecf20Sopenharmony_ci				    u32 ramask, u8 rateid, int sgi);
15198c2ecf20Sopenharmony_civoid rtl8xxxu_gen1_report_connect(struct rtl8xxxu_priv *priv,
15208c2ecf20Sopenharmony_ci				  u8 macid, bool connect);
15218c2ecf20Sopenharmony_civoid rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv,
15228c2ecf20Sopenharmony_ci				  u8 macid, bool connect);
15238c2ecf20Sopenharmony_civoid rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv);
15248c2ecf20Sopenharmony_civoid rtl8xxxu_gen1_enable_rf(struct rtl8xxxu_priv *priv);
15258c2ecf20Sopenharmony_civoid rtl8xxxu_gen1_disable_rf(struct rtl8xxxu_priv *priv);
15268c2ecf20Sopenharmony_civoid rtl8xxxu_gen2_disable_rf(struct rtl8xxxu_priv *priv);
15278c2ecf20Sopenharmony_ciint rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb);
15288c2ecf20Sopenharmony_ciint rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb);
15298c2ecf20Sopenharmony_ciint rtl8xxxu_gen2_channel_to_group(int channel);
15308c2ecf20Sopenharmony_cibool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv,
15318c2ecf20Sopenharmony_ci				      int result[][8], int c1, int c2);
15328c2ecf20Sopenharmony_civoid rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
15338c2ecf20Sopenharmony_ci			     struct ieee80211_tx_info *tx_info,
15348c2ecf20Sopenharmony_ci			     struct rtl8xxxu_txdesc32 *tx_desc, bool sgi,
15358c2ecf20Sopenharmony_ci			     bool short_preamble, bool ampdu_enable,
15368c2ecf20Sopenharmony_ci			     u32 rts_rate);
15378c2ecf20Sopenharmony_civoid rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
15388c2ecf20Sopenharmony_ci			     struct ieee80211_tx_info *tx_info,
15398c2ecf20Sopenharmony_ci			     struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi,
15408c2ecf20Sopenharmony_ci			     bool short_preamble, bool ampdu_enable,
15418c2ecf20Sopenharmony_ci			     u32 rts_rate);
15428c2ecf20Sopenharmony_civoid rtl8723bu_set_ps_tdma(struct rtl8xxxu_priv *priv,
15438c2ecf20Sopenharmony_ci			   u8 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5);
15448c2ecf20Sopenharmony_ci
15458c2ecf20Sopenharmony_ciextern struct rtl8xxxu_fileops rtl8192cu_fops;
15468c2ecf20Sopenharmony_ciextern struct rtl8xxxu_fileops rtl8192eu_fops;
15478c2ecf20Sopenharmony_ciextern struct rtl8xxxu_fileops rtl8723au_fops;
15488c2ecf20Sopenharmony_ciextern struct rtl8xxxu_fileops rtl8723bu_fops;
1549