blob: 15b2055e6212c4401347dbc873f9f49628fe2d3f [file] [log] [blame]
Larry Finger0c817332010-12-08 11:12:31 -06001/******************************************************************************
2 *
Larry Fingerfc616852012-01-07 20:46:43 -06003 * Copyright(c) 2009-2012 Realtek Corporation.
Larry Finger0c817332010-12-08 11:12:31 -06004 *
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 *
26 * Larry Finger <Larry.Finger@lwfinger.net>
27 *
28 *****************************************************************************/
29
Chaoming_Li3ac5e262011-04-25 12:53:40 -050030#ifndef __RTL92C__FW__COMMON__H__
31#define __RTL92C__FW__COMMON__H__
Larry Finger0c817332010-12-08 11:12:31 -060032
33#define FW_8192C_SIZE 0x3000
34#define FW_8192C_START_ADDRESS 0x1000
George040a7272011-11-17 12:14:42 -060035#define FW_8192C_END_ADDRESS 0x1FFF
Larry Finger0c817332010-12-08 11:12:31 -060036#define FW_8192C_PAGE_SIZE 4096
37#define FW_8192C_POLLING_DELAY 5
38#define FW_8192C_POLLING_TIMEOUT_COUNT 100
39
40#define IS_FW_HEADER_EXIST(_pfwhdr) \
Larry Fingerabfabc92011-11-17 12:14:44 -060041 ((le16_to_cpu(_pfwhdr->signature)&0xFFF0) == 0x92C0 ||\
42 (le16_to_cpu(_pfwhdr->signature)&0xFFF0) == 0x88C0)
Larry Finger0c817332010-12-08 11:12:31 -060043
44struct rtl92c_firmware_header {
Larry Fingerabfabc92011-11-17 12:14:44 -060045 __le16 signature;
Larry Finger0c817332010-12-08 11:12:31 -060046 u8 category;
47 u8 function;
Larry Fingerabfabc92011-11-17 12:14:44 -060048 __le16 version;
Larry Finger0c817332010-12-08 11:12:31 -060049 u8 subversion;
50 u8 rsvd1;
51 u8 month;
52 u8 date;
53 u8 hour;
54 u8 minute;
Larry Fingerabfabc92011-11-17 12:14:44 -060055 __le16 ramcodeSize;
56 __le16 rsvd2;
57 __le32 svnindex;
58 __le32 rsvd3;
59 __le32 rsvd4;
60 __le32 rsvd5;
Larry Finger0c817332010-12-08 11:12:31 -060061};
62
63enum rtl8192c_h2c_cmd {
64 H2C_AP_OFFLOAD = 0,
65 H2C_SETPWRMODE = 1,
66 H2C_JOINBSSRPT = 2,
67 H2C_RSVDPAGE = 3,
68 H2C_RSSI_REPORT = 5,
69 H2C_RA_MASK = 6,
Larry Finger3a16b412013-03-24 22:06:40 -050070 H2C_MACID_PS_MODE = 7,
71 H2C_P2P_PS_OFFLOAD = 8,
72 H2C_P2P_PS_CTW_CMD = 32,
Larry Finger0c817332010-12-08 11:12:31 -060073 MAX_H2CCMD
74};
75
76#define pagenum_128(_len) (u32)(((_len)>>7) + ((_len)&0x7F ? 1 : 0))
77
78#define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val) \
79 SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val)
80#define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__ph2ccmd, __val) \
81 SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val)
82#define SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(__ph2ccmd, __val) \
83 SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val)
84#define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val) \
85 SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val)
86#define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val) \
87 SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val)
88#define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val) \
89 SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val)
90#define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val) \
91 SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val)
92
93int rtl92c_download_fw(struct ieee80211_hw *hw);
94void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id,
95 u32 cmd_len, u8 *p_cmdbuffer);
96void rtl92c_firmware_selfreset(struct ieee80211_hw *hw);
97void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
98void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished);
99void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus);
Larry Fingerff6ff962011-11-17 12:14:43 -0600100void usb_writeN_async(struct rtl_priv *rtlpriv, u32 addr, void *data, u16 len);
Larry Finger3a16b412013-03-24 22:06:40 -0500101void rtl92c_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state);
Larry Finger0c817332010-12-08 11:12:31 -0600102
103#endif