From dc0d16a1079320282c272de69c14e08802b46ea8 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Wed, 9 Apr 2014 23:20:29 +0200 Subject: [PATCH] staging: rtl8723au: Eliminate HW_VAR_CAM_WRITE and clean up all the wrapping around it Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 7 ++-- .../staging/rtl8723au/core/rtw_wlan_util.c | 39 +------------------ drivers/staging/rtl8723au/hal/hal_com.c | 31 +++++++++++++-- .../rtl8723au/hal/rtl8723a_bt-coexist.c | 4 +- .../staging/rtl8723au/hal/rtl8723a_hal_init.c | 4 -- drivers/staging/rtl8723au/include/hal_com.h | 3 +- drivers/staging/rtl8723au/include/hal_intf.h | 1 - .../staging/rtl8723au/include/rtw_mlme_ext.h | 2 - 8 files changed, 37 insertions(+), 54 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 068203e62688..a40bb035187f 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -9614,7 +9614,7 @@ u8 setkey_hdl23a(struct rtw_adapter *padapter, u8 *pbuf) DBG_8723A_LEVEL(_drv_always_, "set group key to hw: alg:%d(WEP40-1 WEP104-5 TKIP-2 AES-4) " "keyid:%d\n", pparm->algorithm, pparm->keyid); - write_cam23a(padapter, pparm->keyid, ctrl, null_sta, pparm->key); + rtl8723a_cam_write(padapter, pparm->keyid, ctrl, null_sta, pparm->key); /* allow multicast packets to driver */ rtl8723a_on_rcr_am(padapter); @@ -9678,7 +9678,8 @@ u8 set_stakey_hdl23a(struct rtw_adapter *padapter, u8 *pbuf) pparm->addr[1], pparm->addr[2], pparm->addr[3], pparm->addr[4], pparm->addr[5], cam_id); - write_cam23a(padapter, cam_id, ctrl, pparm->addr, pparm->key); + rtl8723a_cam_write(padapter, cam_id, ctrl, + pparm->addr, pparm->key); return H2C_SUCCESS_RSP; @@ -9701,7 +9702,7 @@ u8 set_stakey_hdl23a(struct rtw_adapter *padapter, u8 *pbuf) ctrl = BIT(15) | ((pparm->algorithm) << 2); - write_cam23a(padapter, cam_id, ctrl, pparm->addr, pparm->key); + rtl8723a_cam_write(padapter, cam_id, ctrl, pparm->addr, pparm->key); pmlmeinfo->enc_algo = pparm->algorithm; diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c b/drivers/staging/rtl8723au/core/rtw_wlan_util.c index 1e538854dbb4..221184457b71 100644 --- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c @@ -483,50 +483,13 @@ void invalidate_cam_all23a(struct rtw_adapter *padapter) rtl8723a_cam_invalid_all(padapter); } -void write_cam23a(struct rtw_adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key) -{ - unsigned int i, val, addr; - int j; - u32 cam_val[2]; - - addr = entry << 3; - - for (j = 5; j >= 0; j--) { - switch (j) { - case 0: - val = (ctrl | (mac[0] << 16) | (mac[1] << 24)); - break; - case 1: - val = (mac[2] | (mac[3] << 8) | (mac[4] << 16) | (mac[5] << 24)); - break; - default: - i = (j - 2) << 2; - val = (key[i] | (key[i+1] << 8) | (key[i+2] << 16) | (key[i+3] << 24)); - break; - } - - cam_val[0] = val; - cam_val[1] = addr + (unsigned int)j; - - rtw_hal_set_hwreg23a(padapter, HW_VAR_CAM_WRITE, (u8 *)cam_val); - - /* rtw_write32(padapter, WCAMI, val); */ - - /* cmd = CAM_POLLINIG | CAM_WRITE | (addr + j); */ - /* rtw_write32(padapter, RWCAM, cmd); */ - - /* DBG_8723A("%s => cam write: %x, %x\n", __func__, cmd, val); */ - - } -} - void clear_cam_entry23a(struct rtw_adapter *padapter, u8 entry) { unsigned char null_sta[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; unsigned char null_key[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - write_cam23a(padapter, entry, 0, null_sta, null_key); + rtl8723a_cam_write(padapter, entry, 0, null_sta, null_key); } int allocate_fw_sta_entry23a(struct rtw_adapter *padapter) diff --git a/drivers/staging/rtl8723au/hal/hal_com.c b/drivers/staging/rtl8723au/hal/hal_com.c index 06ea165ceddd..5d4e51c493e6 100644 --- a/drivers/staging/rtl8723au/hal/hal_com.c +++ b/drivers/staging/rtl8723au/hal/hal_com.c @@ -685,14 +685,37 @@ void rtl8723a_cam_invalid_all(struct rtw_adapter *padapter) rtw_write32(padapter, RWCAM, BIT(31) | BIT(30)); } -void rtl8723a_cam_write(struct rtw_adapter *padapter, u32 val1, u32 val2) +void rtl8723a_cam_write(struct rtw_adapter *padapter, + u8 entry, u16 ctrl, u8 *mac, u8 *key) { u32 cmd; + unsigned int i, val, addr; + int j; - rtw_write32(padapter, WCAMI, val1); + addr = entry << 3; - cmd = CAM_POLLINIG | CAM_WRITE | val2; - rtw_write32(padapter, RWCAM, cmd); + for (j = 5; j >= 0; j--) { + switch (j) { + case 0: + val = ctrl | (mac[0] << 16) | (mac[1] << 24); + break; + case 1: + val = mac[2] | (mac[3] << 8) | + (mac[4] << 16) | (mac[5] << 24); + break; + default: + i = (j - 2) << 2; + val = key[i] | (key[i+1] << 8) | + (key[i+2] << 16) | (key[i+3] << 24); + break; + } + + rtw_write32(padapter, WCAMI, val); + cmd = CAM_POLLINIG | CAM_WRITE | (addr + j); + rtw_write32(padapter, RWCAM, cmd); + + /* DBG_8723A("%s => cam write: %x, %x\n", __func__, cmd, val);*/ + } } void rtl8723a_fifo_cleanup(struct rtw_adapter *padapter) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c index 3de077b3ed5b..69041efe5c36 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c @@ -11219,7 +11219,9 @@ void HALBT_SetKey(struct rtw_adapter *padapter, u8 EntryNum) pBtAssocEntry->HwCAMIndex = BT_HWCAM_STAR + EntryNum; usConfig = CAM_VALID | (CAM_AES << 2); - write_cam23a(padapter, pBtAssocEntry->HwCAMIndex, usConfig, pBtAssocEntry->BTRemoteMACAddr, pBtAssocEntry->PTK + TKIP_ENC_KEY_POS); + rtl8723a_cam_write(padapter, pBtAssocEntry->HwCAMIndex, usConfig, + pBtAssocEntry->BTRemoteMACAddr, + pBtAssocEntry->PTK + TKIP_ENC_KEY_POS); } void HALBT_RemoveKey(struct rtw_adapter *padapter, u8 EntryNum) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index cfc9eb1276ea..ba58bab2a3f6 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -3157,10 +3157,6 @@ void SetHwReg8723A(struct rtw_adapter *padapter, u8 variable, u8 *val) rtl8723a_odm_support_ability_clr(padapter, *val32); break; - case HW_VAR_CAM_WRITE: - rtl8723a_cam_write(padapter, val32[0], val32[1]); - break; - case HW_VAR_AC_PARAM_VO: rtl8723a_set_ac_param_vo(padapter, *val32); break; diff --git a/drivers/staging/rtl8723au/include/hal_com.h b/drivers/staging/rtl8723au/include/hal_com.h index b62ca2d4b5b4..9d036132ac4f 100644 --- a/drivers/staging/rtl8723au/include/hal_com.h +++ b/drivers/staging/rtl8723au/include/hal_com.h @@ -183,7 +183,8 @@ void rtl8723a_ack_preamble(struct rtw_adapter *padapter, u8 bShortPreamble); void rtl8723a_set_sec_cfg(struct rtw_adapter *padapter, u8 sec); void rtl8723a_cam_empty_entry(struct rtw_adapter *padapter, u8 ucIndex); void rtl8723a_cam_invalid_all(struct rtw_adapter *padapter); -void rtl8723a_cam_write(struct rtw_adapter *padapter, u32 val1, u32 val2); +void rtl8723a_cam_write(struct rtw_adapter *padapter, + u8 entry, u16 ctrl, u8 *mac, u8 *key); void rtl8723a_fifo_cleanup(struct rtw_adapter *padapter); void rtl8723a_set_apfm_on_mac(struct rtw_adapter *padapter, u8 val); void rtl8723a_bcn_valid(struct rtw_adapter *padapter); diff --git a/drivers/staging/rtl8723au/include/hal_intf.h b/drivers/staging/rtl8723au/include/hal_intf.h index 72da07444212..64fed853c2fa 100644 --- a/drivers/staging/rtl8723au/include/hal_intf.h +++ b/drivers/staging/rtl8723au/include/hal_intf.h @@ -44,7 +44,6 @@ enum HW_VARIABLES { HW_VAR_DM_FUNC_OP, HW_VAR_DM_FUNC_SET, HW_VAR_DM_FUNC_CLR, - HW_VAR_CAM_WRITE, HW_VAR_CAM_READ, HW_VAR_AC_PARAM_VO, HW_VAR_AC_PARAM_VI, diff --git a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h index 060de9f3de83..b61fc95b1037 100644 --- a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h @@ -495,8 +495,6 @@ void SetBWMode23a(struct rtw_adapter *padapter, unsigned short bwmode, unsigned int decide_wait_for_beacon_timeout23a(unsigned int bcn_interval); -void write_cam23a(struct rtw_adapter *padapter, u8 entry, u16 ctrl, - u8 *mac, u8 *key); void clear_cam_entry23a(struct rtw_adapter *padapter, u8 entry); void invalidate_cam_all23a(struct rtw_adapter *padapter); -- 2.20.1