public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
Cc: Felix Fietkau <nbd@nbd.name>, Sean Wang <sean.wang@mediatek.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Shayne Chen <shayne.chen@mediatek.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	linux-wireless@vger.kernel.org, Rex Lu <rex.lu@mediatek.com>
Subject: Re: [PATCH net-next] net: mediatek: wed: Introduce MT7992 WED support
Date: Mon, 28 Jul 2025 17:28:41 +0200	[thread overview]
Message-ID: <aIeXKRmGxDROUDHt@lore-rh-laptop> (raw)
In-Reply-To: <9314b674-dadb-4749-a792-bd4053eaae04@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 8591 bytes --]

> On 2025-07-27 2:50 PM, Lorenzo Bianconi wrote:
> > Introduce the second WDMA RX ring in WED driver since Meditake MT7992
> 
> s/Meditake/Mediatek

ack, I will fix it in v2.

> 
> > WiFi chipset support two separated WDMA rings. This is a preliminary
> 
> s/support/supports

ack, I will fix it in v2.

> 
> > patch to properly support WED for MT7992 in MT76 driver.
> > 
> > Co-developed-by: Rex Lu <rex.lu@mediatek.com>
> > Signed-off-by: Rex Lu <rex.lu@mediatek.com>
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > ---
> >   drivers/net/ethernet/mediatek/mtk_wed.c          | 33 +++++++++++++++++++-----
> >   drivers/net/ethernet/mediatek/mtk_wed.h          |  2 +-
> >   drivers/net/wireless/mediatek/mt76/mt7915/mmio.c |  6 ++---
> >   drivers/net/wireless/mediatek/mt76/mt7996/mmio.c | 12 ++++-----
> >   include/linux/soc/mediatek/mtk_wed.h             |  2 +-
> >   5 files changed, 38 insertions(+), 17 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
> > index 73c26fcfd85e7be3040abea8e80ff4bee881016c..44a7b4b9d5a4e7cb2c6173ff97024ef74c241058 100644
> > --- a/drivers/net/ethernet/mediatek/mtk_wed.c
> > +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
> > @@ -59,7 +59,9 @@ struct mtk_wed_flow_block_priv {
> >   static const struct mtk_wed_soc_data mt7622_data = {
> >   	.regmap = {
> >   		.tx_bm_tkid		= 0x088,
> > -		.wpdma_rx_ring0		= 0x770,
> > +		.wpdma_rx_ring = {
> > +			0x770,
> > +		},
> >   		.reset_idx_tx_mask	= GENMASK(3, 0),
> >   		.reset_idx_rx_mask	= GENMASK(17, 16),
> >   	},
> > @@ -70,7 +72,9 @@ static const struct mtk_wed_soc_data mt7622_data = {
> >   static const struct mtk_wed_soc_data mt7986_data = {
> >   	.regmap = {
> >   		.tx_bm_tkid		= 0x0c8,
> > -		.wpdma_rx_ring0		= 0x770,
> > +		.wpdma_rx_ring = {
> > +			0x770,
> > +		},
> >   		.reset_idx_tx_mask	= GENMASK(1, 0),
> >   		.reset_idx_rx_mask	= GENMASK(7, 6),
> >   	},
> > @@ -81,7 +85,10 @@ static const struct mtk_wed_soc_data mt7986_data = {
> >   static const struct mtk_wed_soc_data mt7988_data = {
> 
> In the patch description you mention the mt7992 chip, however you are adding
> a second rx_ring definition for the mt7988, is this correct?

yes, since MT7992 is the WiFi chiset that is the WED funcationality consumer
while MT7988 is the SoC ethernet controller. I will add more info in the commit
log.

> 
> >   	.regmap = {
> >   		.tx_bm_tkid		= 0x0c8,
> > -		.wpdma_rx_ring0		= 0x7d0,
> > +		.wpdma_rx_ring = {
> > +			0x7d0,
> > +			0x7d8,
> > +		},
> >   		.reset_idx_tx_mask	= GENMASK(1, 0),
> >   		.reset_idx_rx_mask	= GENMASK(7, 6),
> >   	},
> > @@ -621,8 +628,8 @@ mtk_wed_amsdu_init(struct mtk_wed_device *dev)
> >   		return ret;
> >   	}
> > -	/* eagle E1 PCIE1 tx ring 22 flow control issue */
> > -	if (dev->wlan.id == 0x7991)
> > +	/* Kite and Eagle E1 PCIE1 tx ring 22 flow control issue */
> > +	if (dev->wlan.id == 0x7991 || dev->wlan.id == 0x7992)
> >   		wed_clr(dev, MTK_WED_AMSDU_FIFO, MTK_WED_AMSDU_IS_PRIOR0_RING);
> >   	wed_set(dev, MTK_WED_CTRL, MTK_WED_CTRL_TX_AMSDU_EN);
> > @@ -1239,7 +1246,11 @@ mtk_wed_set_wpdma(struct mtk_wed_device *dev)
> >   		return;
> >   	wed_w32(dev, MTK_WED_WPDMA_RX_GLO_CFG, dev->wlan.wpdma_rx_glo);
> > -	wed_w32(dev, dev->hw->soc->regmap.wpdma_rx_ring0, dev->wlan.wpdma_rx);
> > +	wed_w32(dev, dev->hw->soc->regmap.wpdma_rx_ring[0],
> > +		dev->wlan.wpdma_rx[0]);
> > +	if (mtk_wed_is_v3(dev->hw))
> 
> You also have mtk_wed_is_v3_or_greater() defined in the header, why not use
> that?

ack, I will fix it in v2.

Regards,
Lorenzo

> 
> > +		wed_w32(dev, dev->hw->soc->regmap.wpdma_rx_ring[1],
> > +			dev->wlan.wpdma_rx[1]);
> >   	if (!dev->wlan.hw_rro)
> >   		return;
> > @@ -2323,6 +2334,16 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
> >   		if (!dev->rx_wdma[i].desc)
> >   			mtk_wed_wdma_rx_ring_setup(dev, i, 16, false);
> > +	if (dev->wlan.hw_rro) {
> > +		for (i = 0; i < MTK_WED_RX_PAGE_QUEUES; i++) {
> > +			u32 addr = MTK_WED_RRO_MSDU_PG_CTRL0(i) +
> > +				   MTK_WED_RING_OFS_COUNT;
> > +
> > +			if (!wed_r32(dev, addr))
> > +				wed_w32(dev, addr, 1);
> > +		}
> > +	}
> > +
> >   	mtk_wed_hw_init(dev);
> >   	mtk_wed_configure_irq(dev, irq_mask);
> > diff --git a/drivers/net/ethernet/mediatek/mtk_wed.h b/drivers/net/ethernet/mediatek/mtk_wed.h
> > index c1f0479d7a7182919e77c40efc30ade37abfad58..b49aee9a8b65156310e4f66a17921e5320b3077c 100644
> > --- a/drivers/net/ethernet/mediatek/mtk_wed.h
> > +++ b/drivers/net/ethernet/mediatek/mtk_wed.h
> > @@ -17,7 +17,7 @@ struct mtk_wed_wo;
> >   struct mtk_wed_soc_data {
> >   	struct {
> >   		u32 tx_bm_tkid;
> > -		u32 wpdma_rx_ring0;
> > +		u32 wpdma_rx_ring[MTK_WED_RX_QUEUES];
> >   		u32 reset_idx_tx_mask;
> >   		u32 reset_idx_rx_mask;
> >   	} regmap;
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c b/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c
> > index 4a82f8e4c118061fc76459dc0e38f7ee27e25a3a..36488aa6cc20117de4f5b76b80beca149015e055 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c
> > @@ -664,8 +664,8 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
> >   					 MT_RXQ_WED_RING_BASE;
> >   		wed->wlan.wpdma_rx_glo = pci_resource_start(pci_dev, 0) +
> >   					 MT_WPDMA_GLO_CFG;
> > -		wed->wlan.wpdma_rx = pci_resource_start(pci_dev, 0) +
> > -				     MT_RXQ_WED_DATA_RING_BASE;
> > +		wed->wlan.wpdma_rx[0] = pci_resource_start(pci_dev, 0) +
> > +					MT_RXQ_WED_DATA_RING_BASE;
> >   	} else {
> >   		struct platform_device *plat_dev = pdev_ptr;
> >   		struct resource *res;
> > @@ -687,7 +687,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
> >   		wed->wlan.wpdma_tx = res->start + MT_TXQ_WED_RING_BASE;
> >   		wed->wlan.wpdma_txfree = res->start + MT_RXQ_WED_RING_BASE;
> >   		wed->wlan.wpdma_rx_glo = res->start + MT_WPDMA_GLO_CFG;
> > -		wed->wlan.wpdma_rx = res->start + MT_RXQ_WED_DATA_RING_BASE;
> > +		wed->wlan.wpdma_rx[0] = res->start + MT_RXQ_WED_DATA_RING_BASE;
> >   	}
> >   	wed->wlan.nbuf = MT7915_HW_TOKEN_SIZE;
> >   	wed->wlan.tx_tbit[0] = is_mt7915(&dev->mt76) ? 4 : 30;
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c b/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c
> > index 30b40f4a91be81d429d11f15036167396756d2dc..fb2428a9b877899a0a6fb879aba84e1f6e7840f2 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c
> > @@ -503,9 +503,9 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
> >   		}
> >   		wed->wlan.wpdma_rx_glo = wed->wlan.phy_base + hif1_ofs + MT_WFDMA0_GLO_CFG;
> > -		wed->wlan.wpdma_rx = wed->wlan.phy_base + hif1_ofs +
> > -				     MT_RXQ_RING_BASE(MT7996_RXQ_BAND0) +
> > -				     MT7996_RXQ_BAND0 * MT_RING_SIZE;
> > +		wed->wlan.wpdma_rx[0] = wed->wlan.phy_base + hif1_ofs +
> > +					MT_RXQ_RING_BASE(MT7996_RXQ_BAND0) +
> > +					MT7996_RXQ_BAND0 * MT_RING_SIZE;
> >   		wed->wlan.id = MT7996_DEVICE_ID_2;
> >   		wed->wlan.tx_tbit[0] = ffs(MT_INT_TX_DONE_BAND2) - 1;
> > @@ -518,9 +518,9 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
> >   		wed->wlan.wpdma_rx_glo = wed->wlan.phy_base + MT_WFDMA0_GLO_CFG;
> > -		wed->wlan.wpdma_rx = wed->wlan.phy_base +
> > -				     MT_RXQ_RING_BASE(MT7996_RXQ_BAND0) +
> > -				     MT7996_RXQ_BAND0 * MT_RING_SIZE;
> > +		wed->wlan.wpdma_rx[0] = wed->wlan.phy_base +
> > +					MT_RXQ_RING_BASE(MT7996_RXQ_BAND0) +
> > +					MT7996_RXQ_BAND0 * MT_RING_SIZE;
> >   		wed->wlan.wpdma_rx_rro[0] = wed->wlan.phy_base +
> >   					    MT_RXQ_RING_BASE(MT7996_RXQ_RRO_BAND0) +
> > diff --git a/include/linux/soc/mediatek/mtk_wed.h b/include/linux/soc/mediatek/mtk_wed.h
> > index d8949a4ed0dc9d41b3364e85a21e15d258519c45..c4ff6bab176db1f51cd94ac4198df0caeb557df2 100644
> > --- a/include/linux/soc/mediatek/mtk_wed.h
> > +++ b/include/linux/soc/mediatek/mtk_wed.h
> > @@ -147,7 +147,7 @@ struct mtk_wed_device {
> >   		u32 wpdma_tx;
> >   		u32 wpdma_txfree;
> >   		u32 wpdma_rx_glo;
> > -		u32 wpdma_rx;
> > +		u32 wpdma_rx[MTK_WED_RX_QUEUES];
> >   		u32 wpdma_rx_rro[MTK_WED_RX_QUEUES];
> >   		u32 wpdma_rx_pg;
> > 
> > ---
> > base-commit: fa582ca7e187a15e772e6a72fe035f649b387a60
> > change-id: 20250718-mt7992-wed-support-456a50d51f81
> 
> Best,
> Dawid

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2025-07-28 15:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-27 12:50 [PATCH net-next] net: mediatek: wed: Introduce MT7992 WED support Lorenzo Bianconi
2025-07-28 14:52 ` Dawid Osuchowski
2025-07-28 15:28   ` Lorenzo Bianconi [this message]

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=aIeXKRmGxDROUDHt@lore-rh-laptop \
    --to=lorenzo@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=davem@davemloft.net \
    --cc=dawid.osuchowski@linux.intel.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rex.lu@mediatek.com \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.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