xref: /linux/drivers/net/wireless/realtek/rtw89/rtw8852bt.c (revision cc32e9fb380d8afdbf3486d7063d5520bfb0f071)
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /* Copyright(c) 2024 Realtek Corporation
3  */
4 
5 #include "coex.h"
6 #include "fw.h"
7 #include "mac.h"
8 #include "phy.h"
9 #include "reg.h"
10 #include "rtw8852bt.h"
11 #include "rtw8852bt_rfk.h"
12 #include "rtw8852b_common.h"
13 
14 #define RTW8852BT_FW_FORMAT_MAX 0
15 #define RTW8852BT_FW_BASENAME "rtw89/rtw8852bt_fw"
16 #define RTW8852BT_MODULE_FIRMWARE \
17 	RTW8852BT_FW_BASENAME ".bin"
18 
19 static const struct rtw89_hfc_ch_cfg rtw8852bt_hfc_chcfg_pcie[] = {
20 	{16, 742, grp_0}, /* ACH 0 */
21 	{16, 742, grp_0}, /* ACH 1 */
22 	{16, 742, grp_0}, /* ACH 2 */
23 	{16, 742, grp_0}, /* ACH 3 */
24 	{0, 0, grp_0}, /* ACH 4 */
25 	{0, 0, grp_0}, /* ACH 5 */
26 	{0, 0, grp_0}, /* ACH 6 */
27 	{0, 0, grp_0}, /* ACH 7 */
28 	{15, 743, grp_0}, /* B0MGQ */
29 	{15, 743, grp_0}, /* B0HIQ */
30 	{0, 0, grp_0}, /* B1MGQ */
31 	{0, 0, grp_0}, /* B1HIQ */
32 	{40, 0, 0} /* FWCMDQ */
33 };
34 
35 static const struct rtw89_hfc_pub_cfg rtw8852bt_hfc_pubcfg_pcie = {
36 	958, /* Group 0 */
37 	0, /* Group 1 */
38 	958, /* Public Max */
39 	0 /* WP threshold */
40 };
41 
42 static const struct rtw89_hfc_param_ini rtw8852bt_hfc_param_ini_pcie[] = {
43 	[RTW89_QTA_SCC] = {rtw8852bt_hfc_chcfg_pcie, &rtw8852bt_hfc_pubcfg_pcie,
44 			   &rtw89_mac_size.hfc_preccfg_pcie, RTW89_HCIFC_POH},
45 	[RTW89_QTA_DLFW] = {NULL, NULL, &rtw89_mac_size.hfc_preccfg_pcie,
46 			    RTW89_HCIFC_POH},
47 	[RTW89_QTA_INVALID] = {NULL},
48 };
49 
50 static const struct rtw89_dle_mem rtw8852bt_dle_mem_pcie[] = {
51 	[RTW89_QTA_SCC] = {RTW89_QTA_SCC, &rtw89_mac_size.wde_size23,
52 			   &rtw89_mac_size.ple_size9, &rtw89_mac_size.wde_qt23,
53 			   &rtw89_mac_size.wde_qt23, &rtw89_mac_size.ple_qt57,
54 			   &rtw89_mac_size.ple_qt59},
55 	[RTW89_QTA_WOW] = {RTW89_QTA_WOW, &rtw89_mac_size.wde_size23,
56 			   &rtw89_mac_size.ple_size9, &rtw89_mac_size.wde_qt23,
57 			   &rtw89_mac_size.wde_qt23, &rtw89_mac_size.ple_qt57,
58 			   &rtw89_mac_size.ple_qt_52bt_wow},
59 	[RTW89_QTA_DLFW] = {RTW89_QTA_DLFW, &rtw89_mac_size.wde_size4,
60 			    &rtw89_mac_size.ple_size4, &rtw89_mac_size.wde_qt4,
61 			    &rtw89_mac_size.wde_qt4, &rtw89_mac_size.ple_qt13,
62 			    &rtw89_mac_size.ple_qt13},
63 	[RTW89_QTA_INVALID] = {RTW89_QTA_INVALID, NULL, NULL, NULL, NULL, NULL,
64 			       NULL},
65 };
66 
67 static const u32 rtw8852bt_h2c_regs[RTW89_H2CREG_MAX] = {
68 	R_AX_H2CREG_DATA0, R_AX_H2CREG_DATA1,  R_AX_H2CREG_DATA2,
69 	R_AX_H2CREG_DATA3
70 };
71 
72 static const u32 rtw8852bt_c2h_regs[RTW89_C2HREG_MAX] = {
73 	R_AX_C2HREG_DATA0, R_AX_C2HREG_DATA1, R_AX_C2HREG_DATA2,
74 	R_AX_C2HREG_DATA3
75 };
76 
77 static const u32 rtw8852bt_wow_wakeup_regs[RTW89_WOW_REASON_NUM] = {
78 	R_AX_C2HREG_DATA3 + 3, R_AX_C2HREG_DATA3 + 3,
79 };
80 
81 static const struct rtw89_page_regs rtw8852bt_page_regs = {
82 	.hci_fc_ctrl	= R_AX_HCI_FC_CTRL,
83 	.ch_page_ctrl	= R_AX_CH_PAGE_CTRL,
84 	.ach_page_ctrl	= R_AX_ACH0_PAGE_CTRL,
85 	.ach_page_info	= R_AX_ACH0_PAGE_INFO,
86 	.pub_page_info3	= R_AX_PUB_PAGE_INFO3,
87 	.pub_page_ctrl1	= R_AX_PUB_PAGE_CTRL1,
88 	.pub_page_ctrl2	= R_AX_PUB_PAGE_CTRL2,
89 	.pub_page_info1	= R_AX_PUB_PAGE_INFO1,
90 	.pub_page_info2 = R_AX_PUB_PAGE_INFO2,
91 	.wp_page_ctrl1	= R_AX_WP_PAGE_CTRL1,
92 	.wp_page_ctrl2	= R_AX_WP_PAGE_CTRL2,
93 	.wp_page_info1	= R_AX_WP_PAGE_INFO1,
94 };
95 
96 static const struct rtw89_reg_def rtw8852bt_dcfo_comp = {
97 	R_DCFO_COMP_S0, B_DCFO_COMP_S0_MSK
98 };
99 
100 static const struct rtw89_imr_info rtw8852bt_imr_info = {
101 	.wdrls_imr_set		= B_AX_WDRLS_IMR_SET,
102 	.wsec_imr_reg		= R_AX_SEC_DEBUG,
103 	.wsec_imr_set		= B_AX_IMR_ERROR,
104 	.mpdu_tx_imr_set	= 0,
105 	.mpdu_rx_imr_set	= 0,
106 	.sta_sch_imr_set	= B_AX_STA_SCHEDULER_IMR_SET,
107 	.txpktctl_imr_b0_reg	= R_AX_TXPKTCTL_ERR_IMR_ISR,
108 	.txpktctl_imr_b0_clr	= B_AX_TXPKTCTL_IMR_B0_CLR,
109 	.txpktctl_imr_b0_set	= B_AX_TXPKTCTL_IMR_B0_SET,
110 	.txpktctl_imr_b1_reg	= R_AX_TXPKTCTL_ERR_IMR_ISR_B1,
111 	.txpktctl_imr_b1_clr	= B_AX_TXPKTCTL_IMR_B1_CLR,
112 	.txpktctl_imr_b1_set	= B_AX_TXPKTCTL_IMR_B1_SET,
113 	.wde_imr_clr		= B_AX_WDE_IMR_CLR_V01,
114 	.wde_imr_set		= B_AX_WDE_IMR_SET_V01,
115 	.ple_imr_clr		= B_AX_PLE_IMR_CLR,
116 	.ple_imr_set		= B_AX_PLE_IMR_SET,
117 	.host_disp_imr_clr	= B_AX_HOST_DISP_IMR_CLR,
118 	.host_disp_imr_set	= B_AX_HOST_DISP_IMR_SET_V01,
119 	.cpu_disp_imr_clr	= B_AX_CPU_DISP_IMR_CLR,
120 	.cpu_disp_imr_set	= B_AX_CPU_DISP_IMR_SET,
121 	.other_disp_imr_clr	= B_AX_OTHER_DISP_IMR_CLR,
122 	.other_disp_imr_set	= 0,
123 	.bbrpt_com_err_imr_reg	= R_AX_BBRPT_COM_ERR_IMR_ISR,
124 	.bbrpt_chinfo_err_imr_reg = R_AX_BBRPT_CHINFO_ERR_IMR_ISR,
125 	.bbrpt_err_imr_set	= 0,
126 	.bbrpt_dfs_err_imr_reg	= R_AX_BBRPT_DFS_ERR_IMR_ISR,
127 	.ptcl_imr_clr		= B_AX_PTCL_IMR_CLR_ALL,
128 	.ptcl_imr_set		= B_AX_PTCL_IMR_SET,
129 	.cdma_imr_0_reg		= R_AX_DLE_CTRL,
130 	.cdma_imr_0_clr		= B_AX_DLE_IMR_CLR,
131 	.cdma_imr_0_set		= B_AX_DLE_IMR_SET,
132 	.cdma_imr_1_reg		= 0,
133 	.cdma_imr_1_clr		= 0,
134 	.cdma_imr_1_set		= 0,
135 	.phy_intf_imr_reg	= R_AX_PHYINFO_ERR_IMR,
136 	.phy_intf_imr_clr	= B_AX_PHYINFO_IMR_EN_ALL,
137 	.phy_intf_imr_set	= B_AX_PHYINFO_IMR_SET,
138 	.rmac_imr_reg		= R_AX_RMAC_ERR_ISR,
139 	.rmac_imr_clr		= B_AX_RMAC_IMR_CLR,
140 	.rmac_imr_set		= B_AX_RMAC_IMR_SET,
141 	.tmac_imr_reg		= R_AX_TMAC_ERR_IMR_ISR,
142 	.tmac_imr_clr		= B_AX_TMAC_IMR_CLR,
143 	.tmac_imr_set		= B_AX_TMAC_IMR_SET,
144 };
145 
146 static const struct rtw89_rrsr_cfgs rtw8852bt_rrsr_cfgs = {
147 	.ref_rate = {R_AX_TRXPTCL_RRSR_CTL_0, B_AX_WMAC_RESP_REF_RATE_SEL, 0},
148 	.rsc = {R_AX_TRXPTCL_RRSR_CTL_0, B_AX_WMAC_RESP_RSC_MASK, 2},
149 };
150 
151 static const struct rtw89_rfkill_regs rtw8852bt_rfkill_regs = {
152 	.pinmux = {R_AX_GPIO8_15_FUNC_SEL,
153 		   B_AX_PINMUX_GPIO9_FUNC_SEL_MASK,
154 		   0xf},
155 	.mode = {R_AX_GPIO_EXT_CTRL + 2,
156 		 (B_AX_GPIO_MOD_9 | B_AX_GPIO_IO_SEL_9) >> 16,
157 		 0x0},
158 };
159 
160 static const struct rtw89_dig_regs rtw8852bt_dig_regs = {
161 	.seg0_pd_reg = R_SEG0R_PD_V1,
162 	.pd_lower_bound_mask = B_SEG0R_PD_LOWER_BOUND_MSK,
163 	.pd_spatial_reuse_en = B_SEG0R_PD_SPATIAL_REUSE_EN_MSK_V1,
164 	.bmode_pd_reg = R_BMODE_PDTH_EN_V1,
165 	.bmode_cca_rssi_limit_en = B_BMODE_PDTH_LIMIT_EN_MSK_V1,
166 	.bmode_pd_lower_bound_reg = R_BMODE_PDTH_V1,
167 	.bmode_rssi_nocca_low_th_mask = B_BMODE_PDTH_LOWER_BOUND_MSK_V1,
168 	.p0_lna_init = {R_PATH0_LNA_INIT_V1, B_PATH0_LNA_INIT_IDX_MSK},
169 	.p1_lna_init = {R_PATH1_LNA_INIT_V1, B_PATH1_LNA_INIT_IDX_MSK},
170 	.p0_tia_init = {R_PATH0_TIA_INIT_V1, B_PATH0_TIA_INIT_IDX_MSK_V1},
171 	.p1_tia_init = {R_PATH1_TIA_INIT_V1, B_PATH1_TIA_INIT_IDX_MSK_V1},
172 	.p0_rxb_init = {R_PATH0_RXB_INIT_V1, B_PATH0_RXB_INIT_IDX_MSK_V1},
173 	.p1_rxb_init = {R_PATH1_RXB_INIT_V1, B_PATH1_RXB_INIT_IDX_MSK_V1},
174 	.p0_p20_pagcugc_en = {R_PATH0_P20_FOLLOW_BY_PAGCUGC_V2,
175 			      B_PATH0_P20_FOLLOW_BY_PAGCUGC_EN_MSK},
176 	.p0_s20_pagcugc_en = {R_PATH0_S20_FOLLOW_BY_PAGCUGC_V2,
177 			      B_PATH0_S20_FOLLOW_BY_PAGCUGC_EN_MSK},
178 	.p1_p20_pagcugc_en = {R_PATH1_P20_FOLLOW_BY_PAGCUGC_V2,
179 			      B_PATH1_P20_FOLLOW_BY_PAGCUGC_EN_MSK},
180 	.p1_s20_pagcugc_en = {R_PATH1_S20_FOLLOW_BY_PAGCUGC_V2,
181 			      B_PATH1_S20_FOLLOW_BY_PAGCUGC_EN_MSK},
182 };
183 
184 static const struct rtw89_edcca_regs rtw8852bt_edcca_regs = {
185 	.edcca_level			= R_SEG0R_EDCCA_LVL_V1,
186 	.edcca_mask			= B_EDCCA_LVL_MSK0,
187 	.edcca_p_mask			= B_EDCCA_LVL_MSK1,
188 	.ppdu_level			= R_SEG0R_EDCCA_LVL_V1,
189 	.ppdu_mask			= B_EDCCA_LVL_MSK3,
190 	.rpt_a				= R_EDCCA_RPT_A,
191 	.rpt_b				= R_EDCCA_RPT_B,
192 	.rpt_sel			= R_EDCCA_RPT_SEL,
193 	.rpt_sel_mask			= B_EDCCA_RPT_SEL_MSK,
194 	.tx_collision_t2r_st		= R_TX_COLLISION_T2R_ST,
195 	.tx_collision_t2r_st_mask	= B_TX_COLLISION_T2R_ST_M,
196 };
197 
198 static const struct rtw89_btc_rf_trx_para rtw89_btc_8852bt_rf_ul[] = {
199 	{255, 0, 0, 7}, /* 0 -> original */
200 	{255, 2, 0, 7}, /* 1 -> for BT-connected ACI issue && BTG co-rx */
201 	{255, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
202 	{255, 0, 0, 7}, /* 3- >reserved for shared-antenna */
203 	{255, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
204 	{255, 1, 0, 7}, /* the below id is for non-shared-antenna free-run */
205 	{6, 1, 0, 7},
206 	{13, 1, 0, 7},
207 	{13, 1, 0, 7}
208 };
209 
210 static const struct rtw89_btc_rf_trx_para rtw89_btc_8852bt_rf_dl[] = {
211 	{255, 0, 0, 7}, /* 0 -> original */
212 	{255, 2, 0, 7}, /* 1 -> reserved for shared-antenna */
213 	{255, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
214 	{255, 0, 0, 7}, /* 3- >reserved for shared-antenna */
215 	{255, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
216 	{255, 1, 0, 7}, /* the below id is for non-shared-antenna free-run */
217 	{255, 1, 0, 7},
218 	{255, 1, 0, 7},
219 	{255, 1, 0, 7}
220 };
221 
222 static const struct rtw89_btc_fbtc_mreg rtw89_btc_8852bt_mon_reg[] = {
223 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda24),
224 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda28),
225 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda2c),
226 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda30),
227 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda4c),
228 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda10),
229 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda20),
230 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda34),
231 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xcef4),
232 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0x8424),
233 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xd200),
234 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xd220),
235 	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x980),
236 	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x4aa4),
237 	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x4778),
238 	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x476c),
239 };
240 
241 static const u8 rtw89_btc_8852bt_wl_rssi_thres[BTC_WL_RSSI_THMAX] = {70, 60, 50, 40};
242 static const u8 rtw89_btc_8852bt_bt_rssi_thres[BTC_BT_RSSI_THMAX] = {50, 40, 30, 20};
243 
244 static int rtw8852bt_pwr_on_func(struct rtw89_dev *rtwdev)
245 {
246 	u32 val32;
247 	u32 ret;
248 
249 	rtw89_write32_set(rtwdev, R_AX_LDO_AON_CTRL0, B_AX_PD_REGU_L);
250 	rtw89_write32_clr(rtwdev, R_AX_SYS_PW_CTRL, B_AX_AFSM_WLSUS_EN |
251 						    B_AX_AFSM_PCIE_SUS_EN);
252 	rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_DIS_WLBT_PDNSUSEN_SOPC);
253 	rtw89_write32_set(rtwdev, R_AX_WLLPS_CTRL, B_AX_DIS_WLBT_LPSEN_LOPC);
254 	rtw89_write32_clr(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APDM_HPDN);
255 	rtw89_write32_clr(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFM_SWLPS);
256 	rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, B_AX_OCP_L1_MASK, 7);
257 
258 	ret = read_poll_timeout(rtw89_read32, val32, val32 & B_AX_RDY_SYSPWR,
259 				1000, 20000, false, rtwdev, R_AX_SYS_PW_CTRL);
260 	if (ret)
261 		return ret;
262 
263 	rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_EN_WLON);
264 	rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFN_ONMAC);
265 
266 	ret = read_poll_timeout(rtw89_read32, val32, !(val32 & B_AX_APFN_ONMAC),
267 				1000, 20000, false, rtwdev, R_AX_SYS_PW_CTRL);
268 	if (ret)
269 		return ret;
270 
271 	rtw89_write8_set(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
272 	rtw89_write8_clr(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
273 	rtw89_write8_set(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
274 	rtw89_write8_clr(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
275 	rtw89_write8_set(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
276 	rtw89_write32_clr(rtwdev, R_AX_SYS_SDIO_CTRL, B_AX_PCIE_CALIB_EN_V1);
277 	rtw89_write32_set(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_PTA_1P3);
278 
279 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL,
280 				      XTAL_SI_GND_SHDN_WL, XTAL_SI_GND_SHDN_WL);
281 	if (ret)
282 		return ret;
283 
284 	rtw89_write32_set(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_RFC_1P3);
285 
286 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL,
287 				      XTAL_SI_SHDN_WL, XTAL_SI_SHDN_WL);
288 	if (ret)
289 		return ret;
290 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_OFF_WEI,
291 				      XTAL_SI_OFF_WEI);
292 	if (ret)
293 		return ret;
294 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_OFF_EI,
295 				      XTAL_SI_OFF_EI);
296 	if (ret)
297 		return ret;
298 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_RFC2RF);
299 	if (ret)
300 		return ret;
301 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_PON_WEI,
302 				      XTAL_SI_PON_WEI);
303 	if (ret)
304 		return ret;
305 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_PON_EI,
306 				      XTAL_SI_PON_EI);
307 	if (ret)
308 		return ret;
309 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_SRAM2RFC);
310 	if (ret)
311 		return ret;
312 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_SRAM_CTRL, 0, XTAL_SI_SRAM_DIS);
313 	if (ret)
314 		return ret;
315 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_XTAL_XMD_2, 0, XTAL_SI_LDO_LPS);
316 	if (ret)
317 		return ret;
318 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_XTAL_XMD_4, 0, XTAL_SI_LPS_CAP);
319 	if (ret)
320 		return ret;
321 
322 	rtw89_write32_set(rtwdev, R_AX_PMC_DBG_CTRL2, B_AX_SYSON_DIS_PMCR_AX_WRMSK);
323 	rtw89_write32_set(rtwdev, R_AX_SYS_ISO_CTRL, B_AX_ISO_EB2CORE);
324 	rtw89_write32_clr(rtwdev, R_AX_SYS_ISO_CTRL, B_AX_PWC_EV2EF_B15);
325 
326 	fsleep(1000);
327 
328 	rtw89_write32_clr(rtwdev, R_AX_SYS_ISO_CTRL, B_AX_PWC_EV2EF_B14);
329 	rtw89_write32_clr(rtwdev, R_AX_PMC_DBG_CTRL2, B_AX_SYSON_DIS_PMCR_AX_WRMSK);
330 
331 	if (!rtwdev->efuse.valid || rtwdev->efuse.power_k_valid)
332 		goto func_en;
333 
334 	rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, B_AX_VOL_L1_MASK, 0x9);
335 	rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, B_AX_VREFPFM_L_MASK, 0xA);
336 
337 func_en:
338 	rtw89_write32_set(rtwdev, R_AX_DMAC_FUNC_EN,
339 			  B_AX_MAC_FUNC_EN | B_AX_DMAC_FUNC_EN | B_AX_MPDU_PROC_EN |
340 			  B_AX_WD_RLS_EN | B_AX_DLE_WDE_EN | B_AX_TXPKT_CTRL_EN |
341 			  B_AX_STA_SCH_EN | B_AX_DLE_PLE_EN | B_AX_PKT_BUF_EN |
342 			  B_AX_DMAC_TBL_EN | B_AX_PKT_IN_EN | B_AX_DLE_CPUIO_EN |
343 			  B_AX_DISPATCHER_EN | B_AX_BBRPT_EN | B_AX_MAC_SEC_EN |
344 			  B_AX_DMACREG_GCKEN);
345 	rtw89_write32_set(rtwdev, R_AX_CMAC_FUNC_EN,
346 			  B_AX_CMAC_EN | B_AX_CMAC_TXEN | B_AX_CMAC_RXEN |
347 			  B_AX_FORCE_CMACREG_GCKEN | B_AX_PHYINTF_EN | B_AX_CMAC_DMA_EN |
348 			  B_AX_PTCLTOP_EN | B_AX_SCHEDULER_EN | B_AX_TMAC_EN |
349 			  B_AX_RMAC_EN);
350 
351 	rtw89_write32_mask(rtwdev, R_AX_EECS_EESK_FUNC_SEL,
352 			   B_AX_PINMUX_EESK_FUNC_SEL_MASK, 0x1);
353 
354 	return 0;
355 }
356 
357 static int rtw8852bt_pwr_off_func(struct rtw89_dev *rtwdev)
358 {
359 	u32 val32;
360 	u32 ret;
361 
362 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_RFC2RF,
363 				      XTAL_SI_RFC2RF);
364 	if (ret)
365 		return ret;
366 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_OFF_EI);
367 	if (ret)
368 		return ret;
369 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_OFF_WEI);
370 	if (ret)
371 		return ret;
372 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_WL_RFC_S0, 0, XTAL_SI_RF00);
373 	if (ret)
374 		return ret;
375 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_WL_RFC_S1, 0, XTAL_SI_RF10);
376 	if (ret)
377 		return ret;
378 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_SRAM2RFC,
379 				      XTAL_SI_SRAM2RFC);
380 	if (ret)
381 		return ret;
382 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_PON_EI);
383 	if (ret)
384 		return ret;
385 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_PON_WEI);
386 	if (ret)
387 		return ret;
388 
389 	rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_EN_WLON);
390 	rtw89_write32_clr(rtwdev, R_AX_WLRF_CTRL, B_AX_AFC_AFEDIG);
391 	rtw89_write8_clr(rtwdev, R_AX_SYS_FUNC_EN, B_AX_FEN_BB_GLB_RSTN | B_AX_FEN_BBRSTB);
392 	rtw89_write32_clr(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_RFC_1P3);
393 
394 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_SHDN_WL);
395 	if (ret)
396 		return ret;
397 
398 	rtw89_write32_clr(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_PTA_1P3);
399 
400 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_GND_SHDN_WL);
401 	if (ret)
402 		return ret;
403 
404 	rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFM_OFFMAC);
405 
406 	ret = read_poll_timeout(rtw89_read32, val32, !(val32 & B_AX_APFM_OFFMAC),
407 				1000, 20000, false, rtwdev, R_AX_SYS_PW_CTRL);
408 	if (ret)
409 		return ret;
410 
411 	rtw89_write32(rtwdev, R_AX_WLLPS_CTRL, SW_LPS_OPTION);
412 	rtw89_write32_set(rtwdev, R_AX_SYS_SWR_CTRL1, B_AX_SYM_CTRL_SPS_PWMFREQ);
413 	rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, B_AX_REG_ZCDC_H_MASK, 0x3);
414 	rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFM_SWLPS);
415 
416 	return 0;
417 }
418 
419 static void rtw8852bt_bb_reset_en(struct rtw89_dev *rtwdev, enum rtw89_band band,
420 				  enum rtw89_phy_idx phy_idx, bool en)
421 {
422 	if (en) {
423 		rtw89_phy_write32_idx(rtwdev, R_S0_HW_SI_DIS,
424 				      B_S0_HW_SI_DIS_W_R_TRIG, 0x0, phy_idx);
425 		rtw89_phy_write32_idx(rtwdev, R_S1_HW_SI_DIS,
426 				      B_S1_HW_SI_DIS_W_R_TRIG, 0x0, phy_idx);
427 		rtw89_phy_write32_idx(rtwdev, R_RSTB_ASYNC, B_RSTB_ASYNC_ALL, 1, phy_idx);
428 		if (band == RTW89_BAND_2G)
429 			rtw89_phy_write32_mask(rtwdev, R_RXCCA, B_RXCCA_DIS, 0x0);
430 		rtw89_phy_write32_mask(rtwdev, R_PD_CTRL, B_PD_HIT_DIS, 0x0);
431 	} else {
432 		rtw89_phy_write32_mask(rtwdev, R_RXCCA, B_RXCCA_DIS, 0x1);
433 		rtw89_phy_write32_mask(rtwdev, R_PD_CTRL, B_PD_HIT_DIS, 0x1);
434 		rtw89_phy_write32_idx(rtwdev, R_S0_HW_SI_DIS,
435 				      B_S0_HW_SI_DIS_W_R_TRIG, 0x7, phy_idx);
436 		rtw89_phy_write32_idx(rtwdev, R_S1_HW_SI_DIS,
437 				      B_S1_HW_SI_DIS_W_R_TRIG, 0x7, phy_idx);
438 		fsleep(1);
439 		rtw89_phy_write32_idx(rtwdev, R_RSTB_ASYNC, B_RSTB_ASYNC_ALL, 0, phy_idx);
440 	}
441 }
442 
443 static void rtw8852bt_bb_reset(struct rtw89_dev *rtwdev,
444 			       enum rtw89_phy_idx phy_idx)
445 {
446 	rtw89_phy_write32_mask(rtwdev, R_P0_TXPW_RSTB,
447 			       B_P0_TXPW_RSTB_MANON | B_P0_TXPW_RSTB_TSSI, 0x1);
448 	rtw89_phy_write32_set(rtwdev, R_P0_TSSI_TRK, B_P0_TSSI_TRK_EN);
449 	rtw89_phy_write32_mask(rtwdev, R_P1_TXPW_RSTB,
450 			       B_P1_TXPW_RSTB_MANON | B_P1_TXPW_RSTB_TSSI, 0x1);
451 	rtw89_phy_write32_set(rtwdev, R_P1_TSSI_TRK, B_P1_TSSI_TRK_EN);
452 	rtw8852bx_bb_reset_all(rtwdev, phy_idx);
453 	rtw89_phy_write32_mask(rtwdev, R_P0_TXPW_RSTB,
454 			       B_P0_TXPW_RSTB_MANON | B_P0_TXPW_RSTB_TSSI, 3);
455 	rtw89_phy_write32_clr(rtwdev, R_P0_TSSI_TRK, B_P0_TSSI_TRK_EN);
456 	rtw89_phy_write32_mask(rtwdev, R_P1_TXPW_RSTB,
457 			       B_P1_TXPW_RSTB_MANON | B_P0_TXPW_RSTB_TSSI, 0x3);
458 	rtw89_phy_write32_clr(rtwdev, R_P1_TSSI_TRK, B_P1_TSSI_TRK_EN);
459 }
460 
461 static void rtw8852bt_set_channel(struct rtw89_dev *rtwdev,
462 				  const struct rtw89_chan *chan,
463 				  enum rtw89_mac_idx mac_idx,
464 				  enum rtw89_phy_idx phy_idx)
465 {
466 	rtw8852bx_set_channel_mac(rtwdev, chan, mac_idx);
467 	rtw8852bx_set_channel_bb(rtwdev, chan, phy_idx);
468 	rtw8852bt_set_channel_rf(rtwdev, chan, phy_idx);
469 }
470 
471 static void rtw8852bt_tssi_cont_en(struct rtw89_dev *rtwdev, bool en,
472 				   enum rtw89_rf_path path)
473 {
474 	static const u32 tssi_trk[2] = {R_P0_TSSI_TRK, R_P1_TSSI_TRK};
475 
476 	if (en)
477 		rtw89_phy_write32_mask(rtwdev, tssi_trk[path], B_P0_TSSI_TRK_EN, 0x0);
478 	else
479 		rtw89_phy_write32_mask(rtwdev, tssi_trk[path], B_P0_TSSI_TRK_EN, 0x1);
480 }
481 
482 static void rtw8852bt_tssi_cont_en_phyidx(struct rtw89_dev *rtwdev, bool en,
483 					  u8 phy_idx)
484 {
485 	if (!rtwdev->dbcc_en) {
486 		rtw8852bt_tssi_cont_en(rtwdev, en, RF_PATH_A);
487 		rtw8852bt_tssi_cont_en(rtwdev, en, RF_PATH_B);
488 		rtw8852bt_tssi_scan(rtwdev, phy_idx);
489 	} else {
490 		if (phy_idx == RTW89_PHY_0)
491 			rtw8852bt_tssi_cont_en(rtwdev, en, RF_PATH_A);
492 		else
493 			rtw8852bt_tssi_cont_en(rtwdev, en, RF_PATH_B);
494 	}
495 }
496 
497 static void rtw8852bt_adc_en(struct rtw89_dev *rtwdev, bool en)
498 {
499 	if (en)
500 		rtw89_phy_write32_mask(rtwdev, R_ADC_FIFO, B_ADC_FIFO_RST, 0x0);
501 	else
502 		rtw89_phy_write32_mask(rtwdev, R_ADC_FIFO, B_ADC_FIFO_RST, 0xf);
503 }
504 
505 static void rtw8852bt_set_channel_help(struct rtw89_dev *rtwdev, bool enter,
506 				       struct rtw89_channel_help_params *p,
507 				       const struct rtw89_chan *chan,
508 				       enum rtw89_mac_idx mac_idx,
509 				       enum rtw89_phy_idx phy_idx)
510 {
511 	if (enter) {
512 		rtw89_chip_stop_sch_tx(rtwdev, RTW89_MAC_0, &p->tx_en, RTW89_SCH_TX_SEL_ALL);
513 		rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, false);
514 		rtw8852bt_tssi_cont_en_phyidx(rtwdev, false, RTW89_PHY_0);
515 		rtw8852bt_adc_en(rtwdev, false);
516 		fsleep(40);
517 		rtw8852bt_bb_reset_en(rtwdev, chan->band_type, phy_idx, false);
518 	} else {
519 		rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, true);
520 		rtw8852bt_adc_en(rtwdev, true);
521 		rtw8852bt_tssi_cont_en_phyidx(rtwdev, true, RTW89_PHY_0);
522 		rtw8852bt_bb_reset_en(rtwdev, chan->band_type, phy_idx, true);
523 		rtw89_chip_resume_sch_tx(rtwdev, RTW89_MAC_0, p->tx_en);
524 	}
525 }
526 
527 static void rtw8852bt_rfk_init(struct rtw89_dev *rtwdev)
528 {
529 	rtwdev->is_tssi_mode[RF_PATH_A] = false;
530 	rtwdev->is_tssi_mode[RF_PATH_B] = false;
531 
532 	rtw8852bt_dpk_init(rtwdev);
533 	rtw8852bt_rck(rtwdev);
534 	rtw8852bt_dack(rtwdev);
535 	rtw8852bt_rx_dck(rtwdev, RTW89_PHY_0);
536 }
537 
538 static void rtw8852bt_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
539 {
540 	enum rtw89_phy_idx phy_idx = rtwvif->phy_idx;
541 
542 	rtw8852bt_rx_dck(rtwdev, phy_idx);
543 	rtw8852bt_iqk(rtwdev, phy_idx);
544 	rtw8852bt_tssi(rtwdev, phy_idx, true);
545 	rtw8852bt_dpk(rtwdev, phy_idx);
546 }
547 
548 static void rtw8852bt_rfk_band_changed(struct rtw89_dev *rtwdev,
549 				       enum rtw89_phy_idx phy_idx)
550 {
551 	rtw8852bt_tssi_scan(rtwdev, phy_idx);
552 }
553 
554 static void rtw8852bt_rfk_scan(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
555 			       bool start)
556 {
557 	rtw8852bt_wifi_scan_notify(rtwdev, start, rtwvif->phy_idx);
558 }
559 
560 static void rtw8852bt_rfk_track(struct rtw89_dev *rtwdev)
561 {
562 	rtw8852bt_dpk_track(rtwdev);
563 }
564 
565 static void rtw8852bt_btc_set_rfe(struct rtw89_dev *rtwdev)
566 {
567 	const struct rtw89_btc_ver *ver = rtwdev->btc.ver;
568 	union rtw89_btc_module_info *md = &rtwdev->btc.mdinfo;
569 
570 	if (ver->fcxinit == 7) {
571 		md->md_v7.rfe_type = rtwdev->efuse.rfe_type;
572 		md->md_v7.kt_ver = rtwdev->hal.cv;
573 		md->md_v7.kt_ver_adie = rtwdev->hal.acv;
574 		md->md_v7.bt_solo = 0;
575 		md->md_v7.bt_pos = BTC_BT_BTG;
576 		md->md_v7.switch_type = BTC_SWITCH_INTERNAL;
577 		md->md_v7.wa_type = 0;
578 
579 		md->md_v7.ant.type = BTC_ANT_SHARED;
580 		md->md_v7.ant.num = 2;
581 		md->md_v7.ant.isolation = 10;
582 		md->md_v7.ant.diversity = 0;
583 		/* WL 1-stream+1-Ant is located at 0:s0(path-A) or 1:s1(path-B) */
584 		md->md_v7.ant.single_pos = RF_PATH_A;
585 		md->md_v7.ant.btg_pos = RF_PATH_B;
586 
587 		if (md->md_v7.rfe_type == 0) {
588 			rtwdev->btc.dm.error.map.rfe_type0 = true;
589 			return;
590 		}
591 
592 		md->md_v7.ant.num = (md->md_v7.rfe_type % 2) ? 2 : 3;
593 		md->md_v7.ant.stream_cnt = 2;
594 		md->md_v7.wa_type |= BTC_WA_INIT_SCAN;
595 
596 		if (md->md_v7.ant.num == 2) {
597 			md->md_v7.ant.type = BTC_ANT_SHARED;
598 			md->md_v7.bt_pos = BTC_BT_BTG;
599 			md->md_v7.wa_type |= BTC_WA_HFP_LAG;
600 		} else {
601 			md->md_v7.ant.type = BTC_ANT_DEDICATED;
602 			md->md_v7.bt_pos = BTC_BT_ALONE;
603 		}
604 	} else {
605 		return;
606 	}
607 }
608 
609 static void
610 rtw8852bt_btc_set_wl_txpwr_ctrl(struct rtw89_dev *rtwdev, u32 txpwr_val)
611 {
612 	u16 ctrl_all_time = u32_get_bits(txpwr_val, GENMASK(15, 0));
613 	u16 ctrl_gnt_bt = u32_get_bits(txpwr_val, GENMASK(31, 16));
614 
615 	switch (ctrl_all_time) {
616 	case 0xffff:
617 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_RATE_CTRL,
618 					     B_AX_FORCE_PWR_BY_RATE_EN, 0x0);
619 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_RATE_CTRL,
620 					     B_AX_FORCE_PWR_BY_RATE_VALUE_MASK, 0x0);
621 		break;
622 	default:
623 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_RATE_CTRL,
624 					     B_AX_FORCE_PWR_BY_RATE_VALUE_MASK,
625 					     ctrl_all_time);
626 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_RATE_CTRL,
627 					     B_AX_FORCE_PWR_BY_RATE_EN, 0x1);
628 		break;
629 	}
630 
631 	switch (ctrl_gnt_bt) {
632 	case 0xffff:
633 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_COEXT_CTRL,
634 					     B_AX_TXAGC_BT_EN, 0x0);
635 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_COEXT_CTRL,
636 					     B_AX_TXAGC_BT_MASK, 0x0);
637 		break;
638 	default:
639 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_COEXT_CTRL,
640 					     B_AX_TXAGC_BT_MASK, ctrl_gnt_bt);
641 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_COEXT_CTRL,
642 					     B_AX_TXAGC_BT_EN, 0x1);
643 		break;
644 	}
645 }
646 
647 static const struct rtw89_chip_ops rtw8852bt_chip_ops = {
648 	.enable_bb_rf		= rtw8852bx_mac_enable_bb_rf,
649 	.disable_bb_rf		= rtw8852bx_mac_disable_bb_rf,
650 	.bb_preinit		= NULL,
651 	.bb_postinit		= NULL,
652 	.bb_reset		= rtw8852bt_bb_reset,
653 	.bb_sethw		= rtw8852bx_bb_sethw,
654 	.read_rf		= rtw89_phy_read_rf_v1,
655 	.write_rf		= rtw89_phy_write_rf_v1,
656 	.set_channel		= rtw8852bt_set_channel,
657 	.set_channel_help	= rtw8852bt_set_channel_help,
658 	.read_efuse		= rtw8852bx_read_efuse,
659 	.read_phycap		= rtw8852bx_read_phycap,
660 	.fem_setup		= NULL,
661 	.rfe_gpio		= NULL,
662 	.rfk_hw_init		= NULL,
663 	.rfk_init		= rtw8852bt_rfk_init,
664 	.rfk_init_late		= NULL,
665 	.rfk_channel		= rtw8852bt_rfk_channel,
666 	.rfk_band_changed	= rtw8852bt_rfk_band_changed,
667 	.rfk_scan		= rtw8852bt_rfk_scan,
668 	.rfk_track		= rtw8852bt_rfk_track,
669 	.power_trim		= rtw8852bx_power_trim,
670 	.set_txpwr		= rtw8852bx_set_txpwr,
671 	.set_txpwr_ctrl		= rtw8852bx_set_txpwr_ctrl,
672 	.init_txpwr_unit	= rtw8852bx_init_txpwr_unit,
673 	.get_thermal		= rtw8852bx_get_thermal,
674 	.ctrl_btg_bt_rx		= rtw8852bx_ctrl_btg_bt_rx,
675 	.query_ppdu		= rtw8852bx_query_ppdu,
676 	.ctrl_nbtg_bt_tx	= rtw8852bx_ctrl_nbtg_bt_tx,
677 	.cfg_txrx_path		= rtw8852bx_bb_cfg_txrx_path,
678 	.set_txpwr_ul_tb_offset	= rtw8852bx_set_txpwr_ul_tb_offset,
679 	.pwr_on_func		= rtw8852bt_pwr_on_func,
680 	.pwr_off_func		= rtw8852bt_pwr_off_func,
681 	.query_rxdesc		= rtw89_core_query_rxdesc,
682 	.fill_txdesc		= rtw89_core_fill_txdesc,
683 	.fill_txdesc_fwcmd	= rtw89_core_fill_txdesc,
684 	.cfg_ctrl_path		= rtw89_mac_cfg_ctrl_path,
685 	.mac_cfg_gnt		= rtw89_mac_cfg_gnt,
686 	.stop_sch_tx		= rtw89_mac_stop_sch_tx,
687 	.resume_sch_tx		= rtw89_mac_resume_sch_tx,
688 	.h2c_dctl_sec_cam	= NULL,
689 	.h2c_default_cmac_tbl	= rtw89_fw_h2c_default_cmac_tbl,
690 	.h2c_assoc_cmac_tbl	= rtw89_fw_h2c_assoc_cmac_tbl,
691 	.h2c_ampdu_cmac_tbl	= NULL,
692 	.h2c_default_dmac_tbl	= NULL,
693 	.h2c_update_beacon	= rtw89_fw_h2c_update_beacon,
694 	.h2c_ba_cam		= rtw89_fw_h2c_ba_cam,
695 
696 	.btc_set_rfe		= rtw8852bt_btc_set_rfe,
697 	.btc_init_cfg		= rtw8852bx_btc_init_cfg,
698 	.btc_set_wl_pri		= rtw8852bx_btc_set_wl_pri,
699 	.btc_set_wl_txpwr_ctrl	= rtw8852bt_btc_set_wl_txpwr_ctrl,
700 	.btc_get_bt_rssi	= rtw8852bx_btc_get_bt_rssi,
701 	.btc_update_bt_cnt	= rtw8852bx_btc_update_bt_cnt,
702 	.btc_wl_s1_standby	= rtw8852bx_btc_wl_s1_standby,
703 	.btc_set_wl_rx_gain	= rtw8852bx_btc_set_wl_rx_gain,
704 	.btc_set_policy		= rtw89_btc_set_policy_v1,
705 };
706 
707 #ifdef CONFIG_PM
708 static const struct wiphy_wowlan_support rtw_wowlan_stub_8852bt = {
709 	.flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT,
710 	.n_patterns = RTW89_MAX_PATTERN_NUM,
711 	.pattern_max_len = RTW89_MAX_PATTERN_SIZE,
712 	.pattern_min_len = 1,
713 };
714 #endif
715 
716 const struct rtw89_chip_info rtw8852bt_chip_info = {
717 	.chip_id		= RTL8852BT,
718 	.chip_gen		= RTW89_CHIP_AX,
719 	.ops			= &rtw8852bt_chip_ops,
720 	.mac_def		= &rtw89_mac_gen_ax,
721 	.phy_def		= &rtw89_phy_gen_ax,
722 	.fw_basename		= RTW8852BT_FW_BASENAME,
723 	.fw_format_max		= RTW8852BT_FW_FORMAT_MAX,
724 	.try_ce_fw		= true,
725 	.bbmcu_nr		= 0,
726 	.needed_fw_elms		= RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_NO_6GHZ,
727 	.fifo_size		= 458752,
728 	.small_fifo_size	= true,
729 	.dle_scc_rsvd_size	= 98304,
730 	.max_amsdu_limit	= 5000,
731 	.dis_2g_40m_ul_ofdma	= true,
732 	.rsvd_ple_ofst		= 0x6f800,
733 	.hfc_param_ini		= rtw8852bt_hfc_param_ini_pcie,
734 	.dle_mem		= rtw8852bt_dle_mem_pcie,
735 	.wde_qempty_acq_grpnum	= 4,
736 	.wde_qempty_mgq_grpsel	= 4,
737 	.rf_base_addr		= {0xe000, 0xf000},
738 	.pwr_on_seq		= NULL,
739 	.pwr_off_seq		= NULL,
740 	.bb_table		= NULL,
741 	.bb_gain_table		= NULL,
742 	.rf_table		= {},
743 	.nctl_table		= NULL,
744 	.nctl_post_table	= NULL,
745 	.dflt_parms		= NULL,
746 	.rfe_parms_conf		= NULL,
747 	.txpwr_factor_rf	= 2,
748 	.txpwr_factor_mac	= 1,
749 	.dig_table		= NULL,
750 	.dig_regs		= &rtw8852bt_dig_regs,
751 	.tssi_dbw_table		= NULL,
752 	.support_macid_num	= RTW89_MAX_MAC_ID_NUM,
753 	.support_chanctx_num	= 1,
754 	.support_rnr		= false,
755 	.support_bands		= BIT(NL80211_BAND_2GHZ) |
756 				  BIT(NL80211_BAND_5GHZ),
757 	.support_bandwidths	= BIT(NL80211_CHAN_WIDTH_20) |
758 				  BIT(NL80211_CHAN_WIDTH_40) |
759 				  BIT(NL80211_CHAN_WIDTH_80),
760 	.support_unii4		= true,
761 	.ul_tb_waveform_ctrl	= true,
762 	.ul_tb_pwr_diff		= false,
763 	.hw_sec_hdr		= false,
764 	.hw_mgmt_tx_encrypt     = false,
765 	.rf_path_num		= 2,
766 	.tx_nss			= 2,
767 	.rx_nss			= 2,
768 	.acam_num		= 128,
769 	.bcam_num		= 10,
770 	.scam_num		= 128,
771 	.bacam_num		= 2,
772 	.bacam_dynamic_num	= 4,
773 	.bacam_ver		= RTW89_BACAM_V0,
774 	.ppdu_max_usr		= 4,
775 	.sec_ctrl_efuse_size	= 4,
776 	.physical_efuse_size	= 1216,
777 	.logical_efuse_size	= 2048,
778 	.limit_efuse_size	= 1280,
779 	.dav_phy_efuse_size	= 96,
780 	.dav_log_efuse_size	= 16,
781 	.efuse_blocks		= NULL,
782 	.phycap_addr		= 0x580,
783 	.phycap_size		= 128,
784 	.para_ver		= 0,
785 	.wlcx_desired		= 0x070e0000,
786 	.btcx_desired		= 0x7,
787 	.scbd			= 0x1,
788 	.mailbox		= 0x1,
789 
790 	.afh_guard_ch		= 6,
791 	.wl_rssi_thres		= rtw89_btc_8852bt_wl_rssi_thres,
792 	.bt_rssi_thres		= rtw89_btc_8852bt_bt_rssi_thres,
793 	.rssi_tol		= 2,
794 	.mon_reg_num		= ARRAY_SIZE(rtw89_btc_8852bt_mon_reg),
795 	.mon_reg		= rtw89_btc_8852bt_mon_reg,
796 	.rf_para_ulink_num	= ARRAY_SIZE(rtw89_btc_8852bt_rf_ul),
797 	.rf_para_ulink		= rtw89_btc_8852bt_rf_ul,
798 	.rf_para_dlink_num	= ARRAY_SIZE(rtw89_btc_8852bt_rf_dl),
799 	.rf_para_dlink		= rtw89_btc_8852bt_rf_dl,
800 	.ps_mode_supported	= BIT(RTW89_PS_MODE_RFOFF) |
801 				  BIT(RTW89_PS_MODE_CLK_GATED) |
802 				  BIT(RTW89_PS_MODE_PWR_GATED),
803 	.low_power_hci_modes	= 0,
804 	.h2c_cctl_func_id	= H2C_FUNC_MAC_CCTLINFO_UD,
805 	.hci_func_en_addr	= R_AX_HCI_FUNC_EN,
806 	.h2c_desc_size		= sizeof(struct rtw89_txwd_body),
807 	.txwd_body_size		= sizeof(struct rtw89_txwd_body),
808 	.txwd_info_size		= sizeof(struct rtw89_txwd_info),
809 	.h2c_ctrl_reg		= R_AX_H2CREG_CTRL,
810 	.h2c_counter_reg	= {R_AX_UDM1 + 1, B_AX_UDM1_HALMAC_H2C_DEQ_CNT_MASK >> 8},
811 	.h2c_regs		= rtw8852bt_h2c_regs,
812 	.c2h_ctrl_reg		= R_AX_C2HREG_CTRL,
813 	.c2h_counter_reg	= {R_AX_UDM1 + 1, B_AX_UDM1_HALMAC_C2H_ENQ_CNT_MASK >> 8},
814 	.c2h_regs		= rtw8852bt_c2h_regs,
815 	.page_regs		= &rtw8852bt_page_regs,
816 	.wow_reason_reg		= rtw8852bt_wow_wakeup_regs,
817 	.cfo_src_fd		= true,
818 	.cfo_hw_comp		= true,
819 	.dcfo_comp		= &rtw8852bt_dcfo_comp,
820 	.dcfo_comp_sft		= 10,
821 	.imr_info		= &rtw8852bt_imr_info,
822 	.imr_dmac_table		= NULL,
823 	.imr_cmac_table		= NULL,
824 	.rrsr_cfgs		= &rtw8852bt_rrsr_cfgs,
825 	.bss_clr_vld		= {R_BSS_CLR_MAP_V1, B_BSS_CLR_MAP_VLD0},
826 	.bss_clr_map_reg	= R_BSS_CLR_MAP_V1,
827 	.rfkill_init		= &rtw8852bt_rfkill_regs,
828 	.rfkill_get		= {R_AX_GPIO_EXT_CTRL, B_AX_GPIO_IN_9},
829 	.dma_ch_mask		= BIT(RTW89_DMA_ACH4) | BIT(RTW89_DMA_ACH5) |
830 				  BIT(RTW89_DMA_ACH6) | BIT(RTW89_DMA_ACH7) |
831 				  BIT(RTW89_DMA_B1MG) | BIT(RTW89_DMA_B1HI),
832 	.edcca_regs		= &rtw8852bt_edcca_regs,
833 #ifdef CONFIG_PM
834 	.wowlan_stub		= &rtw_wowlan_stub_8852bt,
835 #endif
836 	.xtal_info		= NULL,
837 };
838 EXPORT_SYMBOL(rtw8852bt_chip_info);
839 
840 MODULE_FIRMWARE(RTW8852BT_MODULE_FIRMWARE);
841 MODULE_AUTHOR("Realtek Corporation");
842 MODULE_DESCRIPTION("Realtek 802.11ax wireless 8852BT driver");
843 MODULE_LICENSE("Dual BSD/GPL");
844