diff mbox series

[2/4] wifi: rtw88: 8821cu: Fix connection failure

Message ID 8770f25c-1dcb-48c6-9279-cd6de158dfec@gmail.com
State Superseded
Headers show
Series [1/4] wifi: rtw88: 8821cu: Fix firmware upload fail | expand

Commit Message

Bitterblue Smith Feb. 27, 2024, 12:19 p.m. UTC
Clear bit 8 of REG_SYS_STATUS1 after MAC power on.

Without this, some RTL8821CU and RTL8811CU cannot connect to any
network:

Feb 19 13:33:11 ideapad2 kernel: wlp3s0f3u2: send auth to
	90:55:de:__:__:__ (try 1/3)
Feb 19 13:33:13 ideapad2 kernel: wlp3s0f3u2: send auth to
	90:55:de:__:__:__ (try 2/3)
Feb 19 13:33:14 ideapad2 kernel: wlp3s0f3u2: send auth to
	90:55:de:__:__:__ (try 3/3)
Feb 19 13:33:15 ideapad2 kernel: wlp3s0f3u2: authentication with
	90:55:de:__:__:__ timed out

The RTL8822CU and RTL8822BU out-of-tree drivers do this as well, so do
it for all three types of chips.

Tested with RTL8811CU (Tenda U9 V2.0).

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
 drivers/net/wireless/realtek/rtw88/mac.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Ping-Ke Shih Feb. 29, 2024, 3:42 a.m. UTC | #1
> -----Original Message-----
> From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> Sent: Tuesday, February 27, 2024 8:19 PM
> To: linux-wireless@vger.kernel.org
> Cc: Ping-Ke Shih <pkshih@realtek.com>; Sascha Hauer <sha@pengutronix.de>
> Subject: [PATCH 2/4] wifi: rtw88: 8821cu: Fix connection failure
> 
> Clear bit 8 of REG_SYS_STATUS1 after MAC power on.
> 
> Without this, some RTL8821CU and RTL8811CU cannot connect to any
> network:
> 
> Feb 19 13:33:11 ideapad2 kernel: wlp3s0f3u2: send auth to
>         90:55:de:__:__:__ (try 1/3)
> Feb 19 13:33:13 ideapad2 kernel: wlp3s0f3u2: send auth to
>         90:55:de:__:__:__ (try 2/3)
> Feb 19 13:33:14 ideapad2 kernel: wlp3s0f3u2: send auth to
>         90:55:de:__:__:__ (try 3/3)
> Feb 19 13:33:15 ideapad2 kernel: wlp3s0f3u2: authentication with
>         90:55:de:__:__:__ timed out
> 
> The RTL8822CU and RTL8822BU out-of-tree drivers do this as well, so do
> it for all three types of chips.
> 
> Tested with RTL8811CU (Tenda U9 V2.0).
> 
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> ---
>  drivers/net/wireless/realtek/rtw88/mac.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
> index 298663b03580..a3b2c57c5503 100644
> --- a/drivers/net/wireless/realtek/rtw88/mac.c
> +++ b/drivers/net/wireless/realtek/rtw88/mac.c
> @@ -309,6 +309,14 @@ static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on)
>         pwr_seq = pwr_on ? chip->pwr_on_seq : chip->pwr_off_seq;
>         ret = rtw_pwr_seq_parser(rtwdev, pwr_seq);
> 
> +       if (pwr_seq == chip->pwr_on_seq &&

we can just check this by 'pwr_on'.

> +           rtw_hci_type(rtwdev) == RTW_HCI_TYPE_USB) {
> +               if (chip->id == RTW_CHIP_TYPE_8822C ||
> +                   chip->id == RTW_CHIP_TYPE_8822B ||
> +                   chip->id == RTW_CHIP_TYPE_8821C)
> +                       rtw_write8_clr(rtwdev, REG_SYS_STATUS1 + 1, BIT(0));
> +       }
> +
>         if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_SDIO)
>                 rtw_write32(rtwdev, REG_SDIO_HIMR, imr);
> 
> --
> 2.43.2
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
index 298663b03580..a3b2c57c5503 100644
--- a/drivers/net/wireless/realtek/rtw88/mac.c
+++ b/drivers/net/wireless/realtek/rtw88/mac.c
@@ -309,6 +309,14 @@  static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on)
 	pwr_seq = pwr_on ? chip->pwr_on_seq : chip->pwr_off_seq;
 	ret = rtw_pwr_seq_parser(rtwdev, pwr_seq);
 
+	if (pwr_seq == chip->pwr_on_seq &&
+	    rtw_hci_type(rtwdev) == RTW_HCI_TYPE_USB) {
+		if (chip->id == RTW_CHIP_TYPE_8822C ||
+		    chip->id == RTW_CHIP_TYPE_8822B ||
+		    chip->id == RTW_CHIP_TYPE_8821C)
+			rtw_write8_clr(rtwdev, REG_SYS_STATUS1 + 1, BIT(0));
+	}
+
 	if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_SDIO)
 		rtw_write32(rtwdev, REG_SDIO_HIMR, imr);