diff options
author | Kai-Heng Feng <kai.heng.feng@canonical.com> | 2020-04-07 15:33:31 +0800 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2020-04-14 18:07:00 +0300 |
commit | 6343a6d4b2130be9323f347d60af8a7ba8f7242c (patch) | |
tree | 8781088bcd50e297dd3d0d4784b75a94830378a1 /drivers | |
parent | 63e49a9fdac1b4e97ac26cb3fe953f210d83bc53 (diff) |
rtw88: Add delay on polling h2c command status bit
On some systems we can constanly see rtw88 complains:
[39584.721375] rtw_pci 0000:03:00.0: failed to send h2c command
Increase interval of each check to wait the status bit really changed.
Use read_poll_timeout() macro which fits anything we need here.
Suggested-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200407073331.397-1-kai.heng.feng@canonical.com
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/realtek/rtw88/fw.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c index 9192ab26e39b..245da96dfddc 100644 --- a/drivers/net/wireless/realtek/rtw88/fw.c +++ b/drivers/net/wireless/realtek/rtw88/fw.c @@ -2,6 +2,8 @@ /* Copyright(c) 2018-2019 Realtek Corporation */ +#include <linux/iopoll.h> + #include "main.h" #include "coex.h" #include "fw.h" @@ -193,8 +195,8 @@ static void rtw_fw_send_h2c_command(struct rtw_dev *rtwdev, u8 box; u8 box_state; u32 box_reg, box_ex_reg; - u32 h2c_wait; int idx; + int ret; rtw_dbg(rtwdev, RTW_DBG_FW, "send H2C content %02x%02x%02x%02x %02x%02x%02x%02x\n", @@ -226,12 +228,11 @@ static void rtw_fw_send_h2c_command(struct rtw_dev *rtwdev, goto out; } - h2c_wait = 20; - do { - box_state = rtw_read8(rtwdev, REG_HMETFR); - } while ((box_state >> box) & 0x1 && --h2c_wait > 0); + ret = read_poll_timeout(rtw_read8, box_state, + !((box_state >> box) & 0x1), 100, 3000, false, + rtwdev, REG_HMETFR); - if (!h2c_wait) { + if (ret) { rtw_err(rtwdev, "failed to send h2c command\n"); goto out; } |