diff options
Diffstat (limited to 'drivers/net/wireless/rtlwifi/rtl8188ee/fw.h')
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8188ee/fw.h | 301 |
1 files changed, 301 insertions, 0 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/fw.h b/drivers/net/wireless/rtlwifi/rtl8188ee/fw.h new file mode 100644 index 000000000000..854a9875cd5f --- /dev/null +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/fw.h | |||
@@ -0,0 +1,301 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2009-2013 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 | * 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 | ||
17 | * | ||
18 | * The full GNU General Public License is included in this distribution in the | ||
19 | * file called LICENSE. | ||
20 | * | ||
21 | * Contact Information: | ||
22 | * wlanfae <wlanfae@realtek.com> | ||
23 | * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, | ||
24 | * Hsinchu 300, Taiwan. | ||
25 | * Larry Finger <Larry.Finger@lwfinger.net> | ||
26 | * | ||
27 | *****************************************************************************/ | ||
28 | |||
29 | #ifndef __RTL92C__FW__H__ | ||
30 | #define __RTL92C__FW__H__ | ||
31 | |||
32 | #define FW_8192C_SIZE 0x8000 | ||
33 | #define FW_8192C_START_ADDRESS 0x1000 | ||
34 | #define FW_8192C_END_ADDRESS 0x5FFF | ||
35 | #define FW_8192C_PAGE_SIZE 4096 | ||
36 | #define FW_8192C_POLLING_DELAY 5 | ||
37 | #define FW_8192C_POLLING_TIMEOUT_COUNT 3000 | ||
38 | |||
39 | #define IS_FW_HEADER_EXIST(_pfwhdr) \ | ||
40 | ((_pfwhdr->signature&0xFFFF) == 0x88E1) | ||
41 | #define USE_OLD_WOWLAN_DEBUG_FW 0 | ||
42 | |||
43 | #define H2C_88E_RSVDPAGE_LOC_LEN 5 | ||
44 | #define H2C_88E_PWEMODE_LENGTH 5 | ||
45 | #define H2C_88E_JOINBSSRPT_LENGTH 1 | ||
46 | #define H2C_88E_AP_OFFLOAD_LENGTH 3 | ||
47 | #define H2C_88E_WOWLAN_LENGTH 3 | ||
48 | #define H2C_88E_KEEP_ALIVE_CTRL_LENGTH 3 | ||
49 | #if (USE_OLD_WOWLAN_DEBUG_FW == 0) | ||
50 | #define H2C_88E_REMOTE_WAKE_CTRL_LEN 1 | ||
51 | #else | ||
52 | #define H2C_88E_REMOTE_WAKE_CTRL_LEN 3 | ||
53 | #endif | ||
54 | #define H2C_88E_AOAC_GLOBAL_INFO_LEN 2 | ||
55 | #define H2C_88E_AOAC_RSVDPAGE_LOC_LEN 7 | ||
56 | |||
57 | /* Fw PS state for RPWM. | ||
58 | * BIT[2:0] = HW state | ||
59 | * BIT[3] = Protocol PS state, 1: register active state, 0: register sleep state | ||
60 | * BIT[4] = sub-state | ||
61 | */ | ||
62 | #define FW_PS_GO_ON BIT(0) | ||
63 | #define FW_PS_TX_NULL BIT(1) | ||
64 | #define FW_PS_RF_ON BIT(2) | ||
65 | #define FW_PS_REGISTER_ACTIVE BIT(3) | ||
66 | |||
67 | #define FW_PS_DPS BIT(0) | ||
68 | #define FW_PS_LCLK (FW_PS_DPS) | ||
69 | #define FW_PS_RF_OFF BIT(1) | ||
70 | #define FW_PS_ALL_ON BIT(2) | ||
71 | #define FW_PS_ST_ACTIVE BIT(3) | ||
72 | #define FW_PS_ISR_ENABLE BIT(4) | ||
73 | #define FW_PS_IMR_ENABLE BIT(5) | ||
74 | |||
75 | |||
76 | #define FW_PS_ACK BIT(6) | ||
77 | #define FW_PS_TOGGLE BIT(7) | ||
78 | |||
79 | /* 88E RPWM value*/ | ||
80 | /* BIT[0] = 1: 32k, 0: 40M*/ | ||
81 | #define FW_PS_CLOCK_OFF BIT(0) /* 32k*/ | ||
82 | #define FW_PS_CLOCK_ON 0 /*40M*/ | ||
83 | |||
84 | #define FW_PS_STATE_MASK (0x0F) | ||
85 | #define FW_PS_STATE_HW_MASK (0x07) | ||
86 | /*ISR_ENABLE, IMR_ENABLE, and PS mode should be inherited.*/ | ||
87 | #define FW_PS_STATE_INT_MASK (0x3F) | ||
88 | |||
89 | #define FW_PS_STATE(x) (FW_PS_STATE_MASK & (x)) | ||
90 | #define FW_PS_STATE_HW(x) (FW_PS_STATE_HW_MASK & (x)) | ||
91 | #define FW_PS_STATE_INT(x) (FW_PS_STATE_INT_MASK & (x)) | ||
92 | #define FW_PS_ISR_VAL(x) ((x) & 0x70) | ||
93 | #define FW_PS_IMR_MASK(x) ((x) & 0xDF) | ||
94 | #define FW_PS_KEEP_IMR(x) ((x) & 0x20) | ||
95 | |||
96 | #define FW_PS_STATE_S0 (FW_PS_DPS) | ||
97 | #define FW_PS_STATE_S1 (FW_PS_LCLK) | ||
98 | #define FW_PS_STATE_S2 (FW_PS_RF_OFF) | ||
99 | #define FW_PS_STATE_S3 (FW_PS_ALL_ON) | ||
100 | #define FW_PS_STATE_S4 ((FW_PS_ST_ACTIVE) | (FW_PS_ALL_ON)) | ||
101 | |||
102 | #define FW_PS_STATE_ALL_ON_88E (FW_PS_CLOCK_ON) | ||
103 | #define FW_PS_STATE_RF_ON_88E (FW_PS_CLOCK_ON) | ||
104 | #define FW_PS_STATE_RF_OFF_88E (FW_PS_CLOCK_ON) | ||
105 | #define FW_PS_STATE_RF_OFF_LOW_PWR_88E (FW_PS_CLOCK_OFF) | ||
106 | |||
107 | #define FW_PS_STATE_ALL_ON_92C (FW_PS_STATE_S4) | ||
108 | #define FW_PS_STATE_RF_ON_92C (FW_PS_STATE_S3) | ||
109 | #define FW_PS_STATE_RF_OFF_92C (FW_PS_STATE_S2) | ||
110 | #define FW_PS_STATE_RF_OFF_LOW_PWR_92C (FW_PS_STATE_S1) | ||
111 | |||
112 | /* For 88E H2C PwrMode Cmd ID 5.*/ | ||
113 | #define FW_PWR_STATE_ACTIVE ((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE)) | ||
114 | #define FW_PWR_STATE_RF_OFF 0 | ||
115 | |||
116 | #define FW_PS_IS_ACK(x) ((x) & FW_PS_ACK) | ||
117 | #define FW_PS_IS_CLK_ON(x) ((x) & (FW_PS_RF_OFF | FW_PS_ALL_ON)) | ||
118 | #define FW_PS_IS_RF_ON(x) ((x) & (FW_PS_ALL_ON)) | ||
119 | #define FW_PS_IS_ACTIVE(x) ((x) & (FW_PS_ST_ACTIVE)) | ||
120 | #define FW_PS_IS_CPWM_INT(x) ((x) & 0x40) | ||
121 | |||
122 | #define FW_CLR_PS_STATE(x) ((x) = ((x) & (0xF0))) | ||
123 | |||
124 | #define IS_IN_LOW_POWER_STATE_88E(fwpsstate) \ | ||
125 | (FW_PS_STATE(fwpsstate) == FW_PS_CLOCK_OFF) | ||
126 | |||
127 | #define FW_PWR_STATE_ACTIVE ((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE)) | ||
128 | #define FW_PWR_STATE_RF_OFF 0 | ||
129 | |||
130 | struct rtl92c_firmware_header { | ||
131 | u16 signature; | ||
132 | u8 category; | ||
133 | u8 function; | ||
134 | u16 version; | ||
135 | u8 subversion; | ||
136 | u8 rsvd1; | ||
137 | u8 month; | ||
138 | u8 date; | ||
139 | u8 hour; | ||
140 | u8 minute; | ||
141 | u16 ramcodesize; | ||
142 | u16 rsvd2; | ||
143 | u32 svnindex; | ||
144 | u32 rsvd3; | ||
145 | u32 rsvd4; | ||
146 | u32 rsvd5; | ||
147 | }; | ||
148 | |||
149 | enum rtl8192c_h2c_cmd { | ||
150 | H2C_88E_RSVDPAGE = 0, | ||
151 | H2C_88E_JOINBSSRPT = 1, | ||
152 | H2C_88E_SCAN = 2, | ||
153 | H2C_88E_KEEP_ALIVE_CTRL = 3, | ||
154 | H2C_88E_DISCONNECT_DECISION = 4, | ||
155 | #if (USE_OLD_WOWLAN_DEBUG_FW == 1) | ||
156 | H2C_88E_WO_WLAN = 5, | ||
157 | #endif | ||
158 | H2C_88E_INIT_OFFLOAD = 6, | ||
159 | #if (USE_OLD_WOWLAN_DEBUG_FW == 1) | ||
160 | H2C_88E_REMOTE_WAKE_CTRL = 7, | ||
161 | #endif | ||
162 | H2C_88E_AP_OFFLOAD = 8, | ||
163 | H2C_88E_BCN_RSVDPAGE = 9, | ||
164 | H2C_88E_PROBERSP_RSVDPAGE = 10, | ||
165 | |||
166 | H2C_88E_SETPWRMODE = 0x20, | ||
167 | H2C_88E_PS_TUNING_PARA = 0x21, | ||
168 | H2C_88E_PS_TUNING_PARA2 = 0x22, | ||
169 | H2C_88E_PS_LPS_PARA = 0x23, | ||
170 | H2C_88E_P2P_PS_OFFLOAD = 024, | ||
171 | |||
172 | #if (USE_OLD_WOWLAN_DEBUG_FW == 0) | ||
173 | H2C_88E_WO_WLAN = 0x80, | ||
174 | H2C_88E_REMOTE_WAKE_CTRL = 0x81, | ||
175 | H2C_88E_AOAC_GLOBAL_INFO = 0x82, | ||
176 | H2C_88E_AOAC_RSVDPAGE = 0x83, | ||
177 | #endif | ||
178 | /* Not defined in new 88E H2C CMD Format */ | ||
179 | H2C_88E_RA_MASK, | ||
180 | H2C_88E_SELECTIVE_SUSPEND_ROF_CMD, | ||
181 | H2C_88E_P2P_PS_MODE, | ||
182 | H2C_88E_PSD_RESULT, | ||
183 | /*Not defined CTW CMD for P2P yet*/ | ||
184 | H2C_88E_P2P_PS_CTW_CMD, | ||
185 | MAX_88E_H2CCMD | ||
186 | }; | ||
187 | |||
188 | #define pagenum_128(_len) (u32)(((_len)>>7) + ((_len)&0x7F ? 1 : 0)) | ||
189 | |||
190 | #define SET_88E_H2CCMD_WOWLAN_FUNC_ENABLE(__cmd, __value) \ | ||
191 | SET_BITS_TO_LE_1BYTE(__cmd, 0, 1, __value) | ||
192 | #define SET_88E_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(__cmd, __value) \ | ||
193 | SET_BITS_TO_LE_1BYTE(__cmd, 1, 1, __value) | ||
194 | #define SET_88E_H2CCMD_WOWLAN_MAGIC_PKT_ENABLE(__cmd, __value) \ | ||
195 | SET_BITS_TO_LE_1BYTE(__cmd, 2, 1, __value) | ||
196 | #define SET_88E_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(__cmd, __value) \ | ||
197 | SET_BITS_TO_LE_1BYTE(__cmd, 3, 1, __value) | ||
198 | #define SET_88E_H2CCMD_WOWLAN_ALL_PKT_DROP(__cmd, __value) \ | ||
199 | SET_BITS_TO_LE_1BYTE(__cmd, 4, 1, __value) | ||
200 | #define SET_88E_H2CCMD_WOWLAN_GPIO_ACTIVE(__cmd, __value) \ | ||
201 | SET_BITS_TO_LE_1BYTE(__cmd, 5, 1, __value) | ||
202 | #define SET_88E_H2CCMD_WOWLAN_REKEY_WAKE_UP(__cmd, __value) \ | ||
203 | SET_BITS_TO_LE_1BYTE(__cmd, 6, 1, __value) | ||
204 | #define SET_88E_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(__cmd, __value) \ | ||
205 | SET_BITS_TO_LE_1BYTE(__cmd, 7, 1, __value) | ||
206 | #define SET_88E_H2CCMD_WOWLAN_GPIONUM(__cmd, __value) \ | ||
207 | SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 8, __value) | ||
208 | #define SET_88E_H2CCMD_WOWLAN_GPIO_DURATION(__cmd, __value) \ | ||
209 | SET_BITS_TO_LE_1BYTE((__cmd)+2, 0, 8, __value) | ||
210 | |||
211 | |||
212 | #define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val) \ | ||
213 | SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) | ||
214 | #define SET_H2CCMD_PWRMODE_PARM_RLBM(__cmd, __value) \ | ||
215 | SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 4, __value) | ||
216 | #define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__cmd, __value) \ | ||
217 | SET_BITS_TO_LE_1BYTE((__cmd)+1, 4, 4, __value) | ||
218 | #define SET_H2CCMD_PWRMODE_PARM_AWAKE_INTERVAL(__cmd, __value) \ | ||
219 | SET_BITS_TO_LE_1BYTE((__cmd)+2, 0, 8, __value) | ||
220 | #define SET_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(__cmd, __value) \ | ||
221 | SET_BITS_TO_LE_1BYTE((__cmd)+3, 0, 8, __value) | ||
222 | #define SET_H2CCMD_PWRMODE_PARM_PWR_STATE(__cmd, __value) \ | ||
223 | SET_BITS_TO_LE_1BYTE((__cmd)+4, 0, 8, __value) | ||
224 | #define GET_88E_H2CCMD_PWRMODE_PARM_MODE(__cmd) \ | ||
225 | LE_BITS_TO_1BYTE(__cmd, 0, 8) | ||
226 | |||
227 | #define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val) \ | ||
228 | SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) | ||
229 | #define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val) \ | ||
230 | SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) | ||
231 | #define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val) \ | ||
232 | SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val) | ||
233 | #define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val) \ | ||
234 | SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val) | ||
235 | |||
236 | /* AP_OFFLOAD */ | ||
237 | #define SET_H2CCMD_AP_OFFLOAD_ON(__cmd, __value) \ | ||
238 | SET_BITS_TO_LE_1BYTE(__cmd, 0, 8, __value) | ||
239 | #define SET_H2CCMD_AP_OFFLOAD_HIDDEN(__cmd, __value) \ | ||
240 | SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 8, __value) | ||
241 | #define SET_H2CCMD_AP_OFFLOAD_DENYANY(__cmd, __value) \ | ||
242 | SET_BITS_TO_LE_1BYTE((__cmd)+2, 0, 8, __value) | ||
243 | #define SET_H2CCMD_AP_OFFLOAD_WAKEUP_EVT_RPT(__cmd, __value) \ | ||
244 | SET_BITS_TO_LE_1BYTE((__cmd)+3, 0, 8, __value) | ||
245 | |||
246 | /* Keep Alive Control*/ | ||
247 | #define SET_88E_H2CCMD_KEEP_ALIVE_ENABLE(__cmd, __value) \ | ||
248 | SET_BITS_TO_LE_1BYTE(__cmd, 0, 1, __value) | ||
249 | #define SET_88E_H2CCMD_KEEP_ALIVE_ACCPEPT_USER_DEFINED(__cmd, __value) \ | ||
250 | SET_BITS_TO_LE_1BYTE(__cmd, 1, 1, __value) | ||
251 | #define SET_88E_H2CCMD_KEEP_ALIVE_PERIOD(__cmd, __value) \ | ||
252 | SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 8, __value) | ||
253 | |||
254 | /*REMOTE_WAKE_CTRL */ | ||
255 | #define SET_88E_H2CCMD_REMOTE_WAKE_CTRL_EN(__cmd, __value) \ | ||
256 | SET_BITS_TO_LE_1BYTE(__cmd, 0, 1, __value) | ||
257 | #if (USE_OLD_WOWLAN_DEBUG_FW == 0) | ||
258 | #define SET_88E_H2CCMD_REMOTE_WAKE_CTRL_ARP_OFFLOAD_EN(__cmd, __value) \ | ||
259 | SET_BITS_TO_LE_1BYTE(__cmd, 1, 1, __value) | ||
260 | #define SET_88E_H2CCMD_REMOTE_WAKE_CTRL_NDP_OFFLOAD_EN(__cmd, __value) \ | ||
261 | SET_BITS_TO_LE_1BYTE(__cmd, 2, 1, __value) | ||
262 | #define SET_88E_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(__cmd, __value) \ | ||
263 | SET_BITS_TO_LE_1BYTE(__cmd, 3, 1, __value) | ||
264 | #else | ||
265 | #define SET_88E_H2_REM_WAKE_ENC_ALG(__cmd, __value) \ | ||
266 | SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 8, __value) | ||
267 | #define SET_88E_H2CCMD_REMOTE_WAKE_CTRL_GROUP_ENC_ALG(__cmd, __value) \ | ||
268 | SET_BITS_TO_LE_1BYTE((__cmd)+2, 0, 8, __value) | ||
269 | #endif | ||
270 | |||
271 | /* GTK_OFFLOAD */ | ||
272 | #define SET_88E_H2CCMD_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(__cmd, __value) \ | ||
273 | SET_BITS_TO_LE_1BYTE(__cmd, 0, 8, __value) | ||
274 | #define SET_88E_H2CCMD_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(__cmd, __value) \ | ||
275 | SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 8, __value) | ||
276 | |||
277 | /* AOAC_RSVDPAGE_LOC */ | ||
278 | #define SET_88E_H2CCMD_AOAC_RSVD_LOC_REM_WAKE_CTRL_INFO(__cmd, __value) \ | ||
279 | SET_BITS_TO_LE_1BYTE((__cmd), 0, 8, __value) | ||
280 | #define SET_88E_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(__cmd, __value) \ | ||
281 | SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 8, __value) | ||
282 | #define SET_88E_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(__cmd, __value) \ | ||
283 | SET_BITS_TO_LE_1BYTE((__cmd)+2, 0, 8, __value) | ||
284 | #define SET_88E_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(__cmd, __value) \ | ||
285 | SET_BITS_TO_LE_1BYTE((__cmd)+3, 0, 8, __value) | ||
286 | #define SET_88E_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(__cmd, __value) \ | ||
287 | SET_BITS_TO_LE_1BYTE((__cmd)+4, 0, 8, __value) | ||
288 | |||
289 | int rtl88e_download_fw(struct ieee80211_hw *hw, | ||
290 | bool buse_wake_on_wlan_fw); | ||
291 | void rtl88e_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id, | ||
292 | u32 cmd_len, u8 *p_cmdbuffer); | ||
293 | void rtl88e_firmware_selfreset(struct ieee80211_hw *hw); | ||
294 | void rtl88e_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); | ||
295 | void rtl88e_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, | ||
296 | u8 mstatus); | ||
297 | void rtl88e_set_fw_ap_off_load_cmd(struct ieee80211_hw *hw, u8 enable); | ||
298 | void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished); | ||
299 | void rtl88e_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); | ||
300 | |||
301 | #endif | ||