staging: r8188eu: remove HW_VAR_BASIC_RATE from SetHwReg8188EU()
authorMichael Straube <straube.linux@gmail.com>
Sat, 9 Jul 2022 09:44:54 +0000 (11:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 11 Jul 2022 08:05:57 +0000 (10:05 +0200)
Remove the HW_VAR_BASIC_RATE case from SetHwReg8188EU() and move the
functionality to a separate function. This is part of the ongoing
effort to get rid of SetHwReg8188EU().

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220709094458.9578-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_mlme_ext.c
drivers/staging/r8188eu/core/rtw_wlan_util.c
drivers/staging/r8188eu/hal/usb_halinit.c
drivers/staging/r8188eu/include/hal_intf.h
drivers/staging/r8188eu/include/rtw_mlme_ext.h

index 21485c57dc3f80a2716ff20e24b2001059e4df8e..a16996982b58458ae5597a340ce75dd9fcb6202d 100644 (file)
@@ -6681,7 +6681,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res)
        /*  update IOT-releated issue */
        update_IOT_info(padapter);
 
-       SetHwReg8188EU(padapter, HW_VAR_BASIC_RATE, cur_network->SupportedRates);
+       rtw_set_basic_rate(padapter, cur_network->SupportedRates);
 
        /* BCN interval */
        rtw_write16(padapter, REG_BCN_INTERVAL, pmlmeinfo->bcn_interval);
index aa6b549fd54dcbcac46f10337e4fc83b6be6483d..60c49e161c12e74d543f72b0d526d76a6e765590 100644 (file)
@@ -1265,6 +1265,45 @@ void set_sta_rate(struct adapter *padapter, struct sta_info *psta)
        enable_rate_adaptive(padapter, psta->mac_id);
 }
 
+void rtw_set_basic_rate(struct adapter *adapter, u8 *rates)
+{
+       u16 BrateCfg = 0;
+       u8 RateIndex = 0;
+       int res;
+       u8 reg;
+
+       /*  2007.01.16, by Emily */
+       /*  Select RRSR (in Legacy-OFDM and CCK) */
+       /*  For 8190, we select only 24M, 12M, 6M, 11M, 5.5M, 2M, and 1M from the Basic rate. */
+       /*  We do not use other rates. */
+       HalSetBrateCfg(adapter, rates, &BrateCfg);
+
+       /* 2011.03.30 add by Luke Lee */
+       /* CCK 2M ACK should be disabled for some BCM and Atheros AP IOT */
+       /* because CCK 2M has poor TXEVM */
+       /* CCK 5.5M & 11M ACK should be enabled for better performance */
+
+       BrateCfg = (BrateCfg | 0xd) & 0x15d;
+
+       BrateCfg |= 0x01; /*  default enable 1M ACK rate */
+       /*  Set RRSR rate table. */
+       rtw_write8(adapter, REG_RRSR, BrateCfg & 0xff);
+       rtw_write8(adapter, REG_RRSR + 1, (BrateCfg >> 8) & 0xff);
+       res = rtw_read8(adapter, REG_RRSR + 2, &reg);
+       if (res)
+               return;
+
+       rtw_write8(adapter, REG_RRSR + 2, reg & 0xf0);
+
+       /*  Set RTS initial rate */
+       while (BrateCfg > 0x1) {
+               BrateCfg = (BrateCfg >> 1);
+               RateIndex++;
+       }
+       /*  Ziv - Check */
+       rtw_write8(adapter, REG_INIRTS_RATE_SEL, RateIndex);
+}
+
 /*  Update RRSR and Rate for USERATE */
 void update_tx_basic_rate(struct adapter *padapter, u8 wirelessmode)
 {
@@ -1290,7 +1329,7 @@ void update_tx_basic_rate(struct adapter *padapter, u8 wirelessmode)
        else
                update_mgnt_tx_rate(padapter, IEEE80211_OFDM_RATE_6MB);
 
-       SetHwReg8188EU(padapter, HW_VAR_BASIC_RATE, supported_rates);
+       rtw_set_basic_rate(padapter, supported_rates);
 }
 
 unsigned char check_assoc_AP(u8 *pframe, uint len)
index 1a08de85a6aee662fd6457d29c48770a94eefc2b..97893543d8619cce2848354688f5fd5441890331 100644 (file)
@@ -1071,43 +1071,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val)
        case HW_VAR_SET_OPMODE:
                hw_var_set_opmode(Adapter, val);
                break;
-       case HW_VAR_BASIC_RATE:
-               {
-                       u16 BrateCfg = 0;
-                       u8 RateIndex = 0;
-
-                       /*  2007.01.16, by Emily */
-                       /*  Select RRSR (in Legacy-OFDM and CCK) */
-                       /*  For 8190, we select only 24M, 12M, 6M, 11M, 5.5M, 2M, and 1M from the Basic rate. */
-                       /*  We do not use other rates. */
-                       HalSetBrateCfg(Adapter, val, &BrateCfg);
-
-                       /* 2011.03.30 add by Luke Lee */
-                       /* CCK 2M ACK should be disabled for some BCM and Atheros AP IOT */
-                       /* because CCK 2M has poor TXEVM */
-                       /* CCK 5.5M & 11M ACK should be enabled for better performance */
-
-                       BrateCfg = (BrateCfg | 0xd) & 0x15d;
-
-                       BrateCfg |= 0x01; /*  default enable 1M ACK rate */
-                       /*  Set RRSR rate table. */
-                       rtw_write8(Adapter, REG_RRSR, BrateCfg & 0xff);
-                       rtw_write8(Adapter, REG_RRSR + 1, (BrateCfg >> 8) & 0xff);
-                       res = rtw_read8(Adapter, REG_RRSR + 2, &reg);
-                       if (res)
-                               return;
-
-                       rtw_write8(Adapter, REG_RRSR + 2, reg & 0xf0);
-
-                       /*  Set RTS initial rate */
-                       while (BrateCfg > 0x1) {
-                               BrateCfg = (BrateCfg >> 1);
-                               RateIndex++;
-                       }
-                       /*  Ziv - Check */
-                       rtw_write8(Adapter, REG_INIRTS_RATE_SEL, RateIndex);
-               }
-               break;
        case HW_VAR_CORRECT_TSF:
                {
                        u64     tsf;
index b81144932d9aa94f36dced9c1e0f6414e99f4fc5..3e0ee33aa131d731191a42ebc7b3c66fc8e08486 100644 (file)
@@ -10,7 +10,6 @@
 
 enum hw_variables {
        HW_VAR_SET_OPMODE,
-       HW_VAR_BASIC_RATE,
        HW_VAR_CORRECT_TSF,
        HW_VAR_MLME_SITESURVEY,
        HW_VAR_DM_FLAG,
index 56c0e584bb6cab6ec810e84d0a809ce36fc101a3..3cc475aa912aaa748704af492b9dced4355dedec 100644 (file)
@@ -455,6 +455,7 @@ int rtw_check_bcn_info(struct adapter  *Adapter, u8 *pframe, u32 packet_len);
 void update_IOT_info(struct adapter *padapter);
 void update_capinfo(struct adapter *adapter, u16 updatecap);
 void update_wireless_mode(struct adapter *padapter);
+void rtw_set_basic_rate(struct adapter *adapter, u8 *rates);
 void update_tx_basic_rate(struct adapter *padapter, u8 modulation);
 void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id);
 int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie,