18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* Copyright(c) 2009-2012 Realtek Corporation.*/ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#include "../wifi.h" 58c2ecf20Sopenharmony_ci#include "../core.h" 68c2ecf20Sopenharmony_ci#include "../base.h" 78c2ecf20Sopenharmony_ci#include "../pci.h" 88c2ecf20Sopenharmony_ci#include "reg.h" 98c2ecf20Sopenharmony_ci#include "def.h" 108c2ecf20Sopenharmony_ci#include "phy.h" 118c2ecf20Sopenharmony_ci#include "dm.h" 128c2ecf20Sopenharmony_ci#include "fw.h" 138c2ecf20Sopenharmony_ci#include "hw.h" 148c2ecf20Sopenharmony_ci#include "trx.h" 158c2ecf20Sopenharmony_ci#include "led.h" 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include <linux/module.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_cistatic void rtl92s_init_aspm_vars(struct ieee80211_hw *hw) 208c2ecf20Sopenharmony_ci{ 218c2ecf20Sopenharmony_ci struct rtl_priv *rtlpriv = rtl_priv(hw); 228c2ecf20Sopenharmony_ci struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci /*close ASPM for AMD defaultly */ 258c2ecf20Sopenharmony_ci rtlpci->const_amdpci_aspm = 0; 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci /* ASPM PS mode. 288c2ecf20Sopenharmony_ci * 0 - Disable ASPM, 298c2ecf20Sopenharmony_ci * 1 - Enable ASPM without Clock Req, 308c2ecf20Sopenharmony_ci * 2 - Enable ASPM with Clock Req, 318c2ecf20Sopenharmony_ci * 3 - Alwyas Enable ASPM with Clock Req, 328c2ecf20Sopenharmony_ci * 4 - Always Enable ASPM without Clock Req. 338c2ecf20Sopenharmony_ci * set defult to RTL8192CE:3 RTL8192E:2 348c2ecf20Sopenharmony_ci * */ 358c2ecf20Sopenharmony_ci rtlpci->const_pci_aspm = 2; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci /*Setting for PCI-E device */ 388c2ecf20Sopenharmony_ci rtlpci->const_devicepci_aspm_setting = 0x03; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci /*Setting for PCI-E bridge */ 418c2ecf20Sopenharmony_ci rtlpci->const_hostpci_aspm_setting = 0x02; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci /* In Hw/Sw Radio Off situation. 448c2ecf20Sopenharmony_ci * 0 - Default, 458c2ecf20Sopenharmony_ci * 1 - From ASPM setting without low Mac Pwr, 468c2ecf20Sopenharmony_ci * 2 - From ASPM setting with low Mac Pwr, 478c2ecf20Sopenharmony_ci * 3 - Bus D3 488c2ecf20Sopenharmony_ci * set default to RTL8192CE:0 RTL8192SE:2 498c2ecf20Sopenharmony_ci */ 508c2ecf20Sopenharmony_ci rtlpci->const_hwsw_rfoff_d3 = 2; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci /* This setting works for those device with 538c2ecf20Sopenharmony_ci * backdoor ASPM setting such as EPHY setting. 548c2ecf20Sopenharmony_ci * 0 - Not support ASPM, 558c2ecf20Sopenharmony_ci * 1 - Support ASPM, 568c2ecf20Sopenharmony_ci * 2 - According to chipset. 578c2ecf20Sopenharmony_ci */ 588c2ecf20Sopenharmony_ci rtlpci->const_support_pciaspm = rtlpriv->cfg->mod_params->aspm_support; 598c2ecf20Sopenharmony_ci} 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cistatic void rtl92se_fw_cb(const struct firmware *firmware, void *context) 628c2ecf20Sopenharmony_ci{ 638c2ecf20Sopenharmony_ci struct ieee80211_hw *hw = context; 648c2ecf20Sopenharmony_ci struct rtl_priv *rtlpriv = rtl_priv(hw); 658c2ecf20Sopenharmony_ci struct rt_firmware *pfirmware = NULL; 668c2ecf20Sopenharmony_ci char *fw_name = "rtlwifi/rtl8192sefw.bin"; 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD, 698c2ecf20Sopenharmony_ci "Firmware callback routine entered!\n"); 708c2ecf20Sopenharmony_ci complete(&rtlpriv->firmware_loading_complete); 718c2ecf20Sopenharmony_ci if (!firmware) { 728c2ecf20Sopenharmony_ci pr_err("Firmware %s not available\n", fw_name); 738c2ecf20Sopenharmony_ci rtlpriv->max_fw_size = 0; 748c2ecf20Sopenharmony_ci return; 758c2ecf20Sopenharmony_ci } 768c2ecf20Sopenharmony_ci if (firmware->size > rtlpriv->max_fw_size) { 778c2ecf20Sopenharmony_ci pr_err("Firmware is too big!\n"); 788c2ecf20Sopenharmony_ci rtlpriv->max_fw_size = 0; 798c2ecf20Sopenharmony_ci release_firmware(firmware); 808c2ecf20Sopenharmony_ci return; 818c2ecf20Sopenharmony_ci } 828c2ecf20Sopenharmony_ci pfirmware = (struct rt_firmware *)rtlpriv->rtlhal.pfirmware; 838c2ecf20Sopenharmony_ci memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size); 848c2ecf20Sopenharmony_ci pfirmware->sz_fw_tmpbufferlen = firmware->size; 858c2ecf20Sopenharmony_ci release_firmware(firmware); 868c2ecf20Sopenharmony_ci} 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_cistatic int rtl92s_init_sw_vars(struct ieee80211_hw *hw) 898c2ecf20Sopenharmony_ci{ 908c2ecf20Sopenharmony_ci struct rtl_priv *rtlpriv = rtl_priv(hw); 918c2ecf20Sopenharmony_ci struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 928c2ecf20Sopenharmony_ci int err = 0; 938c2ecf20Sopenharmony_ci u16 earlyrxthreshold = 7; 948c2ecf20Sopenharmony_ci char *fw_name = "rtlwifi/rtl8192sefw.bin"; 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci rtlpriv->dm.dm_initialgain_enable = true; 978c2ecf20Sopenharmony_ci rtlpriv->dm.dm_flag = 0; 988c2ecf20Sopenharmony_ci rtlpriv->dm.disable_framebursting = false; 998c2ecf20Sopenharmony_ci rtlpriv->dm.thermalvalue = 0; 1008c2ecf20Sopenharmony_ci rtlpriv->dm.useramask = true; 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci /* compatible 5G band 91se just 2.4G band & smsp */ 1038c2ecf20Sopenharmony_ci rtlpriv->rtlhal.current_bandtype = BAND_ON_2_4G; 1048c2ecf20Sopenharmony_ci rtlpriv->rtlhal.bandset = BAND_ON_2_4G; 1058c2ecf20Sopenharmony_ci rtlpriv->rtlhal.macphymode = SINGLEMAC_SINGLEPHY; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci rtlpci->transmit_config = 0; 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci rtlpci->receive_config = 1108c2ecf20Sopenharmony_ci RCR_APPFCS | 1118c2ecf20Sopenharmony_ci RCR_APWRMGT | 1128c2ecf20Sopenharmony_ci /*RCR_ADD3 |*/ 1138c2ecf20Sopenharmony_ci RCR_AMF | 1148c2ecf20Sopenharmony_ci RCR_ADF | 1158c2ecf20Sopenharmony_ci RCR_APP_MIC | 1168c2ecf20Sopenharmony_ci RCR_APP_ICV | 1178c2ecf20Sopenharmony_ci RCR_AICV | 1188c2ecf20Sopenharmony_ci /* Accept ICV error, CRC32 Error */ 1198c2ecf20Sopenharmony_ci RCR_ACRC32 | 1208c2ecf20Sopenharmony_ci RCR_AB | 1218c2ecf20Sopenharmony_ci /* Accept Broadcast, Multicast */ 1228c2ecf20Sopenharmony_ci RCR_AM | 1238c2ecf20Sopenharmony_ci /* Accept Physical match */ 1248c2ecf20Sopenharmony_ci RCR_APM | 1258c2ecf20Sopenharmony_ci /* Accept Destination Address packets */ 1268c2ecf20Sopenharmony_ci /*RCR_AAP |*/ 1278c2ecf20Sopenharmony_ci RCR_APP_PHYST_STAFF | 1288c2ecf20Sopenharmony_ci /* Accept PHY status */ 1298c2ecf20Sopenharmony_ci RCR_APP_PHYST_RXFF | 1308c2ecf20Sopenharmony_ci (earlyrxthreshold << RCR_FIFO_OFFSET); 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci rtlpci->irq_mask[0] = (u32) 1338c2ecf20Sopenharmony_ci (IMR_ROK | 1348c2ecf20Sopenharmony_ci IMR_VODOK | 1358c2ecf20Sopenharmony_ci IMR_VIDOK | 1368c2ecf20Sopenharmony_ci IMR_BEDOK | 1378c2ecf20Sopenharmony_ci IMR_BKDOK | 1388c2ecf20Sopenharmony_ci IMR_HCCADOK | 1398c2ecf20Sopenharmony_ci IMR_MGNTDOK | 1408c2ecf20Sopenharmony_ci IMR_COMDOK | 1418c2ecf20Sopenharmony_ci IMR_HIGHDOK | 1428c2ecf20Sopenharmony_ci IMR_BDOK | 1438c2ecf20Sopenharmony_ci IMR_RXCMDOK | 1448c2ecf20Sopenharmony_ci /*IMR_TIMEOUT0 |*/ 1458c2ecf20Sopenharmony_ci IMR_RDU | 1468c2ecf20Sopenharmony_ci IMR_RXFOVW | 1478c2ecf20Sopenharmony_ci IMR_BCNINT 1488c2ecf20Sopenharmony_ci /*| IMR_TXFOVW*/ 1498c2ecf20Sopenharmony_ci /*| IMR_TBDOK | 1508c2ecf20Sopenharmony_ci IMR_TBDER*/); 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci rtlpci->irq_mask[1] = (u32) 0; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci rtlpci->shortretry_limit = 0x30; 1558c2ecf20Sopenharmony_ci rtlpci->longretry_limit = 0x30; 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci rtlpci->first_init = true; 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci /* for LPS & IPS */ 1608c2ecf20Sopenharmony_ci rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; 1618c2ecf20Sopenharmony_ci rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; 1628c2ecf20Sopenharmony_ci rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; 1638c2ecf20Sopenharmony_ci if (!rtlpriv->psc.inactiveps) 1648c2ecf20Sopenharmony_ci pr_info("Power Save off (module option)\n"); 1658c2ecf20Sopenharmony_ci if (!rtlpriv->psc.fwctrl_lps) 1668c2ecf20Sopenharmony_ci pr_info("FW Power Save off (module option)\n"); 1678c2ecf20Sopenharmony_ci rtlpriv->psc.reg_fwctrl_lps = 3; 1688c2ecf20Sopenharmony_ci rtlpriv->psc.reg_max_lps_awakeintvl = 5; 1698c2ecf20Sopenharmony_ci /* for ASPM, you can close aspm through 1708c2ecf20Sopenharmony_ci * set const_support_pciaspm = 0 */ 1718c2ecf20Sopenharmony_ci rtl92s_init_aspm_vars(hw); 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci if (rtlpriv->psc.reg_fwctrl_lps == 1) 1748c2ecf20Sopenharmony_ci rtlpriv->psc.fwctrl_psmode = FW_PS_MIN_MODE; 1758c2ecf20Sopenharmony_ci else if (rtlpriv->psc.reg_fwctrl_lps == 2) 1768c2ecf20Sopenharmony_ci rtlpriv->psc.fwctrl_psmode = FW_PS_MAX_MODE; 1778c2ecf20Sopenharmony_ci else if (rtlpriv->psc.reg_fwctrl_lps == 3) 1788c2ecf20Sopenharmony_ci rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE; 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci /* for firmware buf */ 1818c2ecf20Sopenharmony_ci rtlpriv->rtlhal.pfirmware = vzalloc(sizeof(struct rt_firmware)); 1828c2ecf20Sopenharmony_ci if (!rtlpriv->rtlhal.pfirmware) 1838c2ecf20Sopenharmony_ci return 1; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci rtlpriv->max_fw_size = RTL8190_MAX_FIRMWARE_CODE_SIZE*2 + 1868c2ecf20Sopenharmony_ci sizeof(struct fw_hdr); 1878c2ecf20Sopenharmony_ci pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n" 1888c2ecf20Sopenharmony_ci "Loading firmware %s\n", fw_name); 1898c2ecf20Sopenharmony_ci /* request fw */ 1908c2ecf20Sopenharmony_ci err = request_firmware_nowait(THIS_MODULE, 1, fw_name, 1918c2ecf20Sopenharmony_ci rtlpriv->io.dev, GFP_KERNEL, hw, 1928c2ecf20Sopenharmony_ci rtl92se_fw_cb); 1938c2ecf20Sopenharmony_ci if (err) { 1948c2ecf20Sopenharmony_ci pr_err("Failed to request firmware!\n"); 1958c2ecf20Sopenharmony_ci vfree(rtlpriv->rtlhal.pfirmware); 1968c2ecf20Sopenharmony_ci rtlpriv->rtlhal.pfirmware = NULL; 1978c2ecf20Sopenharmony_ci return 1; 1988c2ecf20Sopenharmony_ci } 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci return err; 2018c2ecf20Sopenharmony_ci} 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_cistatic void rtl92s_deinit_sw_vars(struct ieee80211_hw *hw) 2048c2ecf20Sopenharmony_ci{ 2058c2ecf20Sopenharmony_ci struct rtl_priv *rtlpriv = rtl_priv(hw); 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci if (rtlpriv->rtlhal.pfirmware) { 2088c2ecf20Sopenharmony_ci vfree(rtlpriv->rtlhal.pfirmware); 2098c2ecf20Sopenharmony_ci rtlpriv->rtlhal.pfirmware = NULL; 2108c2ecf20Sopenharmony_ci } 2118c2ecf20Sopenharmony_ci} 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_cistatic bool rtl92se_is_tx_desc_closed(struct ieee80211_hw *hw, u8 hw_queue, 2148c2ecf20Sopenharmony_ci u16 index) 2158c2ecf20Sopenharmony_ci{ 2168c2ecf20Sopenharmony_ci struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 2178c2ecf20Sopenharmony_ci struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue]; 2188c2ecf20Sopenharmony_ci u8 *entry = (u8 *)(&ring->desc[ring->idx]); 2198c2ecf20Sopenharmony_ci u8 own = (u8)rtl92se_get_desc(hw, entry, true, HW_DESC_OWN); 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci if (own) 2228c2ecf20Sopenharmony_ci return false; 2238c2ecf20Sopenharmony_ci return true; 2248c2ecf20Sopenharmony_ci} 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_cistatic struct rtl_hal_ops rtl8192se_hal_ops = { 2278c2ecf20Sopenharmony_ci .init_sw_vars = rtl92s_init_sw_vars, 2288c2ecf20Sopenharmony_ci .deinit_sw_vars = rtl92s_deinit_sw_vars, 2298c2ecf20Sopenharmony_ci .read_eeprom_info = rtl92se_read_eeprom_info, 2308c2ecf20Sopenharmony_ci .interrupt_recognized = rtl92se_interrupt_recognized, 2318c2ecf20Sopenharmony_ci .hw_init = rtl92se_hw_init, 2328c2ecf20Sopenharmony_ci .hw_disable = rtl92se_card_disable, 2338c2ecf20Sopenharmony_ci .hw_suspend = rtl92se_suspend, 2348c2ecf20Sopenharmony_ci .hw_resume = rtl92se_resume, 2358c2ecf20Sopenharmony_ci .enable_interrupt = rtl92se_enable_interrupt, 2368c2ecf20Sopenharmony_ci .disable_interrupt = rtl92se_disable_interrupt, 2378c2ecf20Sopenharmony_ci .set_network_type = rtl92se_set_network_type, 2388c2ecf20Sopenharmony_ci .set_chk_bssid = rtl92se_set_check_bssid, 2398c2ecf20Sopenharmony_ci .set_qos = rtl92se_set_qos, 2408c2ecf20Sopenharmony_ci .set_bcn_reg = rtl92se_set_beacon_related_registers, 2418c2ecf20Sopenharmony_ci .set_bcn_intv = rtl92se_set_beacon_interval, 2428c2ecf20Sopenharmony_ci .update_interrupt_mask = rtl92se_update_interrupt_mask, 2438c2ecf20Sopenharmony_ci .get_hw_reg = rtl92se_get_hw_reg, 2448c2ecf20Sopenharmony_ci .set_hw_reg = rtl92se_set_hw_reg, 2458c2ecf20Sopenharmony_ci .update_rate_tbl = rtl92se_update_hal_rate_tbl, 2468c2ecf20Sopenharmony_ci .fill_tx_desc = rtl92se_tx_fill_desc, 2478c2ecf20Sopenharmony_ci .fill_tx_cmddesc = rtl92se_tx_fill_cmddesc, 2488c2ecf20Sopenharmony_ci .query_rx_desc = rtl92se_rx_query_desc, 2498c2ecf20Sopenharmony_ci .set_channel_access = rtl92se_update_channel_access_setting, 2508c2ecf20Sopenharmony_ci .radio_onoff_checking = rtl92se_gpio_radio_on_off_checking, 2518c2ecf20Sopenharmony_ci .set_bw_mode = rtl92s_phy_set_bw_mode, 2528c2ecf20Sopenharmony_ci .switch_channel = rtl92s_phy_sw_chnl, 2538c2ecf20Sopenharmony_ci .dm_watchdog = rtl92s_dm_watchdog, 2548c2ecf20Sopenharmony_ci .scan_operation_backup = rtl92s_phy_scan_operation_backup, 2558c2ecf20Sopenharmony_ci .set_rf_power_state = rtl92s_phy_set_rf_power_state, 2568c2ecf20Sopenharmony_ci .led_control = rtl92se_led_control, 2578c2ecf20Sopenharmony_ci .set_desc = rtl92se_set_desc, 2588c2ecf20Sopenharmony_ci .get_desc = rtl92se_get_desc, 2598c2ecf20Sopenharmony_ci .is_tx_desc_closed = rtl92se_is_tx_desc_closed, 2608c2ecf20Sopenharmony_ci .tx_polling = rtl92se_tx_polling, 2618c2ecf20Sopenharmony_ci .enable_hw_sec = rtl92se_enable_hw_security_config, 2628c2ecf20Sopenharmony_ci .set_key = rtl92se_set_key, 2638c2ecf20Sopenharmony_ci .init_sw_leds = rtl92se_init_sw_leds, 2648c2ecf20Sopenharmony_ci .get_bbreg = rtl92s_phy_query_bb_reg, 2658c2ecf20Sopenharmony_ci .set_bbreg = rtl92s_phy_set_bb_reg, 2668c2ecf20Sopenharmony_ci .get_rfreg = rtl92s_phy_query_rf_reg, 2678c2ecf20Sopenharmony_ci .set_rfreg = rtl92s_phy_set_rf_reg, 2688c2ecf20Sopenharmony_ci .get_btc_status = rtl_btc_status_false, 2698c2ecf20Sopenharmony_ci}; 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_cistatic struct rtl_mod_params rtl92se_mod_params = { 2728c2ecf20Sopenharmony_ci .sw_crypto = false, 2738c2ecf20Sopenharmony_ci .inactiveps = true, 2748c2ecf20Sopenharmony_ci .swctrl_lps = true, 2758c2ecf20Sopenharmony_ci .fwctrl_lps = false, 2768c2ecf20Sopenharmony_ci .aspm_support = 2, 2778c2ecf20Sopenharmony_ci .debug_level = 0, 2788c2ecf20Sopenharmony_ci .debug_mask = 0, 2798c2ecf20Sopenharmony_ci}; 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci/* Because memory R/W bursting will cause system hang/crash 2828c2ecf20Sopenharmony_ci * for 92se, so we don't read back after every write action */ 2838c2ecf20Sopenharmony_cistatic const struct rtl_hal_cfg rtl92se_hal_cfg = { 2848c2ecf20Sopenharmony_ci .bar_id = 1, 2858c2ecf20Sopenharmony_ci .write_readback = false, 2868c2ecf20Sopenharmony_ci .name = "rtl92s_pci", 2878c2ecf20Sopenharmony_ci .ops = &rtl8192se_hal_ops, 2888c2ecf20Sopenharmony_ci .mod_params = &rtl92se_mod_params, 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, 2918c2ecf20Sopenharmony_ci .maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN, 2928c2ecf20Sopenharmony_ci .maps[SYS_CLK] = SYS_CLKR, 2938c2ecf20Sopenharmony_ci .maps[MAC_RCR_AM] = RCR_AM, 2948c2ecf20Sopenharmony_ci .maps[MAC_RCR_AB] = RCR_AB, 2958c2ecf20Sopenharmony_ci .maps[MAC_RCR_ACRC32] = RCR_ACRC32, 2968c2ecf20Sopenharmony_ci .maps[MAC_RCR_ACF] = RCR_ACF, 2978c2ecf20Sopenharmony_ci .maps[MAC_RCR_AAP] = RCR_AAP, 2988c2ecf20Sopenharmony_ci .maps[MAC_HIMR] = INTA_MASK, 2998c2ecf20Sopenharmony_ci .maps[MAC_HIMRE] = INTA_MASK + 4, 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci .maps[EFUSE_TEST] = REG_EFUSE_TEST, 3028c2ecf20Sopenharmony_ci .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, 3038c2ecf20Sopenharmony_ci .maps[EFUSE_CLK] = REG_EFUSE_CLK, 3048c2ecf20Sopenharmony_ci .maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL, 3058c2ecf20Sopenharmony_ci .maps[EFUSE_PWC_EV12V] = 0, /* nouse for 8192se */ 3068c2ecf20Sopenharmony_ci .maps[EFUSE_FEN_ELDR] = 0, /* nouse for 8192se */ 3078c2ecf20Sopenharmony_ci .maps[EFUSE_LOADER_CLK_EN] = 0,/* nouse for 8192se */ 3088c2ecf20Sopenharmony_ci .maps[EFUSE_ANA8M] = EFUSE_ANA8M, 3098c2ecf20Sopenharmony_ci .maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE_92S, 3108c2ecf20Sopenharmony_ci .maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION, 3118c2ecf20Sopenharmony_ci .maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN, 3128c2ecf20Sopenharmony_ci .maps[EFUSE_OOB_PROTECT_BYTES_LEN] = EFUSE_OOB_PROTECT_BYTES, 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci .maps[RWCAM] = REG_RWCAM, 3158c2ecf20Sopenharmony_ci .maps[WCAMI] = REG_WCAMI, 3168c2ecf20Sopenharmony_ci .maps[RCAMO] = REG_RCAMO, 3178c2ecf20Sopenharmony_ci .maps[CAMDBG] = REG_CAMDBG, 3188c2ecf20Sopenharmony_ci .maps[SECR] = REG_SECR, 3198c2ecf20Sopenharmony_ci .maps[SEC_CAM_NONE] = CAM_NONE, 3208c2ecf20Sopenharmony_ci .maps[SEC_CAM_WEP40] = CAM_WEP40, 3218c2ecf20Sopenharmony_ci .maps[SEC_CAM_TKIP] = CAM_TKIP, 3228c2ecf20Sopenharmony_ci .maps[SEC_CAM_AES] = CAM_AES, 3238c2ecf20Sopenharmony_ci .maps[SEC_CAM_WEP104] = CAM_WEP104, 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6, 3268c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5, 3278c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4, 3288c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3, 3298c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2, 3308c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1, 3318c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8, 3328c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7, 3338c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6, 3348c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5, 3358c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4, 3368c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3, 3378c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2, 3388c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1, 3398c2ecf20Sopenharmony_ci .maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2, 3408c2ecf20Sopenharmony_ci .maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1, 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_ci .maps[RTL_IMR_TXFOVW] = IMR_TXFOVW, 3438c2ecf20Sopenharmony_ci .maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT, 3448c2ecf20Sopenharmony_ci .maps[RTL_IMR_BCNINT] = IMR_BCNINT, 3458c2ecf20Sopenharmony_ci .maps[RTL_IMR_RXFOVW] = IMR_RXFOVW, 3468c2ecf20Sopenharmony_ci .maps[RTL_IMR_RDU] = IMR_RDU, 3478c2ecf20Sopenharmony_ci .maps[RTL_IMR_ATIMEND] = IMR_ATIMEND, 3488c2ecf20Sopenharmony_ci .maps[RTL_IMR_BDOK] = IMR_BDOK, 3498c2ecf20Sopenharmony_ci .maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK, 3508c2ecf20Sopenharmony_ci .maps[RTL_IMR_TBDER] = IMR_TBDER, 3518c2ecf20Sopenharmony_ci .maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK, 3528c2ecf20Sopenharmony_ci .maps[RTL_IMR_COMDOK] = IMR_COMDOK, 3538c2ecf20Sopenharmony_ci .maps[RTL_IMR_TBDOK] = IMR_TBDOK, 3548c2ecf20Sopenharmony_ci .maps[RTL_IMR_BKDOK] = IMR_BKDOK, 3558c2ecf20Sopenharmony_ci .maps[RTL_IMR_BEDOK] = IMR_BEDOK, 3568c2ecf20Sopenharmony_ci .maps[RTL_IMR_VIDOK] = IMR_VIDOK, 3578c2ecf20Sopenharmony_ci .maps[RTL_IMR_VODOK] = IMR_VODOK, 3588c2ecf20Sopenharmony_ci .maps[RTL_IMR_ROK] = IMR_ROK, 3598c2ecf20Sopenharmony_ci .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER), 3608c2ecf20Sopenharmony_ci 3618c2ecf20Sopenharmony_ci .maps[RTL_RC_CCK_RATE1M] = DESC_RATE1M, 3628c2ecf20Sopenharmony_ci .maps[RTL_RC_CCK_RATE2M] = DESC_RATE2M, 3638c2ecf20Sopenharmony_ci .maps[RTL_RC_CCK_RATE5_5M] = DESC_RATE5_5M, 3648c2ecf20Sopenharmony_ci .maps[RTL_RC_CCK_RATE11M] = DESC_RATE11M, 3658c2ecf20Sopenharmony_ci .maps[RTL_RC_OFDM_RATE6M] = DESC_RATE6M, 3668c2ecf20Sopenharmony_ci .maps[RTL_RC_OFDM_RATE9M] = DESC_RATE9M, 3678c2ecf20Sopenharmony_ci .maps[RTL_RC_OFDM_RATE12M] = DESC_RATE12M, 3688c2ecf20Sopenharmony_ci .maps[RTL_RC_OFDM_RATE18M] = DESC_RATE18M, 3698c2ecf20Sopenharmony_ci .maps[RTL_RC_OFDM_RATE24M] = DESC_RATE24M, 3708c2ecf20Sopenharmony_ci .maps[RTL_RC_OFDM_RATE36M] = DESC_RATE36M, 3718c2ecf20Sopenharmony_ci .maps[RTL_RC_OFDM_RATE48M] = DESC_RATE48M, 3728c2ecf20Sopenharmony_ci .maps[RTL_RC_OFDM_RATE54M] = DESC_RATE54M, 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ci .maps[RTL_RC_HT_RATEMCS7] = DESC_RATEMCS7, 3758c2ecf20Sopenharmony_ci .maps[RTL_RC_HT_RATEMCS15] = DESC_RATEMCS15, 3768c2ecf20Sopenharmony_ci}; 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_cistatic const struct pci_device_id rtl92se_pci_ids[] = { 3798c2ecf20Sopenharmony_ci {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8192, rtl92se_hal_cfg)}, 3808c2ecf20Sopenharmony_ci {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8171, rtl92se_hal_cfg)}, 3818c2ecf20Sopenharmony_ci {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8172, rtl92se_hal_cfg)}, 3828c2ecf20Sopenharmony_ci {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8173, rtl92se_hal_cfg)}, 3838c2ecf20Sopenharmony_ci {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8174, rtl92se_hal_cfg)}, 3848c2ecf20Sopenharmony_ci {}, 3858c2ecf20Sopenharmony_ci}; 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(pci, rtl92se_pci_ids); 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ciMODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); 3908c2ecf20Sopenharmony_ciMODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>"); 3918c2ecf20Sopenharmony_ciMODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>"); 3928c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL"); 3938c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Realtek 8192S/8191S 802.11n PCI wireless"); 3948c2ecf20Sopenharmony_ciMODULE_FIRMWARE("rtlwifi/rtl8192sefw.bin"); 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_cimodule_param_named(swenc, rtl92se_mod_params.sw_crypto, bool, 0444); 3978c2ecf20Sopenharmony_cimodule_param_named(debug_level, rtl92se_mod_params.debug_level, int, 0644); 3988c2ecf20Sopenharmony_cimodule_param_named(debug_mask, rtl92se_mod_params.debug_mask, ullong, 0644); 3998c2ecf20Sopenharmony_cimodule_param_named(ips, rtl92se_mod_params.inactiveps, bool, 0444); 4008c2ecf20Sopenharmony_cimodule_param_named(swlps, rtl92se_mod_params.swctrl_lps, bool, 0444); 4018c2ecf20Sopenharmony_cimodule_param_named(fwlps, rtl92se_mod_params.fwctrl_lps, bool, 0444); 4028c2ecf20Sopenharmony_cimodule_param_named(aspm, rtl92se_mod_params.aspm_support, int, 0444); 4038c2ecf20Sopenharmony_ciMODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); 4048c2ecf20Sopenharmony_ciMODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); 4058c2ecf20Sopenharmony_ciMODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 1)\n"); 4068c2ecf20Sopenharmony_ciMODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 0)\n"); 4078c2ecf20Sopenharmony_ciMODULE_PARM_DESC(aspm, "Set to 1 to enable ASPM (default 1)\n"); 4088c2ecf20Sopenharmony_ciMODULE_PARM_DESC(debug_level, "Set debug level (0-5) (default 0)"); 4098c2ecf20Sopenharmony_ciMODULE_PARM_DESC(debug_mask, "Set debug mask (default 0)"); 4108c2ecf20Sopenharmony_ci 4118c2ecf20Sopenharmony_cistatic SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_cistatic struct pci_driver rtl92se_driver = { 4148c2ecf20Sopenharmony_ci .name = KBUILD_MODNAME, 4158c2ecf20Sopenharmony_ci .id_table = rtl92se_pci_ids, 4168c2ecf20Sopenharmony_ci .probe = rtl_pci_probe, 4178c2ecf20Sopenharmony_ci .remove = rtl_pci_disconnect, 4188c2ecf20Sopenharmony_ci .driver.pm = &rtlwifi_pm_ops, 4198c2ecf20Sopenharmony_ci}; 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_cimodule_pci_driver(rtl92se_driver); 422