wifi: rtw89: add polling for LPS H2C to ensure FW received

We add polling after sending LPS H2C to ensure that the Firmware is
received and executes RPWM thereafter. Otherwise, if the Firmware
executes RPWM without receiving LPS H2C, it will cause beacon loss in
WoWLAN mode due to the inability to obtain channel and bandwidth
information from H2C.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20240620055825.17592-8-pkshih@realtek.com
This commit is contained in:
Chih-Kang Chang
2024-06-20 13:58:25 +08:00
committed by Ping-Ke Shih
parent 2e2564877f
commit 792586591f
2 changed files with 9 additions and 0 deletions

View File

@@ -2496,6 +2496,7 @@ int rtw89_fw_h2c_lps_ch_info(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
struct rtw89_h2c_lps_ch_info *h2c;
u32 len = sizeof(*h2c);
struct sk_buff *skb;
u32 done;
int ret;
if (chip->chip_gen != RTW89_CHIP_BE)
@@ -2519,12 +2520,18 @@ int rtw89_fw_h2c_lps_ch_info(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
H2C_CAT_OUTSRC, H2C_CL_OUTSRC_DM,
H2C_FUNC_FW_LPS_CH_INFO, 0, 0, len);
rtw89_phy_write32_mask(rtwdev, R_CHK_LPS_STAT, B_CHK_LPS_STAT, 0);
ret = rtw89_h2c_tx(rtwdev, skb, false);
if (ret) {
rtw89_err(rtwdev, "failed to send h2c\n");
goto fail;
}
ret = read_poll_timeout(rtw89_phy_read32_mask, done, done, 50, 5000,
true, rtwdev, R_CHK_LPS_STAT, B_CHK_LPS_STAT);
if (ret)
rtw89_warn(rtwdev, "h2c_lps_ch_info done polling timeout\n");
return 0;
fail:
dev_kfree_skb_any(skb);

View File

@@ -7818,6 +7818,8 @@
#define B_UPD_P0_EN BIT(31)
#define R_EMLSR 0x0044
#define B_EMLSR_PARM GENMASK(27, 12)
#define R_CHK_LPS_STAT 0x0058
#define B_CHK_LPS_STAT BIT(0)
#define R_SPOOF_CG 0x00B4
#define B_SPOOF_CG_EN BIT(17)
#define R_CHINFO_SEG 0x00B4