summaryrefslogtreecommitdiff
path: root/arch/sparc
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-09-13 18:39:38 +0200
committerChristoph Hellwig <hch@lst.de>2021-10-21 13:03:04 +0200
commit837e80b3a5fc9f5f834e28e108a43ad4dd23dcb7 (patch)
treea1beb4c61971ad29f10a17c5e598fd88ddcc70df /arch/sparc
parent2c38d6a4e959a88213e24214188e056e5b8cf4c6 (diff)
sparc32: remove dma_make_coherent
Fold dma_make_coherent into the only remaining caller. Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Andreas Larsson <andreas@gaisler.com> Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/kernel/ioport.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 59375a01c152..3eb748e86222 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -52,17 +52,6 @@
#include <asm/io-unit.h>
#include <asm/leon.h>
-/* This function must make sure that caches and memory are coherent after DMA
- * On LEON systems without cache snooping it flushes the entire D-CACHE.
- */
-static inline void dma_make_coherent(unsigned long pa, unsigned long len)
-{
- if (sparc_cpu_model == sparc_leon) {
- if (!sparc_leon3_snooping_enabled())
- leon_flush_dcache_all();
- }
-}
-
static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz);
static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
unsigned long size, char *name);
@@ -365,13 +354,19 @@ void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
free_pages((unsigned long)phys_to_virt(dma_addr), get_order(size));
}
-/* IIep is write-through, not flushing on cpu to device transfer. */
-
+/*
+ * IIep is write-through, not flushing on cpu to device transfer.
+ *
+ * On LEON systems without cache snooping, the entire D-CACHE must be flushed to
+ * make DMA to cacheable memory coherent.
+ */
void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
enum dma_data_direction dir)
{
- if (dir != PCI_DMA_TODEVICE)
- dma_make_coherent(paddr, PAGE_ALIGN(size));
+ if (dir != PCI_DMA_TODEVICE &&
+ sparc_cpu_model == sparc_leon &&
+ !sparc_leon3_snooping_enabled())
+ leon_flush_dcache_all();
}
#ifdef CONFIG_PROC_FS