Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: JB Tsai <jb.tsai@mediatek.com>
To: <nbd@nbd.name>, <lorenzo@kernel.org>
Cc: <linux-wireless@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>, <Sean.Wang@mediatek.com>,
	<Yung-lun.Chien@mediatek.com>, <jb.tsai@mediatek.com>,
	allen.chien <yung-lun.chien@mediatek.com>
Subject: [PATCH] wifi: mt76: mt7925: program the fixed rate table via MCU on MT7928
Date: Wed, 11 Nov 2026 10:27:41 +0800	[thread overview]
Message-ID: <20261111022741.783970-1-jb.tsai@mediatek.com> (raw)

From: "allen.chien" <yung-lun.chien@mediatek.com>

MT7928 drops host MMIO writes to the WTBLON CRs, so the legacy rates
written by mt7925_mac_set_fixed_rate_table() never reach the FR table
and the firmware falls back to defaults.

Program the table through the MCU REG_ACCESS command instead, using
mt7925_mcu_regval(), and log an error if any of the writes is rejected.

Signed-off-by: allen.chien <yung-lun.chien@mediatek.com>
---
 .../net/wireless/mediatek/mt76/mt7925/mac.c   | 25 ++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
index 7af996abe294..9dcd65725d0a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
@@ -167,10 +167,29 @@ void mt7925_mac_set_fixed_rate_table(struct mt792x_dev *dev,
 	u32 ctrl = MT_WTBL_ITCR_WR | MT_WTBL_ITCR_EXEC | tbl_idx;
 
 	if (is_mt7928(&dev->mt76)) {
-		mt76_wr(dev, MT7928_WTBL_ITDR0, rate_idx);
+		/* MT7928 drops host writes to the WTBLON CRs (reads still
+		 * work), so program the table through MCU REG_ACCESS.
+		 */
+		u32 spe = MT_WTBL_SPE_IDX_SEL;
+		u32 rate = rate_idx;
+		int ret;
+
+		ret = mt7925_mcu_regval(dev, MT7928_WTBL_ITDR0, &rate, true);
+		if (ret)
+			goto out;
 		/* use wtbl spe idx */
-		mt76_wr(dev, MT7928_WTBL_ITDR1, MT_WTBL_SPE_IDX_SEL);
-		mt76_wr(dev, MT7928_WTBL_ITCR, ctrl);
+		ret = mt7925_mcu_regval(dev, MT7928_WTBL_ITDR1, &spe, true);
+		if (ret)
+			goto out;
+		ret = mt7925_mcu_regval(dev, MT7928_WTBL_ITCR, &ctrl, true);
+		if (ret)
+			goto out;
+
+		return;
+out:
+		dev_err(dev->mt76.dev,
+			"failed to set fixed rate table idx %u: %d\n",
+			tbl_idx, ret);
 	} else {
 		mt76_wr(dev, MT_WTBL_ITDR0, rate_idx);
 		/* use wtbl spe idx */
-- 
2.45.2



                 reply	other threads:[~2026-11-11  2:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261111022741.783970-1-jb.tsai@mediatek.com \
    --to=jb.tsai@mediatek.com \
    --cc=Sean.Wang@mediatek.com \
    --cc=Yung-lun.Chien@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    /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