Hi All
 
I am developing an application using camkes on the i.MX6 which requires DMA enabled peripherals (specifically the USB and Ethernet cores). Both of these cores use transfer descriptors pointing to physical memory buffers which in turn contain user data. For a number of reasons, I would like to place the data buffers in predetermined physical memory locations such that the driver component knows the physical addresses of those buffers, only the client can access the content of the buffers and the driver doesn't have to trust the client to provide correct physical addresses.
 
The camkes_dma_alloc approach does not seem suitable in this instance because camkes_dma_alloc would have to be called by the client (as it has to read/write the content), only the client can call camkes_dma_get_paddr to return the physical address and I don't want the driver to have to trust physical addresses received from the client. 
 
For this reason, I've been using hardware dataports to allow the client access to predetermined areas of DRAM. However, this approach seems to have limitations too:
 1. If the dataport is left uncached, I experience errors with unaligned accesses - e.g. FSR = 0x801 when memcpying a 4-byte value into a 2-byte but not 4-byte aligned address.
 2. If the dataport is set as cached, camkes doesn't provide a function to invalidate the cache prior to read following a DMA transfer into that buffer, resulting in stale data being read from the cache following a DMA transfer (At least, I *believe* that's what's happening..)
 
I hope this goes some way to explaining what I'm trying to do and the rationale behind it. Is there a better way of handling DMA with predetermined physical addresses in camkes?
 
Best regards,
Gareth