Skip to content

Commit cb0ddaa

Browse files
xdarklightKalle Valo
authored andcommitted
wifi: rtw88: sdio: Always use two consecutive bytes for word operations
The Allwinner sunxi-mmc controller cannot handle word (16 bit) transfers. So and sdio_{read,write}w fails with messages like the following example using an RTL8822BS (but the same problems were also observed with RTL8822CS and RTL8723DS chips): rtw_8822bs mmc1:0001:1: Firmware version 27.2.0, H2C version 13 sunxi-mmc 4021000.mmc: unaligned scatterlist: os f80 length 2 sunxi-mmc 4021000.mmc: map DMA failed rtw_8822bs mmc1:0001:1: sdio read16 failed (0x10230): -22 Use two consecutive single byte accesses for word operations instead. It turns out that upon closer inspection this is also what the vendor driver does, even though it does have support for sdio_{read,write}w. So we can conclude that the rtw88 chips do support word access but only on SDIO controllers that also support it. Since there's no way to detect if the controller supports word access or not the rtw88 sdio driver switches to the easiest approach: avoiding word access. Reported-by: Larry Finger <[email protected]> Closes: https://lore.kernel.org/linux-wireless/[email protected]/ Reported-by: Rudi Heitbaum <[email protected]> Link: LibreELEC/LibreELEC.tv#7837 (comment) Fixes: 65371a3 ("wifi: rtw88: sdio: Add HCI implementation for SDIO based chipsets") Reviewed-by: Ping-Ke Shih <[email protected]> Signed-off-by: Martin Blumenstingl <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 098abbd commit cb0ddaa

File tree

1 file changed

+0
-8
lines changed
  • drivers/net/wireless/realtek/rtw88

1 file changed

+0
-8
lines changed

drivers/net/wireless/realtek/rtw88/sdio.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ static void rtw_sdio_writew(struct rtw_dev *rtwdev, u16 val, u32 addr,
8787
u8 buf[2];
8888
int i;
8989

90-
if (rtw_sdio_use_memcpy_io(rtwdev, addr, 2)) {
91-
sdio_writew(rtwsdio->sdio_func, val, addr, err_ret);
92-
return;
93-
}
94-
9590
*(__le16 *)buf = cpu_to_le16(val);
9691

9792
for (i = 0; i < 2; i++) {
@@ -125,9 +120,6 @@ static u16 rtw_sdio_readw(struct rtw_dev *rtwdev, u32 addr, int *err_ret)
125120
u8 buf[2];
126121
int i;
127122

128-
if (rtw_sdio_use_memcpy_io(rtwdev, addr, 2))
129-
return sdio_readw(rtwsdio->sdio_func, addr, err_ret);
130-
131123
for (i = 0; i < 2; i++) {
132124
buf[i] = sdio_readb(rtwsdio->sdio_func, addr + i, err_ret);
133125
if (*err_ret)

0 commit comments

Comments
 (0)