drivers/net/wireless/mediatek/mt76/mt792x_dma.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt792x_dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt792x_dma.c- Extension
.c- Size
- 15779 bytes
- Lines
- 549
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/firmware.hmt792x.hdma.htrace.h
Detected Declarations
function mt792x_irq_handlerfunction mt792x_irq_taskletfunction mt792x_rx_poll_completefunction mt792x_dma_alloc_queuesfunction mt7925_dma_prefetch_setupfunction mt7925_wfdma_setupfunction mt7927_dma_prefetch_setupfunction mt7927_wfdma_setupfunction mt792x_dma_prefetchfunction mt792x_dma_enablefunction mt792x_dma_resetfunction mt792x_wpdma_resetfunction mt792x_wpdma_reinit_condfunction mt792x_dma_disablefunction mt792x_dma_cleanupfunction mt792x_poll_txfunction mt792x_poll_rxfunction mt7927_sema_status_readfunction mt7927_wfsys_resetfunction mt792x_wfsys_reset_defaultfunction mt792x_wfsys_resetexport mt792x_irq_handlerexport mt792x_irq_taskletexport mt792x_rx_poll_completeexport mt792x_dma_alloc_queuesexport mt792x_dma_enableexport mt792x_wpdma_resetexport mt792x_wpdma_reinit_condexport mt792x_dma_disableexport mt792x_dma_cleanupexport mt792x_poll_txexport mt792x_poll_rxexport mt792x_wfsys_reset
Annotated Snippet
if (intr_sw & MT_MCU_CMD_WAKE_RX_PCIE) {
mask |= irq_map->rx.data_complete_mask;
intr |= irq_map->rx.data_complete_mask;
}
}
mt76_set_irq_mask(&dev->mt76, irq_map->host_irq_enable, mask, 0);
if (intr & dev->irq_map->tx.all_complete_mask)
napi_schedule(&dev->mt76.tx_napi);
if (intr & irq_map->rx.wm_complete_mask)
napi_schedule(&dev->mt76.napi[MT_RXQ_MCU]);
if (intr & irq_map->rx.wm2_complete_mask)
napi_schedule(&dev->mt76.napi[MT_RXQ_MCU_WA]);
if (intr & irq_map->rx.data_complete_mask)
napi_schedule(&dev->mt76.napi[MT_RXQ_MAIN]);
}
EXPORT_SYMBOL_GPL(mt792x_irq_tasklet);
void mt792x_rx_poll_complete(struct mt76_dev *mdev, enum mt76_rxq_id q)
{
struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
const struct mt792x_irq_map *irq_map = dev->irq_map;
if (q == MT_RXQ_MAIN)
mt76_connac_irq_enable(mdev, irq_map->rx.data_complete_mask);
else if (q == MT_RXQ_MCU_WA)
mt76_connac_irq_enable(mdev, irq_map->rx.wm2_complete_mask);
else
mt76_connac_irq_enable(mdev, irq_map->rx.wm_complete_mask);
}
EXPORT_SYMBOL_GPL(mt792x_rx_poll_complete);
int mt792x_dma_alloc_queues(struct mt792x_dev *dev,
const struct mt792x_dma_layout *layout)
{
int ret;
mt76_dma_attach(&dev->mt76);
ret = mt792x_dma_disable(dev, true);
if (ret)
return ret;
/* init tx queue */
ret = mt76_connac_init_tx_queues(dev->phy.mt76, layout->tx_data0.qid,
layout->tx_data0.n_desc,
layout->tx_data0.ring_base,
NULL, 0);
if (ret)
return ret;
mt76_wr(dev, MT_WFDMA0_TX_RING0_EXT_CTRL, 0x4);
/* command to WM */
ret = mt76_init_mcu_queue(&dev->mt76, MT_MCUQ_WM,
layout->tx_mcu.qid,
layout->tx_mcu.n_desc,
layout->tx_mcu.ring_base);
if (ret)
return ret;
/* firmware download */
ret = mt76_init_mcu_queue(&dev->mt76, MT_MCUQ_FWDL,
layout->tx_fwdl.qid,
layout->tx_fwdl.n_desc,
layout->tx_fwdl.ring_base);
if (ret)
return ret;
/* rx event */
ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MCU],
layout->rx_mcu.qid,
layout->rx_mcu.n_desc,
MT_RX_BUF_SIZE,
layout->rx_mcu.ring_base);
if (ret)
return ret;
/* rx data */
ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MAIN],
layout->rx_data.qid,
layout->rx_data.n_desc,
MT_RX_BUF_SIZE,
layout->rx_data.ring_base);
return ret;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/firmware.h`, `mt792x.h`, `dma.h`, `trace.h`.
- Detected declarations: `function mt792x_irq_handler`, `function mt792x_irq_tasklet`, `function mt792x_rx_poll_complete`, `function mt792x_dma_alloc_queues`, `function mt7925_dma_prefetch_setup`, `function mt7925_wfdma_setup`, `function mt7927_dma_prefetch_setup`, `function mt7927_wfdma_setup`, `function mt792x_dma_prefetch`, `function mt792x_dma_enable`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.