1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2018-2019 Realtek Corporation
8 #include <net/mac80211.h>
9 #include <linux/vmalloc.h>
10 #include <linux/firmware.h>
11 #include <linux/average.h>
12 #include <linux/bitops.h>
13 #include <linux/bitfield.h>
14 #include <linux/iopoll.h>
15 #include <linux/interrupt.h>
19 #define RTW_MAX_MAC_ID_NUM 32
20 #define RTW_MAX_SEC_CAM_NUM 32
21 #define MAX_PG_CAM_BACKUP_NUM 8
23 #define RTW_MAX_PATTERN_NUM 12
24 #define RTW_MAX_PATTERN_MASK_SIZE 16
25 #define RTW_MAX_PATTERN_SIZE 128
27 #define RTW_WATCH_DOG_DELAY_TIME round_jiffies_relative(HZ * 2)
29 #define RFREG_MASK 0xfffff
30 #define INV_RF_DATA 0xffffffff
31 #define TX_PAGE_SIZE_SHIFT 7
33 #define RTW_CHANNEL_WIDTH_MAX 3
34 #define RTW_RF_PATH_MAX 4
35 #define HW_FEATURE_LEN 13
37 #define RTW_TP_SHIFT 18 /* bytes/2s --> Mbps */
39 extern bool rtw_bf_support
;
40 extern bool rtw_disable_lps_deep_mode
;
41 extern unsigned int rtw_debug_mask
;
42 extern const struct ieee80211_ops rtw_ops
;
44 #define RTW_MAX_CHANNEL_NUM_2G 14
45 #define RTW_MAX_CHANNEL_NUM_5G 49
54 RTW_HCI_TYPE_UNDEFINE
,
58 struct rtw_hci_ops
*ops
;
59 enum rtw_hci_type type
;
67 #define IS_CH_5G_BAND_1(channel) ((channel) >= 36 && (channel <= 48))
68 #define IS_CH_5G_BAND_2(channel) ((channel) >= 52 && (channel <= 64))
69 #define IS_CH_5G_BAND_3(channel) ((channel) >= 100 && (channel <= 144))
70 #define IS_CH_5G_BAND_4(channel) ((channel) >= 149 && (channel <= 177))
72 #define IS_CH_5G_BAND_MID(channel) \
73 (IS_CH_5G_BAND_2(channel) || IS_CH_5G_BAND_3(channel))
75 #define IS_CH_2G_BAND(channel) ((channel) <= 14)
76 #define IS_CH_5G_BAND(channel) \
77 (IS_CH_5G_BAND_1(channel) || IS_CH_5G_BAND_2(channel) || \
78 IS_CH_5G_BAND_3(channel) || IS_CH_5G_BAND_4(channel))
80 enum rtw_supported_band
{
83 RTW_BAND_60G
= 1 << 2,
88 /* now, support upto 80M bw */
89 #define RTW_MAX_CHANNEL_WIDTH RTW_CHANNEL_WIDTH_80
92 RTW_CHANNEL_WIDTH_20
= 0,
93 RTW_CHANNEL_WIDTH_40
= 1,
94 RTW_CHANNEL_WIDTH_80
= 2,
95 RTW_CHANNEL_WIDTH_160
= 3,
96 RTW_CHANNEL_WIDTH_80_80
= 4,
97 RTW_CHANNEL_WIDTH_5
= 5,
98 RTW_CHANNEL_WIDTH_10
= 6,
102 RTW_SC_DONT_CARE
= 0,
105 RTW_SC_20_UPMOST
= 3,
106 RTW_SC_20_LOWEST
= 4,
108 RTW_SC_40_LOWER
= 10,
114 RTW_NET_MGD_LINKED
= 2,
143 BB_PATH_AB
= (BB_PATH_A
| BB_PATH_B
),
144 BB_PATH_AC
= (BB_PATH_A
| BB_PATH_C
),
145 BB_PATH_AD
= (BB_PATH_A
| BB_PATH_D
),
146 BB_PATH_BC
= (BB_PATH_B
| BB_PATH_C
),
147 BB_PATH_BD
= (BB_PATH_B
| BB_PATH_D
),
148 BB_PATH_CD
= (BB_PATH_C
| BB_PATH_D
),
150 BB_PATH_ABC
= (BB_PATH_A
| BB_PATH_B
| BB_PATH_C
),
151 BB_PATH_ABD
= (BB_PATH_A
| BB_PATH_B
| BB_PATH_D
),
152 BB_PATH_ACD
= (BB_PATH_A
| BB_PATH_C
| BB_PATH_D
),
153 BB_PATH_BCD
= (BB_PATH_B
| BB_PATH_C
| BB_PATH_D
),
155 BB_PATH_ABCD
= (BB_PATH_A
| BB_PATH_B
| BB_PATH_C
| BB_PATH_D
),
158 enum rtw_rate_section
{
159 RTW_RATE_SECTION_CCK
= 0,
160 RTW_RATE_SECTION_OFDM
,
161 RTW_RATE_SECTION_HT_1S
,
162 RTW_RATE_SECTION_HT_2S
,
163 RTW_RATE_SECTION_VHT_1S
,
164 RTW_RATE_SECTION_VHT_2S
,
167 RTW_RATE_SECTION_MAX
,
170 enum rtw_wireless_set
{
171 WIRELESS_CCK
= 0x00000001,
172 WIRELESS_OFDM
= 0x00000002,
173 WIRELESS_HT
= 0x00000004,
174 WIRELESS_VHT
= 0x00000008,
177 #define HT_STBC_EN BIT(0)
178 #define VHT_STBC_EN BIT(1)
179 #define HT_LDPC_EN BIT(0)
180 #define VHT_LDPC_EN BIT(1)
189 enum rtw_tx_queue_type
{
190 /* the order of AC queues matters */
191 RTW_TX_QUEUE_BK
= 0x0,
192 RTW_TX_QUEUE_BE
= 0x1,
193 RTW_TX_QUEUE_VI
= 0x2,
194 RTW_TX_QUEUE_VO
= 0x3,
196 RTW_TX_QUEUE_BCN
= 0x4,
197 RTW_TX_QUEUE_MGMT
= 0x5,
198 RTW_TX_QUEUE_HI0
= 0x6,
199 RTW_TX_QUEUE_H2C
= 0x7,
204 enum rtw_rx_queue_type
{
205 RTW_RX_QUEUE_MPDU
= 0x0,
206 RTW_RX_QUEUE_C2H
= 0x1,
216 enum rtw_rate_index
{
217 RTW_RATEID_BGN_40M_2SS
= 0,
218 RTW_RATEID_BGN_40M_1SS
= 1,
219 RTW_RATEID_BGN_20M_2SS
= 2,
220 RTW_RATEID_BGN_20M_1SS
= 3,
221 RTW_RATEID_GN_N2SS
= 4,
222 RTW_RATEID_GN_N1SS
= 5,
225 RTW_RATEID_B_20M
= 8,
226 RTW_RATEID_ARFR0_AC_2SS
= 9,
227 RTW_RATEID_ARFR1_AC_1SS
= 10,
228 RTW_RATEID_ARFR2_AC_2G_1SS
= 11,
229 RTW_RATEID_ARFR3_AC_2G_2SS
= 12,
230 RTW_RATEID_ARFR4_AC_3SS
= 13,
231 RTW_RATEID_ARFR5_N_3SS
= 14,
232 RTW_RATEID_ARFR7_N_4SS
= 15,
233 RTW_RATEID_ARFR6_AC_4SS
= 16
236 enum rtw_trx_desc_rate
{
239 DESC_RATE5_5M
= 0x02,
251 DESC_RATEMCS0
= 0x0c,
252 DESC_RATEMCS1
= 0x0d,
253 DESC_RATEMCS2
= 0x0e,
254 DESC_RATEMCS3
= 0x0f,
255 DESC_RATEMCS4
= 0x10,
256 DESC_RATEMCS5
= 0x11,
257 DESC_RATEMCS6
= 0x12,
258 DESC_RATEMCS7
= 0x13,
259 DESC_RATEMCS8
= 0x14,
260 DESC_RATEMCS9
= 0x15,
261 DESC_RATEMCS10
= 0x16,
262 DESC_RATEMCS11
= 0x17,
263 DESC_RATEMCS12
= 0x18,
264 DESC_RATEMCS13
= 0x19,
265 DESC_RATEMCS14
= 0x1a,
266 DESC_RATEMCS15
= 0x1b,
267 DESC_RATEMCS16
= 0x1c,
268 DESC_RATEMCS17
= 0x1d,
269 DESC_RATEMCS18
= 0x1e,
270 DESC_RATEMCS19
= 0x1f,
271 DESC_RATEMCS20
= 0x20,
272 DESC_RATEMCS21
= 0x21,
273 DESC_RATEMCS22
= 0x22,
274 DESC_RATEMCS23
= 0x23,
275 DESC_RATEMCS24
= 0x24,
276 DESC_RATEMCS25
= 0x25,
277 DESC_RATEMCS26
= 0x26,
278 DESC_RATEMCS27
= 0x27,
279 DESC_RATEMCS28
= 0x28,
280 DESC_RATEMCS29
= 0x29,
281 DESC_RATEMCS30
= 0x2a,
282 DESC_RATEMCS31
= 0x2b,
284 DESC_RATEVHT1SS_MCS0
= 0x2c,
285 DESC_RATEVHT1SS_MCS1
= 0x2d,
286 DESC_RATEVHT1SS_MCS2
= 0x2e,
287 DESC_RATEVHT1SS_MCS3
= 0x2f,
288 DESC_RATEVHT1SS_MCS4
= 0x30,
289 DESC_RATEVHT1SS_MCS5
= 0x31,
290 DESC_RATEVHT1SS_MCS6
= 0x32,
291 DESC_RATEVHT1SS_MCS7
= 0x33,
292 DESC_RATEVHT1SS_MCS8
= 0x34,
293 DESC_RATEVHT1SS_MCS9
= 0x35,
295 DESC_RATEVHT2SS_MCS0
= 0x36,
296 DESC_RATEVHT2SS_MCS1
= 0x37,
297 DESC_RATEVHT2SS_MCS2
= 0x38,
298 DESC_RATEVHT2SS_MCS3
= 0x39,
299 DESC_RATEVHT2SS_MCS4
= 0x3a,
300 DESC_RATEVHT2SS_MCS5
= 0x3b,
301 DESC_RATEVHT2SS_MCS6
= 0x3c,
302 DESC_RATEVHT2SS_MCS7
= 0x3d,
303 DESC_RATEVHT2SS_MCS8
= 0x3e,
304 DESC_RATEVHT2SS_MCS9
= 0x3f,
306 DESC_RATEVHT3SS_MCS0
= 0x40,
307 DESC_RATEVHT3SS_MCS1
= 0x41,
308 DESC_RATEVHT3SS_MCS2
= 0x42,
309 DESC_RATEVHT3SS_MCS3
= 0x43,
310 DESC_RATEVHT3SS_MCS4
= 0x44,
311 DESC_RATEVHT3SS_MCS5
= 0x45,
312 DESC_RATEVHT3SS_MCS6
= 0x46,
313 DESC_RATEVHT3SS_MCS7
= 0x47,
314 DESC_RATEVHT3SS_MCS8
= 0x48,
315 DESC_RATEVHT3SS_MCS9
= 0x49,
317 DESC_RATEVHT4SS_MCS0
= 0x4a,
318 DESC_RATEVHT4SS_MCS1
= 0x4b,
319 DESC_RATEVHT4SS_MCS2
= 0x4c,
320 DESC_RATEVHT4SS_MCS3
= 0x4d,
321 DESC_RATEVHT4SS_MCS4
= 0x4e,
322 DESC_RATEVHT4SS_MCS5
= 0x4f,
323 DESC_RATEVHT4SS_MCS6
= 0x50,
324 DESC_RATEVHT4SS_MCS7
= 0x51,
325 DESC_RATEVHT4SS_MCS8
= 0x52,
326 DESC_RATEVHT4SS_MCS9
= 0x53,
331 enum rtw_regulatory_domains
{
339 RTW_REGD_UKRAINE
= 7,
356 RTW_FLAG_INACTIVE_PS
,
358 RTW_FLAG_LEISURE_PS_DEEP
,
359 RTW_FLAG_DIG_DISABLE
,
360 RTW_FLAG_BUSY_TRAFFIC
,
394 RTW_WOW_FLAG_EN_MAGIC_PKT
,
395 RTW_WOW_FLAG_EN_REKEY_PKT
,
396 RTW_WOW_FLAG_EN_DISCONNECT
,
402 /* the power index is represented by differences, which cck-1s & ht40-1s are
403 * the base values, so for 1s's differences, there are only ht20 & ofdm
405 struct rtw_2g_1s_pwr_idx_diff
{
406 #ifdef __LITTLE_ENDIAN
415 struct rtw_2g_ns_pwr_idx_diff
{
416 #ifdef __LITTLE_ENDIAN
429 struct rtw_2g_txpwr_idx
{
432 struct rtw_2g_1s_pwr_idx_diff ht_1s_diff
;
433 struct rtw_2g_ns_pwr_idx_diff ht_2s_diff
;
434 struct rtw_2g_ns_pwr_idx_diff ht_3s_diff
;
435 struct rtw_2g_ns_pwr_idx_diff ht_4s_diff
;
438 struct rtw_5g_ht_1s_pwr_idx_diff
{
439 #ifdef __LITTLE_ENDIAN
448 struct rtw_5g_ht_ns_pwr_idx_diff
{
449 #ifdef __LITTLE_ENDIAN
458 struct rtw_5g_ofdm_ns_pwr_idx_diff
{
459 #ifdef __LITTLE_ENDIAN
472 struct rtw_5g_vht_ns_pwr_idx_diff
{
473 #ifdef __LITTLE_ENDIAN
482 struct rtw_5g_txpwr_idx
{
484 struct rtw_5g_ht_1s_pwr_idx_diff ht_1s_diff
;
485 struct rtw_5g_ht_ns_pwr_idx_diff ht_2s_diff
;
486 struct rtw_5g_ht_ns_pwr_idx_diff ht_3s_diff
;
487 struct rtw_5g_ht_ns_pwr_idx_diff ht_4s_diff
;
488 struct rtw_5g_ofdm_ns_pwr_idx_diff ofdm_diff
;
489 struct rtw_5g_vht_ns_pwr_idx_diff vht_1s_diff
;
490 struct rtw_5g_vht_ns_pwr_idx_diff vht_2s_diff
;
491 struct rtw_5g_vht_ns_pwr_idx_diff vht_3s_diff
;
492 struct rtw_5g_vht_ns_pwr_idx_diff vht_4s_diff
;
495 struct rtw_txpwr_idx
{
496 struct rtw_2g_txpwr_idx pwr_idx_2g
;
497 struct rtw_5g_txpwr_idx pwr_idx_5g
;
500 struct rtw_timer_list
{
501 struct timer_list timer
;
502 void (*function
)(void *data
);
506 struct rtw_channel_params
{
510 /* center channel by different available bandwidth,
511 * val of (bw > current bandwidth) is invalid
513 u8 cch_by_bw
[RTW_MAX_CHANNEL_WIDTH
+ 1];
521 struct rtw_ltecoex_addr
{
527 struct rtw_reg_domain
{
530 #define RTW_REG_DOMAIN_MAC32 0
531 #define RTW_REG_DOMAIN_MAC16 1
532 #define RTW_REG_DOMAIN_MAC8 2
533 #define RTW_REG_DOMAIN_RF_A 3
534 #define RTW_REG_DOMAIN_RF_B 4
535 #define RTW_REG_DOMAIN_NL 0xFF
539 struct rtw_rf_sipi_addr
{
546 struct rtw_backup_info
{
552 enum rtw_vif_port_set
{
553 PORT_SET_MAC_ADDR
= BIT(0),
554 PORT_SET_BSSID
= BIT(1),
555 PORT_SET_NET_TYPE
= BIT(2),
556 PORT_SET_AID
= BIT(3),
557 PORT_SET_BCN_CTRL
= BIT(4),
560 struct rtw_vif_port
{
561 struct rtw_hw_reg mac_addr
;
562 struct rtw_hw_reg bssid
;
563 struct rtw_hw_reg net_type
;
564 struct rtw_hw_reg aid
;
565 struct rtw_hw_reg bcn_ctrl
;
568 struct rtw_tx_pkt_info
{
585 bool dis_rate_fallback
;
600 struct rtw_rx_pkt_stat
{
617 s8 rx_power
[RTW_RF_PATH_MAX
];
620 s8 rx_snr
[RTW_RF_PATH_MAX
];
621 u8 rx_evm
[RTW_RF_PATH_MAX
];
622 s8 cfo_tail
[RTW_RF_PATH_MAX
];
624 struct rtw_sta_info
*si
;
625 struct ieee80211_vif
*vif
;
628 DECLARE_EWMA(tp
, 10, 2);
630 struct rtw_traffic_stats
{
635 /* count for packets */
642 struct ewma_tp tx_ewma_tp
;
643 struct ewma_tp rx_ewma_tp
;
652 enum rtw_lps_deep_mode
{
653 LPS_DEEP_MODE_NONE
= 0,
654 LPS_DEEP_MODE_LCLK
= 1,
655 LPS_DEEP_MODE_PG
= 2,
664 struct rtw_lps_conf
{
665 enum rtw_lps_mode mode
;
666 enum rtw_lps_deep_mode deep_mode
;
667 enum rtw_lps_deep_mode wow_deep_mode
;
668 enum rtw_pwr_state state
;
674 bool pattern_cam_backup
;
677 enum rtw_hw_key_type
{
685 struct rtw_cam_entry
{
690 struct ieee80211_key_conf
*key
;
693 struct rtw_sec_desc
{
694 /* search strategy */
695 bool default_key_search
;
698 struct rtw_cam_entry cam_table
[RTW_MAX_SEC_CAM_NUM
];
699 DECLARE_BITMAP(cam_map
, RTW_MAX_SEC_CAM_NUM
);
702 struct rtw_tx_report
{
703 /* protect the tx report queue */
705 struct sk_buff_head queue
;
707 struct timer_list purge_timer
;
710 struct rtw_ra_report
{
711 struct rate_info txrate
;
717 struct list_head list
;
720 unsigned long last_push
;
723 #define RTW_BC_MC_MACID 1
724 DECLARE_EWMA(rssi
, 10, 16);
726 struct rtw_sta_info
{
727 struct ieee80211_sta
*sta
;
728 struct ieee80211_vif
*vif
;
730 struct ewma_rssi avg_rssi
;
735 enum rtw_bandwidth bw_mode
;
736 enum rtw_rf_type rf_type
;
737 enum rtw_wireless_set wireless_set
;
746 DECLARE_BITMAP(tid_ba
, IEEE80211_NUM_TIDS
);
748 struct rtw_ra_report ra_report
;
751 struct cfg80211_bitrate_mask
*mask
;
761 enum rtw_bfee_role role
;
765 u8 mac_addr
[ETH_ALEN
];
778 DECLARE_BITMAP(bfer_su_reg_maping
, 2);
783 enum rtw_net_type net_type
;
785 u8 mac_addr
[ETH_ALEN
];
789 struct list_head rsvd_page_list
;
790 struct ieee80211_tx_queue_params tx_params
[IEEE80211_NUM_ACS
];
791 const struct rtw_vif_port
*conf
;
793 struct rtw_traffic_stats stats
;
795 struct rtw_bfee bfee
;
798 struct rtw_regulatory
{
804 struct rtw_chip_ops
{
805 int (*mac_init
)(struct rtw_dev
*rtwdev
);
806 void (*shutdown
)(struct rtw_dev
*rtwdev
);
807 int (*read_efuse
)(struct rtw_dev
*rtwdev
, u8
*map
);
808 void (*phy_set_param
)(struct rtw_dev
*rtwdev
);
809 void (*set_channel
)(struct rtw_dev
*rtwdev
, u8 channel
,
810 u8 bandwidth
, u8 primary_chan_idx
);
811 void (*query_rx_desc
)(struct rtw_dev
*rtwdev
, u8
*rx_desc
,
812 struct rtw_rx_pkt_stat
*pkt_stat
,
813 struct ieee80211_rx_status
*rx_status
);
814 u32 (*read_rf
)(struct rtw_dev
*rtwdev
, enum rtw_rf_path rf_path
,
816 bool (*write_rf
)(struct rtw_dev
*rtwdev
, enum rtw_rf_path rf_path
,
817 u32 addr
, u32 mask
, u32 data
);
818 void (*set_tx_power_index
)(struct rtw_dev
*rtwdev
);
819 int (*rsvd_page_dump
)(struct rtw_dev
*rtwdev
, u8
*buf
, u32 offset
,
821 int (*set_antenna
)(struct rtw_dev
*rtwdev
,
824 void (*cfg_ldo25
)(struct rtw_dev
*rtwdev
, bool enable
);
825 void (*efuse_grant
)(struct rtw_dev
*rtwdev
, bool enable
);
826 void (*false_alarm_statistics
)(struct rtw_dev
*rtwdev
);
827 void (*phy_calibration
)(struct rtw_dev
*rtwdev
);
828 void (*dpk_track
)(struct rtw_dev
*rtwdev
);
829 void (*cck_pd_set
)(struct rtw_dev
*rtwdev
, u8 level
);
830 void (*pwr_track
)(struct rtw_dev
*rtwdev
);
831 void (*config_bfee
)(struct rtw_dev
*rtwdev
, struct rtw_vif
*vif
,
832 struct rtw_bfee
*bfee
, bool enable
);
833 void (*set_gid_table
)(struct rtw_dev
*rtwdev
,
834 struct ieee80211_vif
*vif
,
835 struct ieee80211_bss_conf
*conf
);
836 void (*cfg_csi_rate
)(struct rtw_dev
*rtwdev
, u8 rssi
, u8 cur_rate
,
837 u8 fixrate_en
, u8
*new_rate
);
840 void (*coex_set_init
)(struct rtw_dev
*rtwdev
);
841 void (*coex_set_ant_switch
)(struct rtw_dev
*rtwdev
,
842 u8 ctrl_type
, u8 pos_type
);
843 void (*coex_set_gnt_fix
)(struct rtw_dev
*rtwdev
);
844 void (*coex_set_gnt_debug
)(struct rtw_dev
*rtwdev
);
845 void (*coex_set_rfe_type
)(struct rtw_dev
*rtwdev
);
846 void (*coex_set_wl_tx_power
)(struct rtw_dev
*rtwdev
, u8 wl_pwr
);
847 void (*coex_set_wl_rx_gain
)(struct rtw_dev
*rtwdev
, bool low_gain
);
850 #define RTW_PWR_POLLING_CNT 20000
852 #define RTW_PWR_CMD_READ 0x00
853 #define RTW_PWR_CMD_WRITE 0x01
854 #define RTW_PWR_CMD_POLLING 0x02
855 #define RTW_PWR_CMD_DELAY 0x03
856 #define RTW_PWR_CMD_END 0x04
858 /* define the base address of each block */
859 #define RTW_PWR_ADDR_MAC 0x00
860 #define RTW_PWR_ADDR_USB 0x01
861 #define RTW_PWR_ADDR_PCIE 0x02
862 #define RTW_PWR_ADDR_SDIO 0x03
864 #define RTW_PWR_INTF_SDIO_MSK BIT(0)
865 #define RTW_PWR_INTF_USB_MSK BIT(1)
866 #define RTW_PWR_INTF_PCI_MSK BIT(2)
867 #define RTW_PWR_INTF_ALL_MSK (BIT(0) | BIT(1) | BIT(2) | BIT(3))
869 #define RTW_PWR_CUT_TEST_MSK BIT(0)
870 #define RTW_PWR_CUT_A_MSK BIT(1)
871 #define RTW_PWR_CUT_B_MSK BIT(2)
872 #define RTW_PWR_CUT_C_MSK BIT(3)
873 #define RTW_PWR_CUT_D_MSK BIT(4)
874 #define RTW_PWR_CUT_E_MSK BIT(5)
875 #define RTW_PWR_CUT_F_MSK BIT(6)
876 #define RTW_PWR_CUT_G_MSK BIT(7)
877 #define RTW_PWR_CUT_ALL_MSK 0xFF
879 enum rtw_pwr_seq_cmd_delay_unit
{
884 struct rtw_pwr_seq_cmd
{
895 RTW_CHIP_VER_CUT_A
= 0x00,
896 RTW_CHIP_VER_CUT_B
= 0x01,
897 RTW_CHIP_VER_CUT_C
= 0x02,
898 RTW_CHIP_VER_CUT_D
= 0x03,
899 RTW_CHIP_VER_CUT_E
= 0x04,
900 RTW_CHIP_VER_CUT_F
= 0x05,
901 RTW_CHIP_VER_CUT_G
= 0x06,
904 #define RTW_INTF_PHY_PLATFORM_ALL 0
906 enum rtw_intf_phy_cut
{
907 RTW_INTF_PHY_CUT_A
= BIT(0),
908 RTW_INTF_PHY_CUT_B
= BIT(1),
909 RTW_INTF_PHY_CUT_C
= BIT(2),
910 RTW_INTF_PHY_CUT_D
= BIT(3),
911 RTW_INTF_PHY_CUT_E
= BIT(4),
912 RTW_INTF_PHY_CUT_F
= BIT(5),
913 RTW_INTF_PHY_CUT_G
= BIT(6),
914 RTW_INTF_PHY_CUT_ALL
= 0xFFFF,
922 RTW_IP_SEL_UNDEF
= 0xFFFF
932 RTW_PQ_MAP_NUM
= 0x6,
937 enum rtw_dma_mapping
{
938 RTW_DMA_MAPPING_EXTRA
= 0,
939 RTW_DMA_MAPPING_LOW
= 1,
940 RTW_DMA_MAPPING_NORMAL
= 2,
941 RTW_DMA_MAPPING_HIGH
= 3,
944 RTW_DMA_MAPPING_UNDEF
,
948 enum rtw_dma_mapping dma_map_vo
;
949 enum rtw_dma_mapping dma_map_vi
;
950 enum rtw_dma_mapping dma_map_be
;
951 enum rtw_dma_mapping dma_map_bk
;
952 enum rtw_dma_mapping dma_map_mg
;
953 enum rtw_dma_mapping dma_map_hi
;
956 struct rtw_prioq_addr
{
961 struct rtw_prioq_addrs
{
962 struct rtw_prioq_addr prio
[RTW_DMA_MAPPING_MAX
];
966 struct rtw_page_table
{
974 struct rtw_intf_phy_para
{
982 struct rtw_wow_pattern
{
986 u8 mask
[RTW_MAX_PATTERN_MASK_SIZE
];
989 struct rtw_pno_request
{
992 struct cfg80211_match_set
*match_sets
;
994 struct ieee80211_channel
*channels
;
995 struct cfg80211_sched_scan_plan scan_plan
;
998 struct rtw_wow_param
{
999 struct ieee80211_vif
*wow_vif
;
1000 DECLARE_BITMAP(flags
, RTW_WOW_FLAG_MAX
);
1003 struct rtw_wow_pattern patterns
[RTW_MAX_PATTERN_NUM
];
1006 struct rtw_pno_request pno_req
;
1009 struct rtw_intf_phy_para_table
{
1010 const struct rtw_intf_phy_para
*usb2_para
;
1011 const struct rtw_intf_phy_para
*usb3_para
;
1012 const struct rtw_intf_phy_para
*gen1_para
;
1013 const struct rtw_intf_phy_para
*gen2_para
;
1023 void (*parse
)(struct rtw_dev
*rtwdev
, const struct rtw_table
*tbl
);
1024 void (*do_cfg
)(struct rtw_dev
*rtwdev
, const struct rtw_table
*tbl
,
1025 u32 addr
, u32 data
);
1026 enum rtw_rf_path rf_path
;
1029 static inline void rtw_load_table(struct rtw_dev
*rtwdev
,
1030 const struct rtw_table
*tbl
)
1032 (*tbl
->parse
)(rtwdev
, tbl
);
1038 RTW_RFE_IFEM2G_EFEM5G
,
1042 struct rtw_rfe_def
{
1043 const struct rtw_table
*phy_pg_tbl
;
1044 const struct rtw_table
*txpwr_lmt_tbl
;
1047 #define RTW_DEF_RFE(chip, bb_pg, pwrlmt) { \
1048 .phy_pg_tbl = &rtw ## chip ## _bb_pg_type ## bb_pg ## _tbl, \
1049 .txpwr_lmt_tbl = &rtw ## chip ## _txpwr_lmt_type ## pwrlmt ## _tbl, \
1052 #define RTW_PWR_TRK_5G_1 0
1053 #define RTW_PWR_TRK_5G_2 1
1054 #define RTW_PWR_TRK_5G_3 2
1055 #define RTW_PWR_TRK_5G_NUM 3
1057 #define RTW_PWR_TRK_TBL_SZ 30
1059 /* This table stores the values of TX power that will be adjusted by power
1062 * For 5G bands, there are 3 different settings.
1063 * For 2G there are cck rate and ofdm rate with different settings.
1065 struct rtw_pwr_track_tbl
{
1066 const u8
*pwrtrk_5gb_n
[RTW_PWR_TRK_5G_NUM
];
1067 const u8
*pwrtrk_5gb_p
[RTW_PWR_TRK_5G_NUM
];
1068 const u8
*pwrtrk_5ga_n
[RTW_PWR_TRK_5G_NUM
];
1069 const u8
*pwrtrk_5ga_p
[RTW_PWR_TRK_5G_NUM
];
1070 const u8
*pwrtrk_2gb_n
;
1071 const u8
*pwrtrk_2gb_p
;
1072 const u8
*pwrtrk_2ga_n
;
1073 const u8
*pwrtrk_2ga_p
;
1074 const u8
*pwrtrk_2g_cckb_n
;
1075 const u8
*pwrtrk_2g_cckb_p
;
1076 const u8
*pwrtrk_2g_ccka_n
;
1077 const u8
*pwrtrk_2g_ccka_p
;
1078 const s8
*pwrtrk_xtal_n
;
1079 const s8
*pwrtrk_xtal_p
;
1087 enum rtw_fw_fifo_sel
{
1090 RTW_FW_FIFO_SEL_RSVD_PAGE
,
1091 RTW_FW_FIFO_SEL_REPORT
,
1092 RTW_FW_FIFO_SEL_LLT
,
1093 RTW_FW_FIFO_SEL_RXBUF_FW
,
1098 /* hardware configuration for each IC */
1099 struct rtw_chip_info
{
1100 struct rtw_chip_ops
*ops
;
1103 const char *fw_name
;
1104 enum rtw_wlan_cpu wlan_cpu
;
1111 u32 ptct_efuse_size
;
1121 bool is_pwr_by_rate_dec
;
1125 u16 fw_fifo_addr
[RTW_FW_FIFO_MAX
];
1129 u8 lps_deep_mode_supported
;
1133 const struct rtw_pwr_seq_cmd
**pwr_on_seq
;
1134 const struct rtw_pwr_seq_cmd
**pwr_off_seq
;
1135 const struct rtw_rqpn
*rqpn_table
;
1136 const struct rtw_prioq_addrs
*prioq_addrs
;
1137 const struct rtw_page_table
*page_table
;
1138 const struct rtw_intf_phy_para_table
*intf_table
;
1140 const struct rtw_hw_reg
*dig
;
1141 const struct rtw_hw_reg
*dig_cck
;
1142 u32 rf_base_addr
[2];
1143 u32 rf_sipi_addr
[2];
1144 const struct rtw_rf_sipi_addr
*rf_sipi_read_addr
;
1146 const struct rtw_ltecoex_addr
*ltecoex_addr
;
1148 const struct rtw_table
*mac_tbl
;
1149 const struct rtw_table
*agc_tbl
;
1150 const struct rtw_table
*bb_tbl
;
1151 const struct rtw_table
*rf_tbl
[RTW_RF_PATH_MAX
];
1152 const struct rtw_table
*rfk_init_tbl
;
1154 const struct rtw_rfe_def
*rfe_defs
;
1160 const struct rtw_pwr_track_tbl
*pwr_track_tbl
;
1165 const char *wow_fw_name
;
1166 const struct wiphy_wowlan_support
*wowlan_stub
;
1167 const u8 max_sched_scan_ssids
;
1169 /* for 8821c set channel */
1176 bool new_scbd10_def
; /* true: fix 2M(8822c) */
1177 bool ble_hid_profile_support
;
1178 u8 pstdma_type
; /* 0: LPSoff, 1:LPSon */
1186 u8 bt_afh_span_bw20
;
1187 u8 bt_afh_span_bw40
;
1190 u8 coex_info_hw_regs_num
;
1191 const u8
*bt_rssi_step
;
1192 const u8
*wl_rssi_step
;
1193 const struct coex_table_para
*table_nsant
;
1194 const struct coex_table_para
*table_sant
;
1195 const struct coex_tdma_para
*tdma_sant
;
1196 const struct coex_tdma_para
*tdma_nsant
;
1197 const struct coex_rf_para
*wl_rf_para_tx
;
1198 const struct coex_rf_para
*wl_rf_para_rx
;
1199 const struct coex_5g_afh_map
*afh_5g
;
1200 const struct rtw_hw_reg
*btg_reg
;
1201 const struct rtw_reg_domain
*coex_info_hw_regs
;
1202 u32 wl_fw_desired_ver
;
1205 enum rtw_coex_bt_state_cnt
{
1208 COEX_CNT_BT_REENABLE
,
1209 COEX_CNT_BT_POPEVENT
,
1210 COEX_CNT_BT_SETUPLINK
,
1211 COEX_CNT_BT_IGNWLANACT
,
1214 COEX_CNT_BT_ROLESWITCH
,
1215 COEX_CNT_BT_AFHUPDATE
,
1216 COEX_CNT_BT_INFOUPDATE
,
1218 COEX_CNT_BT_IQKFAIL
,
1223 enum rtw_coex_wl_state_cnt
{
1225 COEX_CNT_WL_CONNPKT
,
1226 COEX_CNT_WL_COEXRUN
,
1230 COEX_CNT_WL_5MS_NOEXTEND
,
1231 COEX_CNT_WL_FW_NOTIFY
,
1236 struct rtw_coex_rfe
{
1237 bool ant_switch_exist
;
1238 bool ant_switch_diversity
;
1239 bool ant_switch_with_bt
;
1241 u8 ant_switch_polarity
;
1243 /* true if WLG at BTG, else at WLAG */
1247 #define COEX_WL_TDMA_PARA_LENGTH 5
1249 struct rtw_coex_dm
{
1250 bool cur_ps_tdma_on
;
1251 bool cur_wl_rx_low_gain_en
;
1255 u8 bt_rssi_state
[4];
1256 u8 wl_rssi_state
[4];
1265 u32 cur_ant_pos_type
;
1266 u32 cur_switch_status
;
1268 u8 fw_tdma_para
[COEX_WL_TDMA_PARA_LENGTH
];
1271 #define COEX_BTINFO_SRC_WL_FW 0x0
1272 #define COEX_BTINFO_SRC_BT_RSP 0x1
1273 #define COEX_BTINFO_SRC_BT_ACT 0x2
1274 #define COEX_BTINFO_SRC_BT_IQK 0x3
1275 #define COEX_BTINFO_SRC_BT_SCBD 0x4
1276 #define COEX_BTINFO_SRC_H2C60 0x5
1277 #define COEX_BTINFO_SRC_MAX 0x6
1279 #define COEX_INFO_FTP BIT(7)
1280 #define COEX_INFO_A2DP BIT(6)
1281 #define COEX_INFO_HID BIT(5)
1282 #define COEX_INFO_SCO_BUSY BIT(4)
1283 #define COEX_INFO_ACL_BUSY BIT(3)
1284 #define COEX_INFO_INQ_PAGE BIT(2)
1285 #define COEX_INFO_SCO_ESCO BIT(1)
1286 #define COEX_INFO_CONNECTION BIT(0)
1287 #define COEX_BTINFO_LENGTH_MAX 10
1288 #define COEX_BTINFO_LENGTH 7
1290 struct rtw_coex_stat
{
1292 bool bt_disabled_pre
;
1304 bool bt_pan_exist
; /* PAN or OPP */
1305 bool bt_opp_exist
; /* OPP only */
1310 bool bt_multi_link_pre
;
1311 bool bt_multi_link_remain
;
1313 bool bt_a2dp_active
;
1315 bool bt_ble_scan_en
;
1318 bool bt_418_hid_exist
;
1319 bool bt_ble_hid_exist
;
1320 bool bt_mailbox_reply
;
1324 bool wl_hi_pri_task1
;
1325 bool wl_hi_pri_task2
;
1326 bool wl_force_lps_ctrl
;
1328 bool wl_linkscan_proc
;
1329 bool wl_ps_state_fail
;
1330 bool wl_tx_limit_en
;
1331 bool wl_ampdu_limit_en
;
1333 bool wl_slot_extend
;
1335 bool wl_cck_lock_pre
;
1336 bool wl_cck_lock_ever
;
1338 bool wl_slot_toggle
;
1339 bool wl_slot_toggle_change
; /* if toggle to no-toggle */
1341 u32 bt_supported_version
;
1342 u32 bt_supported_feature
;
1348 u16 bt_reg_vendor_ae
;
1349 u16 bt_reg_vendor_ac
;
1352 u8 gnt_workaround_state
;
1355 u8 bt_info_c2h
[COEX_BTINFO_SRC_MAX
][COEX_BTINFO_LENGTH_MAX
];
1362 u8 bt_ble_scan_type
;
1368 u16 wl_beacon_interval
;
1370 u8 wl_fw_dbg_info
[10];
1371 u8 wl_fw_dbg_info_pre
[10];
1380 u8 wl_toggle_para
[6];
1381 u8 wl_toggle_interval
;
1386 /* counters to record bt states */
1387 u32 cnt_bt
[COEX_CNT_BT_MAX
];
1389 /* counters to record wifi states */
1390 u32 cnt_wl
[COEX_CNT_WL_MAX
];
1392 /* counters to record bt c2h data */
1393 u32 cnt_bt_info_c2h
[COEX_BTINFO_SRC_MAX
];
1400 /* protects coex info request section */
1402 struct sk_buff_head queue
;
1403 wait_queue_head_t wait
;
1410 bool manual_control
;
1412 struct rtw_coex_stat stat
;
1413 struct rtw_coex_dm dm
;
1414 struct rtw_coex_rfe rfe
;
1416 struct delayed_work bt_relink_work
;
1417 struct delayed_work bt_reenable_work
;
1418 struct delayed_work defreeze_work
;
1419 struct delayed_work wl_remain_work
;
1420 struct delayed_work bt_remain_work
;
1421 struct delayed_work wl_connecting_work
;
1422 struct delayed_work bt_multi_link_remain_work
;
1423 struct delayed_work wl_ccklock_work
;
1427 #define DPK_RF_REG_NUM 7
1428 #define DPK_RF_PATH_NUM 2
1429 #define DPK_BB_REG_NUM 18
1430 #define DPK_CHANNEL_WIDTH_80 1
1432 DECLARE_EWMA(thermal
, 10, 4);
1434 struct rtw_dpk_info
{
1438 DECLARE_BITMAP(dpk_path_ok
, DPK_RF_PATH_NUM
);
1440 u8 thermal_dpk
[DPK_RF_PATH_NUM
];
1441 struct ewma_thermal avg_thermal
[DPK_RF_PATH_NUM
];
1446 u8 result
[RTW_RF_PATH_MAX
];
1447 u8 dpk_txagc
[RTW_RF_PATH_MAX
];
1448 u32 coef
[RTW_RF_PATH_MAX
][20];
1449 u16 dpk_gs
[RTW_RF_PATH_MAX
];
1450 u8 thermal_dpk_delta
[RTW_RF_PATH_MAX
];
1451 u8 pre_pwsf
[RTW_RF_PATH_MAX
];
1458 struct rtw_phy_cck_pd_reg
{
1465 #define DACK_MSBK_BACKUP_NUM 0xf
1466 #define DACK_DCK_BACKUP_NUM 0x2
1468 struct rtw_swing_table
{
1469 const u8
*p
[RTW_RF_PATH_MAX
];
1470 const u8
*n
[RTW_RF_PATH_MAX
];
1473 struct rtw_pkt_count
{
1475 u16 num_qry_pkt
[DESC_RATE_MAX
];
1478 DECLARE_EWMA(evm
, 10, 4);
1479 DECLARE_EWMA(snr
, 10, 4);
1481 struct rtw_iqk_info
{
1491 struct rtw_dm_info
{
1521 u8 thermal_avg
[RTW_RF_PATH_MAX
];
1523 s8 delta_power_index
[RTW_RF_PATH_MAX
];
1524 s8 delta_power_index_last
[RTW_RF_PATH_MAX
];
1525 u8 default_ofdm_index
;
1526 bool pwr_trk_triggered
;
1527 bool pwr_trk_init_trigger
;
1528 struct ewma_thermal avg_thermal
[RTW_RF_PATH_MAX
];
1529 s8 txagc_remnant_cck
;
1530 s8 txagc_remnant_ofdm
;
1532 /* backup dack results for each path and I/Q */
1533 u32 dack_adck
[RTW_RF_PATH_MAX
];
1534 u16 dack_msbk
[RTW_RF_PATH_MAX
][2][DACK_MSBK_BACKUP_NUM
];
1535 u8 dack_dck
[RTW_RF_PATH_MAX
][2][DACK_DCK_BACKUP_NUM
];
1537 struct rtw_dpk_info dpk_info
;
1539 /* [bandwidth 0:20M/1:40M][number of path] */
1540 u8 cck_pd_lv
[2][RTW_RF_PATH_MAX
];
1544 /* save the last rx phy status for debug */
1545 s8 rx_snr
[RTW_RF_PATH_MAX
];
1546 u8 rx_evm_dbm
[RTW_RF_PATH_MAX
];
1547 s16 cfo_tail
[RTW_RF_PATH_MAX
];
1548 u8 rssi
[RTW_RF_PATH_MAX
];
1550 struct rtw_pkt_count cur_pkt_count
;
1551 struct rtw_pkt_count last_pkt_count
;
1552 struct ewma_evm ewma_evm
[RTW_EVM_NUM
];
1553 struct ewma_snr ewma_snr
[RTW_SNR_NUM
];
1555 struct rtw_iqk_info iqk
;
1569 u8 power_track_type
;
1570 u8 thermal_meter
[RTW_RF_PATH_MAX
];
1590 u8 tx_bb_swing_setting_2g
;
1591 u8 tx_bb_swing_setting_5g
;
1594 /* bt share antenna with wifi */
1606 struct rtw_txpwr_idx txpwr_idx_table
[4];
1609 struct rtw_phy_cond
{
1610 #ifdef __LITTLE_ENDIAN
1632 #define INTF_PCIE BIT(0)
1633 #define INTF_USB BIT(1)
1634 #define INTF_SDIO BIT(2)
1637 #define BRANCH_ELIF 1
1638 #define BRANCH_ELSE 2
1639 #define BRANCH_ENDIF 3
1642 struct rtw_fifo_conf
{
1643 /* tx fifo information */
1646 u16 rsvd_drv_pg_num
;
1650 u16 rsvd_h2c_info_addr
;
1651 u16 rsvd_h2c_sta_info_addr
;
1653 u16 rsvd_cpu_instr_addr
;
1654 u16 rsvd_fw_txbuf_addr
;
1655 u16 rsvd_csibuf_addr
;
1656 const struct rtw_rqpn
*rqpn
;
1659 #define FW_CD_TYPE 0xffff
1661 #define FW_CD_VAL 0xaabbccdd
1662 struct rtw_fw_state
{
1663 const struct firmware
*firmware
;
1664 struct rtw_dev
*rtwdev
;
1665 struct completion completion
;
1681 struct rtw_phy_cond phy_cond
;
1685 u8 current_band_width
;
1686 u8 current_band_type
;
1688 /* center channel for different available bandwidth,
1689 * val of (bw > current_band_width) is invalid
1691 u8 cch_by_bw
[RTW_MAX_CHANNEL_WIDTH
+ 1];
1701 /* protect tx power section */
1702 struct mutex tx_power_mutex
;
1703 s8 tx_pwr_by_rate_offset_2g
[RTW_RF_PATH_MAX
]
1705 s8 tx_pwr_by_rate_offset_5g
[RTW_RF_PATH_MAX
]
1707 s8 tx_pwr_by_rate_base_2g
[RTW_RF_PATH_MAX
]
1708 [RTW_RATE_SECTION_MAX
];
1709 s8 tx_pwr_by_rate_base_5g
[RTW_RF_PATH_MAX
]
1710 [RTW_RATE_SECTION_MAX
];
1711 s8 tx_pwr_limit_2g
[RTW_REGD_MAX
]
1712 [RTW_CHANNEL_WIDTH_MAX
]
1713 [RTW_RATE_SECTION_MAX
]
1714 [RTW_MAX_CHANNEL_NUM_2G
];
1715 s8 tx_pwr_limit_5g
[RTW_REGD_MAX
]
1716 [RTW_CHANNEL_WIDTH_MAX
]
1717 [RTW_RATE_SECTION_MAX
]
1718 [RTW_MAX_CHANNEL_NUM_5G
];
1719 s8 tx_pwr_tbl
[RTW_RF_PATH_MAX
]
1724 struct ieee80211_hw
*hw
;
1729 struct rtw_chip_info
*chip
;
1731 struct rtw_fifo_conf fifo
;
1732 struct rtw_fw_state fw
;
1733 struct rtw_efuse efuse
;
1734 struct rtw_sec_desc sec
;
1735 struct rtw_traffic_stats stats
;
1736 struct rtw_regulatory regd
;
1737 struct rtw_bf_info bf_info
;
1739 struct rtw_dm_info dm_info
;
1740 struct rtw_coex coex
;
1742 /* ensures exclusive access from mac80211 callbacks */
1745 /* read/write rf register */
1748 /* watch dog every 2 sec */
1749 struct delayed_work watch_dog_work
;
1752 struct list_head rsvd_page_list
;
1754 /* c2h cmd queue & handler work */
1755 struct sk_buff_head c2h_queue
;
1756 struct work_struct c2h_work
;
1757 struct work_struct fw_recovery_work
;
1759 /* used to protect txqs list */
1760 spinlock_t txq_lock
;
1761 struct list_head txqs
;
1762 struct tasklet_struct tx_tasklet
;
1763 struct work_struct ba_work
;
1765 struct rtw_tx_report tx_report
;
1768 /* incicate the mail box to use with fw */
1770 /* protect to send h2c to fw */
1775 /* lps power state & handler work */
1776 struct rtw_lps_conf lps_conf
;
1778 struct completion lps_leave_check
;
1780 struct dentry
*debugfs
;
1785 DECLARE_BITMAP(mac_id_map
, RTW_MAX_MAC_ID_NUM
);
1786 DECLARE_BITMAP(flags
, NUM_OF_RTW_FLAGS
);
1790 struct rtw_fw_state wow_fw
;
1791 struct rtw_wow_param wow
;
1795 /* hci related data, must be last */
1796 u8 priv
[] __aligned(sizeof(void *));
1801 static inline bool rtw_is_assoc(struct rtw_dev
*rtwdev
)
1803 return !!rtwdev
->sta_cnt
;
1806 static inline struct ieee80211_txq
*rtwtxq_to_txq(struct rtw_txq
*rtwtxq
)
1810 return container_of(p
, struct ieee80211_txq
, drv_priv
);
1813 static inline struct ieee80211_vif
*rtwvif_to_vif(struct rtw_vif
*rtwvif
)
1817 return container_of(p
, struct ieee80211_vif
, drv_priv
);
1820 static inline bool rtw_ssid_equal(struct cfg80211_ssid
*a
,
1821 struct cfg80211_ssid
*b
)
1823 if (!a
|| !b
|| a
->ssid_len
!= b
->ssid_len
)
1826 if (memcmp(a
->ssid
, b
->ssid
, a
->ssid_len
))
1832 static inline void rtw_chip_efuse_grant_on(struct rtw_dev
*rtwdev
)
1834 if (rtwdev
->chip
->ops
->efuse_grant
)
1835 rtwdev
->chip
->ops
->efuse_grant(rtwdev
, true);
1838 static inline void rtw_chip_efuse_grant_off(struct rtw_dev
*rtwdev
)
1840 if (rtwdev
->chip
->ops
->efuse_grant
)
1841 rtwdev
->chip
->ops
->efuse_grant(rtwdev
, false);
1844 static inline bool rtw_chip_wcpu_11n(struct rtw_dev
*rtwdev
)
1846 return rtwdev
->chip
->wlan_cpu
== RTW_WCPU_11N
;
1849 static inline bool rtw_chip_wcpu_11ac(struct rtw_dev
*rtwdev
)
1851 return rtwdev
->chip
->wlan_cpu
== RTW_WCPU_11AC
;
1854 static inline bool rtw_chip_has_rx_ldpc(struct rtw_dev
*rtwdev
)
1856 return rtwdev
->chip
->rx_ldpc
;
1859 static inline void rtw_release_macid(struct rtw_dev
*rtwdev
, u8 mac_id
)
1861 clear_bit(mac_id
, rtwdev
->mac_id_map
);
1864 void rtw_get_channel_params(struct cfg80211_chan_def
*chandef
,
1865 struct rtw_channel_params
*ch_param
);
1866 bool check_hw_ready(struct rtw_dev
*rtwdev
, u32 addr
, u32 mask
, u32 target
);
1867 bool ltecoex_read_reg(struct rtw_dev
*rtwdev
, u16 offset
, u32
*val
);
1868 bool ltecoex_reg_write(struct rtw_dev
*rtwdev
, u16 offset
, u32 value
);
1869 void rtw_restore_reg(struct rtw_dev
*rtwdev
,
1870 struct rtw_backup_info
*bckp
, u32 num
);
1871 void rtw_desc_to_mcsrate(u16 rate
, u8
*mcs
, u8
*nss
);
1872 void rtw_set_channel(struct rtw_dev
*rtwdev
);
1873 void rtw_chip_prepare_tx(struct rtw_dev
*rtwdev
);
1874 void rtw_vif_port_config(struct rtw_dev
*rtwdev
, struct rtw_vif
*rtwvif
,
1876 void rtw_tx_report_purge_timer(struct timer_list
*t
);
1877 void rtw_update_sta_info(struct rtw_dev
*rtwdev
, struct rtw_sta_info
*si
);
1878 int rtw_core_start(struct rtw_dev
*rtwdev
);
1879 void rtw_core_stop(struct rtw_dev
*rtwdev
);
1880 int rtw_chip_info_setup(struct rtw_dev
*rtwdev
);
1881 int rtw_core_init(struct rtw_dev
*rtwdev
);
1882 void rtw_core_deinit(struct rtw_dev
*rtwdev
);
1883 int rtw_register_hw(struct rtw_dev
*rtwdev
, struct ieee80211_hw
*hw
);
1884 void rtw_unregister_hw(struct rtw_dev
*rtwdev
, struct ieee80211_hw
*hw
);
1885 u16
rtw_desc_to_bitrate(u8 desc_rate
);
1886 void rtw_vif_assoc_changed(struct rtw_vif
*rtwvif
,
1887 struct ieee80211_bss_conf
*conf
);
1888 int rtw_sta_add(struct rtw_dev
*rtwdev
, struct ieee80211_sta
*sta
,
1889 struct ieee80211_vif
*vif
);
1890 void rtw_sta_remove(struct rtw_dev
*rtwdev
, struct ieee80211_sta
*sta
,
1892 void rtw_fw_recovery(struct rtw_dev
*rtwdev
);