In jetson sdk 32.5,
drivers/pci/endpoint/functions/pci-epf-tegra-vnet.c file uses polling for dma write completed as follows:
dma_common_wr8(tvnet->dma_base, DMA_WR_DATA_CH, DMA_WRITE_DOORBELL_OFF); | ((transfer->dst_iova_addr >> 32) & 0xFFFFFFFF),
desc_cnt->wr_cnt++; | DMA_DAR_HIGH_OFF_WRCH);
|
while (true) { | /* ring the door bell with channel number */
val = dma_common_rd(tvnet->dma_base, DMA_WRITE_INT_STATUS_OFF); | ep_dma_common_wr8(rc_xdma->dma_base, channel, DMA_WRITE_DOORBELL_OFF);
if (val == BIT(DMA_WR_DATA_CH)) { |
dma_common_wr(tvnet->dma_base, val, | now = jiffies;
DMA_WRITE_INT_CLEAR_OFF); | while (true) {
break; | val = ep_dma_common_rd(rc_xdma->dma_base, DMA_WRITE_INT_STATUS_OFF);
} | if (BIT(channel) & val) {
if (time_after(jiffies, timeout)) { | ep_dma_common_wr(rc_xdma->dma_base, val, DMA_WRITE_INT_CLEAR_OFF);
dev_err(fdev, "dma took more time, reset dma engine\n"); | break;
dma_common_wr(tvnet->dma_base, | }
DMA_WRITE_ENGINE_EN_OFF_DISABLE, |
DMA_WRITE_ENGINE_EN_OFF); | if (time_after(jiffies, now + timeout)) {
mdelay(1); | pr_err("DMA write timed out & poll end\n");
dma_common_wr(tvnet->dma_base, | ep_dma_common_wr(rc_xdma->dma_base, DMA_WRITE_ENGINE_EN_OFF_DISABLE,
DMA_WRITE_ENGINE_EN_OFF_ENABLE, | DMA_WRITE_ENGINE_EN_OFF);
DMA_WRITE_ENGINE_EN_OFF); | mdelay(1);
desc_cnt->wr_cnt--; | ep_dma_common_wr(rc_xdma->dma_base, DMA_WRITE_ENGINE_EN_OFF_ENABLE,
pci_epc_unmap_addr(epc, tvnet->tx_dst_pci_addr); | DMA_WRITE_ENGINE_EN_OFF);
dma_unmap_single(cdev, src_iova, len, DMA_TO_DEVICE); | return -ETIMEDOUT;
return NETDEV_TX_BUSY; | }
} | }
}```
But I want to use interrupt by request_irq method instead of polling. What I should do to relize it?