103f3dd37SLarry Finger // SPDX-License-Identifier: GPL-2.0
203f3dd37SLarry Finger /* Copyright(c) 2009-2010 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 "dm.h"
11f1d2b4d3SLarry Finger #include "hw.h"
12f1d2b4d3SLarry Finger #include "fw.h"
13f1d2b4d3SLarry Finger #include "trx.h"
14f1d2b4d3SLarry Finger #include "led.h"
15f1d2b4d3SLarry Finger #include "table.h"
16f1d2b4d3SLarry Finger #include "../btcoexist/rtl_btc.h"
17f1d2b4d3SLarry Finger
18f1d2b4d3SLarry Finger #include <linux/vmalloc.h>
19f1d2b4d3SLarry Finger #include <linux/module.h>
20f1d2b4d3SLarry Finger
rtl8821ae_init_aspm_vars(struct ieee80211_hw * hw)21f1d2b4d3SLarry Finger static void rtl8821ae_init_aspm_vars(struct ieee80211_hw *hw)
22f1d2b4d3SLarry Finger {
2384efbad4SPing-Ke Shih struct rtl_priv *rtlpriv = rtl_priv(hw);
24f1d2b4d3SLarry Finger struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
25f1d2b4d3SLarry Finger
26f1d2b4d3SLarry Finger /*close ASPM for AMD defaultly */
27f1d2b4d3SLarry Finger rtlpci->const_amdpci_aspm = 0;
28f1d2b4d3SLarry Finger
29f1d2b4d3SLarry Finger /**
30f1d2b4d3SLarry Finger * ASPM PS mode.
31f1d2b4d3SLarry Finger * 0 - Disable ASPM,
32f1d2b4d3SLarry Finger * 1 - Enable ASPM without Clock Req,
33f1d2b4d3SLarry Finger * 2 - Enable ASPM with Clock Req,
34f1d2b4d3SLarry Finger * 3 - Alwyas Enable ASPM with Clock Req,
35f1d2b4d3SLarry Finger * 4 - Always Enable ASPM without Clock Req.
36f1d2b4d3SLarry Finger * set defult to RTL8192CE:3 RTL8192E:2
37f1d2b4d3SLarry Finger */
38f1d2b4d3SLarry Finger rtlpci->const_pci_aspm = 3;
39f1d2b4d3SLarry Finger
40f1d2b4d3SLarry Finger /*Setting for PCI-E device */
41f1d2b4d3SLarry Finger rtlpci->const_devicepci_aspm_setting = 0x03;
42f1d2b4d3SLarry Finger
43f1d2b4d3SLarry Finger /*Setting for PCI-E bridge */
44f1d2b4d3SLarry Finger rtlpci->const_hostpci_aspm_setting = 0x02;
45f1d2b4d3SLarry Finger
46f1d2b4d3SLarry Finger /**
47f1d2b4d3SLarry Finger * In Hw/Sw Radio Off situation.
48f1d2b4d3SLarry Finger * 0 - Default,
49f1d2b4d3SLarry Finger * 1 - From ASPM setting without low Mac Pwr,
50f1d2b4d3SLarry Finger * 2 - From ASPM setting with low Mac Pwr,
51f1d2b4d3SLarry Finger * 3 - Bus D3
52f1d2b4d3SLarry Finger * set default to RTL8192CE:0 RTL8192SE:2
53f1d2b4d3SLarry Finger */
54f1d2b4d3SLarry Finger rtlpci->const_hwsw_rfoff_d3 = 0;
55f1d2b4d3SLarry Finger
56f1d2b4d3SLarry Finger /**
57f1d2b4d3SLarry Finger * This setting works for those device with
58f1d2b4d3SLarry Finger * backdoor ASPM setting such as EPHY setting.
59f1d2b4d3SLarry Finger * 0 - Not support ASPM,
60f1d2b4d3SLarry Finger * 1 - Support ASPM,
61f1d2b4d3SLarry Finger * 2 - According to chipset.
62f1d2b4d3SLarry Finger */
6384efbad4SPing-Ke Shih rtlpci->const_support_pciaspm = rtlpriv->cfg->mod_params->aspm_support;
64f1d2b4d3SLarry Finger }
65f1d2b4d3SLarry Finger
66f1d2b4d3SLarry Finger /*InitializeVariables8812E*/
rtl8821ae_init_sw_vars(struct ieee80211_hw * hw)678ddd4a2aSAmadeusz Sławiński static int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
68f1d2b4d3SLarry Finger {
69f1d2b4d3SLarry Finger int err = 0;
70f1d2b4d3SLarry Finger struct rtl_priv *rtlpriv = rtl_priv(hw);
71f1d2b4d3SLarry Finger struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
72f1d2b4d3SLarry Finger struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
73f1d2b4d3SLarry Finger struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
74cf4747d7SLarry Finger char *fw_name, *wowlan_fw_name;
75f1d2b4d3SLarry Finger
76f1d2b4d3SLarry Finger rtl8821ae_bt_reg_init(hw);
77f1d2b4d3SLarry Finger rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer();
78f1d2b4d3SLarry Finger
79*e8277abdSJason Yan rtlpriv->dm.dm_initialgain_enable = true;
80f1d2b4d3SLarry Finger rtlpriv->dm.dm_flag = 0;
81*e8277abdSJason Yan rtlpriv->dm.disable_framebursting = false;
82f1d2b4d3SLarry Finger rtlpriv->dm.thermalvalue = 0;
83f1d2b4d3SLarry Finger rtlpci->transmit_config = CFENDFORM | BIT(15) | BIT(24) | BIT(25);
84f1d2b4d3SLarry Finger
85f1d2b4d3SLarry Finger mac->ht_enable = true;
86f1d2b4d3SLarry Finger mac->ht_cur_stbc = 0;
87f1d2b4d3SLarry Finger mac->ht_stbc_cap = 0;
88f1d2b4d3SLarry Finger mac->vht_cur_ldpc = 0;
89f1d2b4d3SLarry Finger mac->vht_ldpc_cap = 0;
90f1d2b4d3SLarry Finger mac->vht_cur_stbc = 0;
91f1d2b4d3SLarry Finger mac->vht_stbc_cap = 0;
92f1d2b4d3SLarry Finger
93f1d2b4d3SLarry Finger rtlpriv->rtlhal.current_bandtype = BAND_ON_2_4G;
94f1d2b4d3SLarry Finger /*following 2 is for register 5G band, refer to _rtl_init_mac80211()*/
95f1d2b4d3SLarry Finger rtlpriv->rtlhal.bandset = BAND_ON_BOTH;
96f1d2b4d3SLarry Finger rtlpriv->rtlhal.macphymode = SINGLEMAC_SINGLEPHY;
97f1d2b4d3SLarry Finger
98f1d2b4d3SLarry Finger rtlpci->receive_config = (RCR_APPFCS |
99f1d2b4d3SLarry Finger RCR_APP_MIC |
100f1d2b4d3SLarry Finger RCR_APP_ICV |
101f1d2b4d3SLarry Finger RCR_APP_PHYST_RXFF |
102f1d2b4d3SLarry Finger RCR_NONQOS_VHT |
103f1d2b4d3SLarry Finger RCR_HTC_LOC_CTRL |
104f1d2b4d3SLarry Finger RCR_AMF |
105f1d2b4d3SLarry Finger RCR_ACF |
106f1d2b4d3SLarry Finger /*This bit controls the PS-Poll packet filter.*/
107f1d2b4d3SLarry Finger RCR_ADF |
108f1d2b4d3SLarry Finger RCR_AICV |
109f1d2b4d3SLarry Finger RCR_ACRC32 |
110f1d2b4d3SLarry Finger RCR_AB |
111f1d2b4d3SLarry Finger RCR_AM |
112f1d2b4d3SLarry Finger RCR_APM |
113f1d2b4d3SLarry Finger 0);
114f1d2b4d3SLarry Finger
115f1d2b4d3SLarry Finger rtlpci->irq_mask[0] =
116f1d2b4d3SLarry Finger (u32)(IMR_PSTIMEOUT |
117f1d2b4d3SLarry Finger IMR_GTINT3 |
118f1d2b4d3SLarry Finger IMR_HSISR_IND_ON_INT |
119f1d2b4d3SLarry Finger IMR_C2HCMD |
120f1d2b4d3SLarry Finger IMR_HIGHDOK |
121f1d2b4d3SLarry Finger IMR_MGNTDOK |
122f1d2b4d3SLarry Finger IMR_BKDOK |
123f1d2b4d3SLarry Finger IMR_BEDOK |
124f1d2b4d3SLarry Finger IMR_VIDOK |
125f1d2b4d3SLarry Finger IMR_VODOK |
126f1d2b4d3SLarry Finger IMR_RDU |
127f1d2b4d3SLarry Finger IMR_ROK |
128f1d2b4d3SLarry Finger 0);
129f1d2b4d3SLarry Finger
130f1d2b4d3SLarry Finger rtlpci->irq_mask[1] =
131f1d2b4d3SLarry Finger (u32)(IMR_RXFOVW |
132f1d2b4d3SLarry Finger IMR_TXFOVW |
133f1d2b4d3SLarry Finger 0);
134f1d2b4d3SLarry Finger rtlpci->sys_irq_mask = (u32)(HSIMR_PDN_INT_EN |
135f1d2b4d3SLarry Finger HSIMR_RON_INT_EN |
136f1d2b4d3SLarry Finger 0);
137f1d2b4d3SLarry Finger /* for WOWLAN */
138f1d2b4d3SLarry Finger rtlpriv->psc.wo_wlan_mode = WAKE_ON_MAGIC_PACKET |
139f1d2b4d3SLarry Finger WAKE_ON_PATTERN_MATCH;
140f1d2b4d3SLarry Finger
141f1d2b4d3SLarry Finger /* for LPS & IPS */
142f1d2b4d3SLarry Finger rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps;
143f1d2b4d3SLarry Finger rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
144f1d2b4d3SLarry Finger rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
145f1d2b4d3SLarry Finger rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
14678bae1deSLarry Finger rtlpci->int_clear = rtlpriv->cfg->mod_params->int_clear;
147f1d2b4d3SLarry Finger if (rtlpriv->cfg->mod_params->disable_watchdog)
148f1d2b4d3SLarry Finger pr_info("watchdog disabled\n");
1491024b316SPing-Ke Shih rtlpriv->psc.reg_fwctrl_lps = 2;
1501024b316SPing-Ke Shih rtlpriv->psc.reg_max_lps_awakeintvl = 2;
151f1d2b4d3SLarry Finger
152f1d2b4d3SLarry Finger /* for ASPM, you can close aspm through
153f1d2b4d3SLarry Finger * set const_support_pciaspm = 0
154f1d2b4d3SLarry Finger */
155f1d2b4d3SLarry Finger rtl8821ae_init_aspm_vars(hw);
156f1d2b4d3SLarry Finger
157f1d2b4d3SLarry Finger if (rtlpriv->psc.reg_fwctrl_lps == 1)
158f1d2b4d3SLarry Finger rtlpriv->psc.fwctrl_psmode = FW_PS_MIN_MODE;
159f1d2b4d3SLarry Finger else if (rtlpriv->psc.reg_fwctrl_lps == 2)
160f1d2b4d3SLarry Finger rtlpriv->psc.fwctrl_psmode = FW_PS_MAX_MODE;
161f1d2b4d3SLarry Finger else if (rtlpriv->psc.reg_fwctrl_lps == 3)
162f1d2b4d3SLarry Finger rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE;
163f1d2b4d3SLarry Finger
164f1d2b4d3SLarry Finger /* for firmware buf */
165f1d2b4d3SLarry Finger rtlpriv->rtlhal.pfirmware = vzalloc(0x8000);
166f1d2b4d3SLarry Finger if (!rtlpriv->rtlhal.pfirmware) {
167004a1e16SLarry Finger pr_err("Can't alloc buffer for fw.\n");
168f1d2b4d3SLarry Finger return 1;
169f1d2b4d3SLarry Finger }
170f1d2b4d3SLarry Finger rtlpriv->rtlhal.wowlan_firmware = vzalloc(0x8000);
171f1d2b4d3SLarry Finger if (!rtlpriv->rtlhal.wowlan_firmware) {
172004a1e16SLarry Finger pr_err("Can't alloc buffer for wowlan fw.\n");
173f2764f61SSouptick Joarder vfree(rtlpriv->rtlhal.pfirmware);
174f2764f61SSouptick Joarder rtlpriv->rtlhal.pfirmware = NULL;
175f1d2b4d3SLarry Finger return 1;
176f1d2b4d3SLarry Finger }
177f1d2b4d3SLarry Finger
178f1d2b4d3SLarry Finger if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) {
179cf4747d7SLarry Finger fw_name = "rtlwifi/rtl8812aefw.bin";
180cf4747d7SLarry Finger wowlan_fw_name = "rtlwifi/rtl8812aefw_wowlan.bin";
181f1d2b4d3SLarry Finger } else {
182f70e4df2SLarry Finger fw_name = "rtlwifi/rtl8821aefw_29.bin";
183cf4747d7SLarry Finger wowlan_fw_name = "rtlwifi/rtl8821aefw_wowlan.bin";
184f1d2b4d3SLarry Finger }
185f1d2b4d3SLarry Finger
186f1d2b4d3SLarry Finger rtlpriv->max_fw_size = 0x8000;
187f1d2b4d3SLarry Finger /*load normal firmware*/
188cf4747d7SLarry Finger pr_info("Using firmware %s\n", fw_name);
189cf4747d7SLarry Finger err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
190f1d2b4d3SLarry Finger rtlpriv->io.dev, GFP_KERNEL, hw,
191f1d2b4d3SLarry Finger rtl_fw_cb);
192f1d2b4d3SLarry Finger if (err) {
193004a1e16SLarry Finger pr_err("Failed to request normal firmware!\n");
194f2764f61SSouptick Joarder vfree(rtlpriv->rtlhal.wowlan_firmware);
195f2764f61SSouptick Joarder vfree(rtlpriv->rtlhal.pfirmware);
196f1d2b4d3SLarry Finger return 1;
197f1d2b4d3SLarry Finger }
198f1d2b4d3SLarry Finger /*load wowlan firmware*/
199cf4747d7SLarry Finger pr_info("Using firmware %s\n", wowlan_fw_name);
200f1d2b4d3SLarry Finger err = request_firmware_nowait(THIS_MODULE, 1,
201cf4747d7SLarry Finger wowlan_fw_name,
202f1d2b4d3SLarry Finger rtlpriv->io.dev, GFP_KERNEL, hw,
203f1d2b4d3SLarry Finger rtl_wowlan_fw_cb);
204f1d2b4d3SLarry Finger if (err) {
205004a1e16SLarry Finger pr_err("Failed to request wowlan firmware!\n");
206f2764f61SSouptick Joarder vfree(rtlpriv->rtlhal.wowlan_firmware);
207f2764f61SSouptick Joarder vfree(rtlpriv->rtlhal.pfirmware);
208f1d2b4d3SLarry Finger return 1;
209f1d2b4d3SLarry Finger }
210f1d2b4d3SLarry Finger return 0;
211f1d2b4d3SLarry Finger }
212f1d2b4d3SLarry Finger
rtl8821ae_deinit_sw_vars(struct ieee80211_hw * hw)2138ddd4a2aSAmadeusz Sławiński static void rtl8821ae_deinit_sw_vars(struct ieee80211_hw *hw)
214f1d2b4d3SLarry Finger {
215f1d2b4d3SLarry Finger struct rtl_priv *rtlpriv = rtl_priv(hw);
216f1d2b4d3SLarry Finger
217f1d2b4d3SLarry Finger if (rtlpriv->rtlhal.pfirmware) {
218f1d2b4d3SLarry Finger vfree(rtlpriv->rtlhal.pfirmware);
219f1d2b4d3SLarry Finger rtlpriv->rtlhal.pfirmware = NULL;
220f1d2b4d3SLarry Finger }
221f1d2b4d3SLarry Finger #if (USE_SPECIFIC_FW_TO_SUPPORT_WOWLAN == 1)
222f1d2b4d3SLarry Finger if (rtlpriv->rtlhal.wowlan_firmware) {
223f1d2b4d3SLarry Finger vfree(rtlpriv->rtlhal.wowlan_firmware);
224f1d2b4d3SLarry Finger rtlpriv->rtlhal.wowlan_firmware = NULL;
225f1d2b4d3SLarry Finger }
226f1d2b4d3SLarry Finger #endif
227f1d2b4d3SLarry Finger }
228f1d2b4d3SLarry Finger
229f1d2b4d3SLarry Finger /* get bt coexist status */
rtl8821ae_get_btc_status(void)2308ddd4a2aSAmadeusz Sławiński static bool rtl8821ae_get_btc_status(void)
231f1d2b4d3SLarry Finger {
232f1d2b4d3SLarry Finger return true;
233f1d2b4d3SLarry Finger }
234f1d2b4d3SLarry Finger
235f1d2b4d3SLarry Finger static struct rtl_hal_ops rtl8821ae_hal_ops = {
236f1d2b4d3SLarry Finger .init_sw_vars = rtl8821ae_init_sw_vars,
237f1d2b4d3SLarry Finger .deinit_sw_vars = rtl8821ae_deinit_sw_vars,
238f1d2b4d3SLarry Finger .read_eeprom_info = rtl8821ae_read_eeprom_info,
239f1d2b4d3SLarry Finger .interrupt_recognized = rtl8821ae_interrupt_recognized,
240f1d2b4d3SLarry Finger .hw_init = rtl8821ae_hw_init,
241f1d2b4d3SLarry Finger .hw_disable = rtl8821ae_card_disable,
242f1d2b4d3SLarry Finger .hw_suspend = rtl8821ae_suspend,
243f1d2b4d3SLarry Finger .hw_resume = rtl8821ae_resume,
244f1d2b4d3SLarry Finger .enable_interrupt = rtl8821ae_enable_interrupt,
245f1d2b4d3SLarry Finger .disable_interrupt = rtl8821ae_disable_interrupt,
246f1d2b4d3SLarry Finger .set_network_type = rtl8821ae_set_network_type,
247f1d2b4d3SLarry Finger .set_chk_bssid = rtl8821ae_set_check_bssid,
248f1d2b4d3SLarry Finger .set_qos = rtl8821ae_set_qos,
249f1d2b4d3SLarry Finger .set_bcn_reg = rtl8821ae_set_beacon_related_registers,
250f1d2b4d3SLarry Finger .set_bcn_intv = rtl8821ae_set_beacon_interval,
251f1d2b4d3SLarry Finger .update_interrupt_mask = rtl8821ae_update_interrupt_mask,
252f1d2b4d3SLarry Finger .get_hw_reg = rtl8821ae_get_hw_reg,
253f1d2b4d3SLarry Finger .set_hw_reg = rtl8821ae_set_hw_reg,
254f1d2b4d3SLarry Finger .update_rate_tbl = rtl8821ae_update_hal_rate_tbl,
255f1d2b4d3SLarry Finger .fill_tx_desc = rtl8821ae_tx_fill_desc,
256f1d2b4d3SLarry Finger .fill_tx_cmddesc = rtl8821ae_tx_fill_cmddesc,
257f1d2b4d3SLarry Finger .query_rx_desc = rtl8821ae_rx_query_desc,
258f1d2b4d3SLarry Finger .set_channel_access = rtl8821ae_update_channel_access_setting,
259f1d2b4d3SLarry Finger .radio_onoff_checking = rtl8821ae_gpio_radio_on_off_checking,
260f1d2b4d3SLarry Finger .set_bw_mode = rtl8821ae_phy_set_bw_mode,
261f1d2b4d3SLarry Finger .switch_channel = rtl8821ae_phy_sw_chnl,
262f1d2b4d3SLarry Finger .dm_watchdog = rtl8821ae_dm_watchdog,
263f1d2b4d3SLarry Finger .scan_operation_backup = rtl8821ae_phy_scan_operation_backup,
264f1d2b4d3SLarry Finger .set_rf_power_state = rtl8821ae_phy_set_rf_power_state,
265f1d2b4d3SLarry Finger .led_control = rtl8821ae_led_control,
266f1d2b4d3SLarry Finger .set_desc = rtl8821ae_set_desc,
267f1d2b4d3SLarry Finger .get_desc = rtl8821ae_get_desc,
268f1d2b4d3SLarry Finger .is_tx_desc_closed = rtl8821ae_is_tx_desc_closed,
269f1d2b4d3SLarry Finger .tx_polling = rtl8821ae_tx_polling,
270f1d2b4d3SLarry Finger .enable_hw_sec = rtl8821ae_enable_hw_security_config,
271f1d2b4d3SLarry Finger .set_key = rtl8821ae_set_key,
272f1d2b4d3SLarry Finger .get_bbreg = rtl8821ae_phy_query_bb_reg,
273f1d2b4d3SLarry Finger .set_bbreg = rtl8821ae_phy_set_bb_reg,
274f1d2b4d3SLarry Finger .get_rfreg = rtl8821ae_phy_query_rf_reg,
275f1d2b4d3SLarry Finger .set_rfreg = rtl8821ae_phy_set_rf_reg,
276f1d2b4d3SLarry Finger .fill_h2c_cmd = rtl8821ae_fill_h2c_cmd,
277f1d2b4d3SLarry Finger .get_btc_status = rtl8821ae_get_btc_status,
27816cefa44SPing-Ke Shih .c2h_ra_report_handler = rtl8821ae_c2h_ra_report_handler,
279f1d2b4d3SLarry Finger .add_wowlan_pattern = rtl8821ae_add_wowlan_pattern,
280f1d2b4d3SLarry Finger };
281f1d2b4d3SLarry Finger
282f1d2b4d3SLarry Finger static struct rtl_mod_params rtl8821ae_mod_params = {
283f1d2b4d3SLarry Finger .sw_crypto = false,
284f1d2b4d3SLarry Finger .inactiveps = true,
285f1d2b4d3SLarry Finger .swctrl_lps = false,
286f1d2b4d3SLarry Finger .fwctrl_lps = true,
287f1d2b4d3SLarry Finger .msi_support = true,
28884efbad4SPing-Ke Shih .aspm_support = 1,
289d59542ddSDavid S. Miller .int_clear = true,
290c34df318SLarry Finger .debug_level = 0,
291c34df318SLarry Finger .debug_mask = 0,
292f1d2b4d3SLarry Finger .disable_watchdog = 0,
293f1d2b4d3SLarry Finger };
294f1d2b4d3SLarry Finger
295d86e6476SJulia Lawall static const struct rtl_hal_cfg rtl8821ae_hal_cfg = {
296f1d2b4d3SLarry Finger .bar_id = 2,
297f1d2b4d3SLarry Finger .write_readback = true,
298f1d2b4d3SLarry Finger .name = "rtl8821ae_pci",
2991d9b168dSSven Joachim .alt_fw_name = "rtlwifi/rtl8821aefw.bin",
300f1d2b4d3SLarry Finger .ops = &rtl8821ae_hal_ops,
301f1d2b4d3SLarry Finger .mod_params = &rtl8821ae_mod_params,
3021ca72c30SPing-Ke Shih .spec_ver = RTL_SPEC_SUPPORT_VHT,
303f1d2b4d3SLarry Finger .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
304f1d2b4d3SLarry Finger .maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN,
305f1d2b4d3SLarry Finger .maps[SYS_CLK] = REG_SYS_CLKR,
306f1d2b4d3SLarry Finger .maps[MAC_RCR_AM] = AM,
307f1d2b4d3SLarry Finger .maps[MAC_RCR_AB] = AB,
308f1d2b4d3SLarry Finger .maps[MAC_RCR_ACRC32] = ACRC32,
309f1d2b4d3SLarry Finger .maps[MAC_RCR_ACF] = ACF,
310f1d2b4d3SLarry Finger .maps[MAC_RCR_AAP] = AAP,
311f1d2b4d3SLarry Finger .maps[MAC_HIMR] = REG_HIMR,
312f1d2b4d3SLarry Finger .maps[MAC_HIMRE] = REG_HIMRE,
313f1d2b4d3SLarry Finger
314f1d2b4d3SLarry Finger .maps[EFUSE_ACCESS] = REG_EFUSE_ACCESS,
315f1d2b4d3SLarry Finger
316f1d2b4d3SLarry Finger .maps[EFUSE_TEST] = REG_EFUSE_TEST,
317f1d2b4d3SLarry Finger .maps[EFUSE_CTRL] = REG_EFUSE_CTRL,
318f1d2b4d3SLarry Finger .maps[EFUSE_CLK] = 0,
319f1d2b4d3SLarry Finger .maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL,
320f1d2b4d3SLarry Finger .maps[EFUSE_PWC_EV12V] = PWC_EV12V,
321f1d2b4d3SLarry Finger .maps[EFUSE_FEN_ELDR] = FEN_ELDR,
322f1d2b4d3SLarry Finger .maps[EFUSE_LOADER_CLK_EN] = LOADER_CLK_EN,
323f1d2b4d3SLarry Finger .maps[EFUSE_ANA8M] = ANA8M,
324f1d2b4d3SLarry Finger .maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE,
325f1d2b4d3SLarry Finger .maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION,
326f1d2b4d3SLarry Finger .maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN,
327f1d2b4d3SLarry Finger .maps[EFUSE_OOB_PROTECT_BYTES_LEN] = EFUSE_OOB_PROTECT_BYTES,
328f1d2b4d3SLarry Finger
329f1d2b4d3SLarry Finger .maps[RWCAM] = REG_CAMCMD,
330f1d2b4d3SLarry Finger .maps[WCAMI] = REG_CAMWRITE,
331f1d2b4d3SLarry Finger .maps[RCAMO] = REG_CAMREAD,
332f1d2b4d3SLarry Finger .maps[CAMDBG] = REG_CAMDBG,
333f1d2b4d3SLarry Finger .maps[SECR] = REG_SECCFG,
334f1d2b4d3SLarry Finger .maps[SEC_CAM_NONE] = CAM_NONE,
335f1d2b4d3SLarry Finger .maps[SEC_CAM_WEP40] = CAM_WEP40,
336f1d2b4d3SLarry Finger .maps[SEC_CAM_TKIP] = CAM_TKIP,
337f1d2b4d3SLarry Finger .maps[SEC_CAM_AES] = CAM_AES,
338f1d2b4d3SLarry Finger .maps[SEC_CAM_WEP104] = CAM_WEP104,
339f1d2b4d3SLarry Finger
340f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6,
341f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5,
342f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4,
343f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3,
344f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2,
345f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1,
346f1d2b4d3SLarry Finger /* .maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8, */ /*need check*/
347f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7,
348f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6,
349f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5,
350f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4,
351f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3,
352f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2,
353f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1,
354f1d2b4d3SLarry Finger /* .maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2,*/
355f1d2b4d3SLarry Finger /* .maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1,*/
356f1d2b4d3SLarry Finger
357f1d2b4d3SLarry Finger .maps[RTL_IMR_TXFOVW] = IMR_TXFOVW,
358f1d2b4d3SLarry Finger .maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT,
359f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNINT] = IMR_BCNDMAINT0,
360f1d2b4d3SLarry Finger .maps[RTL_IMR_RXFOVW] = IMR_RXFOVW,
361f1d2b4d3SLarry Finger .maps[RTL_IMR_RDU] = IMR_RDU,
362f1d2b4d3SLarry Finger .maps[RTL_IMR_ATIMEND] = IMR_ATIMEND,
363f1d2b4d3SLarry Finger .maps[RTL_IMR_BDOK] = IMR_BCNDOK0,
364f1d2b4d3SLarry Finger .maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK,
365f1d2b4d3SLarry Finger .maps[RTL_IMR_TBDER] = IMR_TBDER,
366f1d2b4d3SLarry Finger .maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK,
367f1d2b4d3SLarry Finger .maps[RTL_IMR_TBDOK] = IMR_TBDOK,
368f1d2b4d3SLarry Finger .maps[RTL_IMR_BKDOK] = IMR_BKDOK,
369f1d2b4d3SLarry Finger .maps[RTL_IMR_BEDOK] = IMR_BEDOK,
370f1d2b4d3SLarry Finger .maps[RTL_IMR_VIDOK] = IMR_VIDOK,
371f1d2b4d3SLarry Finger .maps[RTL_IMR_VODOK] = IMR_VODOK,
372f1d2b4d3SLarry Finger .maps[RTL_IMR_ROK] = IMR_ROK,
373f1d2b4d3SLarry Finger .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNDMAINT0 | IMR_TBDOK | IMR_TBDER),
374f1d2b4d3SLarry Finger
375f1d2b4d3SLarry Finger .maps[RTL_RC_CCK_RATE1M] = DESC_RATE1M,
376f1d2b4d3SLarry Finger .maps[RTL_RC_CCK_RATE2M] = DESC_RATE2M,
377f1d2b4d3SLarry Finger .maps[RTL_RC_CCK_RATE5_5M] = DESC_RATE5_5M,
378f1d2b4d3SLarry Finger .maps[RTL_RC_CCK_RATE11M] = DESC_RATE11M,
379f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE6M] = DESC_RATE6M,
380f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE9M] = DESC_RATE9M,
381f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE12M] = DESC_RATE12M,
382f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE18M] = DESC_RATE18M,
383f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE24M] = DESC_RATE24M,
384f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE36M] = DESC_RATE36M,
385f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE48M] = DESC_RATE48M,
386f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE54M] = DESC_RATE54M,
387f1d2b4d3SLarry Finger
388f1d2b4d3SLarry Finger .maps[RTL_RC_HT_RATEMCS7] = DESC_RATEMCS7,
389f1d2b4d3SLarry Finger .maps[RTL_RC_HT_RATEMCS15] = DESC_RATEMCS15,
390f1d2b4d3SLarry Finger
391f1d2b4d3SLarry Finger /*VHT hightest rate*/
392f1d2b4d3SLarry Finger .maps[RTL_RC_VHT_RATE_1SS_MCS7] = DESC_RATEVHT1SS_MCS7,
393f1d2b4d3SLarry Finger .maps[RTL_RC_VHT_RATE_1SS_MCS8] = DESC_RATEVHT1SS_MCS8,
394f1d2b4d3SLarry Finger .maps[RTL_RC_VHT_RATE_1SS_MCS9] = DESC_RATEVHT1SS_MCS9,
395f1d2b4d3SLarry Finger .maps[RTL_RC_VHT_RATE_2SS_MCS7] = DESC_RATEVHT2SS_MCS7,
396f1d2b4d3SLarry Finger .maps[RTL_RC_VHT_RATE_2SS_MCS8] = DESC_RATEVHT2SS_MCS8,
397f1d2b4d3SLarry Finger .maps[RTL_RC_VHT_RATE_2SS_MCS9] = DESC_RATEVHT2SS_MCS9,
398f1d2b4d3SLarry Finger };
399f1d2b4d3SLarry Finger
400468952f1SArvind Yadav static const struct pci_device_id rtl8821ae_pci_ids[] = {
401f1d2b4d3SLarry Finger {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8812, rtl8821ae_hal_cfg)},
402f1d2b4d3SLarry Finger {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8821, rtl8821ae_hal_cfg)},
403f1d2b4d3SLarry Finger {},
404f1d2b4d3SLarry Finger };
405f1d2b4d3SLarry Finger
406f1d2b4d3SLarry Finger MODULE_DEVICE_TABLE(pci, rtl8821ae_pci_ids);
407f1d2b4d3SLarry Finger
408f1d2b4d3SLarry Finger MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>");
409f1d2b4d3SLarry Finger MODULE_LICENSE("GPL");
410f1d2b4d3SLarry Finger MODULE_DESCRIPTION("Realtek 8821ae 802.11ac PCI wireless");
411f1d2b4d3SLarry Finger MODULE_FIRMWARE("rtlwifi/rtl8821aefw.bin");
412f70e4df2SLarry Finger MODULE_FIRMWARE("rtlwifi/rtl8821aefw_29.bin");
413f1d2b4d3SLarry Finger
414f1d2b4d3SLarry Finger module_param_named(swenc, rtl8821ae_mod_params.sw_crypto, bool, 0444);
415c34df318SLarry Finger module_param_named(debug_level, rtl8821ae_mod_params.debug_level, int, 0644);
416c34df318SLarry Finger module_param_named(debug_mask, rtl8821ae_mod_params.debug_mask, ullong, 0644);
417f1d2b4d3SLarry Finger module_param_named(ips, rtl8821ae_mod_params.inactiveps, bool, 0444);
418f1d2b4d3SLarry Finger module_param_named(swlps, rtl8821ae_mod_params.swctrl_lps, bool, 0444);
419f1d2b4d3SLarry Finger module_param_named(fwlps, rtl8821ae_mod_params.fwctrl_lps, bool, 0444);
420f1d2b4d3SLarry Finger module_param_named(msi, rtl8821ae_mod_params.msi_support, bool, 0444);
42184efbad4SPing-Ke Shih module_param_named(aspm, rtl8821ae_mod_params.aspm_support, int, 0444);
422f1d2b4d3SLarry Finger module_param_named(disable_watchdog, rtl8821ae_mod_params.disable_watchdog,
423f1d2b4d3SLarry Finger bool, 0444);
424d59542ddSDavid S. Miller module_param_named(int_clear, rtl8821ae_mod_params.int_clear, bool, 0444);
425f1d2b4d3SLarry Finger MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
426f1d2b4d3SLarry Finger MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n");
427f1d2b4d3SLarry Finger MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n");
428f1d2b4d3SLarry Finger MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
429f1d2b4d3SLarry Finger MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 1)\n");
43084efbad4SPing-Ke Shih MODULE_PARM_DESC(aspm, "Set to 1 to enable ASPM (default 1)\n");
431c34df318SLarry Finger MODULE_PARM_DESC(debug_level, "Set debug level (0-5) (default 0)");
432c34df318SLarry Finger MODULE_PARM_DESC(debug_mask, "Set debug mask (default 0)");
433f1d2b4d3SLarry Finger MODULE_PARM_DESC(disable_watchdog, "Set to 1 to disable the watchdog (default 0)\n");
434eeec5d0eSLarry Finger MODULE_PARM_DESC(int_clear, "Set to 0 to disable interrupt clear before set (default 1)\n");
435f1d2b4d3SLarry Finger
436f1d2b4d3SLarry Finger static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
437f1d2b4d3SLarry Finger
438f1d2b4d3SLarry Finger static struct pci_driver rtl8821ae_driver = {
439f1d2b4d3SLarry Finger .name = KBUILD_MODNAME,
440f1d2b4d3SLarry Finger .id_table = rtl8821ae_pci_ids,
441f1d2b4d3SLarry Finger .probe = rtl_pci_probe,
442f1d2b4d3SLarry Finger .remove = rtl_pci_disconnect,
443f1d2b4d3SLarry Finger .driver.pm = &rtlwifi_pm_ops,
444f1d2b4d3SLarry Finger };
445f1d2b4d3SLarry Finger
446f1d2b4d3SLarry Finger module_pci_driver(rtl8821ae_driver);
447