]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/net/wireless/rtlwifi/rtl8723com/fw_common.h
Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64...
[karo-tx-linux.git] / drivers / net / wireless / rtlwifi / rtl8723com / fw_common.h
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__
27 #define __FW_COMMON_H__
28
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
33 #define FW_8192C_POLLING_TIMEOUT_COUNT          6000
34 #define FW_8192C_POLLING_DELAY                  5
35
36 #define MCUFWDL_RDY                             BIT(1)
37 #define FWDL_CHKSUM_RPT                         BIT(2)
38 #define WINTINI_RDY                             BIT(6)
39
40 #define REG_RSV_CTRL                            0x001C
41 #define REG_HMETFR                              0x01CC
42
43 enum version_8723e {
44         VERSION_TEST_UMC_CHIP_8723 = 0x0081,
45         VERSION_NORMAL_UMC_CHIP_8723_1T1R_A_CUT = 0x0089,
46         VERSION_NORMAL_UMC_CHIP_8723_1T1R_B_CUT = 0x1089,
47         VERSION_TEST_CHIP_1T1R_8723B = 0x0106,
48         VERSION_NORMAL_SMIC_CHIP_1T1R_8723B = 0x010E,
49         VERSION_UNKNOWN = 0xFF,
50 };
51
52 enum rtl8723ae_h2c_cmd {
53         H2C_AP_OFFLOAD = 0,
54         H2C_SETPWRMODE = 1,
55         H2C_JOINBSSRPT = 2,
56         H2C_RSVDPAGE = 3,
57         H2C_RSSI_REPORT = 4,
58         H2C_P2P_PS_CTW_CMD = 5,
59         H2C_P2P_PS_OFFLOAD = 6,
60         H2C_RA_MASK = 7,
61         MAX_H2CCMD
62 };
63
64 enum rtl8723be_cmd {
65         H2C_8723BE_RSVDPAGE = 0,
66         H2C_8723BE_JOINBSSRPT = 1,
67         H2C_8723BE_SCAN = 2,
68         H2C_8723BE_KEEP_ALIVE_CTRL = 3,
69         H2C_8723BE_DISCONNECT_DECISION = 4,
70         H2C_8723BE_INIT_OFFLOAD = 6,
71         H2C_8723BE_AP_OFFLOAD = 8,
72         H2C_8723BE_BCN_RSVDPAGE = 9,
73         H2C_8723BE_PROBERSP_RSVDPAGE = 10,
74
75         H2C_8723BE_SETPWRMODE = 0x20,
76         H2C_8723BE_PS_TUNING_PARA = 0x21,
77         H2C_8723BE_PS_TUNING_PARA2 = 0x22,
78         H2C_8723BE_PS_LPS_PARA = 0x23,
79         H2C_8723BE_P2P_PS_OFFLOAD = 0x24,
80
81         H2C_8723BE_WO_WLAN = 0x80,
82         H2C_8723BE_REMOTE_WAKE_CTRL = 0x81,
83         H2C_8723BE_AOAC_GLOBAL_INFO = 0x82,
84         H2C_8723BE_AOAC_RSVDPAGE = 0x83,
85         H2C_8723BE_RSSI_REPORT = 0x42,
86         H2C_8723BE_RA_MASK = 0x40,
87         H2C_8723BE_SELECTIVE_SUSPEND_ROF_CMD,
88         H2C_8723BE_P2P_PS_MODE,
89         H2C_8723BE_PSD_RESULT,
90         /*Not defined CTW CMD for P2P yet*/
91         H2C_8723BE_P2P_PS_CTW_CMD,
92         MAX_8723BE_H2CCMD
93 };
94
95 struct rtl92c_firmware_header {
96         u16 signature;
97         u8 category;
98         u8 function;
99         u16 version;
100         u8 subversion;
101         u8 rsvd1;
102         u8 month;
103         u8 date;
104         u8 hour;
105         u8 minute;
106         u16 ramcodesize;
107         u16 rsvd2;
108         u32 svnindex;
109         u32 rsvd3;
110         u32 rsvd4;
111         u32 rsvd5;
112 };
113
114 void rtl8723ae_firmware_selfreset(struct ieee80211_hw *hw);
115 void rtl8723be_firmware_selfreset(struct ieee80211_hw *hw);
116 void rtl8723_enable_fw_download(struct ieee80211_hw *hw, bool enable);
117 void rtl8723_fw_block_write(struct ieee80211_hw *hw,
118                             const u8 *buffer, u32 size);
119 void rtl8723_fw_page_write(struct ieee80211_hw *hw,
120                            u32 page, const u8 *buffer, u32 size);
121 void rtl8723_write_fw(struct ieee80211_hw *hw,
122                       enum version_8723e version,
123                       u8 *buffer, u32 size);
124 int rtl8723_fw_free_to_go(struct ieee80211_hw *hw, bool is_8723be);
125 int rtl8723_download_fw(struct ieee80211_hw *hw, bool is_8723be);
126 #endif