I'm writing a Linux kernel driver that must transfer up to 512KB of data from an FPGA (connected via the i.mx53's EIM) to a memory buffer.
I have it working with memcpy() right now, but need to use DMA to offload the copying from the CPU.
The FPGA has been mapped such that it can be read as a 512KB contiguous region of memory, and the EIM is set up so that it does not do burst/page accesses to the FPGA.
The 512KB destination buffer has been allocated using dma_alloc_coherent(), and the FPGA's read address range has been made available using dev_ioremap_nocache().
I would like to use the generic Linux DMA layer (the dmaengine) rather than talk to the imx-sdma driver for best portability in the future.
However, my attempts to get DMA working have been met with kernel crashes and/or a lack of access to the FPGA (I have an oscilloscope connected that will show when the FPGA RAM addresses are accessed).
I'm using the 2.6.38 kernel, if it matters.
I've attached a greatly simplified version of my code (with error handling and other stuff removed) that shows the DMA-related operations.
Could anyone suggest a fix that might get this working?
Original Attachment has been moved to: dma_example.c.zip