This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: Allocating DMA coherent memory and which APIs to use

Part Number: TDA4VM

Customer is attempting the following:

1.) Declare a memory in device tree file (reserve 16MB for DMA purpose)

2.) Get this physical memory and upon request from application , allocate the requested memory (pages) and mmap to the application.

To do this task, customer used the following API's and got a build error.

dma_declare_coherent_memory()

dma_alloc_from_dev_coherent().

When looking at the dma-mapping.h file, it is mentioned that dma_alloc_from_dev_coherent() shall not be used by device drivers.

```bash 

/* * These three functions are only for dma allocator. * Don't use them in device drivers. */ int dma_alloc_from_dev_coherent(struct device *dev, ssize_t size, dma_addr_t *dma_handle, void **ret);

```

Which APIs can be used by device drivers to do this job?