42 #include "../rtl8192ce/hw.h"
121 static void _rtl92cu_read_txpower_info_from_hwpg(
struct ieee80211_hw *hw,
130 for (rf_path = 0; rf_path < 2; rf_path++) {
131 for (i = 0; i < 3; i++) {
132 if (!autoload_fail) {
150 for (i = 0; i < 3; i++) {
158 ((tempval & 0xf0) >> 4);
160 for (rf_path = 0; rf_path < 2; rf_path++)
161 for (i = 0; i < 3; i++)
163 "RF(%d) EEPROM CCK Area(%d) = 0x%x\n",
167 for (rf_path = 0; rf_path < 2; rf_path++)
168 for (i = 0; i < 3; i++)
170 "RF(%d) EEPROM HT40 1S Area(%d) = 0x%x\n",
174 for (rf_path = 0; rf_path < 2; rf_path++)
175 for (i = 0; i < 3; i++)
177 "RF(%d) EEPROM HT40 2S Diff Area(%d) = 0x%x\n",
181 for (rf_path = 0; rf_path < 2; rf_path++) {
182 for (i = 0; i < 14; i++) {
183 index = _rtl92c_get_chnl_group((
u8) i);
204 for (i = 0; i < 14; i++) {
206 "RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = [0x%x / 0x%x / 0x%x]\n", rf_path, i,
212 for (i = 0; i < 3; i++) {
213 if (!autoload_fail) {
223 for (rf_path = 0; rf_path < 2; rf_path++) {
224 for (i = 0; i < 14; i++) {
225 index = _rtl92c_get_chnl_group((
u8) i);
242 "RF-%d pwrgroup_ht20[%d] = 0x%x\n",
246 "RF-%d pwrgroup_ht40[%d] = 0x%x\n",
251 for (i = 0; i < 14; i++) {
252 index = _rtl92c_get_chnl_group((
u8) i);
259 ((tempval >> 4) & 0xF);
264 index = _rtl92c_get_chnl_group((
u8)
i);
271 ((tempval >> 4) & 0xF);
275 for (i = 0; i < 14; i++)
277 "RF-A Ht20 to HT40 Diff[%d] = 0x%x\n",
279 for (i = 0; i < 14; i++)
281 "RF-A Legacy to Ht40 Diff[%d] = 0x%x\n",
283 for (i = 0; i < 14; i++)
285 "RF-B Ht20 to HT40 Diff[%d] = 0x%x\n",
287 for (i = 0; i < 14; i++)
289 "RF-B Legacy to HT40 Diff[%d] = 0x%x\n",
297 if (!autoload_fail) {
305 "TSSI_A = 0x%x, TSSI_B = 0x%x\n",
323 static void _rtl92cu_read_board_type(
struct ieee80211_hw *hw,
u8 *contents)
342 static void _rtl92cu_read_adapter_info(
struct ieee80211_hw *hw)
358 "RTL819X Not boot from eeprom, check it !!\n");
365 "EEPROM ID(%#x) is invalid!!\n", eeprom_id);
373 for (i = 0; i < 6; i += 2) {
378 _rtl92cu_read_txpower_info_from_hwpg(hw,
416 _rtl92cu_read_board_type(hw, hwinfo);
419 static void _rtl92cu_hal_customized_behavior(
struct ieee80211_hw *hw)
427 usb_priv->
ledctl.led_opendrain =
true;
460 _rtl92cu_read_adapter_info(hw);
461 _rtl92cu_hal_customized_behavior(hw);
465 static int _rtl92cu_init_power_on(
struct ieee80211_hw *hw)
472 u32 pollingCount = 0;
480 if (pollingCount++ > 100) {
482 "Failed to polling REG_APS_FSMCO[PFM_ALDN] done!\n");
497 " power-on :REG_LDOV12D_CTRL Reg0x21:0x%02x\n",
511 pr_info(
"MAC auto ON okay!\n");
514 if (pollingCount++ > 100) {
516 "Failed to polling REG_APS_FSMCO[APFM_ONMAC] done!\n");
528 rtl_write_byte(rtlpriv,
REG_APSD_CTRL, (rtl_read_byte(rtlpriv,
532 }
while ((pollingCount < 200) &&
535 value16 = rtl_read_word(rtlpriv,
REG_CR);
538 rtl_write_word(rtlpriv,
REG_CR, value16);
542 static void _rtl92cu_init_queue_reserved_page(
struct ieee80211_hw *hw,
550 u32 outEPNum = (
u32)out_ep_num;
557 u32 txQPageNum, txQPageUnit, txQRemainPage;
564 txQPageUnit = txQPageNum/outEPNum;
565 txQRemainPage = txQPageNum % outEPNum;
572 if ((outEPNum > 1) && (txQRemainPage))
573 numHQ += txQRemainPage;
585 if (queue_sel & TX_SELE_HQ) {
589 if (queue_sel & TX_SELE_LQ) {
603 rtl_write_dword(rtlpriv,
REG_RQPN, value32);
606 static void _rtl92c_init_trx_buffer(
struct ieee80211_hw *hw,
bool wmm_enable)
623 rtl_write_byte(rtlpriv,
REG_TDECTRL+1, txpktbuf_bndy);
626 rtl_write_byte(rtlpriv,
REG_PBP, value8);
629 static void _rtl92c_init_chipN_reg_priority(
struct ieee80211_hw *hw,
u16 beQ,
642 static void _rtl92cu_init_chipN_one_out_ep_priority(
struct ieee80211_hw *hw,
664 pr_info(
"Tx queue select: 0x%02x\n", queue_sel);
667 static void _rtl92cu_init_chipN_two_out_ep_priority(
struct ieee80211_hw *hw,
671 u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ;
676 case (TX_SELE_HQ | TX_SELE_LQ):
707 _rtl92c_init_chipN_reg_priority(hw, beQ, bkQ, viQ, voQ, mgtQ, hiQ);
708 pr_info(
"Tx queue select: 0x%02x\n", queue_sel);
711 static void _rtl92cu_init_chipN_three_out_ep_priority(
struct ieee80211_hw *hw,
715 u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ;
733 _rtl92c_init_chipN_reg_priority(hw, beQ, bkQ, viQ, voQ, mgtQ, hiQ);
738 static void _rtl92cu_init_chipN_queue_priority(
struct ieee80211_hw *hw,
743 switch (out_ep_num) {
745 _rtl92cu_init_chipN_one_out_ep_priority(hw, wmm_enable,
749 _rtl92cu_init_chipN_two_out_ep_priority(hw, wmm_enable,
753 _rtl92cu_init_chipN_three_out_ep_priority(hw, wmm_enable,
762 static void _rtl92cu_init_chipT_queue_priority(
struct ieee80211_hw *hw,
770 switch (out_ep_num) {
780 if (TX_SELE_LQ == queue_sel) {
783 }
else if (TX_SELE_HQ == queue_sel) {
798 static void _rtl92cu_init_queue_priority(
struct ieee80211_hw *hw,
805 _rtl92cu_init_chipN_queue_priority(hw, wmm_enable, out_ep_num,
808 _rtl92cu_init_chipT_queue_priority(hw, wmm_enable, out_ep_num,
812 static void _rtl92cu_init_usb_aggregation(
struct ieee80211_hw *hw)
816 static void _rtl92cu_init_wmac_setting(
struct ieee80211_hw *hw)
828 rtl_write_dword(rtlpriv,
REG_MAR, 0xFFFFFFFF);
829 rtl_write_dword(rtlpriv,
REG_MAR + 4, 0xFFFFFFFF);
848 u8 wmm_enable =
false;
851 err = _rtl92cu_init_power_on(hw);
855 "Failed to init power on!\n");
867 "Failed to init LLT Table!\n");
870 _rtl92cu_init_queue_reserved_page(hw, wmm_enable, out_ep_nums,
872 _rtl92c_init_trx_buffer(hw, wmm_enable);
873 _rtl92cu_init_queue_priority(hw, wmm_enable, out_ep_nums,
879 _rtl92cu_init_wmac_setting(hw);
884 _rtl92cu_init_usb_aggregation(hw);
896 u8 sec_reg_value = 0x0;
900 "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n",
901 rtlpriv->
sec.pairwise_enc_algorithm,
902 rtlpriv->
sec.group_enc_algorithm);
903 if (rtlpriv->
cfg->mod_params->sw_crypto || rtlpriv->
sec.use_sw_sec) {
905 "not open sw encryption\n");
909 if (rtlpriv->
sec.use_defaultkey) {
915 rtl_write_byte(rtlpriv,
REG_CR + 1, 0x02);
921 static void _rtl92cu_hw_configure(
struct ieee80211_hw *hw)
928 rtl_write_byte(rtlpriv, 0x15, 0xe9);
933 rtl_write_byte(rtlpriv, 0xfe40, 0xe0);
934 rtl_write_byte(rtlpriv, 0xfe41, 0x8d);
935 rtl_write_byte(rtlpriv, 0xfe42, 0x80);
948 if (!(pa_setting &
BIT(0))) {
949 rtl_set_rfreg(hw,
RF90_PATH_A, 0x15, 0x0FFFFF, 0x0F406);
950 rtl_set_rfreg(hw,
RF90_PATH_A, 0x15, 0x0FFFFF, 0x4F406);
951 rtl_set_rfreg(hw,
RF90_PATH_A, 0x15, 0x0FFFFF, 0x8F406);
952 rtl_set_rfreg(hw,
RF90_PATH_A, 0x15, 0x0FFFFF, 0xCF406);
956 rtl_set_rfreg(hw,
RF90_PATH_B, 0x15, 0x0FFFFF, 0x0F406);
957 rtl_set_rfreg(hw,
RF90_PATH_B, 0x15, 0x0FFFFF, 0x4F406);
958 rtl_set_rfreg(hw,
RF90_PATH_B, 0x15, 0x0FFFFF, 0x8F406);
959 rtl_set_rfreg(hw,
RF90_PATH_B, 0x15, 0x0FFFFF, 0xCF406);
961 if (!(pa_setting &
BIT(4))) {
962 pa_setting = rtl_read_byte(rtlpriv, 0x16);
964 rtl_write_byte(rtlpriv, 0x16, pa_setting | 0x90);
968 static void _update_mac_setting(
struct ieee80211_hw *hw)
987 static bool iqk_initialized;
990 err = _rtl92cu_init_mac(hw);
998 "Failed to download FW. Init HW without FW now..\n");
1003 _rtl92cu_phy_param_tab_init(hw);
1024 if (iqk_initialized) {
1028 iqk_initialized =
true;
1033 _rtl92cu_hw_configure(hw);
1035 _update_mac_setting(hw);
1040 static void _DisableRFAFEAndResetBB(
struct ieee80211_hw *hw)
1050 u8 eRFPath = 0, value8 = 0;
1063 static void _ResetDigitalProcedure1(
struct ieee80211_hw *hw,
bool bWithoutHWSM)
1096 while ((retry_cnts++ < 100) &&
1101 if (retry_cnts >= 100) {
1103 "#####=> 8051 reset failed!.........................\n");
1105 rtl_write_byte(rtlpriv,
1130 static void _ResetDigitalProcedure2(
struct ieee80211_hw *hw)
1159 value8 = (
u8) (value32&0x000000FF);
1160 value32 |= ((value8<<8) | 0x00FF0000);
1165 value8 = (
u8) (value16&0x000F);
1166 value16 |= ((value8<<4) | 0x0780);
1172 static void _DisableAnalog(
struct ieee80211_hw *hw,
bool bWithoutHWSM)
1187 value8 &= (~LDV12_EN);
1204 _DisableRFAFEAndResetBB(hw);
1206 _ResetDigitalProcedure1(hw,
false);
1210 _DisableAnalog(hw,
false);
1213 static void _CardDisableWithoutHWSM(
struct ieee80211_hw *hw)
1216 _DisableRFAFEAndResetBB(hw);
1218 _ResetDigitalProcedure1(hw,
true);
1222 _ResetDigitalProcedure2(hw);
1224 _DisableAnalog(hw,
true);
1227 static void _rtl92cu_set_bcn_ctrl_reg(
struct ieee80211_hw *hw,
1238 static void _rtl92cu_stop_tx_beacon(
struct ieee80211_hw *hw)
1246 tmp1byte & (~
BIT(6)));
1249 tmp1byte &= ~(
BIT(0));
1257 static void _rtl92cu_resume_tx_beacon(
struct ieee80211_hw *hw)
1277 static void _rtl92cu_enable_bcn_sub_func(
struct ieee80211_hw *hw)
1283 _rtl92cu_set_bcn_ctrl_reg(hw, 0,
BIT(1));
1285 _rtl92cu_set_bcn_ctrl_reg(hw, 0,
BIT(4));
1288 static void _rtl92cu_disable_bcn_sub_func(
struct ieee80211_hw *hw)
1294 _rtl92cu_set_bcn_ctrl_reg(hw,
BIT(1), 0);
1296 _rtl92cu_set_bcn_ctrl_reg(hw,
BIT(4), 0);
1299 static int _rtl92cu_set_media_status(
struct ieee80211_hw *hw,
1303 u8 bt_msr = rtl_read_byte(rtlpriv,
MSR);
1310 _rtl92cu_stop_tx_beacon(hw);
1311 _rtl92cu_enable_bcn_sub_func(hw);
1313 _rtl92cu_resume_tx_beacon(hw);
1314 _rtl92cu_disable_bcn_sub_func(hw);
1317 "Set HW_VAR_MEDIA_STATUS:No such media status(%x)\n",
1325 "Set Network type to NO LINK!\n");
1330 "Set Network type to Ad Hoc!\n");
1336 "Set Network type to STA!\n");
1341 "Set Network type to AP!\n");
1345 "Network type %d not supported!\n", type);
1348 rtl_write_byte(rtlpriv, (
MSR), bt_msr);
1349 rtlpriv->
cfg->ops->led_control(hw, ledaction);
1350 if ((bt_msr & 0xfc) ==
MSR_AP)
1369 _rtl92cu_set_media_status(hw, opmode);
1373 _CardDisableHWSM(hw);
1375 _CardDisableWithoutHWSM(hw);
1385 static void _rtl92cu_set_check_bssid(
struct ieee80211_hw *hw,
1389 u32 reg_rcr = rtl_read_dword(rtlpriv,
REG_RCR);
1392 u8 filterout_non_associated_bssid =
false;
1397 filterout_non_associated_bssid =
true;
1404 if (filterout_non_associated_bssid) {
1409 rtlpriv->
cfg->ops->set_hw_reg(hw,
1412 _rtl92cu_set_bcn_ctrl_reg(hw, 0,
BIT(4));
1416 rtlpriv->
cfg->ops->set_hw_reg(hw,
1419 _rtl92cu_set_bcn_ctrl_reg(hw,
BIT(4), 0);
1426 _rtl92cu_set_bcn_ctrl_reg(hw, 0, (
BIT(4)|
BIT(5)));
1428 }
else if (filterout_non_associated_bssid ==
false) {
1433 _rtl92cu_set_bcn_ctrl_reg(hw,
BIT(4), 0);
1438 _rtl92cu_set_bcn_ctrl_reg(hw, (
BIT(4)|
BIT(5)), 0);
1445 if (_rtl92cu_set_media_status(hw, type))
1447 _rtl92cu_set_check_bssid(hw, type);
1451 static void _InitBeaconParameters(
struct ieee80211_hw *hw)
1470 static void _beacon_function_enable(
struct ieee80211_hw *hw,
bool Enable,
1475 _rtl92cu_set_bcn_ctrl_reg(hw, (
BIT(4) |
BIT(3) |
BIT(1)), 0x00);
1484 u16 bcn_interval, atim_window;
1489 rtl_write_word(rtlpriv,
REG_ATIMWND, atim_window);
1491 _InitBeaconParameters(hw);
1492 rtl_write_byte(rtlpriv,
REG_SLOT, 0x09);
1500 value32 = rtl_read_dword(rtlpriv,
REG_TCR);
1502 rtl_write_dword(rtlpriv,
REG_TCR, value32);
1504 rtl_write_dword(rtlpriv,
REG_TCR, value32);
1506 "SetBeaconRelatedRegisters8192CUsb(): Set TCR(%x)\n",
1515 _beacon_function_enable(hw,
true,
true);
1554 *((
bool *) (val)) =
true;
1556 val_rcr = rtl_read_dword(rtlpriv,
REG_RCR);
1557 val_rcr &= 0x00070000;
1559 *((
bool *) (val)) =
false;
1561 *((
bool *) (val)) =
true;
1573 *ptsf_high = rtl_read_dword(rtlpriv, (
REG_TSFTR + 4));
1574 *ptsf_low = rtl_read_dword(rtlpriv,
REG_TSFTR);
1589 "switch case not processed\n");
1607 for (idx = 0; idx <
ETH_ALEN; idx++) {
1608 rtl_write_byte(rtlpriv, (
REG_MACID + idx),
1614 u16 rate_cfg = ((
u16 *) val)[0];
1624 rtl_write_byte(rtlpriv,
REG_RRSR, rate_cfg & 0xff);
1625 rtl_write_byte(rtlpriv,
REG_RRSR + 1,
1626 (rate_cfg >> 8) & 0xff);
1627 while (rate_cfg > 0x1) {
1636 for (idx = 0; idx <
ETH_ALEN; idx++) {
1637 rtl_write_byte(rtlpriv, (
REG_BSSID + idx),
1656 rtl_write_byte(rtlpriv,
REG_SLOT, val[0]);
1658 "HW_VAR_SLOT_TIME %x\n", val[0]);
1660 for (e_aci = 0; e_aci <
AC_MAX; e_aci++)
1661 rtlpriv->
cfg->ops->set_hw_reg(hw,
1674 u1bAIFS = sifstime + (2 * val[0]);
1688 u8 short_preamble = (
bool)*val;
1692 rtl_write_byte(rtlpriv,
REG_RRSR + 2, reg_tmp);
1696 u8 min_spacing_to_set;
1699 min_spacing_to_set = *
val;
1700 if (min_spacing_to_set <= 7) {
1701 switch (rtlpriv->
sec.pairwise_enc_algorithm) {
1715 if (min_spacing_to_set < sec_min_space)
1716 min_spacing_to_set = sec_min_space;
1719 min_spacing_to_set);
1720 *val = min_spacing_to_set;
1722 "Set HW_VAR_AMPDU_MIN_SPACE: %#x\n",
1732 density_to_set = *
val;
1733 density_to_set &= 0x1f;
1737 "Set HW_VAR_SHORTGI_DENSITY: %#x\n",
1744 u8 regtoset_normal[4] = {0x41, 0xa8, 0x72, 0xb9};
1749 p_regtoset = regtoset_normal;
1750 factor_toset = *
val;
1751 if (factor_toset <= 3) {
1752 factor_toset = (1 << (factor_toset + 2));
1753 if (factor_toset > 0xf)
1755 for (index = 0; index < 4; index++) {
1756 if ((p_regtoset[index] & 0xf0) >
1757 (factor_toset << 4))
1759 (p_regtoset[
index] & 0x0f)
1760 | (factor_toset << 4);
1761 if ((p_regtoset[index] & 0x0f) >
1764 (p_regtoset[index] & 0xf0)
1766 rtl_write_byte(rtlpriv,
1771 "Set HW_VAR_AMPDU_FACTOR: %#x\n",
1783 u4b_ac_param = (
u32) mac->
ac[e_aci].aifs;
1784 u4b_ac_param |= (
u32) ((cw_min & 0xF) <<
1786 u4b_ac_param |= (
u32) ((cw_max & 0xF) <<
1790 "queue:%x, ac_param:%x\n",
1791 e_aci, u4b_ac_param);
1811 "SetHwReg8185(): invalid aci: %d !\n",
1816 rtlpriv->
cfg->ops->set_hw_reg(hw,
1823 (&(mac->
ac[0].aifs));
1824 u8 acm = p_aci_aifsn->
f.acm;
1828 acm_ctrl | ((rtlusb->
acm_method == 2) ? 0x0 : 0x1);
1842 "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n",
1859 "switch case not processed\n");
1864 "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n",
1870 rtl_write_dword(rtlpriv,
REG_RCR, ((
u32 *) (val))[0]);
1873 "### Set RCR(0x%08x) ###\n", mac->
rx_conf);
1877 u8 retry_limit = val[0];
1879 rtl_write_word(rtlpriv,
REG_RL,
1883 "Set HW_VAR_RETRY_LIMIT(0x%08x)\n",
1905 if (rpwm_val &
BIT(7))
1927 bool recover =
false;
1930 rtlpriv->
cfg->ops->set_hw_reg(hw,
1932 rtl_write_byte(rtlpriv,
REG_CR + 1, 0x03);
1933 _rtl92cu_set_bcn_ctrl_reg(hw, 0,
BIT(3));
1934 _rtl92cu_set_bcn_ctrl_reg(hw,
BIT(4), 0);
1935 tmp_reg422 = rtl_read_byte(rtlpriv,
1937 if (tmp_reg422 &
BIT(6))
1940 tmp_reg422 & (~
BIT(6)));
1942 _rtl92cu_set_bcn_ctrl_reg(hw,
BIT(3), 0);
1943 _rtl92cu_set_bcn_ctrl_reg(hw, 0,
BIT(4));
1945 rtl_write_byte(rtlpriv,
1947 tmp_reg422 |
BIT(6));
1948 rtl_write_byte(rtlpriv,
REG_CR + 1, 0x02);
1963 u8 btype_ibss = val[0];
1966 _rtl92cu_stop_tx_beacon(hw);
1967 _rtl92cu_set_bcn_ctrl_reg(hw, 0,
BIT(3));
1971 (
u32)((mac->
tsf >> 32) & 0xffffffff));
1972 _rtl92cu_set_bcn_ctrl_reg(hw,
BIT(3), 0);
1974 _rtl92cu_resume_tx_beacon(hw);
1988 "switch case not processed\n");
2001 u8 *mcsrate = mac->
mcs;
2005 u16 shortgi_rate = 0;
2006 u32 tmp_ratr_value = 0;
2007 u8 curtxbw_40mhz = mac->
bw_40;
2012 ratr_value |= ((*(
u16 *) (mcsrate))) << 12;
2013 switch (wirelessmode) {
2015 if (ratr_value & 0x0000000c)
2016 ratr_value &= 0x0000000d;
2018 ratr_value &= 0x0000000f;
2021 ratr_value &= 0x00000FF5;
2027 ratr_value &= 0x0007F005;
2031 if (get_rf_type(rtlphy) ==
RF_1T2R ||
2032 get_rf_type(rtlphy) ==
RF_1T1R)
2033 ratr_mask = 0x000ff005;
2035 ratr_mask = 0x0f0ff005;
2037 ratr_mask |= 0x00000010;
2038 ratr_value &= ratr_mask;
2043 ratr_value &= 0x000ff0ff;
2045 ratr_value &= 0x0f0ff0ff;
2048 ratr_value &= 0x0FFFFFFF;
2049 if (nmode && ((curtxbw_40mhz && curshortgi_40mhz) ||
2050 (!curtxbw_40mhz && curshortgi_20mhz))) {
2051 ratr_value |= 0x10000000;
2052 tmp_ratr_value = (ratr_value >> 12);
2053 for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) {
2054 if ((1 << shortgi_rate) & tmp_ratr_value)
2057 shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) |
2058 (shortgi_rate << 4) | (shortgi_rate);
2060 rtl_write_dword(rtlpriv,
REG_ARFR0 + ratr_index * 4, ratr_value);
2071 u8 *p_mcsrate = mac->
mcs;
2073 u8 curtxbw_40mhz = mac->
bw_40;
2077 bool shortgi =
false;
2082 ratr_bitmap |= (p_mcsrate[1] << 20) | (p_mcsrate[0] << 12);
2083 switch (wirelessmode) {
2086 if (ratr_bitmap & 0x0000000c)
2087 ratr_bitmap &= 0x0000000d;
2089 ratr_bitmap &= 0x0000000f;
2093 if (rssi_level == 1)
2094 ratr_bitmap &= 0x00000f00;
2095 else if (rssi_level == 2)
2096 ratr_bitmap &= 0x00000ff0;
2098 ratr_bitmap &= 0x00000ff5;
2102 ratr_bitmap &= 0x00000ff0;
2108 if (rssi_level == 1)
2109 ratr_bitmap &= 0x00070000;
2110 else if (rssi_level == 2)
2111 ratr_bitmap &= 0x0007f000;
2113 ratr_bitmap &= 0x0007f005;
2117 if (curtxbw_40mhz) {
2118 if (rssi_level == 1)
2119 ratr_bitmap &= 0x000f0000;
2120 else if (rssi_level == 2)
2121 ratr_bitmap &= 0x000ff000;
2123 ratr_bitmap &= 0x000ff015;
2125 if (rssi_level == 1)
2126 ratr_bitmap &= 0x000f0000;
2127 else if (rssi_level == 2)
2128 ratr_bitmap &= 0x000ff000;
2130 ratr_bitmap &= 0x000ff005;
2133 if (curtxbw_40mhz) {
2134 if (rssi_level == 1)
2135 ratr_bitmap &= 0x0f0f0000;
2136 else if (rssi_level == 2)
2137 ratr_bitmap &= 0x0f0ff000;
2139 ratr_bitmap &= 0x0f0ff015;
2141 if (rssi_level == 1)
2142 ratr_bitmap &= 0x0f0f0000;
2143 else if (rssi_level == 2)
2144 ratr_bitmap &= 0x0f0ff000;
2146 ratr_bitmap &= 0x0f0ff005;
2150 if ((curtxbw_40mhz && curshortgi_40mhz) ||
2151 (!curtxbw_40mhz && curshortgi_20mhz)) {
2154 else if (macid == 1)
2161 ratr_bitmap &= 0x000ff0ff;
2163 ratr_bitmap &= 0x0f0ff0ff;
2168 *(
u32 *)&rate_mask = ((ratr_bitmap & 0x0fffffff) |
2170 rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80;
2172 "Rate_index:%x, ratr_val:%x, %x:%x:%x:%x:%x\n",
2173 ratr_index, ratr_bitmap,
2174 rate_mask[0], rate_mask[1], rate_mask[2], rate_mask[3],
2188 sifs_timer = 0x0a0a;
2190 sifs_timer = 0x0e0e;
2199 enum rf_pwrstate e_rfpowerstate_toset, cur_rfstate;
2201 bool actuallyset =
false;
2202 unsigned long flag = 0;
2204 u8 usb_autosuspend = 0;
2210 spin_unlock_irqrestore(&rtlpriv->
locks.rf_ps_lock, flag);
2214 spin_unlock_irqrestore(&rtlpriv->
locks.rf_ps_lock, flag);
2217 if (usb_autosuspend) {
2221 u1tmp = rtl_read_byte(rtlpriv,
REG_HSISR);
2222 e_rfpowerstate_toset = (u1tmp &
BIT(7)) ?
2225 "pwrdown, 0x5c(BIT7)=%02x\n", u1tmp);
2228 rtl_read_byte(rtlpriv,
2231 e_rfpowerstate_toset = (u1tmp &
BIT(3)) ?
2234 "GPIO_IN=%02x\n", u1tmp);
2237 e_rfpowerstate_toset);
2241 "GPIOChangeRF - HW Radio ON, RF ON\n");
2244 }
else if ((!ppsc->
hwradiooff) && (e_rfpowerstate_toset ==
2247 "GPIOChangeRF - HW Radio OFF\n");
2252 "pHalData->bHwRadioOff and eRfPowerStateToSet do not match: pHalData->bHwRadioOff %x, eRfPowerStateToSet %x\n",
2257 if (e_rfpowerstate_toset ==
ERFON) {
2267 spin_unlock_irqrestore(&rtlpriv->
locks.rf_ps_lock, flag);
2282 u1tmp = rtl_read_byte(rtlpriv,
2290 if (e_rfpowerstate_toset ==
ERFOFF) {
2296 }
else if (e_rfpowerstate_toset ==
ERFOFF || cur_rfstate ==
ERFOFF) {
2304 spin_unlock_irqrestore(&rtlpriv->
locks.rf_ps_lock, flag);
2308 spin_unlock_irqrestore(&rtlpriv->
locks.rf_ps_lock, flag);