66 u32 *ptsf_low = (
u32 *)&tsf;
67 u32 *ptsf_high = ((
u32 *)&tsf) + 1;
69 *ptsf_high = rtl_read_dword(rtlpriv, (
TSFR + 4));
70 *ptsf_low = rtl_read_dword(rtlpriv,
TSFR);
72 *((
u64 *) (val)) = tsf;
77 *((
bool *)(val)) = rtlpriv->
dm.current_mrc_switch;
82 "switch case not processed\n");
99 rtl_write_dword(rtlpriv,
IDR0, ((
u32 *)(val))[0]);
100 rtl_write_word(rtlpriv,
IDR4, ((
u16 *)(val + 4))[0]);
104 u16 rate_cfg = ((
u16 *) val)[0];
108 rate_cfg = rate_cfg & 0x150;
110 rate_cfg = rate_cfg & 0x15f;
114 rtl_write_byte(rtlpriv,
RRSR, rate_cfg & 0xff);
115 rtl_write_byte(rtlpriv,
RRSR + 1,
116 (rate_cfg >> 8) & 0xff);
118 while (rate_cfg > 0x1) {
119 rate_cfg = (rate_cfg >> 1);
127 rtl_write_dword(rtlpriv,
BSSIDR, ((
u32 *)(val))[0]);
128 rtl_write_word(rtlpriv,
BSSIDR + 4,
129 ((
u16 *)(val + 4))[0]);
133 rtl_write_byte(rtlpriv,
SIFS_OFDM, val[0]);
134 rtl_write_byte(rtlpriv,
SIFS_OFDM + 1, val[1]);
141 "HW_VAR_SLOT_TIME %x\n", val[0]);
143 rtl_write_byte(rtlpriv,
SLOT_TIME, val[0]);
145 for (e_aci = 0; e_aci <
AC_MAX; e_aci++) {
146 rtlpriv->
cfg->ops->set_hw_reg(hw,
154 u8 short_preamble = (
bool) (*val);
159 rtl_write_byte(rtlpriv,
RRSR + 2, reg_tmp);
163 u8 min_spacing_to_set;
166 min_spacing_to_set = *
val;
167 if (min_spacing_to_set <= 7) {
168 if (rtlpriv->
sec.pairwise_enc_algorithm ==
174 if (min_spacing_to_set < sec_min_space)
175 min_spacing_to_set = sec_min_space;
176 if (min_spacing_to_set > 5)
177 min_spacing_to_set = 5;
183 *val = min_spacing_to_set;
186 "Set HW_VAR_AMPDU_MIN_SPACE: %#x\n",
197 density_to_set = *
val;
202 "Set HW_VAR_SHORTGI_DENSITY: %#x\n",
213 u8 factorlevel[18] = {
214 2, 4, 4, 7, 7, 13, 13,
220 if (factor_toset <= 3) {
221 factor_toset = (1 << (factor_toset + 2));
222 if (factor_toset > 0xf)
225 for (index = 0; index < 17; index++) {
226 if (factorlevel[index] > factor_toset)
231 for (index = 0; index < 8; index++) {
232 regtoset = ((factorlevel[index * 2]) |
235 rtl_write_byte(rtlpriv,
240 regtoset = ((factorlevel[16]) |
241 (factorlevel[17] << 4));
245 "Set HW_VAR_AMPDU_FACTOR: %#x\n",
255 rtlpriv->
cfg->ops->set_hw_reg(hw,
264 u8 acm = p_aci_aifsn->
f.acm;
267 acm_ctrl = acm_ctrl | ((rtlpci->
acm_method == 2) ?
283 "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n",
300 "switch case not processed\n");
306 "HW_VAR_ACM_CTRL Write 0x%X\n", acm_ctrl);
307 rtl_write_byte(rtlpriv,
AcmHwCtrl, acm_ctrl);
311 rtl_write_dword(rtlpriv,
RCR, ((
u32 *) (val))[0]);
316 u8 retry_limit = val[0];
338 rtl_write_byte(rtlpriv,
REG_SECR, *val);
361 bool bmrc_toset = *((
bool *)val);
367 u1bdata = (
u8)rtl_get_bbreg(hw,
372 ((u1bdata & 0xf0) | 0x03));
373 u1bdata = (
u8)rtl_get_bbreg(hw,
381 rtlpriv->
dm.current_mrc_switch = bmrc_toset;
385 u1bdata = (
u8)rtl_get_bbreg(hw,
390 ((u1bdata & 0xf0) | 0x01));
391 u1bdata = (
u8)rtl_get_bbreg(hw,
398 rtlpriv->
dm.current_mrc_switch = bmrc_toset;
405 "switch case not processed\n");
414 u8 sec_reg_value = 0x0;
417 "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n",
418 rtlpriv->
sec.pairwise_enc_algorithm,
419 rtlpriv->
sec.group_enc_algorithm);
421 if (rtlpriv->
cfg->mod_params->sw_crypto || rtlpriv->
sec.use_sw_sec) {
423 "not open hw encryption\n");
429 if (rtlpriv->
sec.use_defaultkey) {
445 bool bresult =
false;
448 rtl_write_byte(rtlpriv,
SYS_CLKR + 1, data);
454 tmpvalue = rtl_read_byte(rtlpriv,
SYS_CLKR + 1);
455 bresult = ((tmpvalue &
BIT(7)) == (data &
BIT(7)));
457 if ((data & (
BIT(6) |
BIT(7))) ==
false) {
464 tmpvalue = rtl_read_byte(rtlpriv,
SYS_CLKR + 1);
465 if ((tmpvalue &
BIT(6)))
468 pr_err(
"wait for BIT(6) return value %x\n", tmpvalue);
524 static void _rtl92se_macconfig_before_fwdownload(
struct ieee80211_hw *hw)
545 tmpu1b = rtl_read_byte(rtlpriv, (
SYS_CLKR + 1));
546 if (tmpu1b &
BIT(7)) {
547 tmpu1b &= ~(
BIT(6) |
BIT(7));
550 if (!_rtl92ce_halset_sysclk(hw, tmpu1b))
560 rtl_write_byte(rtlpriv,
RPWM, 0x0);
569 rtl_write_byte(rtlpriv,
CMDR, 0);
570 rtl_write_byte(rtlpriv,
TCR, 0);
573 tmpu1b = rtl_read_byte(rtlpriv, 0x562);
575 rtl_write_byte(rtlpriv, 0x562, tmpu1b);
577 rtl_write_byte(rtlpriv, 0x562, tmpu1b);
588 tmpu1b = rtl_read_byte(rtlpriv,
AFE_MISC);
589 rtl_write_byte(rtlpriv,
AFE_MISC, (tmpu1b |
BIT(0)));
593 tmpu1b = rtl_read_byte(rtlpriv,
AFE_MISC);
594 rtl_write_byte(rtlpriv,
AFE_MISC, (tmpu1b | 0x02));
634 tmpu2b = rtl_read_word(rtlpriv,
SYS_CLKR);
648 tmpu2b = rtl_read_word(rtlpriv,
SYS_CLKR);
649 rtl_write_word(rtlpriv,
SYS_CLKR, (tmpu2b & (~
BIT(2))));
651 tmpu1b = rtl_read_byte(rtlpriv, (
SYS_CLKR + 1));
652 tmpu1b = ((tmpu1b |
BIT(7)) & (~
BIT(6)));
653 if (!_rtl92ce_halset_sysclk(hw, tmpu1b))
656 rtl_write_word(rtlpriv,
CMDR, 0x07FC);
661 rtl_write_byte(rtlpriv, 0x6, 0x30);
662 rtl_write_byte(rtlpriv, 0x49, 0xf0);
664 rtl_write_byte(rtlpriv, 0x4b, 0x81);
666 rtl_write_byte(rtlpriv, 0xb5, 0x21);
668 rtl_write_byte(rtlpriv, 0xdc, 0xff);
669 rtl_write_byte(rtlpriv, 0xdd, 0xff);
670 rtl_write_byte(rtlpriv, 0xde, 0xff);
671 rtl_write_byte(rtlpriv, 0xdf, 0xff);
673 rtl_write_byte(rtlpriv, 0x11a, 0x00);
674 rtl_write_byte(rtlpriv, 0x11b, 0x00);
676 for (i = 0; i < 32; i++)
677 rtl_write_byte(rtlpriv,
INIMCS_SEL + i, 0x1b);
679 rtl_write_byte(rtlpriv, 0x236, 0xff);
681 rtl_write_byte(rtlpriv, 0x503, 0x22);
684 rtl_write_byte(rtlpriv, 0x560, 0x40);
686 rtl_write_byte(rtlpriv, 0x560, 0x00);
688 rtl_write_byte(rtlpriv,
DBG_PORT, 0x91);
705 rtl_write_word(rtlpriv,
CMDR, 0x37FC);
710 tmpu1b = rtl_read_byte(rtlpriv,
TCR);
715 }
while (pollingcnt--);
717 if (pollingcnt <= 0) {
719 "Polling TXDMA_INIT_VALUE timeout!! Current TCR(%#x)\n",
721 tmpu1b = rtl_read_byte(rtlpriv,
CMDR);
734 rfpwr_state_toset = _rtl92se_rf_onoff_detect(hw);
736 if (rfpwr_state_toset ==
ERFON)
741 static void _rtl92se_macconfig_after_fwdownload(
struct ieee80211_hw *hw)
759 rtl_write_dword(rtlpriv,
TCR, rtl_read_dword(rtlpriv,
TCR) |
770 rtl_write_word(rtlpriv,
SIFS_CCK, 0x0a0a);
771 rtl_write_word(rtlpriv,
SIFS_OFDM, 0x1010);
778 rtl_write_word(rtlpriv,
ATIMWND, 2);
787 rtl_write_byte(rtlpriv,
RXDMA, rtl_read_byte(rtlpriv,
RXDMA) |
BIT(6));
798 rtl_write_byte(rtlpriv,
RRSR, 0xf0);
800 rtl_write_byte(rtlpriv,
RRSR, 0xff);
801 rtl_write_byte(rtlpriv,
RRSR + 1, 0x01);
802 rtl_write_byte(rtlpriv,
RRSR + 2, 0x00);
806 for (i = 0; i < 8; i++) {
809 rtl_write_dword(rtlpriv,
ARFR0 + i * 4, 0x1f0ff0f0);
825 rtl_write_dword(rtlpriv,
DARFRC, 0x04010000);
826 rtl_write_dword(rtlpriv,
DARFRC + 4, 0x09070605);
827 rtl_write_dword(rtlpriv,
RARFRC, 0x04010000);
828 rtl_write_dword(rtlpriv,
RARFRC + 4, 0x09070605);
832 rtl_write_word(rtlpriv,
SG_RATE, 0xFFFF);
838 rtl_write_byte(rtlpriv,
CFEND_TH, 0xFF);
878 static void _rtl92se_hw_configure(
struct ieee80211_hw *hw)
885 u8 reg_bw_opmode = 0;
893 reg_rrsr = ((reg_rrsr & 0x000fffff) << 8) | regtmp;
895 rtl_write_byte(rtlpriv,
BW_OPMODE, reg_bw_opmode);
901 rtl_write_byte(rtlpriv,
MLT, 0x8f);
926 bool rtstatus =
true;
930 int wdcapra_add[] = {
937 rtlpriv->
intf_ops->disable_aspm(hw);
941 _rtl92se_macconfig_before_fwdownload(hw);
952 "Failed to download FW. Init HW without FW now... "
953 "Please copy FW into /lib/firmware/rtlwifi\n");
958 _rtl92se_macconfig_after_fwdownload(hw);
972 rtl_write_dword(rtlpriv,
CMDR, 0x37FC);
989 u32 rfoffreason = rtlpriv->
psc.rfoff_reason;
997 if (rtlpriv->
psc.hwradiooff ==
false) {
999 rtlpriv->
psc.rfoff_reason = 0;
1007 rtl_write_byte(rtlpriv,
SPS1_CTRL + 3, 0x07);
1009 rtl_write_byte(rtlpriv,
RF_CTRL, 0x07);
1033 _rtl92se_hw_configure(hw);
1043 for (i = 0; i < 6; i++)
1050 rtl_write_byte(rtlpriv, 0x4d, 0x0);
1054 tmp_byte = tmp_byte |
BIT(5);
1056 rtl_write_dword(rtlpriv,
TXDESC_MSK, 0xFFFFCFFF);
1074 rtl_write_byte(rtlpriv,
REG_SECR, secr_value);
1076 for (i = 0; i < 4; i++)
1077 rtl_write_dword(rtlpriv, wdcapra_add[i], 0x5e4322);
1080 bool mrc2set =
true;
1102 if (rtlpriv->
psc.rfpwr_state !=
ERFON)
1108 }
else if (!check_bssid) {
1115 static int _rtl92se_set_media_status(
struct ieee80211_hw *hw,
1119 u8 bt_msr = rtl_read_byte(rtlpriv,
MSR);
1127 "Set Network type to NO LINK!\n");
1132 "Set Network type to Ad Hoc!\n");
1137 "Set Network type to STA!\n");
1142 "Set Network type to AP!\n");
1146 "Network type %d not supported!\n", type);
1152 rtl_write_byte(rtlpriv, (
MSR), bt_msr);
1154 temp = rtl_read_dword(rtlpriv,
TCR);
1155 rtl_write_dword(rtlpriv,
TCR, temp & (~
BIT(8)));
1156 rtl_write_dword(rtlpriv,
TCR, temp |
BIT(8));
1167 if (_rtl92se_set_media_status(hw, type))
1200 RT_ASSERT(
false,
"invalid aci: %d !\n", aci);
1226 rtl_write_dword(rtlpriv,
INTA_MASK + 4, 0);
1239 rtl_write_byte(rtlpriv,
SYS_CLKR + 1, data);
1245 tmp = rtl_read_byte(rtlpriv,
SYS_CLKR + 1);
1246 result = ((tmp &
BIT(7)) == (data &
BIT(7)));
1248 if ((data & (
BIT(6) |
BIT(7))) ==
false) {
1254 tmp = rtl_read_byte(rtlpriv,
SYS_CLKR + 1);
1259 pr_err(
"wait for BIT(6) return value %x\n", tmp);
1275 static void _rtl92s_phy_set_rfhalt(
struct ieee80211_hw *hw)
1283 rtl_write_byte(rtlpriv, 0x560, 0x0);
1289 rtl_write_byte(rtlpriv,
SPS1_CTRL, 0x0);
1290 rtl_write_byte(rtlpriv,
TXPAUSE, 0xFF);
1291 rtl_write_word(rtlpriv,
CMDR, 0x57FC);
1293 rtl_write_word(rtlpriv,
CMDR, 0x77FC);
1294 rtl_write_byte(rtlpriv,
PHY_CCA, 0x0);
1296 rtl_write_word(rtlpriv,
CMDR, 0x37FC);
1298 rtl_write_word(rtlpriv,
CMDR, 0x77FC);
1300 rtl_write_word(rtlpriv,
CMDR, 0x57FC);
1301 rtl_write_word(rtlpriv,
CMDR, 0x0000);
1305 u1btmp &= ~(
BIT(0));
1309 u1btmp = rtl_read_byte(rtlpriv, (
SYS_CLKR + 1));
1315 if (u1btmp &
BIT(7)) {
1316 u1btmp &= ~(
BIT(6) |
BIT(7));
1317 if (!_rtl92s_set_sysclk(hw, u1btmp)) {
1318 pr_err(
"Switch ctrl path fail\n");
1327 rtl_write_byte(rtlpriv, 0x03, 0xF9);
1335 rtl_write_byte(rtlpriv, 0x03, 0xF9);
1338 rtl_write_byte(rtlpriv,
SYS_CLKR + 1, 0x70);
1347 static void _rtl92se_gen_refreshledstate(
struct ieee80211_hw *hw)
1364 static void _rtl92se_power_domain_init(
struct ieee80211_hw *hw)
1370 rtlpriv->
psc.pwrdomain_protect =
true;
1372 tmpu1b = rtl_read_byte(rtlpriv, (
SYS_CLKR + 1));
1373 if (tmpu1b &
BIT(7)) {
1374 tmpu1b &= ~(
BIT(6) |
BIT(7));
1375 if (!_rtl92s_set_sysclk(hw, tmpu1b)) {
1376 rtlpriv->
psc.pwrdomain_protect =
false;
1398 rtl_write_byte(rtlpriv,
CMDR, 0);
1399 rtl_write_byte(rtlpriv,
TCR, 0);
1402 tmpu1b = rtl_read_byte(rtlpriv, 0x562);
1404 rtl_write_byte(rtlpriv, 0x562, tmpu1b);
1405 tmpu1b &= ~(
BIT(3));
1406 rtl_write_byte(rtlpriv, 0x562, tmpu1b);
1414 rtl_write_byte(rtlpriv,
AFE_XTAL_CTRL + 1, (tmpu1b & 0xfb));
1417 tmpu1b = rtl_read_byte(rtlpriv,
AFE_MISC);
1418 rtl_write_byte(rtlpriv,
AFE_MISC, (tmpu1b |
BIT(0)));
1422 tmpu1b = rtl_read_byte(rtlpriv,
AFE_MISC);
1423 rtl_write_byte(rtlpriv,
AFE_MISC, (tmpu1b | 0x02));
1453 tmpu2b = rtl_read_word(rtlpriv,
SYS_CLKR);
1463 tmpu2b = rtl_read_word(rtlpriv,
SYS_CLKR);
1464 rtl_write_word(rtlpriv,
SYS_CLKR, (tmpu2b & (~
BIT(2))));
1466 tmpu1b = rtl_read_byte(rtlpriv, (
SYS_CLKR + 1));
1467 tmpu1b = ((tmpu1b |
BIT(7)) & (~
BIT(6)));
1468 if (!_rtl92s_set_sysclk(hw, tmpu1b)) {
1469 rtlpriv->
psc.pwrdomain_protect =
false;
1473 rtl_write_word(rtlpriv,
CMDR, 0x37FC);
1476 _rtl92se_gen_refreshledstate(hw);
1478 rtlpriv->
psc.pwrdomain_protect =
false;
1490 rtlpriv->
intf_ops->enable_aspm(hw);
1501 while (wait-- >= 10 && rtlpriv->
psc.pwrdomain_protect) {
1502 if (rtlpriv->
psc.pwrdomain_protect)
1510 _rtl92se_set_media_status(hw, opmode);
1512 _rtl92s_phy_set_rfhalt(hw);
1522 *p_inta = rtl_read_dword(rtlpriv,
ISR) & rtlpci->
irq_mask[0];
1523 rtl_write_dword(rtlpriv,
ISR, *p_inta);
1525 *p_intb = rtl_read_dword(rtlpriv,
ISR + 4) & rtlpci->
irq_mask[1];
1526 rtl_write_dword(rtlpriv,
ISR + 4, *p_intb);
1533 u16 bcntime_cfg = 0;
1534 u16 bcn_cw = 6, bcn_ifs = 0xf;
1535 u16 atim_window = 2;
1538 rtl_write_word(rtlpriv,
ATIMWND, atim_window);
1599 static void _rtl8192se_get_IC_Inferiority(
struct ieee80211_hw *hw)
1612 if (efuse_id == 0xfe)
1617 static void _rtl92se_read_adapter_info(
struct ieee80211_hw *hw)
1630 "RTL819X Not boot from eeprom, check it !!\n");
1634 memcpy((
void *)hwinfo, (
void *)
1642 eeprom_id = *((
u16 *)&hwinfo[0]);
1645 "EEPROM ID(%#x) is invalid!!\n", eeprom_id);
1655 _rtl8192se_get_IC_Inferiority(hw);
1666 "EEPROMId = 0x%4x\n", eeprom_id);
1668 "EEPROM VID = 0x%4x\n", rtlefuse->
eeprom_vid);
1670 "EEPROM DID = 0x%4x\n", rtlefuse->
eeprom_did);
1676 for (i = 0; i < 6; i += 2) {
1681 for (i = 0; i < 6; i++)
1689 for (rf_path = 0; rf_path < 2; rf_path++) {
1690 for (i = 0; i < 3; i++) {
1706 for (rf_path = 0; rf_path < 2; rf_path++)
1707 for (i = 0; i < 3; i++)
1709 "RF(%d) EEPROM CCK Area(%d) = 0x%x\n",
1713 for (rf_path = 0; rf_path < 2; rf_path++)
1714 for (i = 0; i < 3; i++)
1716 "RF(%d) EEPROM HT40 1S Area(%d) = 0x%x\n",
1720 for (rf_path = 0; rf_path < 2; rf_path++)
1721 for (i = 0; i < 3; i++)
1723 "RF(%d) EEPROM HT40 2S Diff Area(%d) = 0x%x\n",
1728 for (rf_path = 0; rf_path < 2; rf_path++) {
1731 for (i = 0; i < 14; i++) {
1755 for (i = 0; i < 14; i++) {
1757 "RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = [0x%x / 0x%x / 0x%x]\n",
1765 for (rf_path = 0; rf_path < 2; rf_path++) {
1766 for (i = 0; i < 3; i++) {
1773 for (rf_path = 0; rf_path < 2; rf_path++) {
1775 for (i = 0; i < 14; i++) {
1794 "RF-%d pwrgroup_ht20[%d] = 0x%x\n",
1798 "RF-%d pwrgroup_ht40[%d] = 0x%x\n",
1804 for (i = 0; i < 14; i++) {
1819 ((tempval >> 4) & 0xF);
1836 ((tempval >> 4) & 0xF);
1855 for (i = 0; i < 14; i++)
1857 "RF-A Ht20 to HT40 Diff[%d] = 0x%x\n",
1859 for (i = 0; i < 14; i++)
1861 "RF-A Legacy to Ht40 Diff[%d] = 0x%x\n",
1863 for (i = 0; i < 14; i++)
1865 "RF-B Ht20 to HT40 Diff[%d] = 0x%x\n",
1867 for (i = 0; i < 14; i++)
1869 "RF-B Legacy to HT40 Diff[%d] = 0x%x\n",
1924 else if (tempval == 1)
1926 else if (tempval == 2)
1928 else if (tempval == 3)
1934 tempval = rtl_read_byte(rtlpriv, 0x07);
1935 if (!(tempval &
BIT(0))) {
1938 "RF_TYPE=1T2R but only 1SS\n");
1957 tmp_u1b = rtl_read_byte(rtlpriv,
EPROM_CMD);
1959 if (tmp_u1b &
BIT(4)) {
1967 if (tmp_u1b &
BIT(5)) {
1970 _rtl92se_read_adapter_info(hw);
1977 static void rtl92se_update_hal_rate_table(
struct ieee80211_hw *hw,
1988 u16 shortgi_rate = 0;
1989 u32 tmp_ratr_value = 0;
1990 u8 curtxbw_40mhz = mac->
bw_40;
2001 ratr_value |= (sta->
ht_cap.mcs.rx_mask[1] << 20 |
2002 sta->
ht_cap.mcs.rx_mask[0] << 12);
2003 switch (wirelessmode) {
2005 ratr_value &= 0x0000000D;
2008 ratr_value &= 0x00000FF5;
2014 ratr_value &= 0x0007F005;
2018 if (get_rf_type(rtlphy) ==
RF_1T2R ||
2019 get_rf_type(rtlphy) ==
RF_1T1R) {
2021 ratr_mask = 0x000ff015;
2023 ratr_mask = 0x000ff005;
2026 ratr_mask = 0x0f0ff015;
2028 ratr_mask = 0x0f0ff005;
2031 ratr_value &= ratr_mask;
2036 ratr_value &= 0x000ff0ff;
2038 ratr_value &= 0x0f0ff0ff;
2044 ratr_value &= 0x0FFFFFFF;
2046 ratr_value &= 0x0FFFFFF0;
2048 if (nmode && ((curtxbw_40mhz &&
2049 curshortgi_40mhz) || (!curtxbw_40mhz &&
2050 curshortgi_20mhz))) {
2052 ratr_value |= 0x10000000;
2053 tmp_ratr_value = (ratr_value >> 12);
2055 for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) {
2056 if ((1 << shortgi_rate) & tmp_ratr_value)
2060 shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) |
2061 (shortgi_rate << 4) | (shortgi_rate);
2063 rtl_write_byte(rtlpriv,
SG_RATE, shortgi_rate);
2066 rtl_write_dword(rtlpriv,
ARFR0 + ratr_index * 4, ratr_value);
2067 if (ratr_value & 0xfffff000)
2073 rtl_read_dword(rtlpriv,
ARFR0));
2076 static void rtl92se_update_hal_rate_mask(
struct ieee80211_hw *hw,
2094 bool shortgi =
false;
2096 u8 shortgi_rate = 0;
2099 bool bmulticast =
false;
2106 curtxbw_40mhz = mac->
bw_40;
2109 macid = sta->
aid + 1;
2115 ratr_bitmap |= (sta->
ht_cap.mcs.rx_mask[1] << 20 |
2116 sta->
ht_cap.mcs.rx_mask[0] << 12);
2117 switch (wirelessmode) {
2121 if (ratr_bitmap & 0x0000000c)
2122 ratr_bitmap &= 0x0000000d;
2124 ratr_bitmap &= 0x0000000f;
2130 if (rssi_level == 1)
2131 ratr_bitmap &= 0x00000f00;
2132 else if (rssi_level == 2)
2133 ratr_bitmap &= 0x00000ff0;
2135 ratr_bitmap &= 0x00000ff5;
2140 ratr_bitmap &= 0x00000ff0;
2148 if (rssi_level == 1)
2149 ratr_bitmap &= 0x00070000;
2150 else if (rssi_level == 2)
2151 ratr_bitmap &= 0x0007f000;
2153 ratr_bitmap &= 0x0007f005;
2157 if (rssi_level == 1) {
2158 ratr_bitmap &= 0x000f0000;
2159 }
else if (rssi_level == 3) {
2160 ratr_bitmap &= 0x000fc000;
2161 }
else if (rssi_level == 5) {
2162 ratr_bitmap &= 0x000ff000;
2165 ratr_bitmap &= 0x000ff015;
2167 ratr_bitmap &= 0x000ff005;
2170 if (rssi_level == 1) {
2171 ratr_bitmap &= 0x0f8f0000;
2172 }
else if (rssi_level == 3) {
2173 ratr_bitmap &= 0x0f8fc000;
2174 }
else if (rssi_level == 5) {
2175 ratr_bitmap &= 0x0f8ff000;
2178 ratr_bitmap &= 0x0f8ff015;
2180 ratr_bitmap &= 0x0f8ff005;
2185 if ((curtxbw_40mhz && curshortgi_40mhz) ||
2186 (!curtxbw_40mhz && curshortgi_20mhz)) {
2189 else if (macid == 1)
2198 ratr_bitmap &= 0x000ff0ff;
2200 ratr_bitmap &= 0x0f8ff0ff;
2205 ratr_bitmap &= 0x0FFFFFFF;
2207 ratr_bitmap &= 0x0FFFFFF0;
2210 ratr_bitmap |= 0x10000000;
2212 ratr_value = (ratr_bitmap >> 12);
2213 for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) {
2214 if ((1 << shortgi_rate) & ratr_value)
2218 shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) |
2219 (shortgi_rate << 4) | (shortgi_rate);
2220 rtl_write_byte(rtlpriv,
SG_RATE, shortgi_rate);
2223 mask |= (bmulticast ? 1 : 0) << 9 | (macid & 0x1f) << 4 | (band & 0xf);
2227 rtl_write_dword(rtlpriv, 0x2c4, ratr_bitmap);
2239 if (rtlpriv->
dm.useramask)
2240 rtl92se_update_hal_rate_mask(hw, sta, rssi_level);
2242 rtl92se_update_hal_rate_table(hw, sta);
2253 sifs_timer = 0x0e0e;
2267 unsigned long flag = 0;
2268 bool actuallyset =
false;
2269 bool turnonbypowerdomain =
false;
2280 spin_unlock_irqrestore(&rtlpriv->
locks.rf_ps_lock, flag);
2284 spin_unlock_irqrestore(&rtlpriv->
locks.rf_ps_lock, flag);
2294 _rtl92se_power_domain_init(hw);
2295 turnonbypowerdomain =
true;
2298 rfpwr_toset = _rtl92se_rf_onoff_detect(hw);
2302 "RFKILL-HW Radio ON, RF ON\n");
2304 rfpwr_toset =
ERFON;
2309 DBG_DMESG,
"RFKILL-HW Radio OFF, RF OFF\n");
2319 spin_unlock_irqrestore(&rtlpriv->
locks.rf_ps_lock, flag);
2330 turnonbypowerdomain) {
2331 _rtl92s_phy_set_rfhalt(hw);
2337 spin_unlock_irqrestore(&rtlpriv->
locks.rf_ps_lock, flag);
2348 bool is_group,
u8 enc_algo,
bool is_wepkey,
bool clear_all)
2356 bool is_pairwise =
false;
2358 static u8 cam_const_addr[4][6] = {
2359 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
2360 {0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
2361 {0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
2362 {0x00, 0x00, 0x00, 0x00, 0x00, 0x03}
2364 static u8 cam_const_broad[] = {
2365 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
2371 u8 clear_number = 5;
2375 for (idx = 0; idx < clear_number; idx++) {
2382 rtlpriv->
sec.key_len[
idx] = 0;
2402 "switch case not processed\n");
2407 if (is_wepkey || rtlpriv->
sec.use_defaultkey) {
2412 macaddr = cam_const_broad;
2421 "Can not find free hw security cam entry\n");
2433 if (rtlpriv->
sec.key_len[key_index] == 0) {
2435 "delete one entry, entry_id is %d\n",
2442 "The insert KEY length is %d\n",
2445 "The insert KEY is %x %x\n",
2446 rtlpriv->
sec.key_buf[0][0],
2447 rtlpriv->
sec.key_buf[0][1]);
2453 "Pairwise Key content",
2454 rtlpriv->
sec.pairwise_key,
2459 "set Pairwise key\n");
2464 rtlpriv->
sec.key_buf[key_index]);
2475 rtlpriv->
sec.key_buf[entry_id]);
2481 rtlpriv->
sec.key_buf[entry_id]);
2500 pci_read_config_dword(rtlpci->
pdev, 0x40, &val);
2501 if ((val & 0x0000ff00) != 0)
2502 pci_write_config_dword(rtlpci->
pdev, 0x40,