Hello Andreas,
Please refer to drivers/pci/host/pci-layerscape-ep-debugfs.c in Linux Kernel source code, I also attached it.
Please refer to the following section.
dma_cap_zero(mask);
dma_cap_set(DMA_MEMCPY, mask);
chan = dma_request_channel(mask, NULL, test);
if (!chan) {
pr_err("failed to request dma channel\n");
return -EINVAL;
}
memset(test->buf, test->data, test->len);
if (test->dirt == TEST_DIRT_WRITE) {
src = test->buf_addr;
dst = test->out_addr;
direction = DMA_TO_DEVICE;
} else {
src = test->out_addr;
dst = test->buf_addr;
direction = DMA_FROM_DEVICE;
}
dma_dev = chan->device;
dma_flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
dma_sync_single_for_device(&test->ep->dev, test->buf_addr,
test->len, direction);
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------