diff mbox series

[RFC,v1,19/19] rtw88: Add support for the SDIO based RTL8821CS chipset

Message ID 20221227233020.284266-20-martin.blumenstingl@googlemail.com (mailing list archive)
State RFC
Delegated to: Kalle Valo
Headers show
Series rtw88: Add SDIO support | expand

Commit Message

Martin Blumenstingl Dec. 27, 2022, 11:30 p.m. UTC
Wire up RTL8821CS chipset support using the new rtw88 SDIO HCI code as
well as the existing RTL8821C chipset code.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/net/wireless/realtek/rtw88/Kconfig    | 11 ++++++
 drivers/net/wireless/realtek/rtw88/Makefile   |  3 ++
 .../net/wireless/realtek/rtw88/rtw8821cs.c    | 34 +++++++++++++++++++
 3 files changed, 48 insertions(+)
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8821cs.c

Comments

Chris Morgan Jan. 3, 2023, 11:01 p.m. UTC | #1
On Wed, Dec 28, 2022 at 12:30:20AM +0100, Martin Blumenstingl wrote:
> Wire up RTL8821CS chipset support using the new rtw88 SDIO HCI code as
> well as the existing RTL8821C chipset code.
> 

Unfortunately, this doesn't work for me. I applied it on top of 6.2-rc2
master and I get errors during probe (it appears the firmware never
loads).

Relevant dmesg logs are as follows:

[    0.989545] mmc2: new high speed SDIO card at address 0001
[    0.989993] rtw_8821cs mmc2:0001:1: Firmware version 24.8.0, H2C version 12
[    1.005684] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x14): -110
[    1.005737] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1080): -110
[    1.005789] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x11080): -110
[    1.005840] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x3): -110
[    1.005920] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x1103): -110
[    1.005998] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x80): -110
[    1.006078] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1700): -110

The error of "sdio read32 failed (0x1700): -110" then repeats several
hundred times, then I get this:

[    1.066294] rtw_8821cs mmc2:0001:1: failed to download firmware
[    1.066367] rtw_8821cs mmc2:0001:1: sdio read16 failed (0x80): -110
[    1.066417] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x100): -110
[    1.066697] rtw_8821cs mmc2:0001:1: failed to setup chip efuse info
[    1.066703] rtw_8821cs mmc2:0001:1: failed to setup chip information
[    1.066839] rtw_8821cs: probe of mmc2:0001:1 failed with error -16

The hardware I am using is an rtl8821cs that I can confirm was working
with a previous driver.

Thank you.

> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
>  drivers/net/wireless/realtek/rtw88/Kconfig    | 11 ++++++
>  drivers/net/wireless/realtek/rtw88/Makefile   |  3 ++
>  .../net/wireless/realtek/rtw88/rtw8821cs.c    | 34 +++++++++++++++++++
>  3 files changed, 48 insertions(+)
>  create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8821cs.c
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/Kconfig b/drivers/net/wireless/realtek/rtw88/Kconfig
> index 6b65da81127f..29eb2f8e0eb7 100644
> --- a/drivers/net/wireless/realtek/rtw88/Kconfig
> +++ b/drivers/net/wireless/realtek/rtw88/Kconfig
> @@ -133,6 +133,17 @@ config RTW88_8821CE
>  
>  	  802.11ac PCIe wireless network adapter
>  
> +config RTW88_8821CS
> +	tristate "Realtek 8821CS SDIO wireless network adapter"
> +	depends on MMC
> +	select RTW88_CORE
> +	select RTW88_SDIO
> +	select RTW88_8821C
> +	help
> +	  Select this option will enable support for 8821CS chipset
> +
> +	  802.11ac SDIO wireless network adapter
> +
>  config RTW88_8821CU
>  	tristate "Realtek 8821CU USB wireless network adapter"
>  	depends on USB
> diff --git a/drivers/net/wireless/realtek/rtw88/Makefile b/drivers/net/wireless/realtek/rtw88/Makefile
> index 6105c2745bda..82979b30ae8d 100644
> --- a/drivers/net/wireless/realtek/rtw88/Makefile
> +++ b/drivers/net/wireless/realtek/rtw88/Makefile
> @@ -59,6 +59,9 @@ rtw88_8821c-objs		:= rtw8821c.o rtw8821c_table.o
>  obj-$(CONFIG_RTW88_8821CE)	+= rtw88_8821ce.o
>  rtw88_8821ce-objs		:= rtw8821ce.o
>  
> +obj-$(CONFIG_RTW88_8821CS)	+= rtw88_8821cs.o
> +rtw88_8821cs-objs		:= rtw8821cs.o
> +
>  obj-$(CONFIG_RTW88_8821CU)	+= rtw88_8821cu.o
>  rtw88_8821cu-objs		:= rtw8821cu.o
>  
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821cs.c b/drivers/net/wireless/realtek/rtw88/rtw8821cs.c
> new file mode 100644
> index 000000000000..61f82b38cda4
> --- /dev/null
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8821cs.c
> @@ -0,0 +1,34 @@
> +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
> +// Copyright(c) Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> +
> +#include <linux/mmc/sdio_func.h>
> +#include <linux/mmc/sdio_ids.h>
> +#include <linux/module.h>
> +#include "sdio.h"
> +#include "rtw8821c.h"
> +
> +static const struct sdio_device_id rtw_8821cs_id_table[] =  {
> +	{
> +		SDIO_DEVICE(SDIO_VENDOR_ID_REALTEK,
> +			    SDIO_DEVICE_ID_REALTEK_RTW8821CS),
> +		.driver_data = (kernel_ulong_t)&rtw8821c_hw_spec,
> +	},
> +	{}
> +};
> +MODULE_DEVICE_TABLE(sdio, rtw_8821cs_id_table);
> +
> +static struct sdio_driver rtw_8821cs_driver = {
> +	.name = "rtw_8821cs",
> +	.probe = rtw_sdio_probe,
> +	.remove = rtw_sdio_remove,
> +	.id_table = rtw_8821cs_id_table,
> +	.drv = {
> +		.pm = &rtw_sdio_pm_ops,
> +		.shutdown = rtw_sdio_shutdown,
> +	}
> +};
> +module_sdio_driver(rtw_8821cs_driver);
> +
> +MODULE_AUTHOR("Martin Blumenstingl <martin.blumenstingl@googlemail.com>");
> +MODULE_DESCRIPTION("Realtek 802.11ac wireless 8821cs driver");
> +MODULE_LICENSE("Dual BSD/GPL");
> -- 
> 2.39.0
>
Martin Blumenstingl Jan. 4, 2023, 3:40 p.m. UTC | #2
Hi Chris,

On Wed, Jan 4, 2023 at 12:01 AM Chris Morgan <macroalpha82@gmail.com> wrote:
>
> On Wed, Dec 28, 2022 at 12:30:20AM +0100, Martin Blumenstingl wrote:
> > Wire up RTL8821CS chipset support using the new rtw88 SDIO HCI code as
> > well as the existing RTL8821C chipset code.
> >
>
> Unfortunately, this doesn't work for me. I applied it on top of 6.2-rc2
> master and I get errors during probe (it appears the firmware never
> loads).
That's unfortunate.

> Relevant dmesg logs are as follows:
>
> [    0.989545] mmc2: new high speed SDIO card at address 0001
> [    0.989993] rtw_8821cs mmc2:0001:1: Firmware version 24.8.0, H2C version 12
> [    1.005684] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x14): -110
> [    1.005737] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1080): -110
> [    1.005789] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x11080): -110
> [    1.005840] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x3): -110
> [    1.005920] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x1103): -110
> [    1.005998] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x80): -110
> [    1.006078] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1700): -110
The error starts with a write to register 0x14 (REG_SDIO_HIMR), which
happens right after configuring RX aggregation.
Can you please try two modifications inside
drivers/net/wireless/realtek/rtw88/sdio.c:
1. inside the rtw_sdio_start() function: change
"rtw_sdio_rx_aggregation(rtwdev, false);" to
"rtw_sdio_rx_aggregation(rtwdev, true);"
2. if 1) does not work: remove the call to rtw_sdio_rx_aggregation()
from rtw_sdio_start()


Best regards,
Martin
Chris Morgan Jan. 4, 2023, 5:05 p.m. UTC | #3
On Wed, Jan 04, 2023 at 04:40:51PM +0100, Martin Blumenstingl wrote:
> Hi Chris,
> 
> On Wed, Jan 4, 2023 at 12:01 AM Chris Morgan <macroalpha82@gmail.com> wrote:
> >
> > On Wed, Dec 28, 2022 at 12:30:20AM +0100, Martin Blumenstingl wrote:
> > > Wire up RTL8821CS chipset support using the new rtw88 SDIO HCI code as
> > > well as the existing RTL8821C chipset code.
> > >
> >
> > Unfortunately, this doesn't work for me. I applied it on top of 6.2-rc2
> > master and I get errors during probe (it appears the firmware never
> > loads).
> That's unfortunate.
> 
> > Relevant dmesg logs are as follows:
> >
> > [    0.989545] mmc2: new high speed SDIO card at address 0001
> > [    0.989993] rtw_8821cs mmc2:0001:1: Firmware version 24.8.0, H2C version 12
> > [    1.005684] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x14): -110
> > [    1.005737] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1080): -110
> > [    1.005789] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x11080): -110
> > [    1.005840] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x3): -110
> > [    1.005920] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x1103): -110
> > [    1.005998] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x80): -110
> > [    1.006078] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1700): -110
> The error starts with a write to register 0x14 (REG_SDIO_HIMR), which
> happens right after configuring RX aggregation.
> Can you please try two modifications inside
> drivers/net/wireless/realtek/rtw88/sdio.c:
> 1. inside the rtw_sdio_start() function: change
> "rtw_sdio_rx_aggregation(rtwdev, false);" to
> "rtw_sdio_rx_aggregation(rtwdev, true);"

No change, still receive identical issue.

> 2. if 1) does not work: remove the call to rtw_sdio_rx_aggregation()
> from rtw_sdio_start()
> 

Same here, still receive identical issue.

> 
> Best regards,
> Martin
Martin Blumenstingl Jan. 4, 2023, 5:23 p.m. UTC | #4
On Wed, Jan 4, 2023 at 6:05 PM Chris Morgan <macroalpha82@gmail.com> wrote:
[...]
> > > [    0.989545] mmc2: new high speed SDIO card at address 0001
> > > [    0.989993] rtw_8821cs mmc2:0001:1: Firmware version 24.8.0, H2C version 12
> > > [    1.005684] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x14): -110
> > > [    1.005737] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1080): -110
> > > [    1.005789] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x11080): -110
> > > [    1.005840] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x3): -110
> > > [    1.005920] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x1103): -110
> > > [    1.005998] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x80): -110
> > > [    1.006078] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1700): -110
> > The error starts with a write to register 0x14 (REG_SDIO_HIMR), which
> > happens right after configuring RX aggregation.
> > Can you please try two modifications inside
> > drivers/net/wireless/realtek/rtw88/sdio.c:
> > 1. inside the rtw_sdio_start() function: change
> > "rtw_sdio_rx_aggregation(rtwdev, false);" to
> > "rtw_sdio_rx_aggregation(rtwdev, true);"
>
> No change, still receive identical issue.
>
> > 2. if 1) does not work: remove the call to rtw_sdio_rx_aggregation()
> > from rtw_sdio_start()
> >
>
> Same here, still receive identical issue.
Thanks for testing and for reporting back!

Looking back at it again: I think I mis-interpreted your error output.
I think it's actually failing in __rtw_mac_init_system_cfg()

Can you please try the latest code from [0] (ignoring any changes I
recommended previously)?
There's two bug fixes in there (compared to this series) which may
solve the issue that you are seeing:
- fix typos to use "if (!*err_ret ..." (to read the error code)
instead of "if (!err_ret ..." (which just checks if a non-null pointer
was passed) in rtw_sdio_read_indirect{8,32}
- change buf[0] to buf[i] in rtw_sdio_read_indirect_bytes

These fixes will be part of v2 of this series anyways.


Best regards,
Martin


[0] https://github.com/xdarklight/linux/tree/d115a8631d208996510822f0805df5dfc8dfb548
Bitterblue Smith Jan. 4, 2023, 7:59 p.m. UTC | #5
On 04/01/2023 01:01, Chris Morgan wrote:
> On Wed, Dec 28, 2022 at 12:30:20AM +0100, Martin Blumenstingl wrote:
>> Wire up RTL8821CS chipset support using the new rtw88 SDIO HCI code as
>> well as the existing RTL8821C chipset code.
>>
> 
> Unfortunately, this doesn't work for me. I applied it on top of 6.2-rc2
> master and I get errors during probe (it appears the firmware never
> loads).
> 
> Relevant dmesg logs are as follows:
> 
> [    0.989545] mmc2: new high speed SDIO card at address 0001
> [    0.989993] rtw_8821cs mmc2:0001:1: Firmware version 24.8.0, H2C version 12
> [    1.005684] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x14): -110
> [    1.005737] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1080): -110
> [    1.005789] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x11080): -110
> [    1.005840] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x3): -110
> [    1.005920] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x1103): -110
> [    1.005998] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x80): -110
> [    1.006078] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1700): -110
> 
> The error of "sdio read32 failed (0x1700): -110" then repeats several
> hundred times, then I get this:
> 
> [    1.066294] rtw_8821cs mmc2:0001:1: failed to download firmware
> [    1.066367] rtw_8821cs mmc2:0001:1: sdio read16 failed (0x80): -110
> [    1.066417] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x100): -110
> [    1.066697] rtw_8821cs mmc2:0001:1: failed to setup chip efuse info
> [    1.066703] rtw_8821cs mmc2:0001:1: failed to setup chip information
> [    1.066839] rtw_8821cs: probe of mmc2:0001:1 failed with error -16
> 
> The hardware I am using is an rtl8821cs that I can confirm was working
> with a previous driver.
> 
> Thank you.
> 
The USB-based RTL8811CU also doesn't work, with suspiciously similar
errors:

Dec 25 21:43:37 home kernel: rtw_8821cu 1-2:1.0: Firmware version 24.11.0, H2C version 12
Dec 25 21:43:37 home kernel: rtw_8821cu 1-2:1.0 wlp0s20f0u2: renamed from wlan0
Dec 25 21:43:40 home kernel: rtw_8821cu 1-2:1.0: read register 0x5 failed with -110
Dec 25 21:43:41 home kernel: rtw_8821cu 1-2:1.0: read register 0x20 failed with -110
Dec 25 21:44:11 home kernel: rtw_8821cu 1-2:1.0: write register 0x20 failed with -110
Dec 25 21:44:12 home kernel: rtw_8821cu 1-2:1.0: read register 0x7c failed with -110
Dec 25 21:44:43 home kernel: rtw_8821cu 1-2:1.0: write register 0x7c failed with -110
Dec 25 21:44:44 home kernel: rtw_8821cu 1-2:1.0: read register 0x1080 failed with -110
Dec 25 21:45:16 home kernel: rtw_8821cu 1-2:1.0: write register 0x1080 failed with -110


Dec 25 21:46:47 home kernel: rtw_8821cu 1-3:1.0: Firmware version 24.11.0, H2C version 12
Dec 25 21:46:47 home kernel: rtw_8821cu 1-3:1.0 wlp0s20f0u3: renamed from wlan0
Dec 25 21:46:55 home kernel: rtw_8821cu 1-3:1.0: failed to poll offset=0x5 mask=0x1 value=0x0
Dec 25 21:46:55 home kernel: rtw_8821cu 1-3:1.0: mac power on failed
Dec 25 21:46:55 home kernel: rtw_8821cu 1-3:1.0: failed to power on mac

I tested with https://github.com/lwfinger/rtw88/ which should have the
same code as wireless-next currently.
Felix Schwarz Jan. 4, 2023, 8:06 p.m. UTC | #6
Am 04.01.23 um 20:59 schrieb Bitterblue Smith:
> The USB-based RTL8811CU also doesn't work, with suspiciously similar
> errors:
> 
> Dec 25 21:43:37 home kernel: rtw_8821cu 1-2:1.0: Firmware version 24.11.0, H2C version 12
> Dec 25 21:43:37 home kernel: rtw_8821cu 1-2:1.0 wlp0s20f0u2: renamed from wlan0
> Dec 25 21:43:40 home kernel: rtw_8821cu 1-2:1.0: read register 0x5 failed with -110
> Dec 25 21:43:41 home kernel: rtw_8821cu 1-2:1.0: read register 0x20 failed with -110
> Dec 25 21:44:11 home kernel: rtw_8821cu 1-2:1.0: write register 0x20 failed with -110
> Dec 25 21:44:12 home kernel: rtw_8821cu 1-2:1.0: read register 0x7c failed with -110
> Dec 25 21:44:43 home kernel: rtw_8821cu 1-2:1.0: write register 0x7c failed with -110
> Dec 25 21:44:44 home kernel: rtw_8821cu 1-2:1.0: read register 0x1080 failed with -110
> Dec 25 21:45:16 home kernel: rtw_8821cu 1-2:1.0: write register 0x1080 failed with -110

Same for me: I saw very similar read/write failures with my "Realtek 
Semiconductor Corp. 802.11ac NIC" (ID 0bda:c811) after applying Ping-Ke's patch 
for rfe 38 (see my message to linux-wireless on Dec 29).

Felix
Larry Finger Jan. 4, 2023, 8:14 p.m. UTC | #7
On 1/4/23 13:59, Bitterblue Smith wrote:
> I tested with https://github.com/lwfinger/rtw88/ which should have the
> same code as wireless-next currently.

I just rechecked. My repo was missing some changes from wireless-next. It now 
matches.

Larry
Chris Morgan Jan. 4, 2023, 10:45 p.m. UTC | #8
On Wed, Jan 04, 2023 at 06:23:24PM +0100, Martin Blumenstingl wrote:
> On Wed, Jan 4, 2023 at 6:05 PM Chris Morgan <macroalpha82@gmail.com> wrote:
> [...]
> > > > [    0.989545] mmc2: new high speed SDIO card at address 0001
> > > > [    0.989993] rtw_8821cs mmc2:0001:1: Firmware version 24.8.0, H2C version 12
> > > > [    1.005684] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x14): -110
> > > > [    1.005737] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1080): -110
> > > > [    1.005789] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x11080): -110
> > > > [    1.005840] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x3): -110
> > > > [    1.005920] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x1103): -110
> > > > [    1.005998] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x80): -110
> > > > [    1.006078] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1700): -110
> > > The error starts with a write to register 0x14 (REG_SDIO_HIMR), which
> > > happens right after configuring RX aggregation.
> > > Can you please try two modifications inside
> > > drivers/net/wireless/realtek/rtw88/sdio.c:
> > > 1. inside the rtw_sdio_start() function: change
> > > "rtw_sdio_rx_aggregation(rtwdev, false);" to
> > > "rtw_sdio_rx_aggregation(rtwdev, true);"
> >
> > No change, still receive identical issue.
> >
> > > 2. if 1) does not work: remove the call to rtw_sdio_rx_aggregation()
> > > from rtw_sdio_start()
> > >
> >
> > Same here, still receive identical issue.
> Thanks for testing and for reporting back!
> 
> Looking back at it again: I think I mis-interpreted your error output.
> I think it's actually failing in __rtw_mac_init_system_cfg()
> 
> Can you please try the latest code from [0] (ignoring any changes I
> recommended previously)?
> There's two bug fixes in there (compared to this series) which may
> solve the issue that you are seeing:
> - fix typos to use "if (!*err_ret ..." (to read the error code)
> instead of "if (!err_ret ..." (which just checks if a non-null pointer
> was passed) in rtw_sdio_read_indirect{8,32}
> - change buf[0] to buf[i] in rtw_sdio_read_indirect_bytes
> 
> These fixes will be part of v2 of this series anyways.

That still doesn't fix it, I receive the same error. I'm using an older
patch series of yours (that I can't seem to find on github anymore),
so I'll see if I can compare the older series that works with this one
and find out the root cause.

Thank you.

> 
> 
> Best regards,
> Martin
> 
> 
> [0] https://github.com/xdarklight/linux/tree/d115a8631d208996510822f0805df5dfc8dfb548
Sascha Hauer Jan. 5, 2023, 8:01 a.m. UTC | #9
On Wed, Jan 04, 2023 at 09:59:35PM +0200, Bitterblue Smith wrote:
> On 04/01/2023 01:01, Chris Morgan wrote:
> > On Wed, Dec 28, 2022 at 12:30:20AM +0100, Martin Blumenstingl wrote:
> >> Wire up RTL8821CS chipset support using the new rtw88 SDIO HCI code as
> >> well as the existing RTL8821C chipset code.
> >>
> > 
> > Unfortunately, this doesn't work for me. I applied it on top of 6.2-rc2
> > master and I get errors during probe (it appears the firmware never
> > loads).
> > 
> > Relevant dmesg logs are as follows:
> > 
> > [    0.989545] mmc2: new high speed SDIO card at address 0001
> > [    0.989993] rtw_8821cs mmc2:0001:1: Firmware version 24.8.0, H2C version 12
> > [    1.005684] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x14): -110
> > [    1.005737] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1080): -110
> > [    1.005789] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x11080): -110
> > [    1.005840] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x3): -110
> > [    1.005920] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x1103): -110
> > [    1.005998] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x80): -110
> > [    1.006078] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1700): -110
> > 
> > The error of "sdio read32 failed (0x1700): -110" then repeats several
> > hundred times, then I get this:
> > 
> > [    1.066294] rtw_8821cs mmc2:0001:1: failed to download firmware
> > [    1.066367] rtw_8821cs mmc2:0001:1: sdio read16 failed (0x80): -110
> > [    1.066417] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x100): -110
> > [    1.066697] rtw_8821cs mmc2:0001:1: failed to setup chip efuse info
> > [    1.066703] rtw_8821cs mmc2:0001:1: failed to setup chip information
> > [    1.066839] rtw_8821cs: probe of mmc2:0001:1 failed with error -16
> > 
> > The hardware I am using is an rtl8821cs that I can confirm was working
> > with a previous driver.
> > 
> > Thank you.
> > 
> The USB-based RTL8811CU also doesn't work, with suspiciously similar
> errors:
> 
> Dec 25 21:43:37 home kernel: rtw_8821cu 1-2:1.0: Firmware version 24.11.0, H2C version 12
> Dec 25 21:43:37 home kernel: rtw_8821cu 1-2:1.0 wlp0s20f0u2: renamed from wlan0
> Dec 25 21:43:40 home kernel: rtw_8821cu 1-2:1.0: read register 0x5 failed with -110

Is this the very first register access or are there other register
accesses before that actually do work?

Sascha
Bitterblue Smith Jan. 5, 2023, 3:38 p.m. UTC | #10
On 05/01/2023 10:01, Sascha Hauer wrote:
> On Wed, Jan 04, 2023 at 09:59:35PM +0200, Bitterblue Smith wrote:
>> On 04/01/2023 01:01, Chris Morgan wrote:
>>> On Wed, Dec 28, 2022 at 12:30:20AM +0100, Martin Blumenstingl wrote:
>>>> Wire up RTL8821CS chipset support using the new rtw88 SDIO HCI code as
>>>> well as the existing RTL8821C chipset code.
>>>>
>>>
>>> Unfortunately, this doesn't work for me. I applied it on top of 6.2-rc2
>>> master and I get errors during probe (it appears the firmware never
>>> loads).
>>>
>>> Relevant dmesg logs are as follows:
>>>
>>> [    0.989545] mmc2: new high speed SDIO card at address 0001
>>> [    0.989993] rtw_8821cs mmc2:0001:1: Firmware version 24.8.0, H2C version 12
>>> [    1.005684] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x14): -110
>>> [    1.005737] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1080): -110
>>> [    1.005789] rtw_8821cs mmc2:0001:1: sdio write32 failed (0x11080): -110
>>> [    1.005840] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x3): -110
>>> [    1.005920] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x1103): -110
>>> [    1.005998] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x80): -110
>>> [    1.006078] rtw_8821cs mmc2:0001:1: sdio read32 failed (0x1700): -110
>>>
>>> The error of "sdio read32 failed (0x1700): -110" then repeats several
>>> hundred times, then I get this:
>>>
>>> [    1.066294] rtw_8821cs mmc2:0001:1: failed to download firmware
>>> [    1.066367] rtw_8821cs mmc2:0001:1: sdio read16 failed (0x80): -110
>>> [    1.066417] rtw_8821cs mmc2:0001:1: sdio read8 failed (0x100): -110
>>> [    1.066697] rtw_8821cs mmc2:0001:1: failed to setup chip efuse info
>>> [    1.066703] rtw_8821cs mmc2:0001:1: failed to setup chip information
>>> [    1.066839] rtw_8821cs: probe of mmc2:0001:1 failed with error -16
>>>
>>> The hardware I am using is an rtl8821cs that I can confirm was working
>>> with a previous driver.
>>>
>>> Thank you.
>>>
>> The USB-based RTL8811CU also doesn't work, with suspiciously similar
>> errors:
>>
>> Dec 25 21:43:37 home kernel: rtw_8821cu 1-2:1.0: Firmware version 24.11.0, H2C version 12
>> Dec 25 21:43:37 home kernel: rtw_8821cu 1-2:1.0 wlp0s20f0u2: renamed from wlan0
>> Dec 25 21:43:40 home kernel: rtw_8821cu 1-2:1.0: read register 0x5 failed with -110
> 
> Is this the very first register access or are there other register
> accesses before that actually do work?
> 
> Sascha
> 
It's not the first register access. rtw_mac_power_switch() runs a few
times before things fail.
Bitterblue Smith Jan. 7, 2023, 2:53 p.m. UTC | #11
On 04/01/2023 22:14, Larry Finger wrote:
> On 1/4/23 13:59, Bitterblue Smith wrote:
>> I tested with https://github.com/lwfinger/rtw88/ which should have the
>> same code as wireless-next currently.
> 
> I just rechecked. My repo was missing some changes from wireless-next. It now matches.
> 
> Larry
> 
> 
Did you mean to push some commits? The latest one is still from December.
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/Kconfig b/drivers/net/wireless/realtek/rtw88/Kconfig
index 6b65da81127f..29eb2f8e0eb7 100644
--- a/drivers/net/wireless/realtek/rtw88/Kconfig
+++ b/drivers/net/wireless/realtek/rtw88/Kconfig
@@ -133,6 +133,17 @@  config RTW88_8821CE
 
 	  802.11ac PCIe wireless network adapter
 
+config RTW88_8821CS
+	tristate "Realtek 8821CS SDIO wireless network adapter"
+	depends on MMC
+	select RTW88_CORE
+	select RTW88_SDIO
+	select RTW88_8821C
+	help
+	  Select this option will enable support for 8821CS chipset
+
+	  802.11ac SDIO wireless network adapter
+
 config RTW88_8821CU
 	tristate "Realtek 8821CU USB wireless network adapter"
 	depends on USB
diff --git a/drivers/net/wireless/realtek/rtw88/Makefile b/drivers/net/wireless/realtek/rtw88/Makefile
index 6105c2745bda..82979b30ae8d 100644
--- a/drivers/net/wireless/realtek/rtw88/Makefile
+++ b/drivers/net/wireless/realtek/rtw88/Makefile
@@ -59,6 +59,9 @@  rtw88_8821c-objs		:= rtw8821c.o rtw8821c_table.o
 obj-$(CONFIG_RTW88_8821CE)	+= rtw88_8821ce.o
 rtw88_8821ce-objs		:= rtw8821ce.o
 
+obj-$(CONFIG_RTW88_8821CS)	+= rtw88_8821cs.o
+rtw88_8821cs-objs		:= rtw8821cs.o
+
 obj-$(CONFIG_RTW88_8821CU)	+= rtw88_8821cu.o
 rtw88_8821cu-objs		:= rtw8821cu.o
 
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821cs.c b/drivers/net/wireless/realtek/rtw88/rtw8821cs.c
new file mode 100644
index 000000000000..61f82b38cda4
--- /dev/null
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821cs.c
@@ -0,0 +1,34 @@ 
+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+// Copyright(c) Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+
+#include <linux/mmc/sdio_func.h>
+#include <linux/mmc/sdio_ids.h>
+#include <linux/module.h>
+#include "sdio.h"
+#include "rtw8821c.h"
+
+static const struct sdio_device_id rtw_8821cs_id_table[] =  {
+	{
+		SDIO_DEVICE(SDIO_VENDOR_ID_REALTEK,
+			    SDIO_DEVICE_ID_REALTEK_RTW8821CS),
+		.driver_data = (kernel_ulong_t)&rtw8821c_hw_spec,
+	},
+	{}
+};
+MODULE_DEVICE_TABLE(sdio, rtw_8821cs_id_table);
+
+static struct sdio_driver rtw_8821cs_driver = {
+	.name = "rtw_8821cs",
+	.probe = rtw_sdio_probe,
+	.remove = rtw_sdio_remove,
+	.id_table = rtw_8821cs_id_table,
+	.drv = {
+		.pm = &rtw_sdio_pm_ops,
+		.shutdown = rtw_sdio_shutdown,
+	}
+};
+module_sdio_driver(rtw_8821cs_driver);
+
+MODULE_AUTHOR("Martin Blumenstingl <martin.blumenstingl@googlemail.com>");
+MODULE_DESCRIPTION("Realtek 802.11ac wireless 8821cs driver");
+MODULE_LICENSE("Dual BSD/GPL");