staging: rtl8723au: Eliminate HW_VAR_CAM_WRITE and clean up all the wrapping around it

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jes Sorensen 2014-04-09 23:20:29 +02:00 committed by Greg Kroah-Hartman
parent a15a46a7b9
commit dc0d16a107
8 changed files with 37 additions and 54 deletions

View file

@ -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;

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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;

View file

@ -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);

View file

@ -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,

View file

@ -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);