Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
fw.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright(c) 2009-2012 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 <[email protected]>
23  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24  * Hsinchu 300, Taiwan.
25  *
26  * Larry Finger <[email protected]>
27  *
28  *****************************************************************************/
29 #ifndef __REALTEK_FIRMWARE92S_H__
30 #define __REALTEK_FIRMWARE92S_H__
31 
32 #define RTL8190_MAX_FIRMWARE_CODE_SIZE 64000
33 #define RTL8190_MAX_RAW_FIRMWARE_CODE_SIZE 90000
34 #define RTL8190_CPU_START_OFFSET 0x80
35 /* Firmware Local buffer size. 64k */
36 #define MAX_FIRMWARE_CODE_SIZE 0xFF00
37 
38 #define RT_8192S_FIRMWARE_HDR_SIZE 80
39 #define RT_8192S_FIRMWARE_HDR_EXCLUDE_PRI_SIZE 32
40 
41 /* support till 64 bit bus width OS */
42 #define MAX_DEV_ADDR_SIZE 8
43 #define MAX_FIRMWARE_INFORMATION_SIZE 32
44 #define MAX_802_11_HEADER_LENGTH (40 + \
45  MAX_FIRMWARE_INFORMATION_SIZE)
46 #define ENCRYPTION_MAX_OVERHEAD 128
47 #define MAX_FRAGMENT_COUNT 8
48 #define MAX_TRANSMIT_BUFFER_SIZE (1600 + \
49  (MAX_802_11_HEADER_LENGTH + \
50  ENCRYPTION_MAX_OVERHEAD) *\
51  MAX_FRAGMENT_COUNT)
52 
53 #define H2C_TX_CMD_HDR_LEN 8
54 
55 /* The following DM control code are for Reg0x364, */
56 #define FW_DIG_ENABLE_CTL BIT(0)
57 #define FW_HIGH_PWR_ENABLE_CTL BIT(1)
58 #define FW_SS_CTL BIT(2)
59 #define FW_RA_INIT_CTL BIT(3)
60 #define FW_RA_BG_CTL BIT(4)
61 #define FW_RA_N_CTL BIT(5)
62 #define FW_PWR_TRK_CTL BIT(6)
63 #define FW_IQK_CTL BIT(7)
64 #define FW_FA_CTL BIT(8)
65 #define FW_DRIVER_CTRL_DM_CTL BIT(9)
66 #define FW_PAPE_CTL_BY_SW_HW BIT(10)
67 #define FW_DISABLE_ALL_DM 0
68 #define FW_PWR_TRK_PARAM_CLR 0x0000ffff
69 #define FW_RA_PARAM_CLR 0xffff0000
70 
74 };
75 
76 /* 8-bytes alignment required */
77 struct fw_priv {
78  /* --- long word 0 ---- */
79  /* 0x12: CE product, 0x92: IT product */
81  /* 0x87: CE product, 0x81: IT product */
83  /* 0x81: PCI-AP, 01:PCIe, 02: 92S-U,
84  * 0x82: USB-AP, 0x12: 72S-U, 03:SDIO */
86  /* the same value as reigster value */
88  /* customer ID low byte */
90  /* customer ID high byte */
92  /* 0x11: 1T1R, 0x12: 1T2R,
93  * 0x92: 1T2R turbo, 0x22: 2T2R */
95  /* 4: 4EP, 6: 6EP, 11: 11EP */
97 
98  /* --- long word 1 ---- */
99  /* regulatory class bit map 0 */
101  /* regulatory class bit map 1 */
103  /* regulatory class bit map 2 */
105  /* regulatory class bit map 3 */
107  /* 0:SWSI, 1:HWSI, 2:HWPI */
112 
113  /* --- long word 2 ---- */
114  /* 0x00: normal, 0x03: MACLBK, 0x01: PHYLBK */
116  /* 1: for MP use, 0: for normal
117  * driver (to be discussed) */
125 
126  /* --- long word 3 ---- */
127  /* QoS enable */
129  /* 40MHz BW enable */
130  /* 4181 convert AMSDU to AMPDU, 0: disable */
133  /* 11n AMPDU enable */
135  /* FW offloads, 0: driver handles */
137  /* FW offloads, 0: driver handles */
141 
142  /* --- long word 4 ---- */
143  /* 1. FW offloads, 0: driver handles */
145  /* 2. FW offloads, 0: driver handles */
147  /* 3. FW offloads, 0: driver handles */
149  /* 4. FW offloads, 0: driver handles */
151  /* 5. FW offloads, 0: driver handles */
153  /* 6. FW offloads, 0: driver handles */
155  /* 7. FW offloads, 0: driver handles */
158 
159  /* --- long word 5 ---- */
160  /* tcp tx packet length low byte */
162  /* tcp tx packet length high byte */
164  /* tcp rx packet length low byte */
166  /* tcp rx packet length high byte */
172 };
173 
174 /* 8-byte alinment required */
175 struct fw_hdr {
176 
177  /* --- LONG WORD 0 ---- */
179  /* 0x8000 ~ 0x8FFF for FPGA version,
180  * 0x0000 ~ 0x7FFF for ASIC version, */
182  /* define the size of boot loader */
184 
185 
186  /* --- LONG WORD 1 ---- */
187  /* define the size of FW in IMEM */
189  /* define the size of FW in SRAM */
191 
192  /* --- LONG WORD 2 ---- */
193  /* define the size of DMEM variable */
196 
197  /* --- LONG WORD 3 ---- */
200 
201  struct fw_priv fwpriv;
202 
203 } ;
204 
205 enum fw_status {
211 };
212 
213 struct rt_firmware {
214  struct fw_hdr *pfwheader;
224 };
225 
231  /* 1: dps, 0: 32k */
235  /* beacon TO (ms). ¡§=0¡¨ no limit. */
238  /* only for VOIP mode. */
242  /* unit: 100 ms */
244 };
245 
249  u8 bssid[6];
252 } ;
253 
254 struct h2c_wpa_ptk {
255  /* EAPOL-Key Key Confirmation Key (KCK) */
256  u8 kck[16];
257  /* EAPOL-Key Key Encryption Key (KEK) */
258  u8 kek[16];
259  /* Temporal Key 1 (TK1) */
260  u8 tk1[16];
261  union {
262  /* Temporal Key 2 (TK2) */
263  u8 tk2[16];
264  struct {
267  } athu;
268  } u;
269 };
270 
272  /* algorithm TKIP or AES */
276 } ;
277 
278 enum h2c_cmd {
284 };
285 
332  H2C_TMP1, /*45*/
339  MAX_H2CCMD /*52*/
340 };
341 
342 /* The following macros are used for FW
343  * CMD map and parameter updated. */
344 #define FW_CMD_IO_CLR(rtlpriv, _Bit) \
345  do { \
346  udelay(1000); \
347  rtlpriv->rtlhal.fwcmd_iomap &= (~_Bit); \
348  } while (0)
349 
350 #define FW_CMD_IO_UPDATE(rtlpriv, _val) \
351  rtlpriv->rtlhal.fwcmd_iomap = _val;
352 
353 #define FW_CMD_IO_SET(rtlpriv, _val) \
354  do { \
355  rtl_write_word(rtlpriv, LBUS_MON_ADDR, (u16)_val); \
356  FW_CMD_IO_UPDATE(rtlpriv, _val); \
357  } while (0)
358 
359 #define FW_CMD_PARA_SET(rtlpriv, _val) \
360  do { \
361  rtl_write_dword(rtlpriv, LBUS_ADDR_MASK, _val); \
362  rtlpriv->rtlhal.fwcmd_ioparam = _val; \
363  } while (0)
364 
365 #define FW_CMD_IO_QUERY(rtlpriv) \
366  (u16)(rtlpriv->rtlhal.fwcmd_iomap)
367 #define FW_CMD_IO_PARA_QUERY(rtlpriv) \
368  ((u32)(rtlpriv->rtlhal.fwcmd_ioparam))
369 
370 int rtl92s_download_fw(struct ieee80211_hw *hw);
373  u8 mstatus, u8 ps_qosinfo);
374 
375 #endif
376