Larry Finger | 1b509ca | 2013-08-21 22:33:48 -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 | * |
Larry Finger | 1b509ca | 2013-08-21 22:33:48 -0500 | [diff] [blame] | 14 | ******************************************************************************/ |
| 15 | |
| 16 | #include <rtw_sreset.h> |
navin patidar | e73fd15 | 2014-06-11 22:51:40 +0530 | [diff] [blame] | 17 | #include <usb_ops_linux.h> |
Larry Finger | 1b509ca | 2013-08-21 22:33:48 -0500 | [diff] [blame] | 18 | |
| 19 | void sreset_init_value(struct adapter *padapter) |
| 20 | { |
| 21 | struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); |
| 22 | struct sreset_priv *psrtpriv = &pHalData->srestpriv; |
| 23 | |
Larry Finger | 1b509ca | 2013-08-21 22:33:48 -0500 | [diff] [blame] | 24 | psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; |
Larry Finger | 1b509ca | 2013-08-21 22:33:48 -0500 | [diff] [blame] | 25 | } |
Larry Finger | 1b509ca | 2013-08-21 22:33:48 -0500 | [diff] [blame] | 26 | |
| 27 | u8 sreset_get_wifi_status(struct adapter *padapter) |
| 28 | { |
| 29 | struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); |
| 30 | struct sreset_priv *psrtpriv = &pHalData->srestpriv; |
| 31 | |
| 32 | u8 status = WIFI_STATUS_SUCCESS; |
| 33 | u32 val32 = 0; |
| 34 | |
navin patidar | 99ecfb0 | 2014-06-11 22:51:34 +0530 | [diff] [blame] | 35 | val32 = usb_read32(padapter, REG_TXDMA_STATUS); |
Larry Finger | 1b509ca | 2013-08-21 22:33:48 -0500 | [diff] [blame] | 36 | if (val32 == 0xeaeaeaea) { |
| 37 | psrtpriv->Wifi_Error_Status = WIFI_IF_NOT_EXIST; |
| 38 | } else if (val32 != 0) { |
| 39 | DBG_88E("txdmastatu(%x)\n", val32); |
| 40 | psrtpriv->Wifi_Error_Status = WIFI_MAC_TXDMA_ERROR; |
| 41 | } |
| 42 | |
| 43 | if (WIFI_STATUS_SUCCESS != psrtpriv->Wifi_Error_Status) { |
| 44 | DBG_88E("==>%s error_status(0x%x)\n", __func__, psrtpriv->Wifi_Error_Status); |
Haneen Mohammed | adb3d77 | 2015-03-13 19:55:55 +0300 | [diff] [blame] | 45 | status = psrtpriv->Wifi_Error_Status & (~(USB_READ_PORT_FAIL|USB_WRITE_PORT_FAIL)); |
Larry Finger | 1b509ca | 2013-08-21 22:33:48 -0500 | [diff] [blame] | 46 | } |
| 47 | DBG_88E("==> %s wifi_status(0x%x)\n", __func__, status); |
| 48 | |
| 49 | /* status restore */ |
| 50 | psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; |
| 51 | |
| 52 | return status; |
| 53 | } |
| 54 | |
| 55 | void sreset_set_wifi_error_status(struct adapter *padapter, u32 status) |
| 56 | { |
| 57 | struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); |
| 58 | pHalData->srestpriv.Wifi_Error_Status = status; |
| 59 | } |