Linux-Wireless Archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@gmail.com>
To: Kalle Valo <kvalo@kernel.org>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org,
	Larry Finger <Larry.Finger@gmail.com>,
	stable@vger.kernel.org
Subject: [RFC] rtw88: Fix startup problems for SDIO wifi plus UART Bluetooth
Date: Thu, 11 Apr 2024 01:26:55 +0000	[thread overview]
Message-ID: <4umro86wvv84.MjDfYvt4P5uZryt8boBK8Q2@1EHFQ.trk.elasticemail.com> (raw)

As discussed in the links below, the SDIO part of RTW8821CS fails to
start correctly if such startup happens while the UART portion of
the chip is initializing. The logged results with such failure is

[   10.230516] rtw_8821cs mmc3:0001:1: Start of rtw_sdio_probe
[   10.306569] Bluetooth: HCI UART driver ver 2.3
[   10.306717] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   10.307167] of_dma_request_slave_channel: dma-names property of node '/serial@fe650000' missing or empty
[   10.307199] dw-apb-uart fe650000.serial: failed to request DMA
[   10.543474] rtw_8821cs mmc3:0001:1: Firmware version 24.8.0, H2C version 12
[   10.730744] rtw_8821cs mmc3:0001:1: sdio read32 failed (0x11080): -110
[   10.730923] rtw_8821cs mmc3:0001:1: sdio write32 failed (0x11080): -110

Due to the above errors, wifi fails to work.

For those instances when wifi works, the following is logged:

[   10.452861] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   10.453580] of_dma_request_slave_channel: dma-names property of node '/serial@fe650000' missing or empty
[   10.453621] dw-apb-uart fe650000.serial: failed to request DMA
[   10.455741] rtw_8821cs mmc3:0001:1: Start of rtw_sdio_probe
[   10.639186] rtw_8821cs mmc3:0001:1: Firmware version 24.8.0, H2C version 12

In this case, SDIO wifi works correctly. The correct case is ensured by
adding an mdelay(500) statement before the call to rtw_core_init(). No
adverse effects are observed.

Link: https://1EHFQ.trk.elasticemail.com/tracking/click?d=1UfsVowwwMAM6kBoyumkHP3o7pYa4kGXhuklYI-QPLuVUi2ohkUG8HssjZcN67C_2TySHAezxTUVFT_8wvKkE9xqzm8H8qwhbclOJ9HB0cExNK65eHoXK4LaCW3PT7iyvMI3d6qqwN6PHhYj2GEblxeP4xr4CJPwZE7lyMCRTuxZ0
Link: https://1EHFQ.trk.elasticemail.com/tracking/click?d=XUEf4t8W9xt0czASPOeeDt8BnPqLK_YeGMMwadyXNu17p5TeSDk6RmEZ25rBt0-C5d-GR5IlKqu5URoKaespUAOAffgoysVTLbvgzQoAO57Ix1ChR-fYsf2VGRa1vIR9iWmNK1bUBvdHTZb0StprYVFMTYNi3fpihu3YoQYbaiZsYjqFovexmfiXfyHM3S00rqaJrXQwoylF4bELv8WaAC-QQM6OuDzE6rb32eW83smj0
Fixes: 65371a3f14e7 ("wifi: rtw88: sdio: Add HCI implementation for SDIO based chipsets")
Signed-off-by: Larry Finger <Larry.Finger@gmail.com>
Cc: stable@vger.kernel.org # v6.4+
---
 drivers/net/wireless/realtek/rtw88/sdio.c | 28 +++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
index 0cae5746f540..eec0ad85be72 100644
--- a/drivers/net/wireless/realtek/rtw88/sdio.c
+++ b/drivers/net/wireless/realtek/rtw88/sdio.c
@@ -1325,6 +1325,34 @@ int rtw_sdio_probe(struct sdio_func *sdio_func,
 	rtwdev->hci.ops = &rtw_sdio_ops;
 	rtwdev->hci.type = RTW_HCI_TYPE_SDIO;
 
+	/* Insert a delay of 500 ms. Without the delay, the wifi part
+	 * and the UART that controls Bluetooth interfere with one
+	 * another resulting in the following being logged:
+	 *
+	 * Start of SDIO probe function.
+	 * Bluetooth: HCI UART driver ver 2.3
+	 * Bluetooth: HCI UART protocol Three-wire (H5) registered
+	 * of_dma_request_slave_channel: dma-names property of node '/serial@fe650000'
+	 *	 missing or empty
+	 * dw-apb-uart fe650000.serial: failed to request DMA
+`	 * rtw_8821cs mmc3:0001:1: Firmware version 24.8.0, H2C version 12
+	 * rtw_8821cs mmc3:0001:1: sdio read32 failed (0x11080): -110
+	 *
+	 * If the UART is finished initializing before the SDIO probe
+	 * function startw, the following is logged:
+	 *
+	 * Bluetooth: HCI UART protocol Three-wire (H5) registered
+	 * of_dma_request_slave_channel: dma-names property of node '/serial@fe650000'
+	 *	missing or empty
+	 * dw-apb-uart fe650000.serial: failed to request DMA
+	 * Start of SDIO probe function.
+	 * rtw_8821cs mmc3:0001:1: Firmware version 24.8.0, H2C version 12
+	 * Bluetooth: hci0: RTL: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8821
+	 * SDIO wifi works correctly.
+	 *
+	 * No adverse effects are observed from the delay.
+	 */
+	mdelay(500);
 	ret = rtw_core_init(rtwdev);
 	if (ret)
 		goto err_release_hw;
-- 
2.44.0


https://1EHFQ.trk.elasticemail.com/tracking/unsubscribe?d=Q8ssbFKKxFyDYflgetP6nBeacBsR9zpdaz0g6MwIeA6CJKd2sQMmPI9ONTwNj6faC9CgSWZc53ZQ96HQFrbDSPngQHeCyqSokhmrQJQALWxI0

             reply	other threads:[~2024-04-11  1:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11  1:26 Larry Finger [this message]
2024-04-11  2:13 ` [RFC] rtw88: Fix startup problems for SDIO wifi plus UART Bluetooth Ping-Ke Shih
2024-04-11  2:47   ` Larry Finger
2024-04-11  4:25     ` Ping-Ke Shih
2024-04-11  7:08     ` Kalle Valo
2024-04-11 17:28       ` Larry Finger
2024-04-15  0:45         ` Ping-Ke Shih
2024-04-15  1:23           ` Larry Finger

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=4umro86wvv84.MjDfYvt4P5uZryt8boBK8Q2@1EHFQ.trk.elasticemail.com \
    --to=larry.finger@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 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 read-only IMAP folder(s) and NNTP newsgroup(s).