1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2009-2012 Realtek Corporation.*/
13 static bool _rtl92d_is_fw_downloaded(struct rtl_priv
*rtlpriv
)
15 return (rtl_read_dword(rtlpriv
, REG_MCUFWDL
) & MCUFWDL_RDY
) ?
19 static void _rtl92d_enable_fw_download(struct ieee80211_hw
*hw
, bool enable
)
21 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
25 tmp
= rtl_read_byte(rtlpriv
, REG_SYS_FUNC_EN
+ 1);
26 rtl_write_byte(rtlpriv
, REG_SYS_FUNC_EN
+ 1, tmp
| 0x04);
27 tmp
= rtl_read_byte(rtlpriv
, REG_MCUFWDL
);
28 rtl_write_byte(rtlpriv
, REG_MCUFWDL
, tmp
| 0x01);
29 tmp
= rtl_read_byte(rtlpriv
, REG_MCUFWDL
+ 2);
30 rtl_write_byte(rtlpriv
, REG_MCUFWDL
+ 2, tmp
& 0xf7);
32 tmp
= rtl_read_byte(rtlpriv
, REG_MCUFWDL
);
33 rtl_write_byte(rtlpriv
, REG_MCUFWDL
, tmp
& 0xfe);
34 /* Reserved for fw extension.
35 * 0x81[7] is used for mac0 status ,
36 * so don't write this reg here
37 * rtl_write_byte(rtlpriv, REG_MCUFWDL + 1, 0x00);*/
41 static void _rtl92d_write_fw(struct ieee80211_hw
*hw
,
42 enum version_8192d version
, u8
*buffer
, u32 size
)
44 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
45 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
46 u8
*bufferptr
= buffer
;
47 u32 pagenums
, remainsize
;
50 RT_TRACE(rtlpriv
, COMP_FW
, DBG_TRACE
, "FW size is %d bytes,\n", size
);
51 if (rtlhal
->hw_type
== HARDWARE_TYPE_RTL8192DE
)
52 rtl_fill_dummy(bufferptr
, &size
);
53 pagenums
= size
/ FW_8192D_PAGE_SIZE
;
54 remainsize
= size
% FW_8192D_PAGE_SIZE
;
56 pr_err("Page numbers should not greater then 8\n");
57 for (page
= 0; page
< pagenums
; page
++) {
58 offset
= page
* FW_8192D_PAGE_SIZE
;
59 rtl_fw_page_write(hw
, page
, (bufferptr
+ offset
),
63 offset
= pagenums
* FW_8192D_PAGE_SIZE
;
65 rtl_fw_page_write(hw
, page
, (bufferptr
+ offset
), remainsize
);
69 static int _rtl92d_fw_free_to_go(struct ieee80211_hw
*hw
)
71 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
76 value32
= rtl_read_dword(rtlpriv
, REG_MCUFWDL
);
77 } while ((counter
++ < FW_8192D_POLLING_TIMEOUT_COUNT
) &&
78 (!(value32
& FWDL_CHKSUM_RPT
)));
79 if (counter
>= FW_8192D_POLLING_TIMEOUT_COUNT
) {
80 pr_err("chksum report fail! REG_MCUFWDL:0x%08x\n",
84 value32
= rtl_read_dword(rtlpriv
, REG_MCUFWDL
);
85 value32
|= MCUFWDL_RDY
;
86 rtl_write_dword(rtlpriv
, REG_MCUFWDL
, value32
);
90 void rtl92d_firmware_selfreset(struct ieee80211_hw
*hw
)
92 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
96 /* Set (REG_HMETFR + 3) to 0x20 is reset 8051 */
97 rtl_write_byte(rtlpriv
, REG_HMETFR
+ 3, 0x20);
98 u1b_tmp
= rtl_read_byte(rtlpriv
, REG_SYS_FUNC_EN
+ 1);
99 while (u1b_tmp
& BIT(2)) {
104 u1b_tmp
= rtl_read_byte(rtlpriv
, REG_SYS_FUNC_EN
+ 1);
106 WARN_ONCE((delay
<= 0), "rtl8192de: 8051 reset failed!\n");
107 RT_TRACE(rtlpriv
, COMP_FW
, DBG_DMESG
,
108 "=====> 8051 reset success (%d)\n", delay
);
111 static int _rtl92d_fw_init(struct ieee80211_hw
*hw
)
113 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
114 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
117 RT_TRACE(rtlpriv
, COMP_FW
, DBG_DMESG
, "FW already have download\n");
118 /* polling for FW ready */
121 if (rtlhal
->interfaceindex
== 0) {
122 if (rtl_read_byte(rtlpriv
, FW_MAC0_READY
) &
124 RT_TRACE(rtlpriv
, COMP_FW
, DBG_DMESG
,
125 "Polling FW ready success!! REG_MCUFWDL: 0x%x\n",
126 rtl_read_byte(rtlpriv
,
132 if (rtl_read_byte(rtlpriv
, FW_MAC1_READY
) &
134 RT_TRACE(rtlpriv
, COMP_FW
, DBG_DMESG
,
135 "Polling FW ready success!! REG_MCUFWDL: 0x%x\n",
136 rtl_read_byte(rtlpriv
,
142 } while (counter
++ < POLLING_READY_TIMEOUT_COUNT
);
144 if (rtlhal
->interfaceindex
== 0) {
145 RT_TRACE(rtlpriv
, COMP_FW
, DBG_DMESG
,
146 "Polling FW ready fail!! MAC0 FW init not ready: 0x%x\n",
147 rtl_read_byte(rtlpriv
, FW_MAC0_READY
));
149 RT_TRACE(rtlpriv
, COMP_FW
, DBG_DMESG
,
150 "Polling FW ready fail!! MAC1 FW init not ready: 0x%x\n",
151 rtl_read_byte(rtlpriv
, FW_MAC1_READY
));
153 RT_TRACE(rtlpriv
, COMP_FW
, DBG_DMESG
,
154 "Polling FW ready fail!! REG_MCUFWDL:0x%08x\n",
155 rtl_read_dword(rtlpriv
, REG_MCUFWDL
));
159 int rtl92d_download_fw(struct ieee80211_hw
*hw
)
161 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
162 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
167 enum version_8192d version
= rtlhal
->version
;
170 bool fw_downloaded
= false, fwdl_in_process
= false;
173 if (rtlpriv
->max_fw_size
== 0 || !rtlhal
->pfirmware
)
175 fwsize
= rtlhal
->fwsize
;
176 pfwheader
= rtlhal
->pfirmware
;
177 pfwdata
= rtlhal
->pfirmware
;
178 rtlhal
->fw_version
= (u16
) GET_FIRMWARE_HDR_VERSION(pfwheader
);
179 rtlhal
->fw_subversion
= (u16
) GET_FIRMWARE_HDR_SUB_VER(pfwheader
);
180 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_LOUD
,
181 "FirmwareVersion(%d), FirmwareSubVersion(%d), Signature(%#x)\n",
182 rtlhal
->fw_version
, rtlhal
->fw_subversion
,
183 GET_FIRMWARE_HDR_SIGNATURE(pfwheader
));
184 if (IS_FW_HEADER_EXIST(pfwheader
)) {
185 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_LOUD
,
186 "Shift 32 bytes for FW header!!\n");
187 pfwdata
= pfwdata
+ 32;
188 fwsize
= fwsize
- 32;
191 spin_lock_irqsave(&globalmutex_for_fwdownload
, flags
);
192 fw_downloaded
= _rtl92d_is_fw_downloaded(rtlpriv
);
193 if ((rtl_read_byte(rtlpriv
, 0x1f) & BIT(5)) == BIT(5))
194 fwdl_in_process
= true;
196 fwdl_in_process
= false;
198 spin_unlock_irqrestore(&globalmutex_for_fwdownload
, flags
);
200 } else if (fwdl_in_process
) {
201 spin_unlock_irqrestore(&globalmutex_for_fwdownload
, flags
);
202 for (count
= 0; count
< 5000; count
++) {
204 spin_lock_irqsave(&globalmutex_for_fwdownload
, flags
);
205 fw_downloaded
= _rtl92d_is_fw_downloaded(rtlpriv
);
206 if ((rtl_read_byte(rtlpriv
, 0x1f) & BIT(5)) == BIT(5))
207 fwdl_in_process
= true;
209 fwdl_in_process
= false;
210 spin_unlock_irqrestore(&globalmutex_for_fwdownload
,
214 else if (!fwdl_in_process
)
217 RT_TRACE(rtlpriv
, COMP_FW
, DBG_DMESG
,
218 "Wait for another mac download fw\n");
220 spin_lock_irqsave(&globalmutex_for_fwdownload
, flags
);
221 value
= rtl_read_byte(rtlpriv
, 0x1f);
223 rtl_write_byte(rtlpriv
, 0x1f, value
);
224 spin_unlock_irqrestore(&globalmutex_for_fwdownload
, flags
);
226 value
= rtl_read_byte(rtlpriv
, 0x1f);
228 rtl_write_byte(rtlpriv
, 0x1f, value
);
229 spin_unlock_irqrestore(&globalmutex_for_fwdownload
, flags
);
232 /* If 8051 is running in RAM code, driver should
233 * inform Fw to reset by itself, or it will cause
234 * download Fw fail.*/
236 if (rtl_read_byte(rtlpriv
, REG_MCUFWDL
) & BIT(7)) {
237 rtl92d_firmware_selfreset(hw
);
238 rtl_write_byte(rtlpriv
, REG_MCUFWDL
, 0x00);
240 _rtl92d_enable_fw_download(hw
, true);
241 _rtl92d_write_fw(hw
, version
, pfwdata
, fwsize
);
242 _rtl92d_enable_fw_download(hw
, false);
243 spin_lock_irqsave(&globalmutex_for_fwdownload
, flags
);
244 err
= _rtl92d_fw_free_to_go(hw
);
245 /* download fw over,clear 0x1f[5] */
246 value
= rtl_read_byte(rtlpriv
, 0x1f);
248 rtl_write_byte(rtlpriv
, 0x1f, value
);
249 spin_unlock_irqrestore(&globalmutex_for_fwdownload
, flags
);
251 pr_err("fw is not ready to run!\n");
253 err
= _rtl92d_fw_init(hw
);
257 static bool _rtl92d_check_fw_read_last_h2c(struct ieee80211_hw
*hw
, u8 boxnum
)
259 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
263 val_hmetfr
= rtl_read_byte(rtlpriv
, REG_HMETFR
);
264 if (((val_hmetfr
>> boxnum
) & BIT(0)) == 0)
269 static void _rtl92d_fill_h2c_command(struct ieee80211_hw
*hw
,
270 u8 element_id
, u32 cmd_len
, u8
*cmdbuffer
)
272 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
273 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
274 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtl_priv(hw
));
276 u16 box_reg
= 0, box_extreg
= 0;
278 bool isfw_read
= false;
280 bool bwrite_success
= false;
281 u8 wait_h2c_limmit
= 100;
282 u8 wait_writeh2c_limmit
= 100;
283 u8 boxcontent
[4], boxextcontent
[2];
284 u32 h2c_waitcounter
= 0;
288 if (ppsc
->rfpwr_state
== ERFOFF
|| ppsc
->inactive_pwrstate
== ERFOFF
) {
289 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
290 "Return as RF is off!!!\n");
293 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
, "come in\n");
295 spin_lock_irqsave(&rtlpriv
->locks
.h2c_lock
, flag
);
296 if (rtlhal
->h2c_setinprogress
) {
297 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
298 "H2C set in progress! Wait to set..element_id(%d)\n",
301 while (rtlhal
->h2c_setinprogress
) {
302 spin_unlock_irqrestore(&rtlpriv
->locks
.h2c_lock
,
305 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
306 "Wait 100 us (%d times)...\n",
310 if (h2c_waitcounter
> 1000)
313 spin_lock_irqsave(&rtlpriv
->locks
.h2c_lock
,
316 spin_unlock_irqrestore(&rtlpriv
->locks
.h2c_lock
, flag
);
318 rtlhal
->h2c_setinprogress
= true;
319 spin_unlock_irqrestore(&rtlpriv
->locks
.h2c_lock
, flag
);
323 while (!bwrite_success
) {
324 wait_writeh2c_limmit
--;
325 if (wait_writeh2c_limmit
== 0) {
326 pr_err("Write H2C fail because no trigger for FW INT!\n");
329 boxnum
= rtlhal
->last_hmeboxnum
;
332 box_reg
= REG_HMEBOX_0
;
333 box_extreg
= REG_HMEBOX_EXT_0
;
336 box_reg
= REG_HMEBOX_1
;
337 box_extreg
= REG_HMEBOX_EXT_1
;
340 box_reg
= REG_HMEBOX_2
;
341 box_extreg
= REG_HMEBOX_EXT_2
;
344 box_reg
= REG_HMEBOX_3
;
345 box_extreg
= REG_HMEBOX_EXT_3
;
348 pr_err("switch case %#x not processed\n",
352 isfw_read
= _rtl92d_check_fw_read_last_h2c(hw
, boxnum
);
355 if (wait_h2c_limmit
== 0) {
356 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
357 "Waiting too long for FW read clear HMEBox(%d)!\n",
362 isfw_read
= _rtl92d_check_fw_read_last_h2c(hw
, boxnum
);
363 u1b_tmp
= rtl_read_byte(rtlpriv
, 0x1BF);
364 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
365 "Waiting for FW read clear HMEBox(%d)!!! 0x1BF = %2x\n",
369 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
370 "Write H2C register BOX[%d] fail!!!!! Fw do not read.\n",
374 memset(boxcontent
, 0, sizeof(boxcontent
));
375 memset(boxextcontent
, 0, sizeof(boxextcontent
));
376 boxcontent
[0] = element_id
;
377 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
378 "Write element_id box_reg(%4x) = %2x\n",
379 box_reg
, element_id
);
382 boxcontent
[0] &= ~(BIT(7));
383 memcpy(boxcontent
+ 1, cmdbuffer
+ buf_index
, 1);
384 for (idx
= 0; idx
< 4; idx
++)
385 rtl_write_byte(rtlpriv
, box_reg
+ idx
,
389 boxcontent
[0] &= ~(BIT(7));
390 memcpy(boxcontent
+ 1, cmdbuffer
+ buf_index
, 2);
391 for (idx
= 0; idx
< 4; idx
++)
392 rtl_write_byte(rtlpriv
, box_reg
+ idx
,
396 boxcontent
[0] &= ~(BIT(7));
397 memcpy(boxcontent
+ 1, cmdbuffer
+ buf_index
, 3);
398 for (idx
= 0; idx
< 4; idx
++)
399 rtl_write_byte(rtlpriv
, box_reg
+ idx
,
403 boxcontent
[0] |= (BIT(7));
404 memcpy(boxextcontent
, cmdbuffer
+ buf_index
, 2);
405 memcpy(boxcontent
+ 1, cmdbuffer
+ buf_index
+ 2, 2);
406 for (idx
= 0; idx
< 2; idx
++)
407 rtl_write_byte(rtlpriv
, box_extreg
+ idx
,
409 for (idx
= 0; idx
< 4; idx
++)
410 rtl_write_byte(rtlpriv
, box_reg
+ idx
,
414 boxcontent
[0] |= (BIT(7));
415 memcpy(boxextcontent
, cmdbuffer
+ buf_index
, 2);
416 memcpy(boxcontent
+ 1, cmdbuffer
+ buf_index
+ 2, 3);
417 for (idx
= 0; idx
< 2; idx
++)
418 rtl_write_byte(rtlpriv
, box_extreg
+ idx
,
420 for (idx
= 0; idx
< 4; idx
++)
421 rtl_write_byte(rtlpriv
, box_reg
+ idx
,
425 pr_err("switch case %#x not processed\n",
429 bwrite_success
= true;
430 rtlhal
->last_hmeboxnum
= boxnum
+ 1;
431 if (rtlhal
->last_hmeboxnum
== 4)
432 rtlhal
->last_hmeboxnum
= 0;
433 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
434 "pHalData->last_hmeboxnum = %d\n",
435 rtlhal
->last_hmeboxnum
);
437 spin_lock_irqsave(&rtlpriv
->locks
.h2c_lock
, flag
);
438 rtlhal
->h2c_setinprogress
= false;
439 spin_unlock_irqrestore(&rtlpriv
->locks
.h2c_lock
, flag
);
440 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
, "go out\n");
443 void rtl92d_fill_h2c_cmd(struct ieee80211_hw
*hw
,
444 u8 element_id
, u32 cmd_len
, u8
*cmdbuffer
)
448 memset(tmp_cmdbuf
, 0, 8);
449 memcpy(tmp_cmdbuf
, cmdbuffer
, cmd_len
);
450 _rtl92d_fill_h2c_command(hw
, element_id
, cmd_len
, (u8
*)&tmp_cmdbuf
);
454 static bool _rtl92d_cmd_send_packet(struct ieee80211_hw
*hw
,
457 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
458 struct rtl_pci
*rtlpci
= rtl_pcidev(rtl_pcipriv(hw
));
459 struct rtl8192_tx_ring
*ring
;
460 struct rtl_tx_desc
*pdesc
;
463 struct sk_buff
*pskb
;
465 ring
= &rtlpci
->tx_ring
[BEACON_QUEUE
];
466 pskb
= __skb_dequeue(&ring
->queue
);
468 spin_lock_irqsave(&rtlpriv
->locks
.irq_th_lock
, flags
);
469 pdesc
= &ring
->desc
[idx
];
470 /* discard output from call below */
471 rtlpriv
->cfg
->ops
->get_desc(hw
, (u8
*)pdesc
, true, HW_DESC_OWN
);
472 rtlpriv
->cfg
->ops
->fill_tx_cmddesc(hw
, (u8
*) pdesc
, 1, 1, skb
);
473 __skb_queue_tail(&ring
->queue
, skb
);
474 spin_unlock_irqrestore(&rtlpriv
->locks
.irq_th_lock
, flags
);
475 rtlpriv
->cfg
->ops
->tx_polling(hw
, BEACON_QUEUE
);
479 #define BEACON_PG 0 /*->1 */
482 #define PROBERSP_PG 4 /*->5 */
483 #define TOTAL_RESERVED_PKT_LEN 768
485 static u8 reserved_page_packet
[TOTAL_RESERVED_PKT_LEN
] = {
487 0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
488 0xFF, 0xFF, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42,
489 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x50, 0x08,
490 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
491 0x64, 0x00, 0x00, 0x04, 0x00, 0x0C, 0x6C, 0x69,
492 0x6E, 0x6B, 0x73, 0x79, 0x73, 0x5F, 0x77, 0x6C,
493 0x61, 0x6E, 0x01, 0x04, 0x82, 0x84, 0x8B, 0x96,
494 0x03, 0x01, 0x01, 0x06, 0x02, 0x00, 0x00, 0x2A,
495 0x01, 0x00, 0x32, 0x08, 0x24, 0x30, 0x48, 0x6C,
496 0x0C, 0x12, 0x18, 0x60, 0x2D, 0x1A, 0x6C, 0x18,
497 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
498 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
499 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
500 0x3D, 0x00, 0xDD, 0x06, 0x00, 0xE0, 0x4C, 0x02,
501 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
502 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
505 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
506 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
507 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
508 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
509 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
510 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
511 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
512 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
513 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
514 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
515 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
516 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
517 0x10, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x10, 0x00,
518 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
519 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
520 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
523 0xA4, 0x10, 0x01, 0xC0, 0x00, 0x40, 0x10, 0x10,
524 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42,
525 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
526 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
527 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
529 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
530 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
531 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
532 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
533 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
534 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
535 0x18, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x00, 0x00,
536 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
537 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
538 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
541 0x48, 0x01, 0x00, 0x00, 0x00, 0x40, 0x10, 0x10,
542 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42,
543 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00,
544 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
545 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
546 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
547 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
548 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
549 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
550 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
551 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
552 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
553 0x72, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x00, 0x00,
554 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
555 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
556 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
558 /* page 4 probe_resp */
559 0x50, 0x00, 0x00, 0x00, 0x00, 0x40, 0x10, 0x10,
560 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42,
561 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00,
562 0x9E, 0x46, 0x15, 0x32, 0x27, 0xF2, 0x2D, 0x00,
563 0x64, 0x00, 0x00, 0x04, 0x00, 0x0C, 0x6C, 0x69,
564 0x6E, 0x6B, 0x73, 0x79, 0x73, 0x5F, 0x77, 0x6C,
565 0x61, 0x6E, 0x01, 0x04, 0x82, 0x84, 0x8B, 0x96,
566 0x03, 0x01, 0x01, 0x06, 0x02, 0x00, 0x00, 0x2A,
567 0x01, 0x00, 0x32, 0x08, 0x24, 0x30, 0x48, 0x6C,
568 0x0C, 0x12, 0x18, 0x60, 0x2D, 0x1A, 0x6C, 0x18,
569 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
570 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
571 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
572 0x3D, 0x00, 0xDD, 0x06, 0x00, 0xE0, 0x4C, 0x02,
573 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
574 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
576 /* page 5 probe_resp */
577 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
578 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
579 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
580 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
581 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
582 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
583 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
584 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
585 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
586 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
587 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
588 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
589 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
590 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
591 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
592 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
595 void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw
*hw
, bool dl_finished
)
597 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
598 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
599 struct sk_buff
*skb
= NULL
;
602 u8 u1rsvdpageloc
[3] = { 0 };
608 /*---------------------------------------------------------
610 ---------------------------------------------------------*/
611 beacon
= &reserved_page_packet
[BEACON_PG
* 128];
612 SET_80211_HDR_ADDRESS2(beacon
, mac
->mac_addr
);
613 SET_80211_HDR_ADDRESS3(beacon
, mac
->bssid
);
614 /*-------------------------------------------------------
616 --------------------------------------------------------*/
617 p_pspoll
= &reserved_page_packet
[PSPOLL_PG
* 128];
618 SET_80211_PS_POLL_AID(p_pspoll
, (mac
->assoc_id
| 0xc000));
619 SET_80211_PS_POLL_BSSID(p_pspoll
, mac
->bssid
);
620 SET_80211_PS_POLL_TA(p_pspoll
, mac
->mac_addr
);
621 SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1rsvdpageloc
, PSPOLL_PG
);
622 /*--------------------------------------------------------
624 ---------------------------------------------------------*/
625 nullfunc
= &reserved_page_packet
[NULL_PG
* 128];
626 SET_80211_HDR_ADDRESS1(nullfunc
, mac
->bssid
);
627 SET_80211_HDR_ADDRESS2(nullfunc
, mac
->mac_addr
);
628 SET_80211_HDR_ADDRESS3(nullfunc
, mac
->bssid
);
629 SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1rsvdpageloc
, NULL_PG
);
630 /*---------------------------------------------------------
632 ----------------------------------------------------------*/
633 p_probersp
= &reserved_page_packet
[PROBERSP_PG
* 128];
634 SET_80211_HDR_ADDRESS1(p_probersp
, mac
->bssid
);
635 SET_80211_HDR_ADDRESS2(p_probersp
, mac
->mac_addr
);
636 SET_80211_HDR_ADDRESS3(p_probersp
, mac
->bssid
);
637 SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1rsvdpageloc
, PROBERSP_PG
);
638 totalpacketlen
= TOTAL_RESERVED_PKT_LEN
;
639 RT_PRINT_DATA(rtlpriv
, COMP_CMD
, DBG_LOUD
,
640 "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL",
641 &reserved_page_packet
[0], totalpacketlen
);
642 RT_PRINT_DATA(rtlpriv
, COMP_CMD
, DBG_DMESG
,
643 "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL",
645 skb
= dev_alloc_skb(totalpacketlen
);
649 skb_put_data(skb
, &reserved_page_packet
, totalpacketlen
);
650 rtstatus
= _rtl92d_cmd_send_packet(hw
, skb
);
656 RT_TRACE(rtlpriv
, COMP_POWER
, DBG_LOUD
,
657 "Set RSVD page location to Fw\n");
658 RT_PRINT_DATA(rtlpriv
, COMP_CMD
, DBG_DMESG
,
659 "H2C_RSVDPAGE", u1rsvdpageloc
, 3);
660 rtl92d_fill_h2c_cmd(hw
, H2C_RSVDPAGE
,
661 sizeof(u1rsvdpageloc
), u1rsvdpageloc
);
663 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_WARNING
,
664 "Set RSVD page location to Fw FAIL!!!!!!\n");
667 void rtl92d_set_fw_joinbss_report_cmd(struct ieee80211_hw
*hw
, u8 mstatus
)
669 u8 u1_joinbssrpt_parm
[1] = {0};
671 SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(u1_joinbssrpt_parm
, mstatus
);
672 rtl92d_fill_h2c_cmd(hw
, H2C_JOINBSSRPT
, 1, u1_joinbssrpt_parm
);