From: Ping-Ke Shih <pkshih@realtek.com>
To: Bitterblue Smith <rtl8821cerfe2@gmail.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: RE: [PATCH rtw-next v1 09/13] wifi: rtw89: Fix rtw89_mac_power_switch() for USB
Date: Mon, 26 May 2025 02:45:08 +0000 [thread overview]
Message-ID: <16d3081da058414688043e2a318d2f6a@realtek.com> (raw)
In-Reply-To: <2c6d27e3-49bf-4fe8-87ea-4cd9f5b1d4df@gmail.com>
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> On 13/05/2025 06:50, Ping-Ke Shih wrote:
> > Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> >> Clear some bits in some registers in order to allow RTL8851BU to power
> >> on. Also tested with RTL8832BU and RTL8832CU.
> >
> > I see mac_pwr_on_pcie_8851b() and mac_pwr_on_usb_8851b() at least in
> > vendor driver. If you use the power on/off functions for USB devices,
> > the problem may disappear.
> >
>
> I modified rtw8851b_pwr_on_func() and rtw8851b_pwr_off_func() to match
> mac_pwr_on_usb_8851b() and mac_pwr_off_usb_8851b(). It wasn't enough.
The vendor driver does different things for USB and PCI, so please take
them please.
> Without this patch the firmware upload still fails:
>
> [ 1238.299960] rtw89_8851bu 1-2:1.2: Firmware version 0.29.41.3 (65cefb31), cmd version 0, type 5
> [ 1238.299970] rtw89_8851bu 1-2:1.2: Firmware version 0.29.41.3 (65cefb31), cmd version 0, type 3
> [ 1238.523187] Bluetooth: hci1: RTL: fw version 0x048ad230
> [ 1238.607110] Bluetooth: hci1: AOSP extensions version v1.00
> [ 1238.622986] Bluetooth: MGMT ver 1.23
> [ 1388.109364] rtw89_8851bu 1-2:1.2: [ERR]H2C path ready
> [ 1388.109751] rtw89_8851bu 1-2:1.2: [ERR]fwdl 0x1E0 = 0xc1
> [ 1388.110115] rtw89_8851bu 1-2:1.2: [ERR]fwdl 0x83F0 = 0x120090
> [ 1388.111615] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cd07
> [ 1388.111984] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cde5
> [ 1388.112358] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cd2b
> [ 1388.112740] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890ef05
> [ 1388.113110] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cd2b
> [ 1388.113510] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cce3
> [ 1388.113868] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cce3
> [ 1388.114234] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cded
> [ 1388.114693] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cce3
> [ 1388.114986] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cce3
> [ 1388.115358] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cde9
> [ 1388.115735] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cce3
> [ 1388.116109] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cce3
> [ 1388.116480] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb89957b3
> [ 1388.116867] rtw89_8851bu 1-2:1.2: [ERR]fw PC = 0xb890cce3
>
> (By the way, 150 seconds is a long time and this is just the first batch
> of error messages. There are at least two more like the above and each
> takes another 150 seconds to appear. Things freeze:
>
> [ 1475.693454] INFO: task systemd-journal:284 blocked for more than 122 seconds.
> [ 1475.693750] INFO: task kded6:853 blocked for more than 122 seconds.
> [ 1598.573772] INFO: task upowerd:1021 blocked for more than 122 seconds.
>
> I haven't figured out how to fix this long delay yet.)
>
> >>
> >> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> >> ---
> >> drivers/net/wireless/realtek/rtw89/mac.c | 8 ++++++++
> >> drivers/net/wireless/realtek/rtw89/reg.h | 1 +
> >> 2 files changed, 9 insertions(+)
> >>
> >> diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
> >> index 99f01fff90fe..d3cf67dfabc9 100644
> >> --- a/drivers/net/wireless/realtek/rtw89/mac.c
> >> +++ b/drivers/net/wireless/realtek/rtw89/mac.c
> >> @@ -1458,6 +1458,14 @@ static int rtw89_mac_power_switch(struct rtw89_dev *rtwdev, bool on)
> >> int ret;
> >> u8 val;
> >>
> >> + if (rtwdev->hci.type == RTW89_HCI_TYPE_USB &&
> >> + rtw89_read32_mask(rtwdev, R_AX_GPIO_MUXCFG, B_AX_BOOT_MODE)) {
> >
> > Not prefer calling a function in if-statement. Suggest to add a function.
> >
>
> Do you mean add a variable?
>
> boot_mode = rtw89_read32_mask(rtwdev, R_AX_GPIO_MUXCFG, B_AX_BOOT_MODE);
>
> if (rtwdev->hci.type == RTW89_HCI_TYPE_USB && boot_mode) {
Yes. I prefer this. But I knew originally you would not do the IO before
checking HCI type. So, I suggested to add a function like
(the naming is not good though)
void rtw89_mac_power_switch_hci(rtwdev, ...)
{
if (!USB)
return;
val = rtw89_read32_mask(rtwdev, R_AX_GPIO_MUXCFG, B_AX_BOOT_MODE));
if (!val)
return;
// do the IO you want.
}
>
>
> >> + rtw89_write32_clr(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFN_ONMAC);
> >> + rtw89_write32_clr(rtwdev, R_AX_SYS_STATUS1, B_AX_AUTO_WLPON);
> >> + rtw89_write32_clr(rtwdev, R_AX_GPIO_MUXCFG, B_AX_BOOT_MODE);
> >> + rtw89_write32_clr(rtwdev, R_AX_RSV_CTRL, B_AX_R_DIS_PRST);
> >> + }
> >> +
> >> if (on) {
> >> cfg_seq = chip->pwr_on_seq;
> >> cfg_func = chip->ops->pwr_on_func;
> >
next prev parent reply other threads:[~2025-05-26 2:45 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-04 20:47 [PATCH rtw-next v1 00/13] wifi: rtw89: Add support for USB devices Bitterblue Smith
2025-05-04 20:49 ` [PATCH rtw-next v1 01/13] wifi: rtw89: 8851b: Accept USB devices and load their MAC address Bitterblue Smith
2025-05-13 2:46 ` Ping-Ke Shih
2025-05-04 20:49 ` [PATCH rtw-next v1 02/13] wifi: rtw89: Get dle_mem via rtw89_hci_dle_mem() Bitterblue Smith
2025-05-13 2:51 ` Ping-Ke Shih
2025-05-14 0:56 ` Ping-Ke Shih
2025-05-25 22:04 ` Bitterblue Smith
2025-05-26 2:52 ` Ping-Ke Shih
2025-05-04 20:49 ` [PATCH rtw-next v1 03/13] wifi: rtw89: Rename hfc_param_ini to hfc_param_ini_pcie Bitterblue Smith
2025-05-13 3:04 ` Ping-Ke Shih
2025-05-04 20:50 ` [PATCH rtw-next v1 04/13] wifi: rtw89: Add dle_mem_usb2 and dle_mem_usb3 Bitterblue Smith
2025-05-13 3:06 ` Ping-Ke Shih
2025-05-04 20:51 ` [PATCH rtw-next v1 05/13] wifi: rtw89: Add hfc_param_ini_usb Bitterblue Smith
2025-05-13 3:12 ` Ping-Ke Shih
2025-05-25 21:55 ` Bitterblue Smith
2025-05-26 1:51 ` Ping-Ke Shih
2025-05-26 6:29 ` Ping-Ke Shih
2025-05-31 20:57 ` Bitterblue Smith
2025-05-31 20:54 ` Bitterblue Smith
2025-05-04 20:51 ` [PATCH rtw-next v1 06/13] wifi: rtw89: Disable some power saving for USB Bitterblue Smith
2025-05-13 3:27 ` Ping-Ke Shih
2025-05-25 21:57 ` Bitterblue Smith
2025-05-26 2:36 ` Ping-Ke Shih
2025-05-04 20:51 ` [PATCH rtw-next v1 07/13] wifi: rtw89: Add extra TX headroom " Bitterblue Smith
2025-05-13 3:28 ` Ping-Ke Shih
2025-05-04 20:52 ` [PATCH rtw-next v1 08/13] wifi: rtw89: Hide some errors when the device is unplugged Bitterblue Smith
2025-05-13 3:43 ` Ping-Ke Shih
2025-05-25 21:58 ` Bitterblue Smith
2025-05-04 20:52 ` [PATCH rtw-next v1 09/13] wifi: rtw89: Fix rtw89_mac_power_switch() for USB Bitterblue Smith
2025-05-13 3:50 ` Ping-Ke Shih
2025-05-25 21:58 ` Bitterblue Smith
2025-05-26 2:45 ` Ping-Ke Shih [this message]
2025-05-04 20:53 ` [PATCH rtw-next v1 10/13] wifi: rtw89: Add some definitions " Bitterblue Smith
2025-05-13 3:52 ` Ping-Ke Shih
2025-05-04 20:54 ` [PATCH rtw-next v1 11/13] wifi: rtw89: Add usb.{c,h} Bitterblue Smith
2025-05-13 6:12 ` Ping-Ke Shih
2025-05-25 22:03 ` Bitterblue Smith
2025-05-26 3:18 ` Ping-Ke Shih
2025-05-31 21:03 ` Bitterblue Smith
2025-05-04 20:54 ` [PATCH rtw-next v1 12/13] wifi: rtw89: Add rtw8851bu.c Bitterblue Smith
2025-05-13 6:14 ` Ping-Ke Shih
2025-05-04 20:55 ` [PATCH rtw-next v1 13/13] wifi: rtw89: Enable the new USB modules Bitterblue Smith
2025-05-13 6:14 ` Ping-Ke Shih
2025-05-13 6:22 ` [PATCH rtw-next v1 00/13] wifi: rtw89: Add support for USB devices Ping-Ke Shih
2025-05-13 7:07 ` Ping-Ke Shih
2025-05-25 22:03 ` Bitterblue Smith
2025-05-26 1:35 ` Ping-Ke Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16d3081da058414688043e2a318d2f6a@realtek.com \
--to=pkshih@realtek.com \
--cc=linux-wireless@vger.kernel.org \
--cc=rtl8821cerfe2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.