diff --git a/hal/hal_hci/hal_usb.c b/hal/hal_hci/hal_usb.c index e47135b..3534c17 100644 --- a/hal/hal_hci/hal_usb.c +++ b/hal/hal_hci/hal_usb.c @@ -35,23 +35,6 @@ int usb_init_recv_priv(_adapter *padapter, u16 ini_in_buf_sz) #endif /* CONFIG_RX_INDICATE_QUEUE */ #endif /* PLATFORM_FREEBSD */ -#ifdef CONFIG_USB_INTERRUPT_IN_PIPE -#ifdef PLATFORM_LINUX - precvpriv->int_in_urb = usb_alloc_urb(0, GFP_KERNEL); - if (precvpriv->int_in_urb == NULL) { - res = _FAIL; - RTW_INFO("alloc_urb for interrupt in endpoint fail !!!!\n"); - goto exit; - } -#endif /* PLATFORM_LINUX */ - precvpriv->int_in_buf = rtw_zmalloc(ini_in_buf_sz); - if (precvpriv->int_in_buf == NULL) { - res = _FAIL; - RTW_INFO("alloc_mem for interrupt in endpoint fail !!!!\n"); - goto exit; - } -#endif /* CONFIG_USB_INTERRUPT_IN_PIPE */ - /* init recv_buf */ _rtw_init_queue(&precvpriv->free_recv_buf_queue); _rtw_init_queue(&precvpriv->recv_buf_pending_queue); @@ -162,14 +145,6 @@ void usb_free_recv_priv(_adapter *padapter, u16 ini_in_buf_sz) if (precvpriv->pallocated_recv_buf) rtw_mfree(precvpriv->pallocated_recv_buf, NR_RECVBUFF * sizeof(struct recv_buf) + 4); -#ifdef CONFIG_USB_INTERRUPT_IN_PIPE -#ifdef PLATFORM_LINUX - if (precvpriv->int_in_urb) - usb_free_urb(precvpriv->int_in_urb); -#endif - if (precvpriv->int_in_buf) - rtw_mfree(precvpriv->int_in_buf, ini_in_buf_sz); -#endif /* CONFIG_USB_INTERRUPT_IN_PIPE */ #ifdef PLATFORM_LINUX diff --git a/hal/rtl8814a/usb/usb_halinit.c b/hal/rtl8814a/usb/usb_halinit.c index 15c21ea..772935a 100644 --- a/hal/rtl8814a/usb/usb_halinit.c +++ b/hal/rtl8814a/usb/usb_halinit.c @@ -1776,35 +1776,31 @@ u32 rtl8814au_hal_deinit(PADAPTER Adapter) if((pwrctl->bHWPwrPindetect ) && (pwrctl->bHWPowerdown)) rtl8814au_hw_power_down(Adapter); } - } + } return _SUCCESS; } unsigned int rtl8814au_inirp_init(PADAPTER Adapter) -{ - u8 i; +{ + u8 i; struct recv_buf *precvbuf; uint status; struct dvobj_priv *pdev= adapter_to_dvobj(Adapter); struct intf_hdl * pintfhdl=&Adapter->iopriv.intf; - struct recv_priv *precvpriv = &(Adapter->recvpriv); + struct recv_priv *precvpriv = &(Adapter->recvpriv); u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); -#ifdef CONFIG_USB_INTERRUPT_IN_PIPE - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u32 (*_read_interrupt)(struct intf_hdl *pintfhdl, u32 addr); -#endif _read_port = pintfhdl->io_ops._read_port; status = _SUCCESS; - RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("===> usb_inirp_init \n")); - + RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("===> usb_inirp_init \n")); + precvpriv->ff_hwaddr = RECV_BULK_IN_ADDR; - //issue Rx irp to receive data - precvbuf = (struct recv_buf *)precvpriv->precv_buf; + //issue Rx irp to receive data + precvbuf = (struct recv_buf *)precvpriv->precv_buf; for(i=0; iff_hwaddr, 0, (unsigned char *)precvbuf) == _FALSE ) @@ -1813,27 +1809,13 @@ unsigned int rtl8814au_inirp_init(PADAPTER Adapter) status = _FAIL; goto exit; } - - precvbuf++; + + precvbuf++; precvpriv->free_recv_buf_queue_cnt--; } -#ifdef CONFIG_USB_INTERRUPT_IN_PIPE - if (pdev->RtInPipe[REALTEK_USB_IN_INT_EP_IDX] != 0x05) { - status = _FAIL; - RTW_INFO("%s =>Warning !! Have not USB Int-IN pipe, RtIntInPipe(%d)!!!\n", __func__, pdev->RtInPipe[REALTEK_USB_IN_INT_EP_IDX]); - goto exit; - } - _read_interrupt = pintfhdl->io_ops._read_interrupt; - if(_read_interrupt(pintfhdl, RECV_INT_IN_ADDR) == _FALSE ) - { - RT_TRACE(_module_hci_hal_init_c_,_drv_err_,("usb_rx_init: usb_read_interrupt error \n")); - status = _FAIL; - } -#endif - exit: - + RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("<=== usb_inirp_init \n")); return status; @@ -1841,9 +1823,9 @@ exit: } unsigned int rtl8814au_inirp_deinit(PADAPTER Adapter) -{ +{ RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("\n ===> usb_rx_deinit \n")); - + rtw_read_port_cancel(Adapter); RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("\n <=== usb_rx_deinit \n")); @@ -1869,8 +1851,8 @@ hal_ReadIDs_8814AU( { pHalData->EEPROMVID = EF2Byte( *(pu2Byte)&PROMContent[EEPROM_VID_8814AU] ); pHalData->EEPROMPID = EF2Byte( *(pu2Byte)&PROMContent[EEPROM_PID_8814AU] ); - - // Customer ID, 0x00 and 0xff are reserved for Realtek. + + // Customer ID, 0x00 and 0xff are reserved for Realtek. pHalData->EEPROMCustomerID = *(pu1Byte)&PROMContent[EEPROM_CustomID_8814]; pHalData->EEPROMSubCustomerID = EEPROM_Default_SubCustomerID; } @@ -1879,11 +1861,11 @@ hal_ReadIDs_8814AU( pHalData->EEPROMVID = EEPROM_Default_VID; pHalData->EEPROMPID = EEPROM_Default_PID; - // Customer ID, 0x00 and 0xff are reserved for Realtek. + // Customer ID, 0x00 and 0xff are reserved for Realtek. pHalData->EEPROMCustomerID = EEPROM_Default_CustomerID; pHalData->EEPROMSubCustomerID = EEPROM_Default_SubCustomerID; } - + RTW_INFO("VID = 0x%04X, PID = 0x%04X\n", pHalData->EEPROMVID, pHalData->EEPROMPID); RTW_INFO("Customer ID: 0x%02X, SubCustomer ID: 0x%02X\n", pHalData->EEPROMCustomerID, pHalData->EEPROMSubCustomerID); } @@ -1904,7 +1886,7 @@ hal_InitPGData_8814A( //#if ((DEV_BUS_TYPE==RT_USB_INTERFACE || DEV_BUS_TYPE==RT_SDIO_INTERFACE)) && (MP_DRIVER != 1) //if(hal_ReadeFuse_8814A(pAdapter) == _FAIL) //#endif - + // Read EFUSE real map to shadow. EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI, _FALSE); } @@ -1928,10 +1910,10 @@ hal_CustomizedBehavior_8814AU( IN PADAPTER Adapter ) { - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct led_priv *pledpriv = &(Adapter->ledpriv); - + // Led mode switch(pHalData->CustomerID) { @@ -1952,9 +1934,9 @@ hal_CustomizeByCustomerID_8814AU( ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - + RTW_INFO("PID= 0x%x, VID= %x\n",pHalData->EEPROMPID,pHalData->EEPROMVID); - + // Decide CustomerID according to VID/DID or EEPROM switch(pHalData->EEPROMCustomerID) { @@ -1968,17 +1950,17 @@ hal_CustomizeByCustomerID_8814AU( else if((pHalData->EEPROMVID == 0x0BFF) && (pHalData->EEPROMPID == 0x8160)) { pHalData->CustomerID = RT_CID_CHINA_MOBILE; - } + } else if((pHalData->EEPROMVID == 0x0BDA) && (pHalData->EEPROMPID == 0x5088)) pHalData->CustomerID = RT_CID_CC_C; - + break; case EEPROM_CID_WHQL: //padapter->bInHctTest = _TRUE; - + //pMgntInfo->bSupportTurboMode = _FALSE; //pMgntInfo->bAutoTurboBy8186 = _FALSE; - + //pMgntInfo->PowerSaveControl.bInactivePs = _FALSE; //pMgntInfo->PowerSaveControl.bIPSModeBackup = _FALSE; //pMgntInfo->PowerSaveControl.bLeisurePs = _FALSE; diff --git a/hal/rtl8814a/usb/usb_ops_linux.c b/hal/rtl8814a/usb/usb_ops_linux.c index a7f7293..71b8abd 100644 --- a/hal/rtl8814a/usb/usb_ops_linux.c +++ b/hal/rtl8814a/usb/usb_ops_linux.c @@ -76,7 +76,7 @@ void interrupt_handler_8814au(_adapter *padapter, u16 pkt_len, u8 *pbuf) if (pHalData->IntArray[0] & IMR_TBDER_88E) RTW_INFO("%s: HISR_TXBCNERR\n", __func__); #endif /* 0 */ - + if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { @@ -249,7 +249,7 @@ _exit_recvbuf2recvframe: #endif void rtl8814au_xmit_tasklet(void *priv) -{ +{ int ret = _FALSE; _adapter *padapter = (_adapter*)priv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; @@ -269,41 +269,37 @@ void rtl8814au_xmit_tasklet(void *priv) if(ret==_FALSE) break; - + } - + } void rtl8814au_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->_read16 = &usb_read16; pops->_read32 = &usb_read32; pops->_read_mem = &usb_read_mem; - pops->_read_port = &usb_read_port; - + pops->_read_port = &usb_read_port; + pops->_write8 = &usb_write8; pops->_write16 = &usb_write16; pops->_write32 = &usb_write32; pops->_writeN = &usb_writeN; - -#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ + +#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ pops->_write8_async= &usb_async_write8; pops->_write16_async = &usb_async_write16; pops->_write32_async = &usb_async_write32; -#endif +#endif pops->_write_mem = &usb_write_mem; pops->_write_port = &usb_write_port; pops->_read_port_cancel = &usb_read_port_cancel; pops->_write_port_cancel = &usb_write_port_cancel; -#ifdef CONFIG_USB_INTERRUPT_IN_PIPE - pops->_read_interrupt = &usb_read_interrupt; -#endif - } void rtl8814au_set_hw_type(struct dvobj_priv *pdvobj) diff --git a/include/rtw_recv.h b/include/rtw_recv.h index 2d170f6..4cee802 100644 --- a/include/rtw_recv.h +++ b/include/rtw_recv.h @@ -376,14 +376,6 @@ struct recv_priv { uint ff_hwaddr; ATOMIC_T rx_pending_cnt; -#ifdef CONFIG_USB_INTERRUPT_IN_PIPE -#ifdef PLATFORM_LINUX - PURB int_in_urb; -#endif - - u8 *int_in_buf; -#endif /* CONFIG_USB_INTERRUPT_IN_PIPE */ - #endif #if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) #ifdef PLATFORM_FREEBSD diff --git a/include/usb_ops_linux.h b/include/usb_ops_linux.h index bf59ca0..f9ece6e 100644 --- a/include/usb_ops_linux.h +++ b/include/usb_ops_linux.h @@ -91,8 +91,4 @@ int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata); u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem); void usb_recv_tasklet(void *priv); -#ifdef CONFIG_USB_INTERRUPT_IN_PIPE -void usb_read_interrupt_complete(struct urb *purb, struct pt_regs *regs); -u32 usb_read_interrupt(struct intf_hdl *pintfhdl, u32 addr); -#endif #endif diff --git a/os_dep/linux/usb_ops_linux.c b/os_dep/linux/usb_ops_linux.c index 3e586ba..7dba139 100644 --- a/os_dep/linux/usb_ops_linux.c +++ b/os_dep/linux/usb_ops_linux.c @@ -399,9 +399,6 @@ void usb_read_port_cancel(struct intf_hdl *pintfhdl) precvbuf++; } -#ifdef CONFIG_USB_INTERRUPT_IN_PIPE - usb_kill_urb(padapter->recvpriv.int_in_urb); -#endif } static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs) @@ -1056,87 +1053,6 @@ exit: } #endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */ -#ifdef CONFIG_USB_INTERRUPT_IN_PIPE -void usb_read_interrupt_complete(struct urb *purb, struct pt_regs *regs) -{ - int err; - _adapter *padapter = (_adapter *)purb->context; - - if (RTW_CANNOT_RX(padapter)) { - RTW_INFO("%s() RX Warning! bDriverStopped(%s) OR bSurpriseRemoved(%s)\n" - , __func__ - , rtw_is_drv_stopped(padapter) ? "True" : "False" - , rtw_is_surprise_removed(padapter) ? "True" : "False"); - - return; - } - - if (purb->status == 0) {/*SUCCESS*/ - if (purb->actual_length > INTERRUPT_MSG_FORMAT_LEN) - RTW_INFO("usb_read_interrupt_complete: purb->actual_length > INTERRUPT_MSG_FORMAT_LEN(%d)\n", INTERRUPT_MSG_FORMAT_LEN); - - rtw_hal_interrupt_handler(padapter, purb->actual_length, purb->transfer_buffer); - - err = usb_submit_urb(purb, GFP_ATOMIC); - if ((err) && (err != (-EPERM))) - RTW_INFO("cannot submit interrupt in-token(err = 0x%08x),urb_status = %d\n", err, purb->status); - } else { - RTW_INFO("###=> usb_read_interrupt_complete => urb status(%d)\n", purb->status); - - switch (purb->status) { - case -EINVAL: - case -EPIPE: - case -ENODEV: - case -ESHUTDOWN: - case -ENOENT: - rtw_set_drv_stopped(padapter); - break; - case -EPROTO: - break; - case -EINPROGRESS: - RTW_INFO("ERROR: URB IS IN PROGRESS!/n"); - break; - default: - break; - } - } -} - -u32 usb_read_interrupt(struct intf_hdl *pintfhdl, u32 addr) -{ - int err; - unsigned int pipe; - u32 ret = _SUCCESS; - _adapter *adapter = pintfhdl->padapter; - struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter); - struct recv_priv *precvpriv = &adapter->recvpriv; - struct usb_device *pusbd = pdvobj->pusbdev; - - - if (RTW_CANNOT_RX(adapter)) { - return _FAIL; - } - - /*translate DMA FIFO addr to pipehandle*/ - pipe = ffaddr2pipehdl(pdvobj, addr); - - usb_fill_int_urb(precvpriv->int_in_urb, pusbd, pipe, - precvpriv->int_in_buf, - INTERRUPT_MSG_FORMAT_LEN, - usb_read_interrupt_complete, - adapter, - 1); - - err = usb_submit_urb(precvpriv->int_in_urb, GFP_ATOMIC); - if ((err) && (err != (-EPERM))) { - RTW_INFO("cannot submit interrupt in-token(err = 0x%08x), urb_status = %d\n", err, precvpriv->int_in_urb->status); - ret = _FAIL; - } - - return ret; -} -#endif /* CONFIG_USB_INTERRUPT_IN_PIPE */ - int recvbuf2recvframe(PADAPTER padapter, void *ptr) {