aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi/rtl8723com
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2014-02-28 16:16:43 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-03-04 13:18:28 -0500
commitaa45a673b291fd761275493bc15316d79555ed55 (patch)
tree4b27260c71479bed2c67f79798c272ab1bc8d515 /drivers/net/wireless/rtlwifi/rtl8723com
parentc24782e612dce377cf9149ad787998af7694f757 (diff)
rtlwifi: btcoexist: Add new mini driver
A new driver in the rtlwifi family for the RTL8723BE will soon be added. The bluetooth coexistence code for this device has been split into a separate mini driver as it will be shared with other devices. This commit adds the the headers and sources, and modifies Kconfig and Makefile to configure and build this driver. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi/rtl8723com')
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723com/fw_common.c849
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723com/fw_common.h50
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723com/phy_common.h75
3 files changed, 974 insertions, 0 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.c
new file mode 100644
index 000000000000..83ca4e25ee50
--- /dev/null
+++ b/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.c
@@ -0,0 +1,849 @@
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#include "../wifi.h"
27#include "fw_common.h"
28#include <linux/module.h>
29
30#define BEACON_PG 0 /* ->1 */
31#define PSPOLL_PG 2
32#define NULL_PG 3
33#define PROBERSP_PG 4 /* ->5 */
34
35#define TOTAL_RESERVED_PKT_LEN 768
36
37static u8 reserved_page_packet[TOTAL_RESERVED_PKT_LEN] = {
38 /* page 0 beacon */
39 0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
40 0xFF, 0xFF, 0x00, 0xE0, 0x4C, 0x02, 0xB1, 0x78,
41 0xEC, 0x1A, 0x59, 0x0B, 0xAD, 0xD4, 0x20, 0x00,
42 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
43 0x64, 0x00, 0x10, 0x04, 0x00, 0x05, 0x54, 0x65,
44 0x73, 0x74, 0x32, 0x01, 0x08, 0x82, 0x84, 0x0B,
45 0x16, 0x24, 0x30, 0x48, 0x6C, 0x03, 0x01, 0x06,
46 0x06, 0x02, 0x00, 0x00, 0x2A, 0x01, 0x02, 0x32,
47 0x04, 0x0C, 0x12, 0x18, 0x60, 0x2D, 0x1A, 0x6C,
48 0x09, 0x03, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
49 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
50 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
51 0x00, 0x3D, 0x00, 0xDD, 0x07, 0x00, 0xE0, 0x4C,
52 0x02, 0x02, 0x00, 0x00, 0xDD, 0x18, 0x00, 0x50,
53 0xF2, 0x01, 0x01, 0x00, 0x00, 0x50, 0xF2, 0x04,
54 0x01, 0x00, 0x00, 0x50, 0xF2, 0x04, 0x01, 0x00,
55
56 /* page 1 beacon */
57 0x00, 0x50, 0xF2, 0x02, 0x00, 0x00, 0x00, 0x00,
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
63 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68 0x10, 0x00, 0x28, 0x8C, 0x00, 0x12, 0x00, 0x00,
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00,
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
73
74 /* page 2 ps-poll */
75 0xA4, 0x10, 0x01, 0xC0, 0xEC, 0x1A, 0x59, 0x0B,
76 0xAD, 0xD4, 0x00, 0xE0, 0x4C, 0x02, 0xB1, 0x78,
77 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
79 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
83 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
84 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
86 0x18, 0x00, 0x28, 0x8C, 0x00, 0x12, 0x00, 0x00,
87 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
88 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
89 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
90 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
91
92 /* page 3 null */
93 0x48, 0x01, 0x00, 0x00, 0xEC, 0x1A, 0x59, 0x0B,
94 0xAD, 0xD4, 0x00, 0xE0, 0x4C, 0x02, 0xB1, 0x78,
95 0xEC, 0x1A, 0x59, 0x0B, 0xAD, 0xD4, 0x00, 0x00,
96 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
99 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
100 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
101 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
102 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
103 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
104 0x72, 0x00, 0x28, 0x8C, 0x00, 0x12, 0x00, 0x00,
105 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
106 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
107 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
108 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
109
110 /* page 4 probe_resp */
111 0x50, 0x00, 0x00, 0x00, 0x00, 0x40, 0x10, 0x10,
112 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42,
113 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00,
114 0x9E, 0x46, 0x15, 0x32, 0x27, 0xF2, 0x2D, 0x00,
115 0x64, 0x00, 0x00, 0x04, 0x00, 0x0C, 0x6C, 0x69,
116 0x6E, 0x6B, 0x73, 0x79, 0x73, 0x5F, 0x77, 0x6C,
117 0x61, 0x6E, 0x01, 0x04, 0x82, 0x84, 0x8B, 0x96,
118 0x03, 0x01, 0x01, 0x06, 0x02, 0x00, 0x00, 0x2A,
119 0x01, 0x00, 0x32, 0x08, 0x24, 0x30, 0x48, 0x6C,
120 0x0C, 0x12, 0x18, 0x60, 0x2D, 0x1A, 0x6C, 0x18,
121 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
122 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
124 0x3D, 0x00, 0xDD, 0x06, 0x00, 0xE0, 0x4C, 0x02,
125 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
126 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
127
128 /* page 5 probe_resp */
129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
132 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
133 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
134 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
139 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
140 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
141 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
145};
146
147void rtl8723_enable_fw_download(struct ieee80211_hw *hw, bool enable)
148{
149 struct rtl_priv *rtlpriv = rtl_priv(hw);
150 u8 tmp;
151
152 if (enable) {
153 tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
154 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, tmp | 0x04);
155
156 tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL);
157 rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp | 0x01);
158
159 tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL + 2);
160 rtl_write_byte(rtlpriv, REG_MCUFWDL + 2, tmp & 0xf7);
161 } else {
162 tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL);
163 rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp & 0xfe);
164
165 rtl_write_byte(rtlpriv, REG_MCUFWDL + 1, 0x00);
166 }
167}
168EXPORT_SYMBOL_GPL(rtl8723_enable_fw_download);
169
170void rtl8723_fw_block_write(struct ieee80211_hw *hw,
171 const u8 *buffer, u32 size)
172{
173 struct rtl_priv *rtlpriv = rtl_priv(hw);
174 u32 blocksize = sizeof(u32);
175 u8 *bufferptr = (u8 *)buffer;
176 u32 *pu4byteptr = (u32 *)buffer;
177 u32 i, offset, blockcount, remainsize;
178
179 blockcount = size / blocksize;
180 remainsize = size % blocksize;
181
182 for (i = 0; i < blockcount; i++) {
183 offset = i * blocksize;
184 rtl_write_dword(rtlpriv, (FW_8192C_START_ADDRESS + offset),
185 *(pu4byteptr + i));
186 }
187 if (remainsize) {
188 offset = blockcount * blocksize;
189 bufferptr += offset;
190 for (i = 0; i < remainsize; i++) {
191 rtl_write_byte(rtlpriv,
192 (FW_8192C_START_ADDRESS + offset + i),
193 *(bufferptr + i));
194 }
195 }
196}
197EXPORT_SYMBOL_GPL(rtl8723_fw_block_write);
198
199void rtl8723_fw_page_write(struct ieee80211_hw *hw,
200 u32 page, const u8 *buffer, u32 size)
201{
202 struct rtl_priv *rtlpriv = rtl_priv(hw);
203 u8 value8;
204 u8 u8page = (u8) (page & 0x07);
205
206 value8 = (rtl_read_byte(rtlpriv, REG_MCUFWDL + 2) & 0xF8) | u8page;
207
208 rtl_write_byte(rtlpriv, (REG_MCUFWDL + 2), value8);
209 rtl8723_fw_block_write(hw, buffer, size);
210}
211EXPORT_SYMBOL_GPL(rtl8723_fw_page_write);
212
213static void rtl8723_fill_dummy(u8 *pfwbuf, u32 *pfwlen)
214{
215 u32 fwlen = *pfwlen;
216 u8 remain = (u8) (fwlen % 4);
217
218 remain = (remain == 0) ? 0 : (4 - remain);
219
220 while (remain > 0) {
221 pfwbuf[fwlen] = 0;
222 fwlen++;
223 remain--;
224 }
225 *pfwlen = fwlen;
226}
227
228void rtl8723_write_fw(struct ieee80211_hw *hw,
229 enum version_8723be version,
230 u8 *buffer, u32 size)
231{
232 struct rtl_priv *rtlpriv = rtl_priv(hw);
233 u8 *bufferptr = (u8 *)buffer;
234 u32 pagenums, remainsize;
235 u32 page, offset;
236
237 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "FW size is %d bytes,\n", size);
238
239 _rtl8723be_fill_dummy(bufferptr, &size);
240
241 pagenums = size / FW_8192C_PAGE_SIZE;
242 remainsize = size % FW_8192C_PAGE_SIZE;
243
244 if (pagenums > 8) {
245 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
246 "Page numbers should not greater then 8\n");
247 }
248 for (page = 0; page < pagenums; page++) {
249 offset = page * FW_8192C_PAGE_SIZE;
250 rtl8723_fw_page_write(hw, page, (bufferptr + offset),
251 FW_8192C_PAGE_SIZE);
252 }
253 if (remainsize) {
254 offset = pagenums * FW_8192C_PAGE_SIZE;
255 page = pagenums;
256 rtl8723_fw_page_write(hw, page, (bufferptr + offset),
257 remainsize);
258 }
259}
260EXPORT_SYMBOL_GPL(rtl8723_write_fw);
261
262void rtl8723ae_firmware_selfreset(struct ieee80211_hw *hw)
263{
264 u8 u1tmp;
265 u8 delay = 100;
266 struct rtl_priv *rtlpriv = rtl_priv(hw);
267
268 rtl_write_byte(rtlpriv, REG_HMETFR + 3, 0x20);
269 u1tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
270
271 while (u1tmp & BIT(2)) {
272 delay--;
273 if (delay == 0)
274 break;
275 udelay(50);
276 u1tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
277 }
278 if (delay == 0) {
279 u1tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
280 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, u1tmp&(~BIT(2)));
281 }
282}
283EXPORT_SYMBOL_GPL(rtl8723ae_firmware_selfreset);
284
285void rtl8723be_firmware_selfreset(struct ieee80211_hw *hw)
286{
287 u8 u1b_tmp;
288 struct rtl_priv *rtlpriv = rtl_priv(hw);
289
290 u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL + 1);
291 rtl_write_byte(rtlpriv, REG_RSV_CTRL + 1, (u1b_tmp & (~BIT(0))));
292
293 u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
294 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, (u1b_tmp & (~BIT(2))));
295 udelay(50);
296
297 u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL + 1);
298 rtl_write_byte(rtlpriv, REG_RSV_CTRL + 1, (u1b_tmp | BIT(0)));
299
300 u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
301 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, (u1b_tmp | BIT(2)));
302
303 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
304 " _8051Reset8723be(): 8051 reset success .\n");
305}
306EXPORT_SYMBOL_GPL(rtl8723be_firmware_selfreset);
307
308int rtl8723_fw_free_to_go(struct ieee80211_hw *hw, bool is_8723be)
309{
310 struct rtl_priv *rtlpriv = rtl_priv(hw);
311 int err = -EIO;
312 u32 counter = 0;
313 u32 value32;
314
315 do {
316 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
317 } while ((counter++ < FW_8192C_POLLING_TIMEOUT_COUNT) &&
318 (!(value32 & FWDL_CHKSUM_RPT)));
319
320 if (counter >= FW_8192C_POLLING_TIMEOUT_COUNT) {
321 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
322 "chksum report faill ! REG_MCUFWDL:0x%08x .\n",
323 value32);
324 goto exit;
325 }
326 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE,
327 "Checksum report OK ! REG_MCUFWDL:0x%08x .\n", value32);
328
329 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
330 value32 |= MCUFWDL_RDY;
331 value32 &= ~WINTINI_RDY;
332 rtl_write_dword(rtlpriv, REG_MCUFWDL, value32);
333
334 if (is_8723be)
335 rtl8723be_firmware_selfreset(hw);
336 counter = 0;
337
338 do {
339 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
340 if (value32 & WINTINI_RDY) {
341 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE,
342 "Polling FW ready success!! "
343 "REG_MCUFWDL:0x%08x .\n",
344 value32);
345 err = 0;
346 goto exit;
347 }
348 udelay(FW_8192C_POLLING_DELAY);
349
350 } while (counter++ < FW_8192C_POLLING_TIMEOUT_COUNT);
351
352 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
353 "Polling FW ready fail!! REG_MCUFWDL:0x%08x .\n",
354 value32);
355
356exit:
357 return err;
358}
359EXPORT_SYMBOL_GPL(rtl8723_fw_free_to_go);
360
361int rtl8723_download_fw(struct ieee80211_hw *hw,
362 bool is_8723be)
363{
364 struct rtl_priv *rtlpriv = rtl_priv(hw);
365 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
366 struct rtl92c_firmware_header *pfwheader;
367 u8 *pfwdata;
368 u32 fwsize;
369 int err;
370 enum version_8723e version = rtlhal->version;
371
372 if (!rtlhal->pfirmware)
373 return 1;
374
375 pfwheader = (struct rtl92c_firmware_header *)rtlhal->pfirmware;
376 pfwdata = (u8 *)rtlhal->pfirmware;
377 fwsize = rtlhal->fwsize;
378 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
379 "normal Firmware SIZE %d\n", fwsize);
380
381 if (IS_FW_HEADER_EXIST(pfwheader)) {
382 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
383 "Firmware Version(%d), Signature(%#x), Size(%d)\n",
384 pfwheader->version, pfwheader->signature,
385 (int)sizeof(struct rtl92c_firmware_header));
386
387 pfwdata = pfwdata + sizeof(struct rtl92c_firmware_header);
388 fwsize = fwsize - sizeof(struct rtl92c_firmware_header);
389 }
390 if (rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(7)) {
391 rtl_write_byte(rtlpriv, REG_MCUFWDL, 0);
392 if (is_8723be)
393 rtl8723be_firmware_selfreset(hw);
394 else
395 rtl8723ae_firmware_selfreset(hw);
396 }
397 rtl8723_enable_fw_download(hw, is_8723be);
398 rtl8723_write_fw(hw, version, pfwdata, fwsize);
399 rtl8723_enable_fw_download(hw, is_8723be);
400
401 err = rtl8723_fw_free_to_go(hw, is_8723be);
402 if (err) {
403 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
404 "Firmware is not ready to run!\n");
405 } else {
406 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD,
407 "Firmware is ready to run!\n");
408 }
409 return 0;
410}
411EXPORT_SYMBOL_GPL(rtl8723_download_fw);
412
413bool rtl8723_check_fw_read_last_h2c(struct ieee80211_hw *hw, u8 boxnum)
414{
415 struct rtl_priv *rtlpriv = rtl_priv(hw);
416 u8 val_hmetfr, val_mcutst_1;
417 bool result = false;
418
419 val_hmetfr = rtl_read_byte(rtlpriv, REG_HMETFR);
420 val_mcutst_1 = rtl_read_byte(rtlpriv, (REG_MCUTST_1 + boxnum));
421
422 if (((val_hmetfr >> boxnum) & BIT(0)) == 0 && val_mcutst_1 == 0)
423 result = true;
424 return result;
425}
426EXPORT_SYMBOL_GPL(rtl8723_check_fw_read_last_h2c);
427
428void rtl8723_fill_h2c_command(struct ieee80211_hw *hw, u8 element_id,
429 u32 cmd_len, u8 *p_cmdbuffer)
430{
431 struct rtl_priv *rtlpriv = rtl_priv(hw);
432 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
433 u8 boxnum;
434 u16 box_reg = 0, box_extreg = 0;
435 u8 u1b_tmp;
436 bool isfw_read = false;
437 u8 buf_index = 0;
438 bool bwrite_sucess = false;
439 u8 wait_h2c_limit = 100;
440 u8 wait_writeh2c_limit = 100;
441 u8 boxcontent[4], boxextcontent[4];
442 u32 h2c_waitcounter = 0;
443 unsigned long flag;
444 u8 idx;
445
446 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "come in\n");
447
448 while (true) {
449 spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag);
450 if (rtlhal->h2c_setinprogress) {
451 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
452 "H2C set in progress! Wait to set.."
453 "element_id(%d).\n", element_id);
454
455 while (rtlhal->h2c_setinprogress) {
456 spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock,
457 flag);
458 h2c_waitcounter++;
459 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
460 "Wait 100 us (%d times)...\n",
461 h2c_waitcounter);
462 udelay(100);
463
464 if (h2c_waitcounter > 1000)
465 return;
466 spin_lock_irqsave(&rtlpriv->locks.h2c_lock,
467 flag);
468 }
469 spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag);
470 } else {
471 rtlhal->h2c_setinprogress = true;
472 spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag);
473 break;
474 }
475 }
476 while (!bwrite_sucess) {
477 wait_writeh2c_limit--;
478 if (wait_writeh2c_limit == 0) {
479 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
480 "Write H2C fail because no trigger "
481 "for FW INT!\n");
482 break;
483 }
484 boxnum = rtlhal->last_hmeboxnum;
485 switch (boxnum) {
486 case 0:
487 box_reg = REG_HMEBOX_0;
488 box_extreg = REG_HMEBOX_EXT_0;
489 break;
490 case 1:
491 box_reg = REG_HMEBOX_1;
492 box_extreg = REG_HMEBOX_EXT_1;
493 break;
494 case 2:
495 box_reg = REG_HMEBOX_2;
496 box_extreg = REG_HMEBOX_EXT_2;
497 break;
498 case 3:
499 box_reg = REG_HMEBOX_3;
500 box_extreg = REG_HMEBOX_EXT_3;
501 break;
502 default:
503 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
504 "switch case not processed\n");
505 break;
506 }
507 isfw_read = rtl8723_check_fw_read_last_h2c(hw, boxnum);
508 while (!isfw_read) {
509 wait_h2c_limit--;
510 if (wait_h2c_limit == 0) {
511 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
512 "Waiting too long for FW read "
513 "clear HMEBox(%d)!\n", boxnum);
514 break;
515 }
516 udelay(10);
517
518 isfw_read = rtl8723_check_fw_read_last_h2c(hw,
519 boxnum);
520 }
521 if (!isfw_read) {
522 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
523 "Write H2C register BOX[%d] fail!!!!! "
524 "Fw do not read.\n", boxnum);
525 break;
526 }
527 memset(boxcontent, 0, sizeof(boxcontent));
528 memset(boxextcontent, 0, sizeof(boxextcontent));
529 boxcontent[0] = element_id;
530 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
531 "Write element_id box_reg(%4x) = %2x\n",
532 box_reg, element_id);
533
534 switch (cmd_len) {
535 case 1:
536 case 2:
537 case 3:
538 /*boxcontent[0] &= ~(BIT(7));*/
539 memcpy((u8 *)(boxcontent) + 1,
540 p_cmdbuffer + buf_index, cmd_len);
541
542 for (idx = 0; idx < 4; idx++) {
543 rtl_write_byte(rtlpriv, box_reg + idx,
544 boxcontent[idx]);
545 }
546 break;
547 case 4:
548 case 5:
549 case 6:
550 case 7:
551 /*boxcontent[0] |= (BIT(7));*/
552 memcpy((u8 *)(boxextcontent),
553 p_cmdbuffer + buf_index+3, cmd_len-3);
554 memcpy((u8 *)(boxcontent) + 1,
555 p_cmdbuffer + buf_index, 3);
556
557 for (idx = 0; idx < 4; idx++) {
558 rtl_write_byte(rtlpriv, box_extreg + idx,
559 boxextcontent[idx]);
560 }
561 for (idx = 0; idx < 4; idx++) {
562 rtl_write_byte(rtlpriv, box_reg + idx,
563 boxcontent[idx]);
564 }
565 break;
566 default:
567 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
568 "switch case not process\n");
569 break;
570 }
571 bwrite_sucess = true;
572
573 rtlhal->last_hmeboxnum = boxnum + 1;
574 if (rtlhal->last_hmeboxnum == 4)
575 rtlhal->last_hmeboxnum = 0;
576
577 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
578 "pHalData->last_hmeboxnum = %d\n",
579 rtlhal->last_hmeboxnum);
580 }
581 if (!rtlpriv) {
582 pr_err("rtlpriv bad\n");
583 return;
584 }
585 if (!rtlhal) {
586 pr_err("rtlhal bad\n");
587 return;
588 }
589 spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag);
590 rtlhal->h2c_setinprogress = false;
591 spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag);
592
593 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "go out\n");
594}
595EXPORT_SYMBOL_GPL(rtl8723_fill_h2c_command);
596
597void rtl8723_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id,
598 u32 cmd_len, u8 *p_cmdbuffer)
599{
600 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
601 u32 tmp_cmdbuf[2];
602
603 if (!rtlhal->fw_ready) {
604 RT_ASSERT(false,
605 "return H2C cmd because of Fw download fail!!!\n");
606 return;
607 }
608 memset(tmp_cmdbuf, 0, 8);
609 memcpy(tmp_cmdbuf, p_cmdbuffer, cmd_len);
610 rtl8723_fill_h2c_command(hw, element_id, cmd_len,
611 (u8 *)&tmp_cmdbuf);
612 return;
613}
614EXPORT_SYMBOL_GPL(rtl8723_fill_h2c_cmd);
615
616void rtl8723_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus)
617{
618 u8 u1_joinbssrpt_parm[1] = { 0 };
619
620 SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(u1_joinbssrpt_parm, mstatus);
621
622 rtl8723_fill_h2c_cmd(hw, H2C_JOINBSSRPT, 1, u1_joinbssrpt_parm);
623}
624EXPORT_SYMBOL_GPL(rtl8723_set_fw_joinbss_report_cmd);
625
626bool rtl8723_cmd_send_packet(struct ieee80211_hw *hw,
627 struct sk_buff *skb)
628{
629 struct rtl_priv *rtlpriv = rtl_priv(hw);
630 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
631 struct rtl8192_tx_ring *ring;
632 struct rtl_tx_desc *pdesc;
633 struct sk_buff *pskb = NULL;
634 u8 own;
635 unsigned long flags;
636
637 ring = &rtlpci->tx_ring[BEACON_QUEUE];
638
639 pskb = __skb_dequeue(&ring->queue);
640 if (pskb)
641 kfree_skb(pskb);
642
643 spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
644
645 pdesc = &ring->desc[0];
646 own = (u8) rtlpriv->cfg->ops->get_desc((u8 *)pdesc, true, HW_DESC_OWN);
647
648 rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *)pdesc, 1, 1, skb);
649
650 __skb_queue_tail(&ring->queue, skb);
651
652 spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags);
653
654 rtlpriv->cfg->ops->tx_polling(hw, BEACON_QUEUE);
655
656 return true;
657}
658EXPORT_SYMBOL_GPL(rtl8723_cmd_send_packet);
659
660void rtl8723_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
661{
662 struct rtl_priv *rtlpriv = rtl_priv(hw);
663 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
664 struct sk_buff *skb = NULL;
665
666 u32 totalpacketlen;
667 bool rtstatus;
668 u8 u1rsvdpageloc[5] = { 0 };
669 bool dlok = false;
670
671 u8 *beacon;
672 u8 *p_pspoll;
673 u8 *nullfunc;
674 u8 *p_probersp;
675 /*---------------------------------------------------------
676 * (1) beacon
677 *---------------------------------------------------------
678 */
679 beacon = &reserved_page_packet[BEACON_PG * 128];
680 SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr);
681 SET_80211_HDR_ADDRESS3(beacon, mac->bssid);
682
683 /*-------------------------------------------------------
684 * (2) ps-poll
685 *-------------------------------------------------------
686 */
687 p_pspoll = &reserved_page_packet[PSPOLL_PG * 128];
688 SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000));
689 SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid);
690 SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr);
691
692 SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1rsvdpageloc, PSPOLL_PG);
693
694 /*--------------------------------------------------------
695 * (3) null data
696 *--------------------------------------------------------
697 */
698 nullfunc = &reserved_page_packet[NULL_PG * 128];
699 SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid);
700 SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr);
701 SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid);
702
703 SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1rsvdpageloc, NULL_PG);
704
705 /*---------------------------------------------------------
706 * (4) probe response
707 *---------------------------------------------------------
708 */
709 p_probersp = &reserved_page_packet[PROBERSP_PG * 128];
710 SET_80211_HDR_ADDRESS1(p_probersp, mac->bssid);
711 SET_80211_HDR_ADDRESS2(p_probersp, mac->mac_addr);
712 SET_80211_HDR_ADDRESS3(p_probersp, mac->bssid);
713
714 SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1rsvdpageloc, PROBERSP_PG);
715
716 totalpacketlen = TOTAL_RESERVED_PKT_LEN;
717
718 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
719 "rtl8723be_set_fw_rsvdpagepkt(): "
720 "HW_VAR_SET_TX_CMD: ALL\n",
721 &reserved_page_packet[0], totalpacketlen);
722 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
723 "rtl8723be_set_fw_rsvdpagepkt(): "
724 "HW_VAR_SET_TX_CMD: ALL\n", u1rsvdpageloc, 3);
725
726
727 skb = dev_alloc_skb(totalpacketlen);
728 memcpy((u8 *)skb_put(skb, totalpacketlen),
729 &reserved_page_packet, totalpacketlen);
730
731 rtstatus = rtl8723_cmd_send_packet(hw, skb);
732
733 if (rtstatus)
734 dlok = true;
735
736 if (dlok) {
737 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
738 "Set RSVD page location to Fw.\n");
739 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, "H2C_RSVDPAGE:\n",
740 u1rsvdpageloc, 3);
741 rtl8723_fill_h2c_cmd(hw, H2C_88E_RSVDPAGE,
742 sizeof(u1rsvdpageloc), u1rsvdpageloc);
743 } else {
744 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
745 "Set RSVD page location to Fw FAIL!!!!!!.\n");
746 }
747}
748EXPORT_SYMBOL_GPL(rtl8723_set_fw_rsvdpagepkt);
749
750/*Should check FW support p2p or not.*/
751void rtl8723_set_p2p_ctw_period_cmd(struct ieee80211_hw *hw, u8 ctwindow)
752{
753 u8 u1_ctwindow_period[1] = {ctwindow};
754
755 rtl8723_fill_h2c_cmd(hw, H2C_88E_P2P_PS_CTW_CMD, 1,
756 u1_ctwindow_period);
757}
758EXPORT_SYMBOL_GPL(rtl8723_set_p2p_ctw_period_cmd);
759
760void rtl8723_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
761{
762 struct rtl_priv *rtlpriv = rtl_priv(hw);
763 struct rtl_ps_ctl *rtlps = rtl_psc(rtl_priv(hw));
764 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
765 struct rtl_p2p_ps_info *p2pinfo = &(rtlps->p2p_ps_info);
766 struct p2p_ps_offload_t *p2p_ps_offload = &rtlhal->p2p_ps_offload;
767 u8 i;
768 u16 ctwindow;
769 u32 start_time, tsf_low;
770
771 switch (p2p_ps_state) {
772 case P2P_PS_DISABLE:
773 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_DISABLE\n");
774 memset(p2p_ps_offload, 0, sizeof(struct p2p_ps_offload_t *));
775 break;
776 case P2P_PS_ENABLE:
777 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_ENABLE\n");
778 /* update CTWindow value. */
779 if (p2pinfo->ctwindow > 0) {
780 p2p_ps_offload->ctwindow_en = 1;
781 ctwindow = p2pinfo->ctwindow;
782 rtl8723_set_p2p_ctw_period_cmd(hw, ctwindow);
783 }
784 /* hw only support 2 set of NoA */
785 for (i = 0; i < p2pinfo->noa_num; i++) {
786 /* To control the register setting
787 * for which NOA
788 */
789 rtl_write_byte(rtlpriv, 0x5cf, (i << 4));
790 if (i == 0)
791 p2p_ps_offload->noa0_en = 1;
792 else
793 p2p_ps_offload->noa1_en = 1;
794
795 /* config P2P NoA Descriptor Register */
796 rtl_write_dword(rtlpriv, 0x5E0,
797 p2pinfo->noa_duration[i]);
798 rtl_write_dword(rtlpriv, 0x5E4,
799 p2pinfo->noa_interval[i]);
800
801 /*Get Current TSF value */
802 tsf_low = rtl_read_dword(rtlpriv, REG_TSFTR);
803
804 start_time = p2pinfo->noa_start_time[i];
805 if (p2pinfo->noa_count_type[i] != 1) {
806 while (start_time <= (tsf_low + (50 * 1024))) {
807 start_time += p2pinfo->noa_interval[i];
808 if (p2pinfo->noa_count_type[i] != 255)
809 p2pinfo->noa_count_type[i]--;
810 }
811 }
812 rtl_write_dword(rtlpriv, 0x5E8, start_time);
813 rtl_write_dword(rtlpriv, 0x5EC,
814 p2pinfo->noa_count_type[i]);
815 }
816 if ((p2pinfo->opp_ps == 1) ||
817 (p2pinfo->noa_num > 0)) {
818 /* rst p2p circuit */
819 rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, BIT(4));
820
821 p2p_ps_offload->offload_en = 1;
822
823 if (P2P_ROLE_GO == rtlpriv->mac80211.p2p) {
824 p2p_ps_offload->role = 1;
825 p2p_ps_offload->allstasleep = 0;
826 } else {
827 p2p_ps_offload->role = 0;
828 }
829 p2p_ps_offload->discovery = 0;
830 }
831 break;
832 case P2P_PS_SCAN:
833 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN\n");
834 p2p_ps_offload->discovery = 1;
835 break;
836 case P2P_PS_SCAN_DONE:
837 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN_DONE\n");
838 p2p_ps_offload->discovery = 0;
839 p2pinfo->p2p_ps_state = P2P_PS_ENABLE;
840 break;
841 default:
842 break;
843 }
844 rtl8723_fill_h2c_cmd(hw, H2C_88E_P2P_PS_OFFLOAD, 1,
845 (u8 *)p2p_ps_offload);
846}
847EXPORT_SYMBOL_GPL(rtl8723_set_p2p_ps_offload_cmd);
848
849#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.h b/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.h
new file mode 100644
index 000000000000..0890e5deddfa
--- /dev/null
+++ b/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.h
@@ -0,0 +1,50 @@
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__#endif
28
29void rtl8723_enable_fw_download(struct ieee80211_hw *hw, bool enable);
30void rtl8723_fw_block_write(struct ieee80211_hw *hw,
31 const u8 *buffer, u32 size);
32void rtl8723_fw_page_write(struct ieee80211_hw *hw,
33 u32 page, const u8 *buffer, u32 size);
34void rtl8723_write_fw(struct ieee80211_hw *hw,
35 enum version_8723be version,
36 u8 *buffer, u32 size);
37int rtl8723_fw_free_to_go(struct ieee80211_hw *hw, bool is_8723be);
38int rtl8723_download_fw(struct ieee80211_hw *hw,
39 bool buse_wake_on_wlan_fw, bool is_8723be);
40bool rtl8723_check_fw_read_last_h2c(struct ieee80211_hw *hw, u8 boxnum);
41void rtl8723_fill_h2c_command(struct ieee80211_hw *hw, u8 element_id,
42 u32 cmd_len, u8 *p_cmdbuffer);
43void rtl8723_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id,
44 u32 cmd_len, u8 *p_cmdbuffer);
45void rtl8723_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus);
46bool rtl8723_cmd_send_packet(struct ieee80211_hw *hw,
47 struct sk_buff *skb);
48void rtl8723_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished);
49void rtl8723_set_p2p_ctw_period_cmd(struct ieee80211_hw *hw, u8 ctwindow);
50void rtl8723_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state);
diff --git a/drivers/net/wireless/rtlwifi/rtl8723com/phy_common.h b/drivers/net/wireless/rtlwifi/rtl8723com/phy_common.h
new file mode 100644
index 000000000000..8f451d0584df
--- /dev/null
+++ b/drivers/net/wireless/rtlwifi/rtl8723com/phy_common.h
@@ -0,0 +1,75 @@
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 __PHY_COMMON__
27#define __PHY_COMMON__
28
29u32 rtl8723_phy_query_bb_reg(struct ieee80211_hw *hw,
30 u32 regaddr, u32 bitmask);
31void rtl8723_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr,
32 u32 bitmask, u32 data);
33u32 rtl8723_phy_calculate_bit_shift(u32 bitmask);
34u32 rtl8723_phy_rf_serial_read(struct ieee80211_hw *hw,
35 enum radio_path rfpath, u32 offset);
36void rtl8723_phy_rf_serial_write(struct ieee80211_hw *hw,
37 enum radio_path rfpath,
38 u32 offset, u32 data);
39u32 rtl8723_phy_query_bb_reg(struct ieee80211_hw *hw,
40 u32 regaddr, u32 bitmask);
41u32 rtl8723_phy_calculate_bit_shift(u32 bitmask);
42void rtl8723_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr,
43 u32 bitmask, u32 data);
44long rtl8723_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
45 enum wireless_mode wirelessmode,
46 u8 txpwridx);
47void rtl8723_phy_init_bb_rf_reg_def(struct ieee80211_hw *hw);
48bool rtl8723_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable,
49 u32 cmdtableidx,
50 u32 cmdtablesz,
51 enum swchnlcmd_id cmdid,
52 u32 para1, u32 para2,
53 u32 msdelay);
54void rtl8723_phy_path_a_fill_iqk_matrix(struct ieee80211_hw *hw,
55 bool iqk_ok,
56 long result[][8],
57 u8 final_candidate,
58 bool btxonly);
59void rtl8723_save_adda_registers(struct ieee80211_hw *hw, u32 *addareg,
60 u32 *addabackup, u32 registernum);
61static void rtl8723_phy_save_mac_registers(struct ieee80211_hw *hw,
62 u32 *macreg, u32 *macbackup);
63void rtl8723_phy_reload_adda_registers(struct ieee80211_hw *hw,
64 u32 *addareg, u32 *addabackup,
65 u32 regiesternum);
66void rtl8723_phy_reload_mac_registers(struct ieee80211_hw *hw,
67 u32 *macreg, u32 *macbackup);
68void rtl8723_phy_path_adda_on(struct ieee80211_hw *hw, u32 *addareg,
69 bool is_patha_on, bool is2t);
70void rtl8723_phy_mac_setting_calibration(struct ieee80211_hw *hw,
71 u32 *macreg, u32 *macbackup);
72void rtl8723_phy_path_a_standby(struct ieee80211_hw *hw);
73void rtl8723_phy_pi_mode_switch(struct ieee80211_hw *hw, bool pi_mode);
74
75#endif