Thread (12 messages) 12 messages, 3 authors, 2018-01-26

[PATCH 2/2] MIPS: Loongson64: Add cache_sync to loongson_dma_map_ops

From: Huacai Chen <hidden>
Date: 2017-11-16 08:35:58
Subsystem: mips, mips/loongson64 architecture, the rest · Maintainers: Thomas Bogendoerfer, Huacai Chen, Jiaxun Yang, Linus Torvalds

To support coherent & non-coherent DMA co-exsistance, we should add
cache_sync to loongson_dma_map_ops.

Signed-off-by: Huacai Chen <redacted>
---
 arch/mips/include/asm/dma-mapping.h       | 3 +++
 arch/mips/loongson64/common/dma-swiotlb.c | 1 +
 arch/mips/mm/dma-default.c                | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
index 0d9418d..5544276 100644
--- a/arch/mips/include/asm/dma-mapping.h
+++ b/arch/mips/include/asm/dma-mapping.h
@@ -37,4 +37,7 @@ static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
 #endif
 }
 
+void mips_dma_cache_sync(struct device *dev, void *vaddr,
+		size_t size, enum dma_data_direction direction);
+
 #endif /* _ASM_DMA_MAPPING_H */
diff --git a/arch/mips/loongson64/common/dma-swiotlb.c b/arch/mips/loongson64/common/dma-swiotlb.c
index ef07740..17956f2 100644
--- a/arch/mips/loongson64/common/dma-swiotlb.c
+++ b/arch/mips/loongson64/common/dma-swiotlb.c
@@ -120,6 +120,7 @@ static const struct dma_map_ops loongson_dma_map_ops = {
 	.sync_sg_for_device = loongson_dma_sync_sg_for_device,
 	.mapping_error = swiotlb_dma_mapping_error,
 	.dma_supported = loongson_dma_supported,
+	.cache_sync = mips_dma_cache_sync,
 };
 
 void __init plat_swiotlb_setup(void)
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index e3e94d0..e86bf5d 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -383,7 +383,7 @@ static int mips_dma_supported(struct device *dev, u64 mask)
 	return plat_dma_supported(dev, mask);
 }
 
-static void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 			 enum dma_data_direction direction)
 {
 	BUG_ON(direction == DMA_NONE);
-- 
2.7.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help