1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 ******************************************************************************/
20 #define _RTL8188E_SRESET_C_
22 #include <rtl8188e_sreset.h>
23 #include <rtl8188e_hal.h>
25 void rtl8188e_silentreset_for_specific_platform(struct adapter *padapter)
29 void rtl8188e_sreset_xmit_status_check(struct adapter *padapter)
31 struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
32 struct sreset_priv *psrtpriv = &pHalData->srestpriv;
34 unsigned long current_time;
35 struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
36 unsigned int diff_time;
39 txdma_status = rtw_read32(padapter, REG_TXDMA_STATUS);
40 if (txdma_status != 0x00) {
41 DBG_88E("%s REG_TXDMA_STATUS:0x%08x\n", __func__, txdma_status);
42 rtw_write32(padapter, REG_TXDMA_STATUS, txdma_status);
43 rtl8188e_silentreset_for_specific_platform(padapter);
45 /* total xmit irp = 4 */
46 current_time = jiffies;
47 if (0 == pxmitpriv->free_xmitbuf_cnt) {
48 diff_time = jiffies_to_msecs(current_time - psrtpriv->last_tx_time);
50 if (diff_time > 2000) {
51 if (psrtpriv->last_tx_complete_time == 0) {
52 psrtpriv->last_tx_complete_time = current_time;
54 diff_time = jiffies_to_msecs(current_time - psrtpriv->last_tx_complete_time);
55 if (diff_time > 4000) {
56 DBG_88E("%s tx hang\n", __func__);
57 rtl8188e_silentreset_for_specific_platform(padapter);
64 void rtl8188e_sreset_linked_status_check(struct adapter *padapter)
66 u32 rx_dma_status = 0;
68 rx_dma_status = rtw_read32(padapter, REG_RXDMA_STATUS);
69 if (rx_dma_status != 0x00) {
70 DBG_88E("%s REG_RXDMA_STATUS:0x%08x\n", __func__, rx_dma_status);
71 rtw_write32(padapter, REG_RXDMA_STATUS, rx_dma_status);
73 fw_status = rtw_read8(padapter, REG_FMETHR);
74 if (fw_status != 0x00) {
76 DBG_88E("%s REG_FW_STATUS (0x%02x), Read_Efuse_Fail !!\n", __func__, fw_status);
77 else if (fw_status == 2)
78 DBG_88E("%s REG_FW_STATUS (0x%02x), Condition_No_Match !!\n", __func__, fw_status);