PROBLEM: RTL8821CS SDIO card is unusable on boot (Anbernic RG353V)

From: John Salamon
Date: Mon Sep 25 2023 - 22:06:59 EST


On an Anbernic RG353V using the latest mainline kernel, the wifi
(RTL8821CS) is in an unusable state on boot (no wireless adapter
available) and I get the following kernel messages:

[ 5.878711] rtw_8821cs mmc3:0001:1: Firmware version 24.11.0, H2C version 12
[ 6.218709] rtw_8821cs mmc3:0001:1: sdio read32 failed (0x11080): -110
[ 6.218844] rtw_8821cs mmc3:0001:1: sdio write32 failed (0x11080): -110
[ 6.219136] rtw_8821cs mmc3:0001:1: sdio read32 failed (0x10080): -110
[ 6.219230] rtw_8821cs mmc3:0001:1: sdio write32 failed (0x10080): -110
[ 6.219409] rtw_8821cs mmc3:0001:1: sdio read32 failed (0x10040): -110
[ 6.219503] rtw_8821cs mmc3:0001:1: sdio write32 failed (0x10040): -110
[ 6.219706] rtw_8821cs mmc3:0001:1: sdio read32 failed (0x11700): -110
[ 6.219800] rtw_8821cs mmc3:0001:1: sdio write32 failed (0x11700): -110
[ 6.219967] rtw_8821cs mmc3:0001:1: sdio read32 failed (0x11708): -110
[ 6.220474] rtw_8821cs mmc3:0001:1: sdio write32 failed (0x11330): -110
[ 6.220673] rtw_8821cs mmc3:0001:1: sdio read32 failed (0x1022c): -110
[ 6.220863] rtw_8821cs mmc3:0001:1: sdio write32 failed (0x1022c): -110
[ 6.220993] rtw_8821cs mmc3:0001:1: sdio read32 failed (0x20): -110
[ 6.221570] rtw_8821cs mmc3:0001:1: sdio read32 failed (0x11208): -110
[ 6.221695] rtw_8821cs mmc3:0001:1: sdio write32 failed (0x11208): -110
[ 6.222076] rtw_8821cs mmc3:0001:1: sdio read32 failed (0x20): -110
[ 6.222195] rtw_8821cs mmc3:0001:1: sdio read32 failed (0x24): -110
[ 6.222322] rtw_8821cs mmc3:0001:1: sdio read32 failed (0x28): -110
[ 6.222471] rtw_8821cs mmc3:0001:1: Failed to write 4608 byte(s) to
SDIO port 0x0000840c
[ 6.222510] rtw_8821cs mmc3:0001:1: failed to write data to rsvd page
[ 6.222680] rtw_8821cs mmc3:0001:1: failed to download rsvd page
[ 6.222851] rtw_8821cs mmc3:0001:1: failed to download firmware
[ 6.223011] rtw_8821cs mmc3:0001:1: failed to setup chip efuse info
[ 6.223033] rtw_8821cs mmc3:0001:1: failed to setup chip information
[ 6.224013] rtw_8821cs: probe of mmc3:0001:1 failed with error -110

If I rmmod rtw_8821cs and modprobe rtw_8821cs, it actually becomes
usable, at least for a while.
After some time, many repeated messages like this appear:

[ 1562.774009] rtw_8821cs mmc3:0001:1: timed out to flush queue 2
[ 1563.234018] rtw_8821cs mmc3:0001:1: timed out to flush queue 1

And I have to do the rmmod/modprobe trick again for it to start working again.

I can always reproduce this on boot.
I am using the latest mainline kernel, uboot and linux-firmware (I've
also tried 6.5 kernel with the same result).
kernel .config:
https://github.com/human9/rg353v_linux/blob/main/linux_new.config
dmesg: https://github.com/human9/rg353v_linux/blob/main/dmesg.txt