dma_declare_coherent_memory should not be in a DMA API guide aimed at driver writers (that is consumers of the API). Move it to a comment near the function instead.
Showing the changes to kernel (1 of 2 files). Show all
Unified · Split
| @@ -107,6 +107,23 @@ static int dma_assign_coherent_memory(struct device *dev, · 106 unmodified lines | ||
| 107 | 107 | return 0; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | +/* | |
| 111 | + * Declare a region of memory to be handed out by dma_alloc_coherent() when it | |
| 112 | + * is asked for coherent memory for this device. This shall only be used | |
| 113 | + * from platform code, usually based on the device tree description. | |
| 114 | + * | |
| 115 | + * phys_addr is the CPU physical address to which the memory is currently | |
| 116 | + * assigned (this will be ioremapped so the CPU can access the region). | |
| 117 | + * | |
| 118 | + * device_addr is the DMA address the device needs to be programmed with to | |
| 119 | + * actually address this memory (this will be handed out as the dma_addr_t in | |
| 120 | + * dma_alloc_coherent()). | |
| 121 | + * | |
| 122 | + * size is the size of the area (must be a multiple of PAGE_SIZE). | |
| 123 | + * | |
| 124 | + * As a simplification for the platforms, only *one* such region of memory may | |
| 125 | + * be declared per device. | |
| 126 | + */ | |
| 110 | 127 | int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, |
| 111 | 128 | dma_addr_t device_addr, size_t size) |
| 112 | 129 | { |