wifi: rtw88: Reset 8703b firmware before download
authorFiona Klute <fiona.klute@gmx.de>
Mon, 11 Mar 2024 10:37:12 +0000 (11:37 +0100)
committerKalle Valo <kvalo@kernel.org>
Thu, 14 Mar 2024 08:59:30 +0000 (10:59 +0200)
Sometimes 8703b firmware is still active from previous use when the
driver needs to download the firmware during MAC activation. Reset it
in that case.

Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Tested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240311103735.615541-9-fiona.klute@gmx.de
drivers/net/wireless/realtek/rtw88/mac.c

index 0c1c1ff31085cf44a723ae8ec9de5de1a85d2d31..699ae3048c6ba60948b1e810660fee84eeaae468 100644 (file)
@@ -943,6 +943,12 @@ static int __rtw_download_firmware_legacy(struct rtw_dev *rtwdev,
 {
        int ret = 0;
 
+       /* reset firmware if still present */
+       if (rtwdev->chip->id == RTW_CHIP_TYPE_8703B &&
+           rtw_read8_mask(rtwdev, REG_MCUFW_CTRL, BIT_RAM_DL_SEL)) {
+               rtw_write8(rtwdev, REG_MCUFW_CTRL, 0x00);
+       }
+
        en_download_firmware_legacy(rtwdev, true);
        ret = download_firmware_legacy(rtwdev, fw->firmware->data, fw->firmware->size);
        en_download_firmware_legacy(rtwdev, false);