Commit 4f29c057 authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by Ralf Baechle

MIPS: Synchronize dma_map_page and dma_map_single

Synchronize dma_map_page/dma_unmap_page and dma_map_single/dma_unmap_single.
This will reduce unnecessary writebacks and invalidates.

[Ralf: make dma_unmap_page an inline function.]
Signed-off-by: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 47740eb8
...@@ -24,8 +24,13 @@ extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, ...@@ -24,8 +24,13 @@ extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction direction); enum dma_data_direction direction);
extern dma_addr_t dma_map_page(struct device *dev, struct page *page, extern dma_addr_t dma_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size, enum dma_data_direction direction); unsigned long offset, size_t size, enum dma_data_direction direction);
extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
size_t size, enum dma_data_direction direction); static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
size_t size, enum dma_data_direction direction)
{
dma_unmap_single(dev, dma_address, size, direction);
}
extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg, extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
int nhwentries, enum dma_data_direction direction); int nhwentries, enum dma_data_direction direction);
extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
......
...@@ -209,7 +209,7 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, ...@@ -209,7 +209,7 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page,
unsigned long addr; unsigned long addr;
addr = (unsigned long) page_address(page) + offset; addr = (unsigned long) page_address(page) + offset;
dma_cache_wback_inv(addr, size); __dma_sync(addr, size, direction);
} }
return plat_map_dma_mem_page(dev, page) + offset; return plat_map_dma_mem_page(dev, page) + offset;
...@@ -217,23 +217,6 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, ...@@ -217,23 +217,6 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page,
EXPORT_SYMBOL(dma_map_page); EXPORT_SYMBOL(dma_map_page);
void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
enum dma_data_direction direction)
{
BUG_ON(direction == DMA_NONE);
if (!plat_device_is_coherent(dev) && direction != DMA_TO_DEVICE) {
unsigned long addr;
addr = dma_addr_to_virt(dma_address);
dma_cache_wback_inv(addr, size);
}
plat_unmap_dma_mem(dev, dma_address);
}
EXPORT_SYMBOL(dma_unmap_page);
void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
enum dma_data_direction direction) enum dma_data_direction direction)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment