wifi: rtw88: sdio: use indirect IO for device registers before power-on
Subsystems (3)
Ping-Ke Shih
maintainerPATCH 1/1 wifi: rtw88: sdio: use indirect IO for device registers before power-on
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.
--- drivers/net/wireless/realtek/rtw88/sdio.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/realtek/rtw88/sdio.c +4 -0
@@ -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); }
Signature · 1 line
2.25.1
Quoted 8 lines · Ping-Ke Shih
The register
REG_SYS_CFG1is 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 actuallyRF_2T2R, causing driver warns:
Quoted 8 lines
rtw88_8822csmmc1:0001:1: unsupported rf path (1)Fix it by using indirect IO before power-on.
Reported-by Piotr Oniszczuk <[email protected]>Suggested-by Bitterblue Smith <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>
Pick from [1] & remove mailto:
Quoted 22 lines
--- drivers/net/wireless/realtek/rtw88/sdio.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/net/wireless/realtek/rtw88/sdio.c +4
-1@@ -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); } --2.25.1
Quoted 8 lines
The register
REG_SYS_CFG1is 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 actuallyRF_2T2R, causing driver warns:
Quoted 8 lines
rtw88_8822csmmc1:0001:1: unsupported rf path (1)Fix it by using indirect IO before power-on.
Reported-by Piotr Oniszczuk <[email protected]>Suggested-by Bitterblue Smith <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>
Thanks for finding and fixing this!
The fix looks correct since indirect access (according to the vendor driver) is needed for both reads and writes (which is what the approach from this patch achives).
Ping-Ke Shih
maintainerQuoted 10 lines · Ping-Ke Shih
The register
REG_SYS_CFG1is 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 actuallyRF_2T2R, causing driver warns:
rtw88_8822csmmc1:0001:1: unsupported rf path (1)
Quoted 8 lines
Fix it by using indirect IO before power-on.
Reported-by Piotr Oniszczuk <[email protected]>Suggested-by Bitterblue Smith <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>Tested-by Piotr Oniszczuk <[email protected]>Reviewed-by Martin Blumenstingl <[email protected]>
1 patch(es) applied to rtw-next branch of rtw.git, thanks.
58de1f91e033 wifi: rtw88: sdio: use indirect IO for device registers before power-on
Hi,
This patch was recently backported to stable kernels (v6.12.58) and it broke wlan on PinePhone, that uses 8723cs SDIO chip. The same problem appears of course on latest 6.18-rc6. Reverting this change resolves the problem.
``` $ sudo dmesg | grep -i rtw88 [ 24.940551] rtw88_8723cs mmc1:0001:1: WOW Firmware version 11.0.0, H2C version 0 [ 24.953085] rtw88_8723cs mmc1:0001:1: Firmware version 11.0.0, H2C version 0 [ 24.955892] rtw88_8723cs mmc1:0001:1: sdio read32 failed (0xf0): -110 [ 24.973135] rtw88_8723cs mmc1:0001:1: sdio write8 failed (0x1c): -110 [ 24.980673] rtw88_8723cs mmc1:0001:1: sdio read32 failed (0xf0): -110 ... [ 25.446691] rtw88_8723cs mmc1:0001:1: sdio read8 failed (0x100): -110 [ 25.453569] rtw88_8723cs mmc1:0001:1: mac power on failed [ 25.459077] rtw88_8723cs mmc1:0001:1: failed to power on mac [ 25.464841] rtw88_8723cs mmc1:0001:1: failed to setup chip efuse info [ 25.464856] rtw88_8723cs mmc1:0001:1: failed to setup chip information [ 25.478341] rtw88_8723cs mmc1:0001:1: probe with driver rtw88_8723cs failed with error -114 ```
Quoted 38 lines · Ping-Ke Shih
The register
REG_SYS_CFG1is 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 actuallyRF_2T2R, causing driver warns:
rtw88_8822csmmc1:0001:1: unsupported rf path (1)Fix it by using indirect IO before power-on.
Reported-by Piotr Oniszczuk <[email protected]>Suggested-by Bitterblue Smith <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>--- drivers/net/wireless/realtek/rtw88/sdio.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/net/wireless/realtek/rtw88/sdio.c +4
-0@@ -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); }Signature · 1 line
2.25.1
Signature · 2 lines
Best regards, Andrey Skvortsov
Ping-Ke Shih
maintainerQuoted 7 lines · Andrey Skvortsov
Hi,
This patch was recently backported to stable kernels (v6.12.58) and it broke wlan on PinePhone, that uses 8723cs SDIO chip. The same problem appears of course on latest 6.18-rc6. Reverting this change resolves the problem.
Quoted 16 lines
``` $ sudo dmesg | grep -i rtw88 [ 24.940551] rtw88_8723cs mmc1:0001:1: WOW Firmware version 11.0.0, H2C version 0 [ 24.953085] rtw88_8723cs mmc1:0001:1: Firmware version 11.0.0, H2C version 0 [ 24.955892] rtw88_8723cs mmc1:0001:1: sdio read32 failed (0xf0): -110 [ 24.973135] rtw88_8723cs mmc1:0001:1: sdio write8 failed (0x1c): -110 [ 24.980673] rtw88_8723cs mmc1:0001:1: sdio read32 failed (0xf0): -110 ... [ 25.446691] rtw88_8723cs mmc1:0001:1: sdio read8 failed (0x100): -110 [ 25.453569] rtw88_8723cs mmc1:0001:1: mac power on failed [ 25.459077] rtw88_8723cs mmc1:0001:1: failed to power on mac [ 25.464841] rtw88_8723cs mmc1:0001:1: failed to setup chip efuse info [ 25.464856] rtw88_8723cs mmc1:0001:1: failed to setup chip information [ 25.478341] rtw88_8723cs mmc1:0001:1: probe with driver rtw88_8723cs failed with error -114 ```
Check original link of this patch [1] that 8822cs read incorrect from 0xf0 resulting in "rtw88_8822cs mmc1:0001:1: unsupported rf path (1)".
I wonder if we can add additional checking rule of chip ID, like:
drivers/net/wireless/realtek/rtw88/sdio.c +3 -1
@@ -144,8 +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) { +bool might_indirect_under_power_off = rtwdev->chip->id !=RTW_CHIP_TYPE_8703B ; +if (!test_bit (RTW_FLAG_POWERON , rtwdev->flags) && - !rtw_sdio_is_bus_addr (addr)) + !rtw_sdio_is_bus_addr (addr) && might_indirect_under_power_off)return false; return !rtw_sdio_is_sdio30_supported(rtwdev) ||
[1] https://lore.kernel.org/linux-wireless/[email protected]/T/#t
Quoted 8 lines · Ping-Ke Shih
Quoted 7 lines · Andrey Skvortsov
Hi,
This patch was recently backported to stable kernels (v6.12.58) and it broke wlan on PinePhone, that uses 8723cs SDIO chip. The same problem appears of course on latest 6.18-rc6. Reverting this change resolves the problem.
Quoted 5 lines
Quoted 5 lines
```
$ sudo dmesg | grep -i rtw88 [ 24.940551] rtw88_8723cs mmc1:0001:1: WOW Firmware version 11.0.0, H2C version 0 [ 24.953085] rtw88_8723cs mmc1:0001:1: Firmware version 11.0.0, H2C version 0 [ 24.955892] rtw88_8723cs mmc1:0001:1: sdio read32 failed (0xf0): -110
I see it fails with timeout on the first operation to read chip version.
Quoted 12 lines
Quoted 11 lines
[ 24.973135] rtw88_8723cs mmc1:0001:1: sdio write8 failed (0x1c): -110 [ 24.980673] rtw88_8723cs mmc1:0001:1: sdio read32 failed (0xf0): -110 ... [ 25.446691] rtw88_8723cs mmc1:0001:1: sdio read8 failed (0x100): -110 [ 25.453569] rtw88_8723cs mmc1:0001:1: mac power on failed [ 25.459077] rtw88_8723cs mmc1:0001:1: failed to power on mac [ 25.464841] rtw88_8723cs mmc1:0001:1: failed to setup chip efuse info [ 25.464856] rtw88_8723cs mmc1:0001:1: failed to setup chip information [ 25.478341] rtw88_8723cs mmc1:0001:1: probe with driver rtw88_8723cs failed with error -114```
Quoted 2 lines
Check original link of this patch [1] that 8822cs read incorrect from
0xf0resulting in "rtw88_8822csmmc1:0001:1: unsupported rf path (1)".
Sorry, I haven't meant, that this patch should be reverted. I see, that it solves real problem. I've meant, that patch caused this regression was identified and it was confirmed by reverting it.
Quoted 1 line
I wonder if we can add additional checking rule of chip ID, like:
I've tried suggested change and wlan is recognized again.
Quoted 18 lines
drivers/net/wireless/realtek/rtw88/sdio.c +3
-1@@ -144,8 +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) { +bool might_indirect_under_power_off = rtwdev->chip->id !=RTW_CHIP_TYPE_8703B ; +if (!test_bit (RTW_FLAG_POWERON , rtwdev->flags) && - !rtw_sdio_is_bus_addr (addr)) + !rtw_sdio_is_bus_addr (addr) && might_indirect_under_power_off)return false; return !rtw_sdio_is_sdio30_supported(rtwdev) ||[1] https://lore.kernel.org/linux-wireless/[email protected]/T/#t
Signature · 2 lines
Best regards, Andrey Skvortsov
Ping-Ke Shih
maintainerQuoted 28 lines · Andrey Skvortsov
Quoted 8 lines · Ping-Ke Shih
Quoted 7 lines · Andrey Skvortsov
Hi,
This patch was recently backported to stable kernels (v6.12.58) and it broke wlan on PinePhone, that uses 8723cs SDIO chip. The same problem appears of course on latest 6.18-rc6. Reverting this change resolves the problem.
Quoted 5 lines
Quoted 5 lines
```
$ sudo dmesg | grep -i rtw88 [ 24.940551] rtw88_8723cs mmc1:0001:1: WOW Firmware version 11.0.0, H2C version 0 [ 24.953085] rtw88_8723cs mmc1:0001:1: Firmware version 11.0.0, H2C version 0 [ 24.955892] rtw88_8723cs mmc1:0001:1: sdio read32 failed (0xf0): -110I see it fails with timeout on the first operation to read chip version.
Quoted 12 lines
Quoted 11 lines
[ 24.973135] rtw88_8723cs mmc1:0001:1: sdio write8 failed (0x1c): -110 [ 24.980673] rtw88_8723cs mmc1:0001:1: sdio read32 failed (0xf0): -110 ... [ 25.446691] rtw88_8723cs mmc1:0001:1: sdio read8 failed (0x100): -110 [ 25.453569] rtw88_8723cs mmc1:0001:1: mac power on failed [ 25.459077] rtw88_8723cs mmc1:0001:1: failed to power on mac [ 25.464841] rtw88_8723cs mmc1:0001:1: failed to setup chip efuse info [ 25.464856] rtw88_8723cs mmc1:0001:1: failed to setup chip information [ 25.478341] rtw88_8723cs mmc1:0001:1: probe with driver rtw88_8723cs failed with error -114```
Quoted 5 lines
Quoted 2 lines
Check original link of this patch [1] that 8822cs read incorrect from
0xf0resulting in "rtw88_8822csmmc1:0001:1: unsupported rf path (1)".Sorry, I haven't meant, that this patch should be reverted. I see, that it solves real problem. I've meant, that patch caused this regression was identified and it was confirmed by reverting it.
I just want to point out the original problem we encountered, and the user weirdly get unexpected value from 0xF0 without any error.
Quoted 5 lines
Quoted 2 lines
I wonder if we can add additional checking rule of chip ID, like:
I've tried suggested change and wlan is recognized again.
I will check if vendor driver does similar things, and then I can make a formal patch for 8723CS.