wifi: mt76: mt792x: add MT7927-specific PCIe DMA support

Add the MT7927-specific PCIe DMA queue layout and local DMA setup,
including the extra RX ring and WFDMA/prefetch programming.

MT7927 does not follow the mt7925 DMA configuration, so provide a
separate DMA init path while reusing the existing common queue setup.

This keeps the chip-specific changes local and prepares the driver
for later MT7927 enablement without affecting existing devices.

Co-developed-by: Javier Tia <[email protected]>
Signed-off-by: Javier Tia <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Sean Wang
2026-05-28 13:32:33 +02:00
committed by Felix Fietkau
parent 903f8b3bfa
commit 79e061f30b
4 changed files with 113 additions and 3 deletions
+52 -1
View File
@@ -228,6 +228,51 @@ static const struct mt792x_dma_layout mt7925_dma_layout = {
MT_RX_DATA_RING_BASE),
};
static const struct mt792x_dma_layout mt7927_dma_layout = {
.tx_data0 = mt792x_dma_ring(MT7927_TXQ_BAND0,
MT7925_TX_RING_SIZE,
MT_TX_RING_BASE),
.tx_mcu = mt792x_dma_ring(MT7927_TXQ_MCU_WM,
MT7925_TX_MCU_RING_SIZE,
MT_TX_RING_BASE),
.tx_fwdl = mt792x_dma_ring(MT7927_TXQ_FWDL,
MT7925_TX_FWDL_RING_SIZE,
MT_TX_RING_BASE),
.rx_mcu = mt792x_dma_ring(MT7927_RXQ_MCU_WM,
MT7925_RX_MCU_RING_SIZE,
MT_RX_EVENT_RING_BASE),
.rx_data = mt792x_dma_ring(MT7927_RXQ_BAND0,
MT7925_RX_RING_SIZE,
MT_RX_DATA_RING_BASE),
};
static int mt7927_dma_init(struct mt792x_dev *dev)
{
int ret;
ret = mt792x_dma_alloc_queues(dev, &mt7927_dma_layout);
if (ret)
return ret;
ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MCU_WA],
MT7927_RXQ_DATA2,
MT7925_RX_MCU_RING_SIZE,
MT_RX_BUF_SIZE,
MT_RX_DATA_RING_BASE);
if (ret)
return ret;
ret = mt76_init_queues(dev, mt792x_poll_rx);
if (ret < 0)
return ret;
netif_napi_add_tx(dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
mt792x_poll_tx);
napi_enable(&dev->mt76.tx_napi);
return mt792x_dma_enable(dev);
}
static int mt7925_dma_init(struct mt792x_dev *dev)
{
int ret;
@@ -406,7 +451,13 @@ static int mt7925_pci_probe(struct pci_dev *pdev,
if (ret)
goto err_free_dev;
ret = mt7925_dma_init(dev);
if (is_mt7927(&dev->mt76))
ret = mt7927_dma_init(dev);
else if (is_mt7925(&dev->mt76))
ret = mt7925_dma_init(dev);
else
ret = -EINVAL;
if (ret)
goto err_free_irq;