|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: SuperKali < [email protected]> |
| 3 | +Date: Sun, 7 Sep 2025 22:00:20 +0200 |
| 4 | +Subject: rtw88: sdio: fix incorrect RF path detection when MAC is powered off |
| 5 | + |
| 6 | +When reading REG_SYS_CFG1 register via direct I/O while MAC is powered off, |
| 7 | +incorrect values are returned (0x303030ea instead of 0x493d30ea), causing |
| 8 | +RTL8822CS to be incorrectly detected as 1T1R instead of 2T2R. |
| 9 | + |
| 10 | +This leads to "unsupported rf path" errors and WiFi malfunction in 9 out of |
| 11 | +10 boots on some hardware configurations. |
| 12 | + |
| 13 | +Fix by forcing indirect I/O when MAC is powered off and the address is not |
| 14 | +a bus address, ensuring correct register values are read during chip |
| 15 | +initialization. |
| 16 | + |
| 17 | +Signed-off-by: SuperKali < [email protected]> |
| 18 | +Link: https://lore.kernel.org/linux-wireless/ [email protected]/ |
| 19 | +--- |
| 20 | + drivers/net/wireless/realtek/rtw88/sdio.c | 8 ++++++-- |
| 21 | + 1 file changed, 6 insertions(+), 2 deletions(-) |
| 22 | + |
| 23 | +diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c |
| 24 | +index 0cae5746f540..b054a73b50e0 100644 |
| 25 | +--- a/drivers/net/wireless/realtek/rtw88/sdio.c |
| 26 | ++++ b/drivers/net/wireless/realtek/rtw88/sdio.c |
| 27 | +@@ -141,12 +141,16 @@ static u32 rtw_sdio_to_io_address(struct rtw_dev *rtwdev, u32 addr, |
| 28 | + return rtw_sdio_to_bus_offset(rtwdev, addr); |
| 29 | + } |
| 30 | + |
| 31 | + static bool rtw_sdio_use_direct_io(struct rtw_dev *rtwdev, u32 addr) |
| 32 | + { |
| 33 | +- return !rtw_sdio_is_sdio30_supported(rtwdev) || |
| 34 | +- rtw_sdio_is_bus_addr(addr); |
| 35 | ++ if (!rtw_sdio_is_bus_addr(addr) && |
| 36 | ++ !test_bit(RTW_FLAG_POWERON, rtwdev->flags)) |
| 37 | ++ return false; |
| 38 | ++ |
| 39 | ++ return !rtw_sdio_is_sdio30_supported(rtwdev) || |
| 40 | ++ rtw_sdio_is_bus_addr(addr); |
| 41 | + } |
| 42 | + |
| 43 | + static int rtw_sdio_indirect_reg_cfg(struct rtw_dev *rtwdev, u32 addr, u32 cfg) |
| 44 | + { |
| 45 | + struct rtw_sdio *rtwsdio = (struct rtw_sdio *)rtwdev->priv; |
| 46 | +-- |
| 47 | +Armbian |
| 48 | + |
0 commit comments