Larry Finger | f7c92d2 | 2014-03-28 21:37:39 -0500 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. |
| 4 | * |
| 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. |
| 8 | * |
| 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 |
| 12 | * more details. |
| 13 | * |
| 14 | ******************************************************************************/ |
| 15 | #define _RTL8723A_SRESET_C_ |
| 16 | |
| 17 | #include <rtl8723a_sreset.h> |
| 18 | #include <rtl8723a_hal.h> |
Jes Sorensen | 050abc4 | 2014-05-16 10:05:08 +0200 | [diff] [blame] | 19 | #include <usb_ops_linux.h> |
Larry Finger | f7c92d2 | 2014-03-28 21:37:39 -0500 | [diff] [blame] | 20 | |
| 21 | void rtl8723a_sreset_xmit_status_check(struct rtw_adapter *padapter) |
| 22 | { |
| 23 | struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); |
| 24 | struct sreset_priv *psrtpriv = &pHalData->srestpriv; |
| 25 | |
| 26 | unsigned long current_time; |
| 27 | struct xmit_priv *pxmitpriv = &padapter->xmitpriv; |
| 28 | unsigned int diff_time; |
| 29 | u32 txdma_status; |
| 30 | |
Jes Sorensen | 050abc4 | 2014-05-16 10:05:08 +0200 | [diff] [blame] | 31 | txdma_status = rtl8723au_read32(padapter, REG_TXDMA_STATUS); |
Larry Finger | f7c92d2 | 2014-03-28 21:37:39 -0500 | [diff] [blame] | 32 | if (txdma_status != 0) { |
| 33 | DBG_8723A("%s REG_TXDMA_STATUS:0x%08x\n", __func__, txdma_status); |
Jes Sorensen | b7c19c2 | 2014-05-16 10:04:00 +0200 | [diff] [blame] | 34 | rtw_sreset_reset(padapter); |
Larry Finger | f7c92d2 | 2014-03-28 21:37:39 -0500 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | current_time = jiffies; |
| 38 | |
| 39 | if (0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) { |
| 40 | |
| 41 | diff_time = jiffies_to_msecs(jiffies - psrtpriv->last_tx_time); |
| 42 | |
| 43 | if (diff_time > 2000) { |
| 44 | if (psrtpriv->last_tx_complete_time == 0) { |
| 45 | psrtpriv->last_tx_complete_time = current_time; |
| 46 | } else { |
| 47 | diff_time = jiffies_to_msecs(jiffies - psrtpriv->last_tx_complete_time); |
| 48 | if (diff_time > 4000) { |
Larry Finger | f7c92d2 | 2014-03-28 21:37:39 -0500 | [diff] [blame] | 49 | DBG_8723A("%s tx hang\n", __func__); |
Jes Sorensen | b7c19c2 | 2014-05-16 10:04:00 +0200 | [diff] [blame] | 50 | rtw_sreset_reset(padapter); |
Larry Finger | f7c92d2 | 2014-03-28 21:37:39 -0500 | [diff] [blame] | 51 | } |
| 52 | } |
| 53 | } |
| 54 | } |
Larry Finger | f7c92d2 | 2014-03-28 21:37:39 -0500 | [diff] [blame] | 55 | } |