]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h
Merge branch 'perf/urgent' into perf/core, to pick up fixes
[mirror_ubuntu-bionic-kernel.git] / drivers / net / wireless / rtlwifi / rtl8192c / fw_common.h
CommitLineData
0c817338
LF
1/******************************************************************************
2 *
fc616856 3 * Copyright(c) 2009-2012 Realtek Corporation.
0c817338
LF
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 *
26 * Larry Finger <Larry.Finger@lwfinger.net>
27 *
28 *****************************************************************************/
29
3ac5e26a
C
30#ifndef __RTL92C__FW__COMMON__H__
31#define __RTL92C__FW__COMMON__H__
0c817338
LF
32
33#define FW_8192C_SIZE 0x3000
34#define FW_8192C_START_ADDRESS 0x1000
040a7278 35#define FW_8192C_END_ADDRESS 0x1FFF
0c817338
LF
36#define FW_8192C_PAGE_SIZE 4096
37#define FW_8192C_POLLING_DELAY 5
38#define FW_8192C_POLLING_TIMEOUT_COUNT 100
9f087a92 39#define NORMAL_CHIP BIT(4)
0c817338
LF
40
41#define IS_FW_HEADER_EXIST(_pfwhdr) \
abfabc9b
LF
42 ((le16_to_cpu(_pfwhdr->signature)&0xFFF0) == 0x92C0 ||\
43 (le16_to_cpu(_pfwhdr->signature)&0xFFF0) == 0x88C0)
0c817338 44
9f087a92
LF
45#define CUT_VERSION_MASK (BIT(6)|BIT(7))
46#define CHIP_VENDOR_UMC BIT(5)
47#define CHIP_VENDOR_UMC_B_CUT BIT(6) /* Chip version for ECO */
48#define IS_CHIP_VER_B(version) ((version & CHIP_VER_B) ? true : false)
49#define RF_TYPE_MASK (BIT(0)|BIT(1))
50#define GET_CVID_RF_TYPE(version) \
51 ((version) & RF_TYPE_MASK)
52#define GET_CVID_CUT_VERSION(version) \
53 ((version) & CUT_VERSION_MASK)
54#define IS_NORMAL_CHIP(version) \
55 ((version & NORMAL_CHIP) ? true : false)
56#define IS_2T2R(version) \
57 (((GET_CVID_RF_TYPE(version)) == \
58 CHIP_92C_BITMASK) ? true : false)
59#define IS_92C_SERIAL(version) \
60 ((IS_2T2R(version)) ? true : false)
61#define IS_CHIP_VENDOR_UMC(version) \
62 ((version & CHIP_VENDOR_UMC) ? true : false)
63#define IS_VENDOR_UMC_A_CUT(version) \
64 ((IS_CHIP_VENDOR_UMC(version)) ? \
65 ((GET_CVID_CUT_VERSION(version)) ? false : true) : false)
66#define IS_81XXC_VENDOR_UMC_B_CUT(version) \
67 ((IS_CHIP_VENDOR_UMC(version)) ? \
68 ((GET_CVID_CUT_VERSION(version) == \
69 CHIP_VENDOR_UMC_B_CUT) ? true : false) : false)
70
0c817338 71struct rtl92c_firmware_header {
abfabc9b 72 __le16 signature;
0c817338
LF
73 u8 category;
74 u8 function;
abfabc9b 75 __le16 version;
0c817338
LF
76 u8 subversion;
77 u8 rsvd1;
78 u8 month;
79 u8 date;
80 u8 hour;
81 u8 minute;
abfabc9b
LF
82 __le16 ramcodeSize;
83 __le16 rsvd2;
84 __le32 svnindex;
85 __le32 rsvd3;
86 __le32 rsvd4;
87 __le32 rsvd5;
0c817338
LF
88};
89
0c817338
LF
90#define pagenum_128(_len) (u32)(((_len)>>7) + ((_len)&0x7F ? 1 : 0))
91
92#define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val) \
93 SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val)
94#define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__ph2ccmd, __val) \
95 SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val)
96#define SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(__ph2ccmd, __val) \
97 SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val)
98#define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val) \
99 SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val)
100#define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val) \
101 SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val)
102#define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val) \
103 SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val)
104#define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val) \
105 SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val)
106
107int rtl92c_download_fw(struct ieee80211_hw *hw);
108void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id,
109 u32 cmd_len, u8 *p_cmdbuffer);
110void rtl92c_firmware_selfreset(struct ieee80211_hw *hw);
111void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
4f2b244c
KW
112void rtl92c_set_fw_rsvdpagepkt
113 (struct ieee80211_hw *hw,
114 bool (*cmd_send_packet)(struct ieee80211_hw *, struct sk_buff *));
0c817338 115void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus);
ff6ff96b 116void usb_writeN_async(struct rtl_priv *rtlpriv, u32 addr, void *data, u16 len);
3a16b412 117void rtl92c_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state);
0c817338
LF
118
119#endif