From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <ku920601@realtek.com>, <kevin_yang@realtek.com>
Subject: [PATCH rtw-next 6/7] wifi: rtw89: coex: offload 8852C IO writes via firmware CMD pack region
Date: Wed, 23 Sep 2026 15:13:53 +0800 [thread overview]
Message-ID: <20260923071354.50864-7-pkshih@realtek.com> (raw)
In-Reply-To: <20260923071354.50864-1-pkshih@realtek.com>
From: Ching-Te Ku <ku920601@realtek.com>
On USB, 8852C is the only chip with .support_fw_cmd_ofld set, which
routes register writes through the FW command offload path via the
transparent io_ops indirection. The coex layer never entered an
rtw89_io_pack() region, so its register writes were always issued
individually instead of being batched to the firmware.
Wrap the RF LUT and GNT write sequences in rtw8852c_btc_init_cfg(),
rtw8852c_btc_wl_s1_standby() and rtw8852c_set_wl_lna2() with
rtw89_io_pack()/rtw89_io_unpack() so that on USB these writes are
enqueued and flushed as a single FW command batch. On PCIe the pack
region is a no-op and raw MMIO proceeds unchanged.
Only write_rf partial-mask, write-only sequences are offloaded, for
which the firmware performs the read-modify-write. Driver-side
same-register read-modify-write helpers and BB phy_write32 flows are
kept outside the pack region to avoid the offload full-dword
overwrite hazard.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
index c68959b63a01..7649706b67e6 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
@@ -2706,6 +2706,8 @@ static void rtw8852c_btc_init_cfg(struct rtw89_dev *rtwdev)
chip->ops->btc_set_wl_pri(rtwdev, BTC_PRI_MASK_TX_RESP, true);
chip->ops->btc_set_wl_pri(rtwdev, BTC_PRI_MASK_BEACON, true);
+ rtw89_io_pack(rtwdev);
+
/* set rf gnt debug off */
rtw89_write_rf(rtwdev, RF_PATH_A, RR_WLSEL, RFREG_MASK, 0x0);
rtw89_write_rf(rtwdev, RF_PATH_B, RR_WLSEL, RFREG_MASK, 0x0);
@@ -2733,6 +2735,8 @@ static void rtw8852c_btc_init_cfg(struct rtw89_dev *rtwdev)
rtw89_write32_set(rtwdev,
R_AX_BT_CNT_CFG, B_AX_BT_CNT_EN |
B_AX_BT_CNT_RST_V1);
+
+ rtw89_io_unpack(rtwdev);
}
static
@@ -2888,6 +2892,8 @@ void rtw8852c_btc_update_bt_cnt(struct rtw89_dev *rtwdev)
static
void rtw8852c_btc_wl_s1_standby(struct rtw89_dev *rtwdev, bool state)
{
+ rtw89_io_pack(rtwdev);
+
rtw89_write_rf(rtwdev, RF_PATH_B, RR_LUTWE, RFREG_MASK, 0x80000);
rtw89_write_rf(rtwdev, RF_PATH_B, RR_LUTWA, RFREG_MASK, 0x1);
rtw89_write_rf(rtwdev, RF_PATH_B, RR_LUTWD1, RFREG_MASK, 0x620);
@@ -2901,6 +2907,8 @@ void rtw8852c_btc_wl_s1_standby(struct rtw89_dev *rtwdev, bool state)
RFREG_MASK, 0x208);
rtw89_write_rf(rtwdev, RF_PATH_B, RR_LUTWE, RFREG_MASK, 0x0);
+
+ rtw89_io_unpack(rtwdev);
}
static void rtw8852c_set_wl_lna2(struct rtw89_dev *rtwdev, u8 level)
@@ -2910,6 +2918,8 @@ static void rtw8852c_set_wl_lna2(struct rtw89_dev *rtwdev, u8 level)
* To improve BT ACI in co-rx
*/
+ rtw89_io_pack(rtwdev);
+
switch (level) {
case 0: /* default */
rtw89_write_rf(rtwdev, RF_PATH_B, RR_LUTWE, RFREG_MASK, 0x1000);
@@ -2936,6 +2946,8 @@ static void rtw8852c_set_wl_lna2(struct rtw89_dev *rtwdev, u8 level)
rtw89_write_rf(rtwdev, RF_PATH_B, RR_LUTWE, RFREG_MASK, 0x0);
break;
}
+
+ rtw89_io_unpack(rtwdev);
}
static void rtw8852c_btc_set_wl_rx_gain(struct rtw89_dev *rtwdev, u32 level)
--
2.25.1
next prev parent reply other threads:[~2026-09-23 7:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 7:13 [PATCH rtw-next 0/7] wifi: rtw89: coex: update to support newer firmware especially RTL8852C Ping-Ke Shih
2026-09-23 7:13 ` [PATCH rtw-next 1/7] wifi: rtw89: coex: log FCX report version mismatch without dropping Ping-Ke Shih
2026-09-30 2:14 ` Ping-Ke Shih
2026-09-23 7:13 ` [PATCH rtw-next 2/7] wifi: rtw89: coex: add fbtc_rpt_ctrl v205 report struct and handling Ping-Ke Shih
2026-09-23 7:13 ` [PATCH rtw-next 3/7] wifi: rtw89: coex: Add firmware 0.27.130.1 support for RTL8852C Ping-Ke Shih
2026-09-23 7:13 ` [PATCH rtw-next 4/7] wifi: rtw89: coex: fix BT scoreboard update for non-C2H paths Ping-Ke Shih
2026-09-23 7:13 ` [PATCH rtw-next 5/7] wifi: rtw89: add instance of IO ops for (un)pack and [um]delay Ping-Ke Shih
2026-09-23 7:13 ` Ping-Ke Shih [this message]
2026-09-23 7:13 ` [PATCH rtw-next 7/7] wifi: rtw89: coex: batch PTA init with masked IO offload 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=20260923071354.50864-7-pkshih@realtek.com \
--to=pkshih@realtek.com \
--cc=kevin_yang@realtek.com \
--cc=ku920601@realtek.com \
--cc=linux-wireless@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