summaryrefslogtreecommitdiff
path: root/arch/mips/mm/dma-default.c
diff options
context:
space:
mode:
authorJayachandran C <jchandra@broadcom.com>2013-06-10 06:28:08 +0000
committerRalf Baechle <ralf@linux-mips.org>2013-06-13 17:46:40 +0200
commit4954a9a211f1863e3ca3958fd56ad06e1bddc22d (patch)
treec5ce63b246124561b138da90056d17cf2ee4084d /arch/mips/mm/dma-default.c
parent0cecddecd3d0f4e2d9499ad2f226969e82910e79 (diff)
MIPS: Support SWIOTLB in default dma operations
Provide a default implementation of phys_to_dma and dma_to_phys in mach-generic/dma_coherence.h. If CONFIG_NEED_SG_DMA_LENGTH is defined, the dma_length field in struct scatterlist is used. Set this up in mips_dma_map_sg so that the default mips DMA ops can be used when SWIOTLB is enabled. Signed-off-by: Jayachandran C <jchandra@broadcom.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5409/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/mm/dma-default.c')
-rw-r--r--arch/mips/mm/dma-default.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index caf92ecb37d6..aaccf1c10699 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -246,6 +246,9 @@ static int mips_dma_map_sg(struct device *dev, struct scatterlist *sg,
if (!plat_device_is_coherent(dev))
__dma_sync(sg_page(sg), sg->offset, sg->length,
direction);
+#ifdef CONFIG_NEED_SG_DMA_LENGTH
+ sg->dma_length = sg->length;
+#endif
sg->dma_address = plat_map_dma_mem_page(dev, sg_page(sg)) +
sg->offset;
}