fw.c (5bd4f692e0eba585674c58f68b8ff62c21468a2f) fw.c (b83faeda028bf361db9c796396e710d5fb1337b0)
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3
4#include "../wifi.h"
5#include "../pci.h"
6#include "../base.h"
7#include "../efuse.h"
8#include "reg.h"

--- 61 unchanged lines hidden (view full) ---

70{
71 struct rtl_priv *rtlpriv = rtl_priv(hw);
72 u32 counter = 0;
73 u32 value32;
74
75 do {
76 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
77 } while ((counter++ < FW_8192D_POLLING_TIMEOUT_COUNT) &&
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3
4#include "../wifi.h"
5#include "../pci.h"
6#include "../base.h"
7#include "../efuse.h"
8#include "reg.h"

--- 61 unchanged lines hidden (view full) ---

70{
71 struct rtl_priv *rtlpriv = rtl_priv(hw);
72 u32 counter = 0;
73 u32 value32;
74
75 do {
76 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
77 } while ((counter++ < FW_8192D_POLLING_TIMEOUT_COUNT) &&
78 (!(value32 & FWDL_ChkSum_rpt)));
78 (!(value32 & FWDL_CHKSUM_RPT)));
79 if (counter >= FW_8192D_POLLING_TIMEOUT_COUNT) {
80 pr_err("chksum report fail! REG_MCUFWDL:0x%08x\n",
81 value32);
82 return -EIO;
83 }
84 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
85 value32 |= MCUFWDL_RDY;
86 rtl_write_dword(rtlpriv, REG_MCUFWDL, value32);

--- 507 unchanged lines hidden (view full) ---

594
595void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
596{
597 struct rtl_priv *rtlpriv = rtl_priv(hw);
598 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
599 struct sk_buff *skb = NULL;
600 u32 totalpacketlen;
601 bool rtstatus;
79 if (counter >= FW_8192D_POLLING_TIMEOUT_COUNT) {
80 pr_err("chksum report fail! REG_MCUFWDL:0x%08x\n",
81 value32);
82 return -EIO;
83 }
84 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
85 value32 |= MCUFWDL_RDY;
86 rtl_write_dword(rtlpriv, REG_MCUFWDL, value32);

--- 507 unchanged lines hidden (view full) ---

594
595void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
596{
597 struct rtl_priv *rtlpriv = rtl_priv(hw);
598 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
599 struct sk_buff *skb = NULL;
600 u32 totalpacketlen;
601 bool rtstatus;
602 u8 u1RsvdPageLoc[3] = { 0 };
602 u8 u1rsvdpageloc[3] = { 0 };
603 bool dlok = false;
604 u8 *beacon;
605 u8 *p_pspoll;
606 u8 *nullfunc;
607 u8 *p_probersp;
608 /*---------------------------------------------------------
609 (1) beacon
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 /*-------------------------------------------------------
615 (2) ps-poll
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);
603 bool dlok = false;
604 u8 *beacon;
605 u8 *p_pspoll;
606 u8 *nullfunc;
607 u8 *p_probersp;
608 /*---------------------------------------------------------
609 (1) beacon
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 /*-------------------------------------------------------
615 (2) ps-poll
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);
621 SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1rsvdpageloc, PSPOLL_PG);
622 /*--------------------------------------------------------
623 (3) null data
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);
622 /*--------------------------------------------------------
623 (3) null data
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);
629 SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1rsvdpageloc, NULL_PG);
630 /*---------------------------------------------------------
631 (4) probe response
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);
630 /*---------------------------------------------------------
631 (4) probe response
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);
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",
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",
644 u1RsvdPageLoc, 3);
644 u1rsvdpageloc, 3);
645 skb = dev_alloc_skb(totalpacketlen);
646 if (!skb) {
647 dlok = false;
648 } else {
649 skb_put_data(skb, &reserved_page_packet, totalpacketlen);
650 rtstatus = _rtl92d_cmd_send_packet(hw, skb);
651
652 if (rtstatus)
653 dlok = true;
654 }
655 if (dlok) {
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,
645 skb = dev_alloc_skb(totalpacketlen);
646 if (!skb) {
647 dlok = false;
648 } else {
649 skb_put_data(skb, &reserved_page_packet, totalpacketlen);
650 rtstatus = _rtl92d_cmd_send_packet(hw, skb);
651
652 if (rtstatus)
653 dlok = true;
654 }
655 if (dlok) {
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);
659 "H2C_RSVDPAGE", u1rsvdpageloc, 3);
660 rtl92d_fill_h2c_cmd(hw, H2C_RSVDPAGE,
660 rtl92d_fill_h2c_cmd(hw, H2C_RSVDPAGE,
661 sizeof(u1RsvdPageLoc), u1RsvdPageLoc);
661 sizeof(u1rsvdpageloc), u1rsvdpageloc);
662 } else
663 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
664 "Set RSVD page location to Fw FAIL!!!!!!\n");
665}
666
667void rtl92d_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus)
668{
669 u8 u1_joinbssrpt_parm[1] = {0};
670
671 SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(u1_joinbssrpt_parm, mstatus);
672 rtl92d_fill_h2c_cmd(hw, H2C_JOINBSSRPT, 1, u1_joinbssrpt_parm);
673}
662 } else
663 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
664 "Set RSVD page location to Fw FAIL!!!!!!\n");
665}
666
667void rtl92d_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus)
668{
669 u8 u1_joinbssrpt_parm[1] = {0};
670
671 SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(u1_joinbssrpt_parm, mstatus);
672 rtl92d_fill_h2c_cmd(hw, H2C_JOINBSSRPT, 1, u1_joinbssrpt_parm);
673}