linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rtw88: Problem with sdio.c
@ 2023-05-24 18:51 Larry Finger
  2023-05-24 19:18 ` Jernej Škrabec
  0 siblings, 1 reply; 4+ messages in thread
From: Larry Finger @ 2023-05-24 18:51 UTC (permalink / raw)
  To: Martin Blumenstingl, Jernej Skrabec; +Cc: linux-wireless

Martin,

When I applied your latest changes to my rtw88 repo, the driver for 8723ds 
broke. The dmesg log first showed things like:

[    3.603884] rtw_8723ds mmc1:0001:1: Firmware version 48.0.0, H2C version 0
[    3.615430] sunxi-mmc 4021000.mmc: unaligned scatterlist: os e80 length 2
[    3.622248] sunxi-mmc 4021000.mmc: map DMA failed
[    3.626974] rtw_8723ds mmc1:0001:1: sdio read16 failed (0x10040): -22
[    3.633435] sunxi-mmc 4021000.mmc: unaligned scatterlist: os e80 length 2
[    3.640236] sunxi-mmc 4021000.mmc: map DMA failed

There were similar messages for write16 operations.

I was able to "fix" the problem by turning off rea16/write16 operations for the 
RTW8723DS with the following patch that uses the rtw_chip_wcpu_11n() function:

diff --git a/sdio.c b/sdio.c
index 1647cdc..2051c30 100644
--- a/sdio.c
+++ b/sdio.c
@@ -87,7 +87,7 @@ static void rtw_sdio_writew(struct rtw_dev *rtwdev, u16 val, 
u32 addr,
         u8 buf[2];
         int i;

-       if (rtw_sdio_use_memcpy_io(rtwdev, addr, 2)) {
+       if (rtw_sdio_use_memcpy_io(rtwdev, addr, 2) && !rtw_chip_wcpu_11n(rtwdev)) {
                 sdio_writew(rtwsdio->sdio_func, val, addr, err_ret);
                 return;
         }
@@ -125,7 +125,7 @@ static u16 rtw_sdio_readw(struct rtw_dev *rtwdev, u32 addr, 
int *err_ret)
         u8 buf[2];
         int i;

-       if (rtw_sdio_use_memcpy_io(rtwdev, addr, 2))
+       if (rtw_sdio_use_memcpy_io(rtwdev, addr, 2) && !rtw_chip_wcpu_11n(rtwdev))
                 return sdio_readw(rtwsdio->sdio_func, addr, err_ret);

         for (i = 0; i < 2; i++) {

This leaves 16-bit reads and write enabled for the other chips. Alternatives 
would be to detect when this particular SDIO controller is in use, or last of 
all, add a module parameter.

Larry

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-27  7:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-24 18:51 rtw88: Problem with sdio.c Larry Finger
2023-05-24 19:18 ` Jernej Škrabec
2023-05-24 20:31   ` Larry Finger
2023-05-27  7:15     ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).