]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: rtw88: sdio: use indirect IO for device registers before power-on
authorPing-Ke Shih <pkshih@realtek.com>
Thu, 24 Jul 2025 00:48:15 +0000 (08:48 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 12 Aug 2025 07:56:46 +0000 (15:56 +0800)
The register REG_SYS_CFG1 is used to determine chip basic information
as arguments of following flows, such as download firmware and load PHY
parameters, so driver read the value early (before power-on).

However, the direct IO is disallowed before power-on, or it causes wrong
values, which driver recognizes a chip as a wrong type RF_1T1R, but
actually RF_2T2R, causing driver warns:

  rtw88_8822cs mmc1:0001:1: unsupported rf path (1)

Fix it by using indirect IO before power-on.

Reported-by: Piotr Oniszczuk <piotr.oniszczuk@gmail.com>
Closes: https://lore.kernel.org/linux-wireless/699C22B4-A3E3-4206-97D0-22AB3348EBF6@gmail.com/T/#t
Suggested-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Tested-by: Piotr Oniszczuk <piotr.oniszczuk@gmail.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250724004815.7043-1-pkshih@realtek.com
drivers/net/wireless/realtek/rtw88/sdio.c

index cc2d4fef35879a734fdf79436152c9de0eba6629..99d7c629eac6fb41aa8dceda4abb9a9a74af9794 100644 (file)
@@ -144,6 +144,10 @@ static u32 rtw_sdio_to_io_address(struct rtw_dev *rtwdev, u32 addr,
 
 static bool rtw_sdio_use_direct_io(struct rtw_dev *rtwdev, u32 addr)
 {
+       if (!test_bit(RTW_FLAG_POWERON, rtwdev->flags) &&
+           !rtw_sdio_is_bus_addr(addr))
+               return false;
+
        return !rtw_sdio_is_sdio30_supported(rtwdev) ||
                rtw_sdio_is_bus_addr(addr);
 }