rtw88: fix TX secondary channel offset of 40M if current bw is 20M or 40M
authorPing-Ke Shih <pkshih@realtek.com>
Fri, 20 Dec 2019 09:21:47 +0000 (17:21 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Sun, 26 Jan 2020 15:38:06 +0000 (17:38 +0200)
TX secondary channel offset is valid only if current bandwidth is 80M,
otherwise leave this value as zero. The wrong value of txsc40 causes
MAC unpredictable behavior.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtw88/mac.c

index 03a82de053ea8dcbb23e8b5c94330af7d9b691f9..cadf0abbe16bb9b8932f58e9aa3e44002f518362 100644 (file)
@@ -16,10 +16,12 @@ void rtw_set_channel_mac(struct rtw_dev *rtwdev, u8 channel, u8 bw,
        u8 value8;
 
        txsc20 = primary_ch_idx;
-       if (txsc20 == 1 || txsc20 == 3)
-               txsc40 = 9;
-       else
-               txsc40 = 10;
+       if (bw == RTW_CHANNEL_WIDTH_80) {
+               if (txsc20 == 1 || txsc20 == 3)
+                       txsc40 = 9;
+               else
+                       txsc40 = 10;
+       }
        rtw_write8(rtwdev, REG_DATA_SC,
                   BIT_TXSC_20M(txsc20) | BIT_TXSC_40M(txsc40));