Is it possible to use the Linux dmaengine on LS2088ARDB / LX2160ARDB ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it possible to use the Linux dmaengine on LS2088ARDB / LX2160ARDB ?

878 Views
andreasr
Contributor I

Hello,

I'm trying to write a linux kernel module for the LS2088ARDB (running linux kernel 4.1.35-rt41) and after that also for the LX2160ARDB (running Linux kernel 4.9.62)  that executes a DMA transfer from main memory to a PCIe device.

Therefore I want to use the Slave-DMA API of the linux dmaengine (documented here : <linux kernel>/Documentation/dmaengine/client.txt). 

According to this doc the first step is to allocate a dma channel with 'dma_request_channel' (in later kernel versions the appropriate function is callled 'dma_request_chan'), but this step fails using my kernel module. 

Is it possible to use this API on these boards, at all? Do the linux BSPs for these two boards support a dma controller that I can use for my purpose? 

Best regards,

Andreas

0 Kudos
1 Reply

724 Views
yipingwang
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos