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 "../usb.h"
78c2ecf20Sopenharmony_ci#include "../efuse.h"
88c2ecf20Sopenharmony_ci#include "../base.h"
98c2ecf20Sopenharmony_ci#include "reg.h"
108c2ecf20Sopenharmony_ci#include "def.h"
118c2ecf20Sopenharmony_ci#include "phy.h"
128c2ecf20Sopenharmony_ci#include "mac.h"
138c2ecf20Sopenharmony_ci#include "dm.h"
148c2ecf20Sopenharmony_ci#include "rf.h"
158c2ecf20Sopenharmony_ci#include "trx.h"
168c2ecf20Sopenharmony_ci#include "led.h"
178c2ecf20Sopenharmony_ci#include "hw.h"
188c2ecf20Sopenharmony_ci#include "../rtl8192c/fw_common.h"
198c2ecf20Sopenharmony_ci#include <linux/module.h>
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciMODULE_AUTHOR("Georgia		<georgia@realtek.com>");
228c2ecf20Sopenharmony_ciMODULE_AUTHOR("Ziv Huang	<ziv_huang@realtek.com>");
238c2ecf20Sopenharmony_ciMODULE_AUTHOR("Larry Finger	<Larry.Finger@lwfinger.net>");
248c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL");
258c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n USB wireless");
268c2ecf20Sopenharmony_ciMODULE_FIRMWARE("rtlwifi/rtl8192cufw.bin");
278c2ecf20Sopenharmony_ciMODULE_FIRMWARE("rtlwifi/rtl8192cufw_A.bin");
288c2ecf20Sopenharmony_ciMODULE_FIRMWARE("rtlwifi/rtl8192cufw_B.bin");
298c2ecf20Sopenharmony_ciMODULE_FIRMWARE("rtlwifi/rtl8192cufw_TMSC.bin");
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_cistatic int rtl92cu_init_sw_vars(struct ieee80211_hw *hw)
328c2ecf20Sopenharmony_ci{
338c2ecf20Sopenharmony_ci	struct rtl_priv *rtlpriv = rtl_priv(hw);
348c2ecf20Sopenharmony_ci	int err;
358c2ecf20Sopenharmony_ci	char *fw_name;
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	rtlpriv->dm.dm_initialgain_enable = true;
388c2ecf20Sopenharmony_ci	rtlpriv->dm.dm_flag = 0;
398c2ecf20Sopenharmony_ci	rtlpriv->dm.disable_framebursting = false;
408c2ecf20Sopenharmony_ci	rtlpriv->dm.thermalvalue = 0;
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci	/* for firmware buf */
438c2ecf20Sopenharmony_ci	rtlpriv->rtlhal.pfirmware = vzalloc(0x4000);
448c2ecf20Sopenharmony_ci	if (!rtlpriv->rtlhal.pfirmware) {
458c2ecf20Sopenharmony_ci		pr_err("Can't alloc buffer for fw\n");
468c2ecf20Sopenharmony_ci		return 1;
478c2ecf20Sopenharmony_ci	}
488c2ecf20Sopenharmony_ci	if (IS_VENDOR_UMC_A_CUT(rtlpriv->rtlhal.version) &&
498c2ecf20Sopenharmony_ci	    !IS_92C_SERIAL(rtlpriv->rtlhal.version)) {
508c2ecf20Sopenharmony_ci		fw_name = "rtlwifi/rtl8192cufw_A.bin";
518c2ecf20Sopenharmony_ci	} else if (IS_81XXC_VENDOR_UMC_B_CUT(rtlpriv->rtlhal.version)) {
528c2ecf20Sopenharmony_ci		fw_name = "rtlwifi/rtl8192cufw_B.bin";
538c2ecf20Sopenharmony_ci	} else {
548c2ecf20Sopenharmony_ci		fw_name = "rtlwifi/rtl8192cufw_TMSC.bin";
558c2ecf20Sopenharmony_ci	}
568c2ecf20Sopenharmony_ci	/* provide name of alternative file */
578c2ecf20Sopenharmony_ci	rtlpriv->cfg->alt_fw_name = "rtlwifi/rtl8192cufw.bin";
588c2ecf20Sopenharmony_ci	pr_info("Loading firmware %s\n", fw_name);
598c2ecf20Sopenharmony_ci	rtlpriv->max_fw_size = 0x4000;
608c2ecf20Sopenharmony_ci	err = request_firmware_nowait(THIS_MODULE, 1,
618c2ecf20Sopenharmony_ci				      fw_name, rtlpriv->io.dev,
628c2ecf20Sopenharmony_ci				      GFP_KERNEL, hw, rtl_fw_cb);
638c2ecf20Sopenharmony_ci	if (err) {
648c2ecf20Sopenharmony_ci		vfree(rtlpriv->rtlhal.pfirmware);
658c2ecf20Sopenharmony_ci		rtlpriv->rtlhal.pfirmware = NULL;
668c2ecf20Sopenharmony_ci	}
678c2ecf20Sopenharmony_ci	return err;
688c2ecf20Sopenharmony_ci}
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_cistatic void rtl92cu_deinit_sw_vars(struct ieee80211_hw *hw)
718c2ecf20Sopenharmony_ci{
728c2ecf20Sopenharmony_ci	struct rtl_priv *rtlpriv = rtl_priv(hw);
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci	if (rtlpriv->rtlhal.pfirmware) {
758c2ecf20Sopenharmony_ci		vfree(rtlpriv->rtlhal.pfirmware);
768c2ecf20Sopenharmony_ci		rtlpriv->rtlhal.pfirmware = NULL;
778c2ecf20Sopenharmony_ci	}
788c2ecf20Sopenharmony_ci}
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci/* get bt coexist status */
818c2ecf20Sopenharmony_cistatic bool rtl92cu_get_btc_status(void)
828c2ecf20Sopenharmony_ci{
838c2ecf20Sopenharmony_ci	return false;
848c2ecf20Sopenharmony_ci}
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_cistatic struct rtl_hal_ops rtl8192cu_hal_ops = {
878c2ecf20Sopenharmony_ci	.init_sw_vars = rtl92cu_init_sw_vars,
888c2ecf20Sopenharmony_ci	.deinit_sw_vars = rtl92cu_deinit_sw_vars,
898c2ecf20Sopenharmony_ci	.read_chip_version = rtl92c_read_chip_version,
908c2ecf20Sopenharmony_ci	.read_eeprom_info = rtl92cu_read_eeprom_info,
918c2ecf20Sopenharmony_ci	.enable_interrupt = rtl92c_enable_interrupt,
928c2ecf20Sopenharmony_ci	.disable_interrupt = rtl92c_disable_interrupt,
938c2ecf20Sopenharmony_ci	.hw_init = rtl92cu_hw_init,
948c2ecf20Sopenharmony_ci	.hw_disable = rtl92cu_card_disable,
958c2ecf20Sopenharmony_ci	.set_network_type = rtl92cu_set_network_type,
968c2ecf20Sopenharmony_ci	.set_chk_bssid = rtl92cu_set_check_bssid,
978c2ecf20Sopenharmony_ci	.set_qos = rtl92c_set_qos,
988c2ecf20Sopenharmony_ci	.set_bcn_reg = rtl92cu_set_beacon_related_registers,
998c2ecf20Sopenharmony_ci	.set_bcn_intv = rtl92cu_set_beacon_interval,
1008c2ecf20Sopenharmony_ci	.update_interrupt_mask = rtl92cu_update_interrupt_mask,
1018c2ecf20Sopenharmony_ci	.get_hw_reg = rtl92cu_get_hw_reg,
1028c2ecf20Sopenharmony_ci	.set_hw_reg = rtl92cu_set_hw_reg,
1038c2ecf20Sopenharmony_ci	.update_rate_tbl = rtl92cu_update_hal_rate_tbl,
1048c2ecf20Sopenharmony_ci	.fill_tx_desc = rtl92cu_tx_fill_desc,
1058c2ecf20Sopenharmony_ci	.fill_fake_txdesc = rtl92cu_fill_fake_txdesc,
1068c2ecf20Sopenharmony_ci	.fill_tx_cmddesc = rtl92cu_tx_fill_cmddesc,
1078c2ecf20Sopenharmony_ci	.query_rx_desc = rtl92cu_rx_query_desc,
1088c2ecf20Sopenharmony_ci	.set_channel_access = rtl92cu_update_channel_access_setting,
1098c2ecf20Sopenharmony_ci	.radio_onoff_checking = rtl92cu_gpio_radio_on_off_checking,
1108c2ecf20Sopenharmony_ci	.set_bw_mode = rtl92c_phy_set_bw_mode,
1118c2ecf20Sopenharmony_ci	.switch_channel = rtl92c_phy_sw_chnl,
1128c2ecf20Sopenharmony_ci	.dm_watchdog = rtl92c_dm_watchdog,
1138c2ecf20Sopenharmony_ci	.scan_operation_backup = rtl_phy_scan_operation_backup,
1148c2ecf20Sopenharmony_ci	.set_rf_power_state = rtl92cu_phy_set_rf_power_state,
1158c2ecf20Sopenharmony_ci	.led_control = rtl92cu_led_control,
1168c2ecf20Sopenharmony_ci	.enable_hw_sec = rtl92cu_enable_hw_security_config,
1178c2ecf20Sopenharmony_ci	.set_key = rtl92c_set_key,
1188c2ecf20Sopenharmony_ci	.init_sw_leds = rtl92cu_init_sw_leds,
1198c2ecf20Sopenharmony_ci	.deinit_sw_leds = rtl92cu_deinit_sw_leds,
1208c2ecf20Sopenharmony_ci	.get_bbreg = rtl92c_phy_query_bb_reg,
1218c2ecf20Sopenharmony_ci	.set_bbreg = rtl92c_phy_set_bb_reg,
1228c2ecf20Sopenharmony_ci	.get_rfreg = rtl92cu_phy_query_rf_reg,
1238c2ecf20Sopenharmony_ci	.set_rfreg = rtl92cu_phy_set_rf_reg,
1248c2ecf20Sopenharmony_ci	.phy_rf6052_config = rtl92cu_phy_rf6052_config,
1258c2ecf20Sopenharmony_ci	.phy_rf6052_set_cck_txpower = rtl92cu_phy_rf6052_set_cck_txpower,
1268c2ecf20Sopenharmony_ci	.phy_rf6052_set_ofdm_txpower = rtl92cu_phy_rf6052_set_ofdm_txpower,
1278c2ecf20Sopenharmony_ci	.config_bb_with_headerfile = _rtl92cu_phy_config_bb_with_headerfile,
1288c2ecf20Sopenharmony_ci	.config_bb_with_pgheaderfile = _rtl92cu_phy_config_bb_with_pgheaderfile,
1298c2ecf20Sopenharmony_ci	.phy_lc_calibrate = _rtl92cu_phy_lc_calibrate,
1308c2ecf20Sopenharmony_ci	.phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback,
1318c2ecf20Sopenharmony_ci	.dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower,
1328c2ecf20Sopenharmony_ci	.fill_h2c_cmd = rtl92c_fill_h2c_cmd,
1338c2ecf20Sopenharmony_ci	.get_btc_status = rtl92cu_get_btc_status,
1348c2ecf20Sopenharmony_ci};
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_cistatic struct rtl_mod_params rtl92cu_mod_params = {
1378c2ecf20Sopenharmony_ci	.sw_crypto = 0,
1388c2ecf20Sopenharmony_ci	.debug_level = 0,
1398c2ecf20Sopenharmony_ci	.debug_mask = 0,
1408c2ecf20Sopenharmony_ci};
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_cimodule_param_named(swenc, rtl92cu_mod_params.sw_crypto, bool, 0444);
1438c2ecf20Sopenharmony_cimodule_param_named(debug_level, rtl92cu_mod_params.debug_level, int, 0644);
1448c2ecf20Sopenharmony_cimodule_param_named(debug_mask, rtl92cu_mod_params.debug_mask, ullong, 0644);
1458c2ecf20Sopenharmony_ciMODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
1468c2ecf20Sopenharmony_ciMODULE_PARM_DESC(debug_level, "Set debug level (0-5) (default 0)");
1478c2ecf20Sopenharmony_ciMODULE_PARM_DESC(debug_mask, "Set debug mask (default 0)");
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_cistatic struct rtl_hal_usbint_cfg rtl92cu_interface_cfg = {
1508c2ecf20Sopenharmony_ci	/* rx */
1518c2ecf20Sopenharmony_ci	.in_ep_num = RTL92C_USB_BULK_IN_NUM,
1528c2ecf20Sopenharmony_ci	.rx_urb_num = RTL92C_NUM_RX_URBS,
1538c2ecf20Sopenharmony_ci	.rx_max_size = RTL92C_SIZE_MAX_RX_BUFFER,
1548c2ecf20Sopenharmony_ci	.usb_rx_hdl = rtl8192cu_rx_hdl,
1558c2ecf20Sopenharmony_ci	.usb_rx_segregate_hdl = NULL,
1568c2ecf20Sopenharmony_ci	/* tx */
1578c2ecf20Sopenharmony_ci	.usb_tx_cleanup = rtl8192c_tx_cleanup,
1588c2ecf20Sopenharmony_ci	.usb_tx_post_hdl = rtl8192c_tx_post_hdl,
1598c2ecf20Sopenharmony_ci	.usb_tx_aggregate_hdl = rtl8192c_tx_aggregate_hdl,
1608c2ecf20Sopenharmony_ci	/* endpoint mapping */
1618c2ecf20Sopenharmony_ci	.usb_endpoint_mapping = rtl8192cu_endpoint_mapping,
1628c2ecf20Sopenharmony_ci	.usb_mq_to_hwq = rtl8192cu_mq_to_hwq,
1638c2ecf20Sopenharmony_ci};
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_cistatic struct rtl_hal_cfg rtl92cu_hal_cfg = {
1668c2ecf20Sopenharmony_ci	.name = "rtl92c_usb",
1678c2ecf20Sopenharmony_ci	.ops = &rtl8192cu_hal_ops,
1688c2ecf20Sopenharmony_ci	.mod_params = &rtl92cu_mod_params,
1698c2ecf20Sopenharmony_ci	.usb_interface_cfg = &rtl92cu_interface_cfg,
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci	.maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
1728c2ecf20Sopenharmony_ci	.maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN,
1738c2ecf20Sopenharmony_ci	.maps[SYS_CLK] = REG_SYS_CLKR,
1748c2ecf20Sopenharmony_ci	.maps[MAC_RCR_AM] = AM,
1758c2ecf20Sopenharmony_ci	.maps[MAC_RCR_AB] = AB,
1768c2ecf20Sopenharmony_ci	.maps[MAC_RCR_ACRC32] = ACRC32,
1778c2ecf20Sopenharmony_ci	.maps[MAC_RCR_ACF] = ACF,
1788c2ecf20Sopenharmony_ci	.maps[MAC_RCR_AAP] = AAP,
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci	.maps[EFUSE_TEST] = REG_EFUSE_TEST,
1818c2ecf20Sopenharmony_ci	.maps[EFUSE_CTRL] = REG_EFUSE_CTRL,
1828c2ecf20Sopenharmony_ci	.maps[EFUSE_CLK] = 0,
1838c2ecf20Sopenharmony_ci	.maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL,
1848c2ecf20Sopenharmony_ci	.maps[EFUSE_PWC_EV12V] = PWC_EV12V,
1858c2ecf20Sopenharmony_ci	.maps[EFUSE_FEN_ELDR] = FEN_ELDR,
1868c2ecf20Sopenharmony_ci	.maps[EFUSE_LOADER_CLK_EN] = LOADER_CLK_EN,
1878c2ecf20Sopenharmony_ci	.maps[EFUSE_ANA8M] = EFUSE_ANA8M,
1888c2ecf20Sopenharmony_ci	.maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE,
1898c2ecf20Sopenharmony_ci	.maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION,
1908c2ecf20Sopenharmony_ci	.maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN,
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci	.maps[RWCAM] = REG_CAMCMD,
1938c2ecf20Sopenharmony_ci	.maps[WCAMI] = REG_CAMWRITE,
1948c2ecf20Sopenharmony_ci	.maps[RCAMO] = REG_CAMREAD,
1958c2ecf20Sopenharmony_ci	.maps[CAMDBG] = REG_CAMDBG,
1968c2ecf20Sopenharmony_ci	.maps[SECR] = REG_SECCFG,
1978c2ecf20Sopenharmony_ci	.maps[SEC_CAM_NONE] = CAM_NONE,
1988c2ecf20Sopenharmony_ci	.maps[SEC_CAM_WEP40] = CAM_WEP40,
1998c2ecf20Sopenharmony_ci	.maps[SEC_CAM_TKIP] = CAM_TKIP,
2008c2ecf20Sopenharmony_ci	.maps[SEC_CAM_AES] = CAM_AES,
2018c2ecf20Sopenharmony_ci	.maps[SEC_CAM_WEP104] = CAM_WEP104,
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6,
2048c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5,
2058c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4,
2068c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3,
2078c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2,
2088c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1,
2098c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8,
2108c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7,
2118c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6,
2128c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5,
2138c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4,
2148c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3,
2158c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2,
2168c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1,
2178c2ecf20Sopenharmony_ci	.maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2,
2188c2ecf20Sopenharmony_ci	.maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1,
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci	.maps[RTL_IMR_TXFOVW] = IMR_TXFOVW,
2218c2ecf20Sopenharmony_ci	.maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT,
2228c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BCNINT] = IMR_BCNINT,
2238c2ecf20Sopenharmony_ci	.maps[RTL_IMR_RXFOVW] = IMR_RXFOVW,
2248c2ecf20Sopenharmony_ci	.maps[RTL_IMR_RDU] = IMR_RDU,
2258c2ecf20Sopenharmony_ci	.maps[RTL_IMR_ATIMEND] = IMR_ATIMEND,
2268c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BDOK] = IMR_BDOK,
2278c2ecf20Sopenharmony_ci	.maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK,
2288c2ecf20Sopenharmony_ci	.maps[RTL_IMR_TBDER] = IMR_TBDER,
2298c2ecf20Sopenharmony_ci	.maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK,
2308c2ecf20Sopenharmony_ci	.maps[RTL_IMR_TBDOK] = IMR_TBDOK,
2318c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BKDOK] = IMR_BKDOK,
2328c2ecf20Sopenharmony_ci	.maps[RTL_IMR_BEDOK] = IMR_BEDOK,
2338c2ecf20Sopenharmony_ci	.maps[RTL_IMR_VIDOK] = IMR_VIDOK,
2348c2ecf20Sopenharmony_ci	.maps[RTL_IMR_VODOK] = IMR_VODOK,
2358c2ecf20Sopenharmony_ci	.maps[RTL_IMR_ROK] = IMR_ROK,
2368c2ecf20Sopenharmony_ci	.maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER),
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci	.maps[RTL_RC_CCK_RATE1M] = DESC_RATE1M,
2398c2ecf20Sopenharmony_ci	.maps[RTL_RC_CCK_RATE2M] = DESC_RATE2M,
2408c2ecf20Sopenharmony_ci	.maps[RTL_RC_CCK_RATE5_5M] = DESC_RATE5_5M,
2418c2ecf20Sopenharmony_ci	.maps[RTL_RC_CCK_RATE11M] = DESC_RATE11M,
2428c2ecf20Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE6M] = DESC_RATE6M,
2438c2ecf20Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE9M] = DESC_RATE9M,
2448c2ecf20Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE12M] = DESC_RATE12M,
2458c2ecf20Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE18M] = DESC_RATE18M,
2468c2ecf20Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE24M] = DESC_RATE24M,
2478c2ecf20Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE36M] = DESC_RATE36M,
2488c2ecf20Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE48M] = DESC_RATE48M,
2498c2ecf20Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE54M] = DESC_RATE54M,
2508c2ecf20Sopenharmony_ci	.maps[RTL_RC_HT_RATEMCS7] = DESC_RATEMCS7,
2518c2ecf20Sopenharmony_ci	.maps[RTL_RC_HT_RATEMCS15] = DESC_RATEMCS15,
2528c2ecf20Sopenharmony_ci};
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci#define USB_VENDOR_ID_REALTEK		0x0bda
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci/* 2010-10-19 DID_USB_V3.4 */
2578c2ecf20Sopenharmony_cistatic const struct usb_device_id rtl8192c_usb_ids[] = {
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci	/*=== Realtek demoboard ===*/
2608c2ecf20Sopenharmony_ci	/* Default ID */
2618c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8191, rtl92cu_hal_cfg)},
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci	/****** 8188CU ********/
2648c2ecf20Sopenharmony_ci	/* RTL8188CTV */
2658c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x018a, rtl92cu_hal_cfg)},
2668c2ecf20Sopenharmony_ci	/* 8188CE-VAU USB minCard */
2678c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8170, rtl92cu_hal_cfg)},
2688c2ecf20Sopenharmony_ci	/* 8188cu 1*1 dongle */
2698c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8176, rtl92cu_hal_cfg)},
2708c2ecf20Sopenharmony_ci	/* 8188cu 1*1 dongle, (b/g mode only) */
2718c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8177, rtl92cu_hal_cfg)},
2728c2ecf20Sopenharmony_ci	/* 8188cu Slim Solo */
2738c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x817a, rtl92cu_hal_cfg)},
2748c2ecf20Sopenharmony_ci	/* 8188cu Slim Combo */
2758c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x817b, rtl92cu_hal_cfg)},
2768c2ecf20Sopenharmony_ci	/* 8188RU High-power USB Dongle */
2778c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x817d, rtl92cu_hal_cfg)},
2788c2ecf20Sopenharmony_ci	/* 8188CE-VAU USB minCard (b/g mode only) */
2798c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x817e, rtl92cu_hal_cfg)},
2808c2ecf20Sopenharmony_ci	/* 8188RU in Alfa AWUS036NHR */
2818c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x817f, rtl92cu_hal_cfg)},
2828c2ecf20Sopenharmony_ci	/* RTL8188CUS-VL */
2838c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x818a, rtl92cu_hal_cfg)},
2848c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x819a, rtl92cu_hal_cfg)},
2858c2ecf20Sopenharmony_ci	/* 8188 Combo for BC4 */
2868c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8754, rtl92cu_hal_cfg)},
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci	/****** 8192CU ********/
2898c2ecf20Sopenharmony_ci	/* 8192cu 2*2 */
2908c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8178, rtl92cu_hal_cfg)},
2918c2ecf20Sopenharmony_ci	/* 8192CE-VAU USB minCard */
2928c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x817c, rtl92cu_hal_cfg)},
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci	/*=== Customer ID ===*/
2958c2ecf20Sopenharmony_ci	/****** 8188CU ********/
2968c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x050d, 0x1102, rtl92cu_hal_cfg)}, /*Belkin - Edimax*/
2978c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x050d, 0x11f2, rtl92cu_hal_cfg)}, /*Belkin - ISY*/
2988c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x06f8, 0xe033, rtl92cu_hal_cfg)}, /*Hercules - Edimax*/
2998c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
3008c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
3018c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
3028c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0846, 0x9043, rtl92cu_hal_cfg)}, /*NG WNA1000Mv2*/
3038c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
3048c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/
3058c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
3068c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
3078c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0df6, 0x0070, rtl92cu_hal_cfg)}, /*Sitecom - 150N */
3088c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0df6, 0x0077, rtl92cu_hal_cfg)}, /*Sitecom-WLA2100V2*/
3098c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/
3108c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/
3118c2ecf20Sopenharmony_ci	/* HP - Lite-On ,8188CUS Slim Combo */
3128c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)},
3138c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x13d3, 0x3357, rtl92cu_hal_cfg)}, /* AzureWave */
3148c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x2001, 0x3308, rtl92cu_hal_cfg)}, /*D-Link - Alpha*/
3158c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x2019, 0x4902, rtl92cu_hal_cfg)}, /*Planex - Etop*/
3168c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x2019, 0xab2a, rtl92cu_hal_cfg)}, /*Planex - Abocom*/
3178c2ecf20Sopenharmony_ci	/*SW-WF02-AD15 -Abocom*/
3188c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x2019, 0xab2e, rtl92cu_hal_cfg)},
3198c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x2019, 0xed17, rtl92cu_hal_cfg)}, /*PCI - Edimax*/
3208c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x20f4, 0x648b, rtl92cu_hal_cfg)}, /*TRENDnet - Cameo*/
3218c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x7392, 0x7811, rtl92cu_hal_cfg)}, /*Edimax - Edimax*/
3228c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x13d3, 0x3358, rtl92cu_hal_cfg)}, /*Azwave 8188CE-VAU*/
3238c2ecf20Sopenharmony_ci	/* Russian customer -Azwave (8188CE-VAU  b/g mode only) */
3248c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x13d3, 0x3359, rtl92cu_hal_cfg)},
3258c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x4855, 0x0090, rtl92cu_hal_cfg)}, /* Feixun */
3268c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x4855, 0x0091, rtl92cu_hal_cfg)}, /* NetweeN-Feixun */
3278c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x9846, 0x9041, rtl92cu_hal_cfg)}, /* Netgear Cameo */
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci	/****** 8188 RU ********/
3308c2ecf20Sopenharmony_ci	/* Netcore */
3318c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x317f, rtl92cu_hal_cfg)},
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_ci	/****** 8188CUS Slim Solo********/
3348c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x04f2, 0xaff7, rtl92cu_hal_cfg)}, /*Xavi*/
3358c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x04f2, 0xaff9, rtl92cu_hal_cfg)}, /*Xavi*/
3368c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x04f2, 0xaffa, rtl92cu_hal_cfg)}, /*Xavi*/
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci	/****** 8188CUS Slim Combo ********/
3398c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x04f2, 0xaff8, rtl92cu_hal_cfg)}, /*Xavi*/
3408c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x04f2, 0xaffb, rtl92cu_hal_cfg)}, /*Xavi*/
3418c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x04f2, 0xaffc, rtl92cu_hal_cfg)}, /*Xavi*/
3428c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x2019, 0x1201, rtl92cu_hal_cfg)}, /*Planex-Vencer*/
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci	/****** 8192CU ********/
3458c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x050d, 0x1004, rtl92cu_hal_cfg)}, /*Belcom-SurfN300*/
3468c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x050d, 0x2102, rtl92cu_hal_cfg)}, /*Belcom-Sercomm*/
3478c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x050d, 0x2103, rtl92cu_hal_cfg)}, /*Belcom-Edimax*/
3488c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0586, 0x341f, rtl92cu_hal_cfg)}, /*Zyxel -Abocom*/
3498c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/
3508c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/
3518c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/
3528c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0846, 0xf001, rtl92cu_hal_cfg)}, /*On Netwrks N300MA*/
3538c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
3548c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/
3558c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/
3568c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x0e66, 0x0019, rtl92cu_hal_cfg)}, /*Hawking-Edimax*/
3578c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/
3588c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x2001, 0x3309, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
3598c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x2001, 0x330a, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
3608c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x2001, 0x330d, rtl92cu_hal_cfg)}, /*D-Link DWA-131 */
3618c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x2019, 0xab2b, rtl92cu_hal_cfg)}, /*Planex -Abocom*/
3628c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x20f4, 0x624d, rtl92cu_hal_cfg)}, /*TRENDNet*/
3638c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x2357, 0x0100, rtl92cu_hal_cfg)}, /*TP-Link WN8200ND*/
3648c2ecf20Sopenharmony_ci	{RTL_USB_DEVICE(0x7392, 0x7822, rtl92cu_hal_cfg)}, /*Edimax -Edimax*/
3658c2ecf20Sopenharmony_ci	{}
3668c2ecf20Sopenharmony_ci};
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(usb, rtl8192c_usb_ids);
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_cistatic int rtl8192cu_probe(struct usb_interface *intf,
3718c2ecf20Sopenharmony_ci			   const struct usb_device_id *id)
3728c2ecf20Sopenharmony_ci{
3738c2ecf20Sopenharmony_ci	return rtl_usb_probe(intf, id, &rtl92cu_hal_cfg);
3748c2ecf20Sopenharmony_ci}
3758c2ecf20Sopenharmony_ci
3768c2ecf20Sopenharmony_cistatic struct usb_driver rtl8192cu_driver = {
3778c2ecf20Sopenharmony_ci	.name = "rtl8192cu",
3788c2ecf20Sopenharmony_ci	.probe = rtl8192cu_probe,
3798c2ecf20Sopenharmony_ci	.disconnect = rtl_usb_disconnect,
3808c2ecf20Sopenharmony_ci	.id_table = rtl8192c_usb_ids,
3818c2ecf20Sopenharmony_ci
3828c2ecf20Sopenharmony_ci#ifdef CONFIG_PM
3838c2ecf20Sopenharmony_ci	/* .suspend = rtl_usb_suspend, */
3848c2ecf20Sopenharmony_ci	/* .resume = rtl_usb_resume, */
3858c2ecf20Sopenharmony_ci	/* .reset_resume = rtl8192c_resume, */
3868c2ecf20Sopenharmony_ci#endif /* CONFIG_PM */
3878c2ecf20Sopenharmony_ci	.disable_hub_initiated_lpm = 1,
3888c2ecf20Sopenharmony_ci};
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_cimodule_usb_driver(rtl8192cu_driver);
391