From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <timlee@realtek.com>, <phhuang@realtek.com>, <kevin_yang@realtek.com>
Subject: [PATCH rtw-next 02/13] wifi: rtw89: pci: update SER parameters for suspend/resume
Date: Tue, 10 Mar 2026 16:01:35 +0800 [thread overview]
Message-ID: <20260310080146.31113-3-pkshih@realtek.com> (raw)
In-Reply-To: <20260310080146.31113-1-pkshih@realtek.com>
In suspend mode, SER timer unit is different from normal mode. Set proper
value to prevent expected SER happened during suspend.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw89/pci.h | 1 +
drivers/net/wireless/realtek/rtw89/pci_be.c | 52 +++++++++++++++++++--
2 files changed, 50 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/pci.h b/drivers/net/wireless/realtek/rtw89/pci.h
index ccfa6d33623a..dc488d9a8884 100644
--- a/drivers/net/wireless/realtek/rtw89/pci.h
+++ b/drivers/net/wireless/realtek/rtw89/pci.h
@@ -1016,6 +1016,7 @@
#define B_BE_PL1_IGNORE_HOT_RST BIT(30)
#define B_BE_PL1_TIMER_UNIT_MASK GENMASK(19, 17)
#define PCIE_SER_TIMER_UNIT 0x2
+#define PCIE_SER_WOW_TIMER_UNIT 0x4
#define B_BE_PL1_TIMER_CLEAR BIT(0)
#define R_BE_REG_PL1_MASK 0x34B0
diff --git a/drivers/net/wireless/realtek/rtw89/pci_be.c b/drivers/net/wireless/realtek/rtw89/pci_be.c
index 114f40c6c31b..dea01d9e57fd 100644
--- a/drivers/net/wireless/realtek/rtw89/pci_be.c
+++ b/drivers/net/wireless/realtek/rtw89/pci_be.c
@@ -721,12 +721,24 @@ static int __maybe_unused rtw89_pci_suspend_be(struct device *dev)
{
struct ieee80211_hw *hw = dev_get_drvdata(dev);
struct rtw89_dev *rtwdev = hw->priv;
+ u32 val32;
rtw89_write32_set(rtwdev, R_BE_RSV_CTRL, B_BE_WLOCK_1C_BIT6);
rtw89_write32_set(rtwdev, R_BE_RSV_CTRL, B_BE_R_DIS_PRST);
rtw89_write32_clr(rtwdev, R_BE_RSV_CTRL, B_BE_WLOCK_1C_BIT6);
rtw89_write32_set(rtwdev, R_BE_PCIE_FRZ_CLK, B_BE_PCIE_FRZ_REG_RST);
- rtw89_write32_clr(rtwdev, R_BE_REG_PL1_MASK, B_BE_SER_PM_MASTER_IMR);
+
+ val32 = rtw89_read32(rtwdev, R_BE_SER_PL1_CTRL);
+ if (val32 & B_BE_PL1_SER_PL1_EN) {
+ val32 = u32_replace_bits(val32, PCIE_SER_WOW_TIMER_UNIT,
+ B_BE_PL1_TIMER_UNIT_MASK);
+ rtw89_write32(rtwdev, R_BE_SER_PL1_CTRL, val32);
+
+ if (rtwdev->chip->chip_id == RTL8922A)
+ rtw89_write32_clr(rtwdev, R_BE_REG_PL1_MASK,
+ B_BE_SER_PM_MASTER_IMR);
+ }
+
return 0;
}
@@ -735,12 +747,19 @@ static int __maybe_unused rtw89_pci_resume_be(struct device *dev)
struct ieee80211_hw *hw = dev_get_drvdata(dev);
struct rtw89_dev *rtwdev = hw->priv;
u32 polling;
+ u32 val32;
+ u16 val16;
int ret;
rtw89_write32_set(rtwdev, R_BE_RSV_CTRL, B_BE_WLOCK_1C_BIT6);
rtw89_write32_clr(rtwdev, R_BE_RSV_CTRL, B_BE_R_DIS_PRST);
rtw89_write32_clr(rtwdev, R_BE_RSV_CTRL, B_BE_WLOCK_1C_BIT6);
rtw89_write32_clr(rtwdev, R_BE_PCIE_FRZ_CLK, B_BE_PCIE_FRZ_REG_RST);
+
+ val32 = rtw89_read32(rtwdev, R_BE_SER_PL1_CTRL);
+ if (!(val32 & B_BE_PL1_SER_PL1_EN))
+ goto clear_phy_isr;
+
rtw89_write32_clr(rtwdev, R_BE_SER_PL1_CTRL, B_BE_PL1_SER_PL1_EN);
ret = read_poll_timeout_atomic(rtw89_read32, polling, !polling, 1, 1000,
@@ -748,8 +767,35 @@ static int __maybe_unused rtw89_pci_resume_be(struct device *dev)
if (ret)
rtw89_warn(rtwdev, "[ERR] PCIE SER clear polling fail\n");
- rtw89_write32_set(rtwdev, R_BE_SER_PL1_CTRL, B_BE_PL1_SER_PL1_EN);
- rtw89_write32_set(rtwdev, R_BE_REG_PL1_MASK, B_BE_SER_PM_MASTER_IMR);
+ if (rtwdev->chip->chip_id == RTL8922A)
+ rtw89_write32_set(rtwdev, R_BE_REG_PL1_MASK,
+ B_BE_SER_PM_MASTER_IMR | B_BE_SER_PCLKREQ_ACK_MASK);
+
+ val32 = rtw89_read32(rtwdev, R_BE_SER_PL1_CTRL);
+ val32 = u32_replace_bits(val32, PCIE_SER_TIMER_UNIT, B_BE_PL1_TIMER_UNIT_MASK);
+ val32 |= B_BE_PL1_SER_PL1_EN;
+ rtw89_write32(rtwdev, R_BE_SER_PL1_CTRL, val32);
+
+clear_phy_isr:
+ if (rtwdev->chip->chip_id == RTL8922D) {
+ val16 = rtw89_read16(rtwdev, RAC_DIRECT_OFFESET_L0_G2 +
+ RAC_ANA41 * RAC_MULT);
+ if (val16 & PHY_ERR_FLAG_EN) {
+ rtw89_write16_clr(rtwdev, RAC_DIRECT_OFFESET_L0_G2 +
+ RAC_ANA41 * RAC_MULT, PHY_ERR_FLAG_EN);
+ rtw89_write16_set(rtwdev, RAC_DIRECT_OFFESET_L0_G2 +
+ RAC_ANA41 * RAC_MULT, PHY_ERR_FLAG_EN);
+ }
+
+ val16 = rtw89_read16(rtwdev, RAC_DIRECT_OFFESET_L0_G1 +
+ RAC_ANA41 * RAC_MULT);
+ if (val16 & PHY_ERR_FLAG_EN) {
+ rtw89_write16_clr(rtwdev, RAC_DIRECT_OFFESET_L0_G1 +
+ RAC_ANA41 * RAC_MULT, PHY_ERR_FLAG_EN);
+ rtw89_write16_set(rtwdev, RAC_DIRECT_OFFESET_L0_G1 +
+ RAC_ANA41 * RAC_MULT, PHY_ERR_FLAG_EN);
+ }
+ }
rtw89_pci_basic_cfg(rtwdev, true);
--
2.25.1
next prev parent reply other threads:[~2026-03-10 8:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 8:01 [PATCH rtw-next 00/13] wifi: rtw89: update hardware settings and tweak for MLO Ping-Ke Shih
2026-03-10 8:01 ` [PATCH rtw-next 01/13] wifi: rtw89: mac: finish active TX immediately without waiting for DMAC Ping-Ke Shih
2026-03-12 3:00 ` Ping-Ke Shih
2026-03-10 8:01 ` Ping-Ke Shih [this message]
2026-03-16 6:53 ` [PATCH rtw-next 02/13] wifi: rtw89: pci: update SER parameters for suspend/resume Ping-Ke Shih
2026-03-10 8:01 ` [PATCH rtw-next 03/13] wifi: rtw89: mac: remove A-die off setting for RTL8852C and RTL8922A Ping-Ke Shih
2026-03-10 8:01 ` [PATCH rtw-next 04/13] wifi: rtw89: phy: limit AMPDU number for RA try rate Ping-Ke Shih
2026-03-10 8:01 ` [PATCH rtw-next 05/13] wifi: rtw89: move disabling dynamic mechanism functions to core Ping-Ke Shih
2026-03-10 8:01 ` [PATCH rtw-next 06/13] wifi: rtw89: tweak settings of TX power and channel for Wi-Fi 7 Ping-Ke Shih
2026-03-10 8:01 ` [PATCH rtw-next 07/13] wifi: rtw89: chan: simplify link handling related to ROC Ping-Ke Shih
2026-03-10 8:01 ` [PATCH rtw-next 08/13] wifi: rtw89: chan: recalc MLO DBCC mode based on current entity mode Ping-Ke Shih
2026-03-10 8:01 ` [PATCH rtw-next 09/13] wifi: rtw89: wow: add retry for ensuring packet are processed Ping-Ke Shih
2026-03-10 8:01 ` [PATCH rtw-next 10/13] wifi: rtw89: replace RF mutex with wiphy lock assertion Ping-Ke Shih
2026-03-10 8:01 ` [PATCH rtw-next 11/13] wifi: rtw89: Drop malformed AMPDU frames with abnormal PN Ping-Ke Shih
2026-03-10 8:01 ` [PATCH rtw-next 12/13] wifi: rtw89: Recalculate station aggregates when AMSDU length changes for MLO links Ping-Ke Shih
2026-03-10 8:01 ` [PATCH rtw-next 13/13] wifi: rtw89: debug: simulate Wi-Fi 7 SER L0/L1 without PS mode 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=20260310080146.31113-3-pkshih@realtek.com \
--to=pkshih@realtek.com \
--cc=kevin_yang@realtek.com \
--cc=linux-wireless@vger.kernel.org \
--cc=phhuang@realtek.com \
--cc=timlee@realtek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox