mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2024-11-22 20:43:40 +00:00
rtl8188eu: Do some cleanup in hal/usb_ops_linux.c
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
b34f4ec9be
commit
b2e37eb332
1 changed files with 97 additions and 142 deletions
|
@ -270,7 +270,7 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
|
||||||
u16 wvalue;
|
u16 wvalue;
|
||||||
u16 index;
|
u16 index;
|
||||||
u16 len;
|
u16 len;
|
||||||
__le32 data;
|
__le16 data;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
request = 0x05;
|
request = 0x05;
|
||||||
|
@ -280,7 +280,7 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
|
||||||
wvalue = (u16)(addr&0x0000ffff);
|
wvalue = (u16)(addr&0x0000ffff);
|
||||||
len = 2;
|
len = 2;
|
||||||
|
|
||||||
data = cpu_to_le32(val);
|
data = cpu_to_le16(val);
|
||||||
|
|
||||||
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
|
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
|
||||||
|
|
||||||
|
@ -297,7 +297,6 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
|
||||||
__le32 data;
|
__le32 data;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
||||||
request = 0x05;
|
request = 0x05;
|
||||||
requesttype = 0x00;//write_out
|
requesttype = 0x00;//write_out
|
||||||
index = 0;//n/a
|
index = 0;//n/a
|
||||||
|
@ -319,7 +318,6 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
|
||||||
u16 index;
|
u16 index;
|
||||||
u16 len;
|
u16 len;
|
||||||
u8 buf[VENDOR_CMD_MAX_DATA_LEN]={0};
|
u8 buf[VENDOR_CMD_MAX_DATA_LEN]={0};
|
||||||
int ret;
|
|
||||||
|
|
||||||
request = 0x05;
|
request = 0x05;
|
||||||
requesttype = 0x00;//write_out
|
requesttype = 0x00;//write_out
|
||||||
|
@ -329,12 +327,7 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
|
||||||
len = length;
|
len = length;
|
||||||
_rtw_memcpy(buf, pdata, len );
|
_rtw_memcpy(buf, pdata, len );
|
||||||
|
|
||||||
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, buf, len, requesttype);
|
return usbctrl_vendorreq(pintfhdl, request, wvalue, index, buf, len, requesttype);
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SUPPORT_USB_INT
|
#ifdef CONFIG_SUPPORT_USB_INT
|
||||||
|
@ -343,8 +336,7 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf)
|
||||||
HAL_DATA_TYPE *pHalData=GET_HAL_DATA(padapter);
|
HAL_DATA_TYPE *pHalData=GET_HAL_DATA(padapter);
|
||||||
struct reportpwrstate_parm pwr_rpt;
|
struct reportpwrstate_parm pwr_rpt;
|
||||||
|
|
||||||
if ( pkt_len != INTERRUPT_MSG_FORMAT_LEN )
|
if ( pkt_len != INTERRUPT_MSG_FORMAT_LEN ) {
|
||||||
{
|
|
||||||
DBG_8192C("%s Invalid interrupt content length (%d)!\n", __FUNCTION__, pkt_len);
|
DBG_8192C("%s Invalid interrupt content length (%d)!\n", __FUNCTION__, pkt_len);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
@ -354,10 +346,8 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf)
|
||||||
_rtw_memcpy(&(pHalData->IntArray[1]), &(pbuf[USB_INTR_CONTENT_HISRE_OFFSET]), 4);
|
_rtw_memcpy(&(pHalData->IntArray[1]), &(pbuf[USB_INTR_CONTENT_HISRE_OFFSET]), 4);
|
||||||
|
|
||||||
#ifdef CONFIG_LPS_LCLK
|
#ifdef CONFIG_LPS_LCLK
|
||||||
if( pHalData->IntArray[0] & IMR_CPWM_88E )
|
if ( pHalData->IntArray[0] & IMR_CPWM_88E ) {
|
||||||
{
|
|
||||||
_rtw_memcpy(&pwr_rpt.state, &(pbuf[USB_INTR_CONTENT_CPWM1_OFFSET]), 1);
|
_rtw_memcpy(&pwr_rpt.state, &(pbuf[USB_INTR_CONTENT_CPWM1_OFFSET]), 1);
|
||||||
//_rtw_memcpy(&pwr_rpt.state2, &(pbuf[USB_INTR_CONTENT_CPWM2_OFFSET]), 1);
|
|
||||||
|
|
||||||
//88e's cpwm value only change BIT0, so driver need to add PS_STATE_S2 for LPS flow.
|
//88e's cpwm value only change BIT0, so driver need to add PS_STATE_S2 for LPS flow.
|
||||||
pwr_rpt.state |= PS_STATE_S2;
|
pwr_rpt.state |= PS_STATE_S2;
|
||||||
|
@ -376,33 +366,21 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf)
|
||||||
{
|
{
|
||||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||||
|
|
||||||
if(check_fwstate(pmlmepriv, WIFI_AP_STATE))
|
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
|
||||||
{
|
|
||||||
//send_beacon(padapter);
|
//send_beacon(padapter);
|
||||||
if (pmlmepriv->update_bcn == true)
|
if (pmlmepriv->update_bcn == true)
|
||||||
{
|
|
||||||
//tx_beacon_hdl(padapter, NULL);
|
|
||||||
set_tx_beacon_cmd(padapter);
|
set_tx_beacon_cmd(padapter);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#ifdef CONFIG_CONCURRENT_MODE
|
#ifdef CONFIG_CONCURRENT_MODE
|
||||||
if(check_buddy_fwstate(padapter, WIFI_AP_STATE))
|
if (check_buddy_fwstate(padapter, WIFI_AP_STATE)) {
|
||||||
{
|
|
||||||
//send_beacon(padapter);
|
//send_beacon(padapter);
|
||||||
if (padapter->pbuddy_adapter->mlmepriv.update_bcn == true)
|
if (padapter->pbuddy_adapter->mlmepriv.update_bcn == true)
|
||||||
{
|
|
||||||
//tx_beacon_hdl(padapter, NULL);
|
|
||||||
set_tx_beacon_cmd(padapter->pbuddy_adapter);
|
set_tx_beacon_cmd(padapter->pbuddy_adapter);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif //CONFIG_INTERRUPT_BASED_TXBCN
|
#endif //CONFIG_INTERRUPT_BASED_TXBCN
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DBG_CONFIG_ERROR_DETECT_INT
|
#ifdef DBG_CONFIG_ERROR_DETECT_INT
|
||||||
if ( pHalData->IntArray[1] & IMR_TXERR_88E )
|
if ( pHalData->IntArray[1] & IMR_TXERR_88E )
|
||||||
DBG_871X("===> %s Tx Error Flag Interrupt Status \n",__FUNCTION__);
|
DBG_871X("===> %s Tx Error Flag Interrupt Status \n",__FUNCTION__);
|
||||||
|
@ -414,7 +392,6 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf)
|
||||||
DBG_871X("===> %s Receive FIFO Overflow \n",__FUNCTION__);
|
DBG_871X("===> %s Receive FIFO Overflow \n",__FUNCTION__);
|
||||||
#endif//DBG_CONFIG_ERROR_DETECT_INT
|
#endif//DBG_CONFIG_ERROR_DETECT_INT
|
||||||
|
|
||||||
|
|
||||||
// C2H Event
|
// C2H Event
|
||||||
if (pbuf[0]!= 0){
|
if (pbuf[0]!= 0){
|
||||||
_rtw_memcpy(&(pHalData->C2hArray[0]), &(pbuf[USB_INTR_CONTENT_C2H_OFFSET]), 16);
|
_rtw_memcpy(&(pHalData->C2hArray[0]), &(pbuf[USB_INTR_CONTENT_C2H_OFFSET]), 16);
|
||||||
|
@ -1438,18 +1415,14 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (precvbuf != NULL) {
|
||||||
if(precvbuf !=NULL)
|
|
||||||
{
|
|
||||||
rtl8188eu_init_recvbuf(adapter, precvbuf);
|
rtl8188eu_init_recvbuf(adapter, precvbuf);
|
||||||
|
|
||||||
//re-assign for linux based on skb
|
//re-assign for linux based on skb
|
||||||
if((precvbuf->reuse == false) || (precvbuf->pskb == NULL))
|
if ((precvbuf->reuse == false) || (precvbuf->pskb == NULL)) {
|
||||||
{
|
|
||||||
precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
|
precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
|
||||||
|
|
||||||
if(precvbuf->pskb == NULL)
|
if (precvbuf->pskb == NULL) {
|
||||||
{
|
|
||||||
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("init_recvbuf(): alloc_skb fail!\n"));
|
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("init_recvbuf(): alloc_skb fail!\n"));
|
||||||
DBG_8192C("#### usb_read_port() alloc_skb fail!#####\n");
|
DBG_8192C("#### usb_read_port() alloc_skb fail!#####\n");
|
||||||
return _FAIL;
|
return _FAIL;
|
||||||
|
@ -1464,8 +1437,7 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
||||||
precvbuf->ptail = skb_tail_pointer(precvbuf->pskb);
|
precvbuf->ptail = skb_tail_pointer(precvbuf->pskb);
|
||||||
precvbuf->pend = skb_end_pointer(precvbuf->pskb);
|
precvbuf->pend = skb_end_pointer(precvbuf->pskb);
|
||||||
precvbuf->pbuf = precvbuf->pskb->data;
|
precvbuf->pbuf = precvbuf->pskb->data;
|
||||||
}
|
} else//reuse skb
|
||||||
else//reuse skb
|
|
||||||
{
|
{
|
||||||
precvbuf->phead = precvbuf->pskb->head;
|
precvbuf->phead = precvbuf->pskb->head;
|
||||||
precvbuf->pdata = precvbuf->pskb->data;
|
precvbuf->pdata = precvbuf->pskb->data;
|
||||||
|
@ -1476,11 +1448,6 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
||||||
precvbuf->reuse = false;
|
precvbuf->reuse = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//_enter_critical(&precvpriv->lock, &irqL);
|
|
||||||
//precvpriv->rx_pending_cnt++;
|
|
||||||
//precvbuf->irp_pending = true;
|
|
||||||
//_exit_critical(&precvpriv->lock, &irqL);
|
|
||||||
|
|
||||||
precvpriv->rx_pending_cnt++;
|
precvpriv->rx_pending_cnt++;
|
||||||
|
|
||||||
purb = precvbuf->purb;
|
purb = precvbuf->purb;
|
||||||
|
@ -1488,28 +1455,23 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
||||||
//translate DMA FIFO addr to pipehandle
|
//translate DMA FIFO addr to pipehandle
|
||||||
pipe = ffaddr2pipehdl(pdvobj, addr);
|
pipe = ffaddr2pipehdl(pdvobj, addr);
|
||||||
|
|
||||||
usb_fill_bulk_urb(purb, pusbd, pipe,
|
usb_fill_bulk_urb(purb, pusbd, pipe, precvbuf->pbuf,
|
||||||
precvbuf->pbuf,
|
MAX_RECVBUF_SZ, usb_read_port_complete,
|
||||||
MAX_RECVBUF_SZ,
|
|
||||||
usb_read_port_complete,
|
|
||||||
precvbuf);//context is precvbuf
|
precvbuf);//context is precvbuf
|
||||||
|
|
||||||
err = usb_submit_urb(purb, GFP_ATOMIC);
|
err = usb_submit_urb(purb, GFP_ATOMIC);
|
||||||
if((err) && (err != (-EPERM)))
|
if ((err) && (err != (-EPERM))) {
|
||||||
{
|
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,
|
||||||
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("cannot submit rx in-token(err=0x%.8x), URB_STATUS =0x%.8x", err, purb->status));
|
("cannot submit rx in-token(err=0x%.8x), URB_STATUS =0x%.8x",
|
||||||
DBG_8192C("cannot submit rx in-token(err = 0x%08x),urb_status = %d\n",err,purb->status);
|
err, purb->status));
|
||||||
|
DBG_8192C("cannot submit rx in-token(err = 0x%08x),urb_status = %d\n",
|
||||||
|
err, purb->status);
|
||||||
ret = _FAIL;
|
ret = _FAIL;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port:precvbuf ==NULL\n"));
|
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port:precvbuf ==NULL\n"));
|
||||||
ret = _FAIL;
|
ret = _FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif // CONFIG_USE_USB_BUFFER_ALLOC_RX
|
#endif // CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||||
|
@ -1523,27 +1485,23 @@ void rtl8188eu_xmit_tasklet(void *priv)
|
||||||
if (check_fwstate(&padapter->mlmepriv, _FW_UNDER_SURVEY) == true)
|
if (check_fwstate(&padapter->mlmepriv, _FW_UNDER_SURVEY) == true)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while(1)
|
while(1) {
|
||||||
{
|
if (padapter->bDriverStopped ||
|
||||||
if ((padapter->bDriverStopped == true)||(padapter->bSurpriseRemoved== true) || (padapter->bWritePortCancel == true))
|
padapter->bSurpriseRemoved ||
|
||||||
{
|
padapter->bWritePortCancel) {
|
||||||
DBG_8192C("xmit_tasklet => bDriverStopped or bSurpriseRemoved or bWritePortCancel\n");
|
DBG_8192C("xmit_tasklet => bDriverStopped or bSurpriseRemoved or bWritePortCancel\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = rtl8188eu_xmitframe_complete(padapter, pxmitpriv, NULL);
|
ret = rtl8188eu_xmitframe_complete(padapter, pxmitpriv, NULL);
|
||||||
|
|
||||||
if(ret==false)
|
if (!ret)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtl8188eu_set_intf_ops(struct _io_ops *pops)
|
void rtl8188eu_set_intf_ops(struct _io_ops *pops)
|
||||||
{
|
{
|
||||||
;
|
|
||||||
|
|
||||||
_rtw_memset((u8 *)pops, 0, sizeof(struct _io_ops));
|
_rtw_memset((u8 *)pops, 0, sizeof(struct _io_ops));
|
||||||
|
|
||||||
pops->_read8 = &usb_read8;
|
pops->_read8 = &usb_read8;
|
||||||
|
@ -1571,9 +1529,6 @@ void rtl8188eu_set_intf_ops(struct _io_ops *pops)
|
||||||
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
||||||
pops->_read_interrupt = &usb_read_interrupt;
|
pops->_read_interrupt = &usb_read_interrupt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtl8188eu_set_hw_type(struct adapter *padapter)
|
void rtl8188eu_set_hw_type(struct adapter *padapter)
|
||||||
|
|
Loading…
Reference in a new issue