Larry Finger | aa45a67 | 2014-02-28 15:16:43 -0600 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright(c) 2009-2014 Realtek Corporation. |
| 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 | * The full GNU General Public License is included in this distribution in the |
| 15 | * file called LICENSE. |
| 16 | * |
| 17 | * Contact Information: |
| 18 | * wlanfae <wlanfae@realtek.com> |
| 19 | * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, |
| 20 | * Hsinchu 300, Taiwan. |
| 21 | * |
| 22 | * Larry Finger <Larry.Finger@lwfinger.net> |
| 23 | * |
| 24 | *****************************************************************************/ |
| 25 | |
| 26 | #ifndef __FW_COMMON_H__ |
Larry Finger | cbd0c85 | 2014-02-28 15:16:48 -0600 | [diff] [blame] | 27 | #define __FW_COMMON_H__ |
Larry Finger | aa45a67 | 2014-02-28 15:16:43 -0600 | [diff] [blame] | 28 | |
Larry Finger | cbd0c85 | 2014-02-28 15:16:48 -0600 | [diff] [blame] | 29 | #define REG_SYS_FUNC_EN 0x0002 |
| 30 | #define REG_MCUFWDL 0x0080 |
| 31 | #define FW_8192C_START_ADDRESS 0x1000 |
| 32 | #define FW_8192C_PAGE_SIZE 4096 |
Larry Finger | 5c99f04 | 2014-09-26 16:40:25 -0500 | [diff] [blame] | 33 | #define FW_8723A_POLLING_TIMEOUT_COUNT 1000 |
| 34 | #define FW_8723B_POLLING_TIMEOUT_COUNT 6000 |
Larry Finger | cbd0c85 | 2014-02-28 15:16:48 -0600 | [diff] [blame] | 35 | #define FW_8192C_POLLING_DELAY 5 |
| 36 | |
| 37 | #define MCUFWDL_RDY BIT(1) |
| 38 | #define FWDL_CHKSUM_RPT BIT(2) |
| 39 | #define WINTINI_RDY BIT(6) |
| 40 | |
| 41 | #define REG_RSV_CTRL 0x001C |
| 42 | #define REG_HMETFR 0x01CC |
| 43 | |
| 44 | enum version_8723e { |
| 45 | VERSION_TEST_UMC_CHIP_8723 = 0x0081, |
| 46 | VERSION_NORMAL_UMC_CHIP_8723_1T1R_A_CUT = 0x0089, |
| 47 | VERSION_NORMAL_UMC_CHIP_8723_1T1R_B_CUT = 0x1089, |
| 48 | VERSION_TEST_CHIP_1T1R_8723B = 0x0106, |
| 49 | VERSION_NORMAL_SMIC_CHIP_1T1R_8723B = 0x010E, |
| 50 | VERSION_UNKNOWN = 0xFF, |
| 51 | }; |
| 52 | |
Larry Finger | 0529c6b | 2014-09-26 16:40:24 -0500 | [diff] [blame] | 53 | struct rtl8723e_firmware_header { |
| 54 | u16 signature; |
| 55 | u8 category; |
| 56 | u8 function; |
| 57 | u16 version; |
| 58 | u8 subversion; |
| 59 | u8 rsvd1; |
| 60 | u8 month; |
| 61 | u8 date; |
| 62 | u8 hour; |
| 63 | u8 minute; |
| 64 | u16 ramcodesize; |
| 65 | u16 rsvd2; |
| 66 | u32 svnindex; |
| 67 | u32 rsvd3; |
| 68 | u32 rsvd4; |
| 69 | u32 rsvd5; |
Larry Finger | cbd0c85 | 2014-02-28 15:16:48 -0600 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | enum rtl8723be_cmd { |
| 73 | H2C_8723BE_RSVDPAGE = 0, |
| 74 | H2C_8723BE_JOINBSSRPT = 1, |
| 75 | H2C_8723BE_SCAN = 2, |
| 76 | H2C_8723BE_KEEP_ALIVE_CTRL = 3, |
| 77 | H2C_8723BE_DISCONNECT_DECISION = 4, |
| 78 | H2C_8723BE_INIT_OFFLOAD = 6, |
| 79 | H2C_8723BE_AP_OFFLOAD = 8, |
| 80 | H2C_8723BE_BCN_RSVDPAGE = 9, |
| 81 | H2C_8723BE_PROBERSP_RSVDPAGE = 10, |
| 82 | |
| 83 | H2C_8723BE_SETPWRMODE = 0x20, |
| 84 | H2C_8723BE_PS_TUNING_PARA = 0x21, |
| 85 | H2C_8723BE_PS_TUNING_PARA2 = 0x22, |
| 86 | H2C_8723BE_PS_LPS_PARA = 0x23, |
| 87 | H2C_8723BE_P2P_PS_OFFLOAD = 0x24, |
| 88 | |
| 89 | H2C_8723BE_WO_WLAN = 0x80, |
| 90 | H2C_8723BE_REMOTE_WAKE_CTRL = 0x81, |
| 91 | H2C_8723BE_AOAC_GLOBAL_INFO = 0x82, |
| 92 | H2C_8723BE_AOAC_RSVDPAGE = 0x83, |
| 93 | H2C_8723BE_RSSI_REPORT = 0x42, |
| 94 | H2C_8723BE_RA_MASK = 0x40, |
| 95 | H2C_8723BE_SELECTIVE_SUSPEND_ROF_CMD, |
| 96 | H2C_8723BE_P2P_PS_MODE, |
| 97 | H2C_8723BE_PSD_RESULT, |
| 98 | /*Not defined CTW CMD for P2P yet*/ |
| 99 | H2C_8723BE_P2P_PS_CTW_CMD, |
| 100 | MAX_8723BE_H2CCMD |
| 101 | }; |
| 102 | |
Larry Finger | cbd0c85 | 2014-02-28 15:16:48 -0600 | [diff] [blame] | 103 | void rtl8723ae_firmware_selfreset(struct ieee80211_hw *hw); |
| 104 | void rtl8723be_firmware_selfreset(struct ieee80211_hw *hw); |
Larry Finger | aa45a67 | 2014-02-28 15:16:43 -0600 | [diff] [blame] | 105 | void rtl8723_enable_fw_download(struct ieee80211_hw *hw, bool enable); |
| 106 | void rtl8723_fw_block_write(struct ieee80211_hw *hw, |
| 107 | const u8 *buffer, u32 size); |
| 108 | void rtl8723_fw_page_write(struct ieee80211_hw *hw, |
| 109 | u32 page, const u8 *buffer, u32 size); |
| 110 | void rtl8723_write_fw(struct ieee80211_hw *hw, |
Larry Finger | cbd0c85 | 2014-02-28 15:16:48 -0600 | [diff] [blame] | 111 | enum version_8723e version, |
Larry Finger | 0529c6b | 2014-09-26 16:40:24 -0500 | [diff] [blame] | 112 | u8 *buffer, u32 size, u8 max_page); |
| 113 | int rtl8723_fw_free_to_go(struct ieee80211_hw *hw, bool is_8723be, int count); |
| 114 | int rtl8723_download_fw(struct ieee80211_hw *hw, bool is_8723be, int count); |
| 115 | bool rtl8723_cmd_send_packet(struct ieee80211_hw *hw, |
| 116 | struct sk_buff *skb); |
| 117 | void rtl8723_fill_dummy(u8 *pfwbuf, u32 *pfwlen); |
| 118 | |
Larry Finger | cbd0c85 | 2014-02-28 15:16:48 -0600 | [diff] [blame] | 119 | #endif |