16f3fcdc8SLarry Finger // SPDX-License-Identifier: GPL-2.0
26f3fcdc8SLarry Finger /* Copyright(c) 2009-2012 Realtek Corporation.*/
3f1d2b4d3SLarry Finger
4f1d2b4d3SLarry Finger #include "../wifi.h"
5f1d2b4d3SLarry Finger #include "../core.h"
6f1d2b4d3SLarry Finger #include "../base.h"
7f1d2b4d3SLarry Finger #include "../pci.h"
8f1d2b4d3SLarry Finger #include "reg.h"
9f1d2b4d3SLarry Finger #include "def.h"
10f1d2b4d3SLarry Finger #include "phy.h"
11f1d2b4d3SLarry Finger #include "dm.h"
12f1d2b4d3SLarry Finger #include "fw.h"
13f1d2b4d3SLarry Finger #include "hw.h"
14f1d2b4d3SLarry Finger #include "trx.h"
15f1d2b4d3SLarry Finger #include "led.h"
16f1d2b4d3SLarry Finger
17f1d2b4d3SLarry Finger #include <linux/module.h>
18f1d2b4d3SLarry Finger
rtl92s_init_aspm_vars(struct ieee80211_hw * hw)19f1d2b4d3SLarry Finger static void rtl92s_init_aspm_vars(struct ieee80211_hw *hw)
20f1d2b4d3SLarry Finger {
2184efbad4SPing-Ke Shih struct rtl_priv *rtlpriv = rtl_priv(hw);
22f1d2b4d3SLarry Finger struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
23f1d2b4d3SLarry Finger
24f1d2b4d3SLarry Finger /*close ASPM for AMD defaultly */
25f1d2b4d3SLarry Finger rtlpci->const_amdpci_aspm = 0;
26f1d2b4d3SLarry Finger
27f1d2b4d3SLarry Finger /* ASPM PS mode.
28f1d2b4d3SLarry Finger * 0 - Disable ASPM,
29f1d2b4d3SLarry Finger * 1 - Enable ASPM without Clock Req,
30f1d2b4d3SLarry Finger * 2 - Enable ASPM with Clock Req,
31f1d2b4d3SLarry Finger * 3 - Alwyas Enable ASPM with Clock Req,
32f1d2b4d3SLarry Finger * 4 - Always Enable ASPM without Clock Req.
33f1d2b4d3SLarry Finger * set defult to RTL8192CE:3 RTL8192E:2
34f1d2b4d3SLarry Finger * */
35f1d2b4d3SLarry Finger rtlpci->const_pci_aspm = 2;
36f1d2b4d3SLarry Finger
37f1d2b4d3SLarry Finger /*Setting for PCI-E device */
38f1d2b4d3SLarry Finger rtlpci->const_devicepci_aspm_setting = 0x03;
39f1d2b4d3SLarry Finger
40f1d2b4d3SLarry Finger /*Setting for PCI-E bridge */
41f1d2b4d3SLarry Finger rtlpci->const_hostpci_aspm_setting = 0x02;
42f1d2b4d3SLarry Finger
43f1d2b4d3SLarry Finger /* In Hw/Sw Radio Off situation.
44f1d2b4d3SLarry Finger * 0 - Default,
45f1d2b4d3SLarry Finger * 1 - From ASPM setting without low Mac Pwr,
46f1d2b4d3SLarry Finger * 2 - From ASPM setting with low Mac Pwr,
47f1d2b4d3SLarry Finger * 3 - Bus D3
48f1d2b4d3SLarry Finger * set default to RTL8192CE:0 RTL8192SE:2
49f1d2b4d3SLarry Finger */
50f1d2b4d3SLarry Finger rtlpci->const_hwsw_rfoff_d3 = 2;
51f1d2b4d3SLarry Finger
52f1d2b4d3SLarry Finger /* This setting works for those device with
53f1d2b4d3SLarry Finger * backdoor ASPM setting such as EPHY setting.
54f1d2b4d3SLarry Finger * 0 - Not support ASPM,
55f1d2b4d3SLarry Finger * 1 - Support ASPM,
56f1d2b4d3SLarry Finger * 2 - According to chipset.
57f1d2b4d3SLarry Finger */
5884efbad4SPing-Ke Shih rtlpci->const_support_pciaspm = rtlpriv->cfg->mod_params->aspm_support;
59f1d2b4d3SLarry Finger }
60f1d2b4d3SLarry Finger
rtl92se_fw_cb(const struct firmware * firmware,void * context)61f1d2b4d3SLarry Finger static void rtl92se_fw_cb(const struct firmware *firmware, void *context)
62f1d2b4d3SLarry Finger {
63f1d2b4d3SLarry Finger struct ieee80211_hw *hw = context;
64f1d2b4d3SLarry Finger struct rtl_priv *rtlpriv = rtl_priv(hw);
65f1d2b4d3SLarry Finger struct rt_firmware *pfirmware = NULL;
66cf4747d7SLarry Finger char *fw_name = "rtlwifi/rtl8192sefw.bin";
67f1d2b4d3SLarry Finger
68*fca8218dSLarry Finger rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
69f1d2b4d3SLarry Finger "Firmware callback routine entered!\n");
70f1d2b4d3SLarry Finger complete(&rtlpriv->firmware_loading_complete);
71f1d2b4d3SLarry Finger if (!firmware) {
72cf4747d7SLarry Finger pr_err("Firmware %s not available\n", fw_name);
73f1d2b4d3SLarry Finger rtlpriv->max_fw_size = 0;
74f1d2b4d3SLarry Finger return;
75f1d2b4d3SLarry Finger }
76f1d2b4d3SLarry Finger if (firmware->size > rtlpriv->max_fw_size) {
772d15acacSLarry Finger pr_err("Firmware is too big!\n");
78f1d2b4d3SLarry Finger rtlpriv->max_fw_size = 0;
79f1d2b4d3SLarry Finger release_firmware(firmware);
80f1d2b4d3SLarry Finger return;
81f1d2b4d3SLarry Finger }
82f1d2b4d3SLarry Finger pfirmware = (struct rt_firmware *)rtlpriv->rtlhal.pfirmware;
83f1d2b4d3SLarry Finger memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size);
84f1d2b4d3SLarry Finger pfirmware->sz_fw_tmpbufferlen = firmware->size;
85f1d2b4d3SLarry Finger release_firmware(firmware);
86f1d2b4d3SLarry Finger }
87f1d2b4d3SLarry Finger
rtl92s_init_sw_vars(struct ieee80211_hw * hw)88f1d2b4d3SLarry Finger static int rtl92s_init_sw_vars(struct ieee80211_hw *hw)
89f1d2b4d3SLarry Finger {
90f1d2b4d3SLarry Finger struct rtl_priv *rtlpriv = rtl_priv(hw);
91f1d2b4d3SLarry Finger struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
92f1d2b4d3SLarry Finger int err = 0;
93f1d2b4d3SLarry Finger u16 earlyrxthreshold = 7;
94cf4747d7SLarry Finger char *fw_name = "rtlwifi/rtl8192sefw.bin";
95f1d2b4d3SLarry Finger
96f1d2b4d3SLarry Finger rtlpriv->dm.dm_initialgain_enable = true;
97f1d2b4d3SLarry Finger rtlpriv->dm.dm_flag = 0;
98f1d2b4d3SLarry Finger rtlpriv->dm.disable_framebursting = false;
99f1d2b4d3SLarry Finger rtlpriv->dm.thermalvalue = 0;
100f1d2b4d3SLarry Finger rtlpriv->dm.useramask = true;
101f1d2b4d3SLarry Finger
102f1d2b4d3SLarry Finger /* compatible 5G band 91se just 2.4G band & smsp */
103f1d2b4d3SLarry Finger rtlpriv->rtlhal.current_bandtype = BAND_ON_2_4G;
104f1d2b4d3SLarry Finger rtlpriv->rtlhal.bandset = BAND_ON_2_4G;
105f1d2b4d3SLarry Finger rtlpriv->rtlhal.macphymode = SINGLEMAC_SINGLEPHY;
106f1d2b4d3SLarry Finger
107f1d2b4d3SLarry Finger rtlpci->transmit_config = 0;
108f1d2b4d3SLarry Finger
109f1d2b4d3SLarry Finger rtlpci->receive_config =
110f1d2b4d3SLarry Finger RCR_APPFCS |
111f1d2b4d3SLarry Finger RCR_APWRMGT |
112f1d2b4d3SLarry Finger /*RCR_ADD3 |*/
113f1d2b4d3SLarry Finger RCR_AMF |
114f1d2b4d3SLarry Finger RCR_ADF |
115f1d2b4d3SLarry Finger RCR_APP_MIC |
116f1d2b4d3SLarry Finger RCR_APP_ICV |
117f1d2b4d3SLarry Finger RCR_AICV |
118f1d2b4d3SLarry Finger /* Accept ICV error, CRC32 Error */
119f1d2b4d3SLarry Finger RCR_ACRC32 |
120f1d2b4d3SLarry Finger RCR_AB |
121f1d2b4d3SLarry Finger /* Accept Broadcast, Multicast */
122f1d2b4d3SLarry Finger RCR_AM |
123f1d2b4d3SLarry Finger /* Accept Physical match */
124f1d2b4d3SLarry Finger RCR_APM |
125f1d2b4d3SLarry Finger /* Accept Destination Address packets */
126f1d2b4d3SLarry Finger /*RCR_AAP |*/
127f1d2b4d3SLarry Finger RCR_APP_PHYST_STAFF |
128f1d2b4d3SLarry Finger /* Accept PHY status */
129f1d2b4d3SLarry Finger RCR_APP_PHYST_RXFF |
130f1d2b4d3SLarry Finger (earlyrxthreshold << RCR_FIFO_OFFSET);
131f1d2b4d3SLarry Finger
132f1d2b4d3SLarry Finger rtlpci->irq_mask[0] = (u32)
133f1d2b4d3SLarry Finger (IMR_ROK |
134f1d2b4d3SLarry Finger IMR_VODOK |
135f1d2b4d3SLarry Finger IMR_VIDOK |
136f1d2b4d3SLarry Finger IMR_BEDOK |
137f1d2b4d3SLarry Finger IMR_BKDOK |
138f1d2b4d3SLarry Finger IMR_HCCADOK |
139f1d2b4d3SLarry Finger IMR_MGNTDOK |
140f1d2b4d3SLarry Finger IMR_COMDOK |
141f1d2b4d3SLarry Finger IMR_HIGHDOK |
142f1d2b4d3SLarry Finger IMR_BDOK |
143f1d2b4d3SLarry Finger IMR_RXCMDOK |
144f1d2b4d3SLarry Finger /*IMR_TIMEOUT0 |*/
145f1d2b4d3SLarry Finger IMR_RDU |
146f1d2b4d3SLarry Finger IMR_RXFOVW |
147f1d2b4d3SLarry Finger IMR_BCNINT
148f1d2b4d3SLarry Finger /*| IMR_TXFOVW*/
149f1d2b4d3SLarry Finger /*| IMR_TBDOK |
150f1d2b4d3SLarry Finger IMR_TBDER*/);
151f1d2b4d3SLarry Finger
152f1d2b4d3SLarry Finger rtlpci->irq_mask[1] = (u32) 0;
153f1d2b4d3SLarry Finger
154f1d2b4d3SLarry Finger rtlpci->shortretry_limit = 0x30;
155f1d2b4d3SLarry Finger rtlpci->longretry_limit = 0x30;
156f1d2b4d3SLarry Finger
157f1d2b4d3SLarry Finger rtlpci->first_init = true;
158f1d2b4d3SLarry Finger
159f1d2b4d3SLarry Finger /* for LPS & IPS */
160f1d2b4d3SLarry Finger rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps;
161f1d2b4d3SLarry Finger rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
162f1d2b4d3SLarry Finger rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
163f1d2b4d3SLarry Finger if (!rtlpriv->psc.inactiveps)
164f1d2b4d3SLarry Finger pr_info("Power Save off (module option)\n");
165f1d2b4d3SLarry Finger if (!rtlpriv->psc.fwctrl_lps)
166f1d2b4d3SLarry Finger pr_info("FW Power Save off (module option)\n");
167f1d2b4d3SLarry Finger rtlpriv->psc.reg_fwctrl_lps = 3;
168f1d2b4d3SLarry Finger rtlpriv->psc.reg_max_lps_awakeintvl = 5;
169f1d2b4d3SLarry Finger /* for ASPM, you can close aspm through
170f1d2b4d3SLarry Finger * set const_support_pciaspm = 0 */
171f1d2b4d3SLarry Finger rtl92s_init_aspm_vars(hw);
172f1d2b4d3SLarry Finger
173f1d2b4d3SLarry Finger if (rtlpriv->psc.reg_fwctrl_lps == 1)
174f1d2b4d3SLarry Finger rtlpriv->psc.fwctrl_psmode = FW_PS_MIN_MODE;
175f1d2b4d3SLarry Finger else if (rtlpriv->psc.reg_fwctrl_lps == 2)
176f1d2b4d3SLarry Finger rtlpriv->psc.fwctrl_psmode = FW_PS_MAX_MODE;
177f1d2b4d3SLarry Finger else if (rtlpriv->psc.reg_fwctrl_lps == 3)
178f1d2b4d3SLarry Finger rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE;
179f1d2b4d3SLarry Finger
180f1d2b4d3SLarry Finger /* for firmware buf */
181f1d2b4d3SLarry Finger rtlpriv->rtlhal.pfirmware = vzalloc(sizeof(struct rt_firmware));
182f1d2b4d3SLarry Finger if (!rtlpriv->rtlhal.pfirmware)
183f1d2b4d3SLarry Finger return 1;
184f1d2b4d3SLarry Finger
185f1d2b4d3SLarry Finger rtlpriv->max_fw_size = RTL8190_MAX_FIRMWARE_CODE_SIZE*2 +
186f1d2b4d3SLarry Finger sizeof(struct fw_hdr);
187f1d2b4d3SLarry Finger pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n"
188cf4747d7SLarry Finger "Loading firmware %s\n", fw_name);
189f1d2b4d3SLarry Finger /* request fw */
190cf4747d7SLarry Finger err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
191f1d2b4d3SLarry Finger rtlpriv->io.dev, GFP_KERNEL, hw,
192f1d2b4d3SLarry Finger rtl92se_fw_cb);
193f1d2b4d3SLarry Finger if (err) {
1942d15acacSLarry Finger pr_err("Failed to request firmware!\n");
195f2764f61SSouptick Joarder vfree(rtlpriv->rtlhal.pfirmware);
196f2764f61SSouptick Joarder rtlpriv->rtlhal.pfirmware = NULL;
197f1d2b4d3SLarry Finger return 1;
198f1d2b4d3SLarry Finger }
199f1d2b4d3SLarry Finger
200f1d2b4d3SLarry Finger return err;
201f1d2b4d3SLarry Finger }
202f1d2b4d3SLarry Finger
rtl92s_deinit_sw_vars(struct ieee80211_hw * hw)203f1d2b4d3SLarry Finger static void rtl92s_deinit_sw_vars(struct ieee80211_hw *hw)
204f1d2b4d3SLarry Finger {
205f1d2b4d3SLarry Finger struct rtl_priv *rtlpriv = rtl_priv(hw);
206f1d2b4d3SLarry Finger
207f1d2b4d3SLarry Finger if (rtlpriv->rtlhal.pfirmware) {
208f1d2b4d3SLarry Finger vfree(rtlpriv->rtlhal.pfirmware);
209f1d2b4d3SLarry Finger rtlpriv->rtlhal.pfirmware = NULL;
210f1d2b4d3SLarry Finger }
211f1d2b4d3SLarry Finger }
212f1d2b4d3SLarry Finger
rtl92se_is_tx_desc_closed(struct ieee80211_hw * hw,u8 hw_queue,u16 index)213f1d2b4d3SLarry Finger static bool rtl92se_is_tx_desc_closed(struct ieee80211_hw *hw, u8 hw_queue,
214f1d2b4d3SLarry Finger u16 index)
215f1d2b4d3SLarry Finger {
216f1d2b4d3SLarry Finger struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
217f1d2b4d3SLarry Finger struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue];
218f1d2b4d3SLarry Finger u8 *entry = (u8 *)(&ring->desc[ring->idx]);
2190c07bd74SPing-Ke Shih u8 own = (u8)rtl92se_get_desc(hw, entry, true, HW_DESC_OWN);
220f1d2b4d3SLarry Finger
221f1d2b4d3SLarry Finger if (own)
222f1d2b4d3SLarry Finger return false;
223f1d2b4d3SLarry Finger return true;
224f1d2b4d3SLarry Finger }
225f1d2b4d3SLarry Finger
226f1d2b4d3SLarry Finger static struct rtl_hal_ops rtl8192se_hal_ops = {
227f1d2b4d3SLarry Finger .init_sw_vars = rtl92s_init_sw_vars,
228f1d2b4d3SLarry Finger .deinit_sw_vars = rtl92s_deinit_sw_vars,
229f1d2b4d3SLarry Finger .read_eeprom_info = rtl92se_read_eeprom_info,
230f1d2b4d3SLarry Finger .interrupt_recognized = rtl92se_interrupt_recognized,
231f1d2b4d3SLarry Finger .hw_init = rtl92se_hw_init,
232f1d2b4d3SLarry Finger .hw_disable = rtl92se_card_disable,
233f1d2b4d3SLarry Finger .hw_suspend = rtl92se_suspend,
234f1d2b4d3SLarry Finger .hw_resume = rtl92se_resume,
235f1d2b4d3SLarry Finger .enable_interrupt = rtl92se_enable_interrupt,
236f1d2b4d3SLarry Finger .disable_interrupt = rtl92se_disable_interrupt,
237f1d2b4d3SLarry Finger .set_network_type = rtl92se_set_network_type,
238f1d2b4d3SLarry Finger .set_chk_bssid = rtl92se_set_check_bssid,
239f1d2b4d3SLarry Finger .set_qos = rtl92se_set_qos,
240f1d2b4d3SLarry Finger .set_bcn_reg = rtl92se_set_beacon_related_registers,
241f1d2b4d3SLarry Finger .set_bcn_intv = rtl92se_set_beacon_interval,
242f1d2b4d3SLarry Finger .update_interrupt_mask = rtl92se_update_interrupt_mask,
243f1d2b4d3SLarry Finger .get_hw_reg = rtl92se_get_hw_reg,
244f1d2b4d3SLarry Finger .set_hw_reg = rtl92se_set_hw_reg,
245f1d2b4d3SLarry Finger .update_rate_tbl = rtl92se_update_hal_rate_tbl,
246f1d2b4d3SLarry Finger .fill_tx_desc = rtl92se_tx_fill_desc,
247f1d2b4d3SLarry Finger .fill_tx_cmddesc = rtl92se_tx_fill_cmddesc,
248f1d2b4d3SLarry Finger .query_rx_desc = rtl92se_rx_query_desc,
249f1d2b4d3SLarry Finger .set_channel_access = rtl92se_update_channel_access_setting,
250f1d2b4d3SLarry Finger .radio_onoff_checking = rtl92se_gpio_radio_on_off_checking,
251f1d2b4d3SLarry Finger .set_bw_mode = rtl92s_phy_set_bw_mode,
252f1d2b4d3SLarry Finger .switch_channel = rtl92s_phy_sw_chnl,
253f1d2b4d3SLarry Finger .dm_watchdog = rtl92s_dm_watchdog,
254f1d2b4d3SLarry Finger .scan_operation_backup = rtl92s_phy_scan_operation_backup,
255f1d2b4d3SLarry Finger .set_rf_power_state = rtl92s_phy_set_rf_power_state,
256f1d2b4d3SLarry Finger .led_control = rtl92se_led_control,
257f1d2b4d3SLarry Finger .set_desc = rtl92se_set_desc,
258f1d2b4d3SLarry Finger .get_desc = rtl92se_get_desc,
259f1d2b4d3SLarry Finger .is_tx_desc_closed = rtl92se_is_tx_desc_closed,
260f1d2b4d3SLarry Finger .tx_polling = rtl92se_tx_polling,
261f1d2b4d3SLarry Finger .enable_hw_sec = rtl92se_enable_hw_security_config,
262f1d2b4d3SLarry Finger .set_key = rtl92se_set_key,
263f1d2b4d3SLarry Finger .get_bbreg = rtl92s_phy_query_bb_reg,
264f1d2b4d3SLarry Finger .set_bbreg = rtl92s_phy_set_bb_reg,
265f1d2b4d3SLarry Finger .get_rfreg = rtl92s_phy_query_rf_reg,
266f1d2b4d3SLarry Finger .set_rfreg = rtl92s_phy_set_rf_reg,
267f1d2b4d3SLarry Finger .get_btc_status = rtl_btc_status_false,
268f1d2b4d3SLarry Finger };
269f1d2b4d3SLarry Finger
270f1d2b4d3SLarry Finger static struct rtl_mod_params rtl92se_mod_params = {
271f1d2b4d3SLarry Finger .sw_crypto = false,
272f1d2b4d3SLarry Finger .inactiveps = true,
273f1d2b4d3SLarry Finger .swctrl_lps = true,
274f1d2b4d3SLarry Finger .fwctrl_lps = false,
27584efbad4SPing-Ke Shih .aspm_support = 2,
276c34df318SLarry Finger .debug_level = 0,
277c34df318SLarry Finger .debug_mask = 0,
278f1d2b4d3SLarry Finger };
279f1d2b4d3SLarry Finger
280f1d2b4d3SLarry Finger /* Because memory R/W bursting will cause system hang/crash
281f1d2b4d3SLarry Finger * for 92se, so we don't read back after every write action */
282d86e6476SJulia Lawall static const struct rtl_hal_cfg rtl92se_hal_cfg = {
283f1d2b4d3SLarry Finger .bar_id = 1,
284f1d2b4d3SLarry Finger .write_readback = false,
285f1d2b4d3SLarry Finger .name = "rtl92s_pci",
286f1d2b4d3SLarry Finger .ops = &rtl8192se_hal_ops,
287f1d2b4d3SLarry Finger .mod_params = &rtl92se_mod_params,
288f1d2b4d3SLarry Finger
289f1d2b4d3SLarry Finger .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
290f1d2b4d3SLarry Finger .maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN,
291f1d2b4d3SLarry Finger .maps[SYS_CLK] = SYS_CLKR,
292f1d2b4d3SLarry Finger .maps[MAC_RCR_AM] = RCR_AM,
293f1d2b4d3SLarry Finger .maps[MAC_RCR_AB] = RCR_AB,
294f1d2b4d3SLarry Finger .maps[MAC_RCR_ACRC32] = RCR_ACRC32,
295f1d2b4d3SLarry Finger .maps[MAC_RCR_ACF] = RCR_ACF,
296f1d2b4d3SLarry Finger .maps[MAC_RCR_AAP] = RCR_AAP,
297f1d2b4d3SLarry Finger .maps[MAC_HIMR] = INTA_MASK,
298f1d2b4d3SLarry Finger .maps[MAC_HIMRE] = INTA_MASK + 4,
299f1d2b4d3SLarry Finger
300f1d2b4d3SLarry Finger .maps[EFUSE_TEST] = REG_EFUSE_TEST,
301f1d2b4d3SLarry Finger .maps[EFUSE_CTRL] = REG_EFUSE_CTRL,
302f1d2b4d3SLarry Finger .maps[EFUSE_CLK] = REG_EFUSE_CLK,
303f1d2b4d3SLarry Finger .maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL,
304f1d2b4d3SLarry Finger .maps[EFUSE_PWC_EV12V] = 0, /* nouse for 8192se */
305f1d2b4d3SLarry Finger .maps[EFUSE_FEN_ELDR] = 0, /* nouse for 8192se */
306f1d2b4d3SLarry Finger .maps[EFUSE_LOADER_CLK_EN] = 0,/* nouse for 8192se */
307f1d2b4d3SLarry Finger .maps[EFUSE_ANA8M] = EFUSE_ANA8M,
308f1d2b4d3SLarry Finger .maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE_92S,
309f1d2b4d3SLarry Finger .maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION,
310f1d2b4d3SLarry Finger .maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN,
311f1d2b4d3SLarry Finger .maps[EFUSE_OOB_PROTECT_BYTES_LEN] = EFUSE_OOB_PROTECT_BYTES,
312f1d2b4d3SLarry Finger
313f1d2b4d3SLarry Finger .maps[RWCAM] = REG_RWCAM,
314f1d2b4d3SLarry Finger .maps[WCAMI] = REG_WCAMI,
315f1d2b4d3SLarry Finger .maps[RCAMO] = REG_RCAMO,
316f1d2b4d3SLarry Finger .maps[CAMDBG] = REG_CAMDBG,
317f1d2b4d3SLarry Finger .maps[SECR] = REG_SECR,
318f1d2b4d3SLarry Finger .maps[SEC_CAM_NONE] = CAM_NONE,
319f1d2b4d3SLarry Finger .maps[SEC_CAM_WEP40] = CAM_WEP40,
320f1d2b4d3SLarry Finger .maps[SEC_CAM_TKIP] = CAM_TKIP,
321f1d2b4d3SLarry Finger .maps[SEC_CAM_AES] = CAM_AES,
322f1d2b4d3SLarry Finger .maps[SEC_CAM_WEP104] = CAM_WEP104,
323f1d2b4d3SLarry Finger
324f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6,
325f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5,
326f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4,
327f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3,
328f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2,
329f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1,
330f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8,
331f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7,
332f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6,
333f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5,
334f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4,
335f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3,
336f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2,
337f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1,
338f1d2b4d3SLarry Finger .maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2,
339f1d2b4d3SLarry Finger .maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1,
340f1d2b4d3SLarry Finger
341f1d2b4d3SLarry Finger .maps[RTL_IMR_TXFOVW] = IMR_TXFOVW,
342f1d2b4d3SLarry Finger .maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT,
343f1d2b4d3SLarry Finger .maps[RTL_IMR_BCNINT] = IMR_BCNINT,
344f1d2b4d3SLarry Finger .maps[RTL_IMR_RXFOVW] = IMR_RXFOVW,
345f1d2b4d3SLarry Finger .maps[RTL_IMR_RDU] = IMR_RDU,
346f1d2b4d3SLarry Finger .maps[RTL_IMR_ATIMEND] = IMR_ATIMEND,
347f1d2b4d3SLarry Finger .maps[RTL_IMR_BDOK] = IMR_BDOK,
348f1d2b4d3SLarry Finger .maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK,
349f1d2b4d3SLarry Finger .maps[RTL_IMR_TBDER] = IMR_TBDER,
350f1d2b4d3SLarry Finger .maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK,
351f1d2b4d3SLarry Finger .maps[RTL_IMR_COMDOK] = IMR_COMDOK,
352f1d2b4d3SLarry Finger .maps[RTL_IMR_TBDOK] = IMR_TBDOK,
353f1d2b4d3SLarry Finger .maps[RTL_IMR_BKDOK] = IMR_BKDOK,
354f1d2b4d3SLarry Finger .maps[RTL_IMR_BEDOK] = IMR_BEDOK,
355f1d2b4d3SLarry Finger .maps[RTL_IMR_VIDOK] = IMR_VIDOK,
356f1d2b4d3SLarry Finger .maps[RTL_IMR_VODOK] = IMR_VODOK,
357f1d2b4d3SLarry Finger .maps[RTL_IMR_ROK] = IMR_ROK,
358f1d2b4d3SLarry Finger .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER),
359f1d2b4d3SLarry Finger
360f1d2b4d3SLarry Finger .maps[RTL_RC_CCK_RATE1M] = DESC_RATE1M,
361f1d2b4d3SLarry Finger .maps[RTL_RC_CCK_RATE2M] = DESC_RATE2M,
362f1d2b4d3SLarry Finger .maps[RTL_RC_CCK_RATE5_5M] = DESC_RATE5_5M,
363f1d2b4d3SLarry Finger .maps[RTL_RC_CCK_RATE11M] = DESC_RATE11M,
364f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE6M] = DESC_RATE6M,
365f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE9M] = DESC_RATE9M,
366f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE12M] = DESC_RATE12M,
367f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE18M] = DESC_RATE18M,
368f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE24M] = DESC_RATE24M,
369f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE36M] = DESC_RATE36M,
370f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE48M] = DESC_RATE48M,
371f1d2b4d3SLarry Finger .maps[RTL_RC_OFDM_RATE54M] = DESC_RATE54M,
372f1d2b4d3SLarry Finger
373f1d2b4d3SLarry Finger .maps[RTL_RC_HT_RATEMCS7] = DESC_RATEMCS7,
374f1d2b4d3SLarry Finger .maps[RTL_RC_HT_RATEMCS15] = DESC_RATEMCS15,
375f1d2b4d3SLarry Finger };
376f1d2b4d3SLarry Finger
37767f512e6SArvind Yadav static const struct pci_device_id rtl92se_pci_ids[] = {
378f1d2b4d3SLarry Finger {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8192, rtl92se_hal_cfg)},
379f1d2b4d3SLarry Finger {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8171, rtl92se_hal_cfg)},
380f1d2b4d3SLarry Finger {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8172, rtl92se_hal_cfg)},
381f1d2b4d3SLarry Finger {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8173, rtl92se_hal_cfg)},
382f1d2b4d3SLarry Finger {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8174, rtl92se_hal_cfg)},
383f1d2b4d3SLarry Finger {},
384f1d2b4d3SLarry Finger };
385f1d2b4d3SLarry Finger
386f1d2b4d3SLarry Finger MODULE_DEVICE_TABLE(pci, rtl92se_pci_ids);
387f1d2b4d3SLarry Finger
388f1d2b4d3SLarry Finger MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>");
389f1d2b4d3SLarry Finger MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>");
390f1d2b4d3SLarry Finger MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>");
391f1d2b4d3SLarry Finger MODULE_LICENSE("GPL");
392f1d2b4d3SLarry Finger MODULE_DESCRIPTION("Realtek 8192S/8191S 802.11n PCI wireless");
393f1d2b4d3SLarry Finger MODULE_FIRMWARE("rtlwifi/rtl8192sefw.bin");
394f1d2b4d3SLarry Finger
395f1d2b4d3SLarry Finger module_param_named(swenc, rtl92se_mod_params.sw_crypto, bool, 0444);
396c34df318SLarry Finger module_param_named(debug_level, rtl92se_mod_params.debug_level, int, 0644);
397c34df318SLarry Finger module_param_named(debug_mask, rtl92se_mod_params.debug_mask, ullong, 0644);
398f1d2b4d3SLarry Finger module_param_named(ips, rtl92se_mod_params.inactiveps, bool, 0444);
399f1d2b4d3SLarry Finger module_param_named(swlps, rtl92se_mod_params.swctrl_lps, bool, 0444);
400f1d2b4d3SLarry Finger module_param_named(fwlps, rtl92se_mod_params.fwctrl_lps, bool, 0444);
40184efbad4SPing-Ke Shih module_param_named(aspm, rtl92se_mod_params.aspm_support, int, 0444);
402f1d2b4d3SLarry Finger MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
403f1d2b4d3SLarry Finger MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n");
4047503efbdSLarry Finger MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 1)\n");
4057503efbdSLarry Finger MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 0)\n");
40684efbad4SPing-Ke Shih MODULE_PARM_DESC(aspm, "Set to 1 to enable ASPM (default 1)\n");
407c34df318SLarry Finger MODULE_PARM_DESC(debug_level, "Set debug level (0-5) (default 0)");
408c34df318SLarry Finger MODULE_PARM_DESC(debug_mask, "Set debug mask (default 0)");
409f1d2b4d3SLarry Finger
410f1d2b4d3SLarry Finger static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
411f1d2b4d3SLarry Finger
412f1d2b4d3SLarry Finger static struct pci_driver rtl92se_driver = {
413f1d2b4d3SLarry Finger .name = KBUILD_MODNAME,
414f1d2b4d3SLarry Finger .id_table = rtl92se_pci_ids,
415f1d2b4d3SLarry Finger .probe = rtl_pci_probe,
416f1d2b4d3SLarry Finger .remove = rtl_pci_disconnect,
417f1d2b4d3SLarry Finger .driver.pm = &rtlwifi_pm_ops,
418f1d2b4d3SLarry Finger };
419f1d2b4d3SLarry Finger
420f1d2b4d3SLarry Finger module_pci_driver(rtl92se_driver);
421