193121c03SLarry Finger // SPDX-License-Identifier: GPL-2.0
293121c03SLarry Finger /* Copyright(c) 2009-2014 Realtek Corporation.*/
3f1d2b4d3SLarry Finger
4f1d2b4d3SLarry Finger #include "../wifi.h"
5f1d2b4d3SLarry Finger #include "../core.h"
6f1d2b4d3SLarry Finger #include "../pci.h"
7f1d2b4d3SLarry Finger #include "reg.h"
8f1d2b4d3SLarry Finger #include "def.h"
9f1d2b4d3SLarry Finger #include "phy.h"
10f1d2b4d3SLarry Finger #include "../rtl8723com/phy_common.h"
11f1d2b4d3SLarry Finger #include "dm.h"
12f1d2b4d3SLarry Finger #include "../rtl8723com/dm_common.h"
13f1d2b4d3SLarry Finger #include "hw.h"
14f1d2b4d3SLarry Finger #include "fw.h"
15f1d2b4d3SLarry Finger #include "../rtl8723com/fw_common.h"
16f1d2b4d3SLarry Finger #include "trx.h"
17f1d2b4d3SLarry Finger #include "led.h"
18f1d2b4d3SLarry Finger #include "table.h"
19f1d2b4d3SLarry Finger #include "../btcoexist/rtl_btc.h"
20f1d2b4d3SLarry Finger
21f1d2b4d3SLarry Finger #include <linux/vmalloc.h>
22f1d2b4d3SLarry Finger #include <linux/module.h>
23f1d2b4d3SLarry Finger
rtl8723be_init_aspm_vars(struct ieee80211_hw * hw)24f1d2b4d3SLarry Finger static void rtl8723be_init_aspm_vars(struct ieee80211_hw *hw)
25f1d2b4d3SLarry Finger {
2684efbad4SPing-Ke Shih struct rtl_priv *rtlpriv = rtl_priv(hw);
27f1d2b4d3SLarry Finger struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
28f1d2b4d3SLarry Finger
29f1d2b4d3SLarry Finger /* ASPM PS mode.
30f1d2b4d3SLarry Finger * 0 - Disable ASPM,
31f1d2b4d3SLarry Finger * 1 - Enable ASPM without Clock Req,
32f1d2b4d3SLarry Finger * 2 - Enable ASPM with Clock Req,
33f1d2b4d3SLarry Finger * 3 - Alwyas Enable ASPM with Clock Req,
34f1d2b4d3SLarry Finger * 4 - Always Enable ASPM without Clock Req.
35*a1e7eafdSFredrik Lönnegren * set default to RTL8192CE:3 RTL8192E:2
36f1d2b4d3SLarry Finger */
37f1d2b4d3SLarry Finger rtlpci->const_pci_aspm = 3;
38f1d2b4d3SLarry Finger
39f1d2b4d3SLarry Finger /*Setting for PCI-E device */
40f1d2b4d3SLarry Finger rtlpci->const_devicepci_aspm_setting = 0x03;
41f1d2b4d3SLarry Finger
42f1d2b4d3SLarry Finger /*Setting for PCI-E bridge */
43f1d2b4d3SLarry Finger rtlpci->const_hostpci_aspm_setting = 0x02;
44f1d2b4d3SLarry Finger
45f1d2b4d3SLarry Finger /* In Hw/Sw Radio Off situation.
46f1d2b4d3SLarry Finger * 0 - Default,
47f1d2b4d3SLarry Finger * 1 - From ASPM setting without low Mac Pwr,
48f1d2b4d3SLarry Finger * 2 - From ASPM setting with low Mac Pwr,
49f1d2b4d3SLarry Finger * 3 - Bus D3
50f1d2b4d3SLarry Finger * set default to RTL8192CE:0 RTL8192SE:2
51f1d2b4d3SLarry Finger */
52f1d2b4d3SLarry Finger rtlpci->const_hwsw_rfoff_d3 = 0;
53f1d2b4d3SLarry Finger
54f1d2b4d3SLarry Finger /* This setting works for those device with
55f1d2b4d3SLarry Finger * backdoor ASPM setting such as EPHY setting.
56f1d2b4d3SLarry Finger * 0 - Not support ASPM,
57f1d2b4d3SLarry Finger * 1 - Support ASPM,
58f1d2b4d3SLarry Finger * 2 - According to chipset.
59f1d2b4d3SLarry Finger */
6084efbad4SPing-Ke Shih rtlpci->const_support_pciaspm = rtlpriv->cfg->mod_params->aspm_support;
61f1d2b4d3SLarry Finger }
62f1d2b4d3SLarry Finger
rtl8723be_init_sw_vars(struct ieee80211_hw * hw)6302a214e2SAmadeusz Sławiński static int rtl8723be_init_sw_vars(struct ieee80211_hw *hw)
64f1d2b4d3SLarry Finger {
65f1d2b4d3SLarry Finger int err = 0;
66f1d2b4d3SLarry Finger struct rtl_priv *rtlpriv = rtl_priv(hw);
67f1d2b4d3SLarry Finger struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
68f1d2b4d3SLarry Finger struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
69f70e4df2SLarry Finger char *fw_name = "rtlwifi/rtl8723befw_36.bin";
70f1d2b4d3SLarry Finger
71f1d2b4d3SLarry Finger rtl8723be_bt_reg_init(hw);
72f1d2b4d3SLarry Finger rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer();
73f1d2b4d3SLarry Finger
7447361089SJason Yan rtlpriv->dm.dm_initialgain_enable = true;
75f1d2b4d3SLarry Finger rtlpriv->dm.dm_flag = 0;
7647361089SJason Yan rtlpriv->dm.disable_framebursting = false;
77f1d2b4d3SLarry Finger rtlpriv->dm.thermalvalue = 0;
78f1d2b4d3SLarry Finger rtlpci->transmit_config = CFENDFORM | BIT(15) | BIT(24) | BIT(25);
79f1d2b4d3SLarry Finger
80f1d2b4d3SLarry Finger rtlpriv->phy.lck_inprogress = false;
81f1d2b4d3SLarry Finger
82f1d2b4d3SLarry Finger mac->ht_enable = true;
83f1d2b4d3SLarry Finger
84f1d2b4d3SLarry Finger /* compatible 5G band 88ce just 2.4G band & smsp */
85f1d2b4d3SLarry Finger rtlpriv->rtlhal.current_bandtype = BAND_ON_2_4G;
86f1d2b4d3SLarry Finger rtlpriv->rtlhal.bandset = BAND_ON_2_4G;
87f1d2b4d3SLarry Finger rtlpriv->rtlhal.macphymode = SINGLEMAC_SINGLEPHY;
88f1d2b4d3SLarry Finger
89f1d2b4d3SLarry Finger rtlpci->receive_config = (RCR_APPFCS |
90f1d2b4d3SLarry Finger RCR_APP_MIC |
91f1d2b4d3SLarry Finger RCR_APP_ICV |
92f1d2b4d3SLarry Finger RCR_APP_PHYST_RXFF |
93f1d2b4d3SLarry Finger RCR_HTC_LOC_CTRL |
94f1d2b4d3SLarry Finger RCR_AMF |
95f1d2b4d3SLarry Finger RCR_ACF |
96f1d2b4d3SLarry Finger RCR_ADF |
97f1d2b4d3SLarry Finger RCR_AICV |
98f1d2b4d3SLarry Finger RCR_AB |
99f1d2b4d3SLarry Finger RCR_AM |
100f1d2b4d3SLarry Finger RCR_APM |
101f1d2b4d3SLarry Finger 0);
102f1d2b4d3SLarry Finger
103f1d2b4d3SLarry Finger rtlpci->irq_mask[0] = (u32) (IMR_PSTIMEOUT |
104f1d2b4d3SLarry Finger IMR_HSISR_IND_ON_INT |
105f1d2b4d3SLarry Finger IMR_C2HCMD |
106f1d2b4d3SLarry Finger IMR_HIGHDOK |
107f1d2b4d3SLarry Finger IMR_MGNTDOK |
108f1d2b4d3SLarry Finger IMR_BKDOK |
109f1d2b4d3SLarry Finger IMR_BEDOK |
110f1d2b4d3SLarry Finger IMR_VIDOK |
111f1d2b4d3SLarry Finger IMR_VODOK |
112f1d2b4d3SLarry Finger IMR_RDU |
113f1d2b4d3SLarry Finger IMR_ROK |
114f1d2b4d3SLarry Finger 0);
115f1d2b4d3SLarry Finger
116f1d2b4d3SLarry Finger rtlpci->irq_mask[1] = (u32)(IMR_RXFOVW | 0);
117f1d2b4d3SLarry Finger
118f1d2b4d3SLarry Finger rtlpci->sys_irq_mask = (u32)(HSIMR_PDN_INT_EN |
119f1d2b4d3SLarry Finger HSIMR_RON_INT_EN |
120f1d2b4d3SLarry Finger 0);
121f1d2b4d3SLarry Finger
122f1d2b4d3SLarry Finger /* for LPS & IPS */
123f1d2b4d3SLarry Finger rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps;
124f1d2b4d3SLarry Finger rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
125f1d2b4d3SLarry Finger rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
126f1d2b4d3SLarry Finger rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
127f1d2b4d3SLarry Finger if (rtlpriv->cfg->mod_params->disable_watchdog)
128f1d2b4d3SLarry Finger pr_info("watchdog disabled\n");
1291024b316SPing-Ke Shih rtlpriv->psc.reg_fwctrl_lps = 2;
1301024b316SPing-Ke Shih rtlpriv->psc.reg_max_lps_awakeintvl = 2;
131f1d2b4d3SLarry Finger /* for ASPM, you can close aspm through
132f1d2b4d3SLarry Finger * set const_support_pciaspm = 0
133f1d2b4d3SLarry Finger */
134f1d2b4d3SLarry Finger rtl8723be_init_aspm_vars(hw);
135f1d2b4d3SLarry Finger
136f1d2b4d3SLarry Finger if (rtlpriv->psc.reg_fwctrl_lps == 1)
137f1d2b4d3SLarry Finger rtlpriv->psc.fwctrl_psmode = FW_PS_MIN_MODE;
138f1d2b4d3SLarry Finger else if (rtlpriv->psc.reg_fwctrl_lps == 2)
139f1d2b4d3SLarry Finger rtlpriv->psc.fwctrl_psmode = FW_PS_MAX_MODE;
140f1d2b4d3SLarry Finger else if (rtlpriv->psc.reg_fwctrl_lps == 3)
141f1d2b4d3SLarry Finger rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE;
142f1d2b4d3SLarry Finger
143f1d2b4d3SLarry Finger /*low power: Disable 32k */
144f1d2b4d3SLarry Finger rtlpriv->psc.low_power_enable = false;
145f1d2b4d3SLarry Finger
146f1d2b4d3SLarry Finger rtlpriv->rtlhal.earlymode_enable = false;
147f1d2b4d3SLarry Finger
148f1d2b4d3SLarry Finger /* for firmware buf */
149f1d2b4d3SLarry Finger rtlpriv->rtlhal.pfirmware = vzalloc(0x8000);
150f1d2b4d3SLarry Finger if (!rtlpriv->rtlhal.pfirmware) {
1514e2b4378SLarry Finger pr_err("Can't alloc buffer for fw.\n");
152f1d2b4d3SLarry Finger return 1;
153f1d2b4d3SLarry Finger }
154f1d2b4d3SLarry Finger
155f1d2b4d3SLarry Finger rtlpriv->max_fw_size = 0x8000;
156cf4747d7SLarry Finger pr_info("Using firmware %s\n", fw_name);
157cf4747d7SLarry Finger err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
158f1d2b4d3SLarry Finger rtlpriv->io.dev, GFP_KERNEL, hw,
159f1d2b4d3SLarry Finger rtl_fw_cb);
160f1d2b4d3SLarry Finger if (err) {
1614e2b4378SLarry Finger pr_err("Failed to request firmware!\n");
162f2764f61SSouptick Joarder vfree(rtlpriv->rtlhal.pfirmware);
163f2764f61SSouptick Joarder rtlpriv->rtlhal.pfirmware = NULL;
164f1d2b4d3SLarry Finger return 1;
165f1d2b4d3SLarry Finger }
166f1d2b4d3SLarry Finger return 0;
167f1d2b4d3SLarry Finger }
168f1d2b4d3SLarry Finger
rtl8723be_deinit_sw_vars(struct ieee80211_hw * hw)16902a214e2SAmadeusz Sławiński static void rtl8723be_deinit_sw_vars(struct ieee80211_hw *hw)
170f1d2b4d3SLarry Finger {
171f1d2b4d3SLarry Finger struct rtl_priv *rtlpriv = rtl_priv(hw);
172f1d2b4d3SLarry Finger
173f1d2b4d3SLarry Finger if (rtlpriv->rtlhal.pfirmware) {
174f1d2b4d3SLarry Finger vfree(rtlpriv->rtlhal.pfirmware);
175f1d2b4d3SLarry Finger rtlpriv->rtlhal.pfirmware = NULL;
176f1d2b4d3SLarry Finger }
177f1d2b4d3SLarry Finger }
178f1d2b4d3SLarry Finger
179f1d2b4d3SLarry Finger /* get bt coexist status */
rtl8723be_get_btc_status(void)18002a214e2SAmadeusz Sławiński static bool rtl8723be_get_btc_status(void)
181f1d2b4d3SLarry Finger {
182f1d2b4d3SLarry Finger return true;
183f1d2b4d3SLarry Finger }
184f1d2b4d3SLarry Finger
is_fw_header(struct rtlwifi_firmware_header * hdr)185f1d2b4d3SLarry Finger static bool is_fw_header(struct rtlwifi_firmware_header *hdr)
186f1d2b4d3SLarry Finger {
187f1d2b4d3SLarry Finger return (le16_to_cpu(hdr->signature) & 0xfff0) == 0x5300;
188f1d2b4d3SLarry Finger }
189f1d2b4d3SLarry Finger
190f1d2b4d3SLarry Finger static struct rtl_hal_ops rtl8723be_hal_ops = {
191f1d2b4d3SLarry Finger .init_sw_vars = rtl8723be_init_sw_vars,
192f1d2b4d3SLarry Finger .deinit_sw_vars = rtl8723be_deinit_sw_vars,
193f1d2b4d3SLarry Finger .read_eeprom_info = rtl8723be_read_eeprom_info,
194f1d2b4d3SLarry Finger .interrupt_recognized = rtl8723be_interrupt_recognized,
195f1d2b4d3SLarry Finger .hw_init = rtl8723be_hw_init,
196f1d2b4d3SLarry Finger .hw_disable = rtl8723be_card_disable,
197f1d2b4d3SLarry Finger .hw_suspend = rtl8723be_suspend,
198f1d2b4d3SLarry Finger .hw_resume = rtl8723be_resume,
199f1d2b4d3SLarry Finger .enable_interrupt = rtl8723be_enable_interrupt,
200f1d2b4d3SLarry Finger .disable_interrupt = rtl8723be_disable_interrupt,
201f1d2b4d3SLarry Finger .set_network_type = rtl8723be_set_network_type,
202f1d2b4d3SLarry Finger .set_chk_bssid = rtl8723be_set_check_bssid,
203f1d2b4d3SLarry Finger .set_qos = rtl8723be_set_qos,
204f1d2b4d3SLarry Finger .set_bcn_reg = rtl8723be_set_beacon_related_registers,
205f1d2b4d3SLarry Finger .set_bcn_intv = rtl8723be_set_beacon_interval,
206f1d2b4d3SLarry Finger .update_interrupt_mask = rtl8723be_update_interrupt_mask,
207f1d2b4d3SLarry Finger .get_hw_reg = rtl8723be_get_hw_reg,
208f1d2b4d3SLarry Finger .set_hw_reg = rtl8723be_set_hw_reg,
209f1d2b4d3SLarry Finger .update_rate_tbl = rtl8723be_update_hal_rate_tbl,
210f1d2b4d3SLarry Finger .fill_tx_desc = rtl8723be_tx_fill_desc,
211f1d2b4d3SLarry Finger .fill_tx_cmddesc = rtl8723be_tx_fill_cmddesc,
212f1d2b4d3SLarry Finger .query_rx_desc = rtl8723be_rx_query_desc,
213f1d2b4d3SLarry Finger .set_channel_access = rtl8723be_update_channel_access_setting,
214f1d2b4d3SLarry Finger .radio_onoff_checking = rtl8723be_gpio_radio_on_off_checking,
215f1d2b4d3SLarry Finger .set_bw_mode = rtl8723be_phy_set_bw_mode,
216f1d2b4d3SLarry Finger .switch_channel = rtl8723be_phy_sw_chnl,
217f1d2b4d3SLarry Finger .dm_watchdog = rtl8723be_dm_watchdog,
218f1d2b4d3SLarry Finger .scan_operation_backup = rtl8723be_phy_scan_operation_backup,
219f1d2b4d3SLarry Finger .set_rf_power_state = rtl8723be_phy_set_rf_power_state,
220f1d2b4d3SLarry Finger .led_control = rtl8723be_led_control,
221f1d2b4d3SLarry Finger .set_desc = rtl8723be_set_desc,
222f1d2b4d3SLarry Finger .get_desc = rtl8723be_get_desc,
223f1d2b4d3SLarry Finger .is_tx_desc_closed = rtl8723be_is_tx_desc_closed,
224f1d2b4d3SLarry Finger .tx_polling = rtl8723be_tx_polling,
225f1d2b4d3SLarry Finger .enable_hw_sec = rtl8723be_enable_hw_security_config,
226f1d2b4d3SLarry Finger .set_key = rtl8723be_set_key,
227f1d2b4d3SLarry Finger .get_bbreg = rtl8723_phy_query_bb_reg,
228f1d2b4d3SLarry Finger .set_bbreg = rtl8723_phy_set_bb_reg,
229f1d2b4d3SLarry Finger .get_rfreg = rtl8723be_phy_query_rf_reg,
230f1d2b4d3SLarry Finger .set_rfreg = rtl8723be_phy_set_rf_reg,
231f1d2b4d3SLarry Finger .fill_h2c_cmd = rtl8723be_fill_h2c_cmd,
232f1d2b4d3SLarry Finger .get_btc_status = rtl8723be_get_btc_status,
233f1d2b4d3SLarry Finger .is_fw_header = is_fw_header,
234f1d2b4d3SLarry Finger };
235f1d2b4d3SLarry Finger
236f1d2b4d3SLarry Finger static struct rtl_mod_params rtl8723be_mod_params = {
237f1d2b4d3SLarry Finger .sw_crypto = false,
238f1d2b4d3SLarry Finger .inactiveps = true,
239f1d2b4d3SLarry Finger .swctrl_lps = false,
240f1d2b4d3SLarry Finger .fwctrl_lps = true,
2417079604dSLarry Finger .msi_support = false,
24284efbad4SPing-Ke Shih .aspm_support = 1,
2437079604dSLarry Finger .disable_watchdog = false,
244c34df318SLarry Finger .debug_level = 0,
245c34df318SLarry Finger .debug_mask = 0,
246c18d8f50SLarry Finger .ant_sel = 0,
247f1d2b4d3SLarry Finger };
248f1d2b4d3SLarry Finger
249d86e6476SJulia Lawall static const struct rtl_hal_cfg rtl8723be_hal_cfg = {
250f1d2b4d3SLarry Finger .bar_id = 2,
251f1d2b4d3SLarry Finger .write_readback = true,
252f1d2b4d3SLarry Finger .name = "rtl8723be_pci",
2531d9b168dSSven Joachim .alt_fw_name = "rtlwifi/rtl8723befw.bin",
254f1d2b4d3SLarry Finger .ops = &rtl8723be_hal_ops,
255f1d2b4d3SLarry Finger .mod_params = &rtl8723be_mod_params,
256f1d2b4d3SLarry Finger .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
257f1d2b4d3SLarry Finger .maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN,
258f1d2b4d3SLarry Finger .maps[SYS_CLK] = REG_SYS_CLKR,
259f1d2b4d3SLarry Finger .maps[MAC_RCR_AM] = AM,
260f1d2b4d3SLarry Finger .maps[MAC_RCR_AB] = AB,
261f1d2b4d3SLarry Finger .maps[MAC_RCR_ACRC32] = ACRC32,
262f1d2b4d3SLarry Finger .maps[MAC_RCR_ACF] = ACF,
263f1d2b4d3SLarry Finger .maps[MAC_RCR_AAP] = AAP,
264f1d2b4d3SLarry Finger .maps[MAC_HIMR] = REG_HIMR,
265f1d2b4d3SLarry Finger .maps[MAC_HIMRE] = REG_HIMRE,
266f1d2b4d3SLarry Finger .maps[MAC_HSISR] = REG_HSISR,
267f1d2b4d3SLarry Finger
268f1d2b4d3SLarry Finger .maps[EFUSE_ACCESS] = REG_EFUSE_ACCESS,
269f1d2b4d3SLarry Finger
270f1d2b4d3SLarry Finger .maps[EFUSE_TEST] = REG_EFUSE_TEST,
271f1d2b4d3SLarry Finger .maps[EFUSE_CTRL] = REG_EFUSE_CTRL,
272f1d2b4d3SLarry Finger .maps[EFUSE_CLK] = 0,
273f1d2b4d3SLarry Finger .maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL,
274f1d2b4d3SLarry Finger .maps[EFUSE_PWC_EV12V] = PWC_EV12V,
275f1d2b4d3SLarry Finger .maps[EFUSE_FEN_ELDR] = FEN_ELDR,
276f1d2b4d3SLarry Finger .maps[EFUSE_LOADER_CLK_EN] = LOADER_CLK_EN,
277f1d2b4d3SLarry Finger .maps[EFUSE_ANA8M] = ANA8M,
278f1d2b4d3SLarry Finger .maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE,
279f1d2b4d3SLarry Finger .maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION,
280f1d2b4d3SLarry Finger .maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN,
281f1d2b4d3SLarry Finger .maps[EFUSE_OOB_PROTECT_BYTES_LEN] = EFUSE_OOB_PROTECT_BYTES,
282f1d2b4d3SLarry Finger
283f1d2b4d3SLarry Finger .maps[RWCAM] = REG_CAMCMD,
284f1d2b4d3SLarry Finger .maps[WCAMI] = REG_CAMWRITE,
285f1d2b4d3SLarry Finger .maps[RCAMO] = REG_CAMREAD,
286f1d2b4d3SLarry Finger .maps[CAMDBG] = REG_CAMDBG,
287f1d2b4d3SLarry Finger .maps[SECR] = REG_SECCFG,
288f1d2b4d3SLarry Finger .maps[SEC_CAM_NONE] = CAM_NONE,
289f1d2b4d3SLarry Finger .maps[SEC_CAM_WEP40] = CAM_WEP40,
290f1d2b4d3SLarry Finger .maps[SEC_CAM_TKIP] = CAM_TKIP,
291f1d2b4d3SLarry Finger .maps[SEC_CAM_AES] = CAM_AES,
292f1d2b4d3SLarry Finger .maps[SEC_CAM_WEP104] = CAM_WEP104,
293f1d2b4d3SLarry Finger
294f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6,
295f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5,
296f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4,
297f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3,
298f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2,
299f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1,
300f1d2b4d3SLarry Finger /* .maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8, */ /*need check*/
301f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7,
302f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6,
303f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5,
304f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4,
305f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3,
306f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2,
307f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1,
308f1d2b4d3SLarry Finger /* .maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2,*/
309f1d2b4d3SLarry Finger /* .maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1,*/
310f1d2b4d3SLarry Finger
311f1d2b4d3SLarry Finger .maps[RTL_IMR_TXFOVW] = IMR_TXFOVW,
312f1d2b4d3SLarry Finger .maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT,
313f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNINT] = IMR_BCNDMAINT0,
314f1d2b4d3SLarry Finger .maps[RTL_IMR_RXFOVW] = IMR_RXFOVW,
315f1d2b4d3SLarry Finger .maps[RTL_IMR_RDU] = IMR_RDU,
316f1d2b4d3SLarry Finger .maps[RTL_IMR_ATIMEND] = IMR_ATIMEND,
317f1d2b4d3SLarry Finger .maps[RTL_IMR_BDOK] = IMR_BCNDOK0,
318f1d2b4d3SLarry Finger .maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK,
319f1d2b4d3SLarry Finger .maps[RTL_IMR_TBDER] = IMR_TBDER,
320f1d2b4d3SLarry Finger .maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK,
321f1d2b4d3SLarry Finger .maps[RTL_IMR_TBDOK] = IMR_TBDOK,
322f1d2b4d3SLarry Finger .maps[RTL_IMR_BKDOK] = IMR_BKDOK,
323f1d2b4d3SLarry Finger .maps[RTL_IMR_BEDOK] = IMR_BEDOK,
324f1d2b4d3SLarry Finger .maps[RTL_IMR_VIDOK] = IMR_VIDOK,
325f1d2b4d3SLarry Finger .maps[RTL_IMR_VODOK] = IMR_VODOK,
326f1d2b4d3SLarry Finger .maps[RTL_IMR_ROK] = IMR_ROK,
327f1d2b4d3SLarry Finger .maps[RTL_IMR_HSISR_IND] = IMR_HSISR_IND_ON_INT,
328f1d2b4d3SLarry Finger .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNDMAINT0 | IMR_TBDOK | IMR_TBDER),
329f1d2b4d3SLarry Finger
330f1d2b4d3SLarry Finger .maps[RTL_RC_CCK_RATE1M] = DESC92C_RATE1M,
331f1d2b4d3SLarry Finger .maps[RTL_RC_CCK_RATE2M] = DESC92C_RATE2M,
332f1d2b4d3SLarry Finger .maps[RTL_RC_CCK_RATE5_5M] = DESC92C_RATE5_5M,
333f1d2b4d3SLarry Finger .maps[RTL_RC_CCK_RATE11M] = DESC92C_RATE11M,
334f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE6M] = DESC92C_RATE6M,
335f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE9M] = DESC92C_RATE9M,
336f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE12M] = DESC92C_RATE12M,
337f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE18M] = DESC92C_RATE18M,
338f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE24M] = DESC92C_RATE24M,
339f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE36M] = DESC92C_RATE36M,
340f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE48M] = DESC92C_RATE48M,
341f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE54M] = DESC92C_RATE54M,
342f1d2b4d3SLarry Finger
343f1d2b4d3SLarry Finger .maps[RTL_RC_HT_RATEMCS7] = DESC92C_RATEMCS7,
344f1d2b4d3SLarry Finger .maps[RTL_RC_HT_RATEMCS15] = DESC92C_RATEMCS15,
345f1d2b4d3SLarry Finger };
346f1d2b4d3SLarry Finger
3478c6f0f5bSArvind Yadav static const struct pci_device_id rtl8723be_pci_ids[] = {
348f1d2b4d3SLarry Finger {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0xB723, rtl8723be_hal_cfg)},
349f1d2b4d3SLarry Finger {},
350f1d2b4d3SLarry Finger };
351f1d2b4d3SLarry Finger
352f1d2b4d3SLarry Finger MODULE_DEVICE_TABLE(pci, rtl8723be_pci_ids);
353f1d2b4d3SLarry Finger
354f1d2b4d3SLarry Finger MODULE_AUTHOR("PageHe <page_he@realsil.com.cn>");
355f1d2b4d3SLarry Finger MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>");
356f1d2b4d3SLarry Finger MODULE_LICENSE("GPL");
357f1d2b4d3SLarry Finger MODULE_DESCRIPTION("Realtek 8723BE 802.11n PCI wireless");
358f1d2b4d3SLarry Finger MODULE_FIRMWARE("rtlwifi/rtl8723befw.bin");
359f70e4df2SLarry Finger MODULE_FIRMWARE("rtlwifi/rtl8723befw_36.bin");
360f1d2b4d3SLarry Finger
361f1d2b4d3SLarry Finger module_param_named(swenc, rtl8723be_mod_params.sw_crypto, bool, 0444);
362c34df318SLarry Finger module_param_named(debug_level, rtl8723be_mod_params.debug_level, int, 0644);
363c34df318SLarry Finger module_param_named(debug_mask, rtl8723be_mod_params.debug_mask, ullong, 0644);
364f1d2b4d3SLarry Finger module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444);
365f1d2b4d3SLarry Finger module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444);
366f1d2b4d3SLarry Finger module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444);
367f1d2b4d3SLarry Finger module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444);
36884efbad4SPing-Ke Shih module_param_named(aspm, rtl8723be_mod_params.aspm_support, int, 0444);
369f1d2b4d3SLarry Finger module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog,
370f1d2b4d3SLarry Finger bool, 0444);
371c18d8f50SLarry Finger module_param_named(ant_sel, rtl8723be_mod_params.ant_sel, int, 0444);
372f1d2b4d3SLarry Finger MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
373f1d2b4d3SLarry Finger MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n");
374f1d2b4d3SLarry Finger MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n");
375f1d2b4d3SLarry Finger MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
376f1d2b4d3SLarry Finger MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 0)\n");
37784efbad4SPing-Ke Shih MODULE_PARM_DESC(aspm, "Set to 1 to enable ASPM (default 1)\n");
378c34df318SLarry Finger MODULE_PARM_DESC(debug_level, "Set debug level (0-5) (default 0)");
379c34df318SLarry Finger MODULE_PARM_DESC(debug_mask, "Set debug mask (default 0)");
380f1d2b4d3SLarry Finger MODULE_PARM_DESC(disable_watchdog,
381f1d2b4d3SLarry Finger "Set to 1 to disable the watchdog (default 0)\n");
382c18d8f50SLarry Finger MODULE_PARM_DESC(ant_sel, "Set to 1 or 2 to force antenna number (default 0)\n");
383f1d2b4d3SLarry Finger
384f1d2b4d3SLarry Finger static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
385f1d2b4d3SLarry Finger
386f1d2b4d3SLarry Finger static struct pci_driver rtl8723be_driver = {
387f1d2b4d3SLarry Finger .name = KBUILD_MODNAME,
388f1d2b4d3SLarry Finger .id_table = rtl8723be_pci_ids,
389f1d2b4d3SLarry Finger .probe = rtl_pci_probe,
390f1d2b4d3SLarry Finger .remove = rtl_pci_disconnect,
391f1d2b4d3SLarry Finger .driver.pm = &rtlwifi_pm_ops,
392f1d2b4d3SLarry Finger };
393f1d2b4d3SLarry Finger
394f1d2b4d3SLarry Finger module_pci_driver(rtl8723be_driver);
395