Skip to content

Commit 837e80b

Browse files
author
Christoph Hellwig
committed
sparc32: remove dma_make_coherent
Fold dma_make_coherent into the only remaining caller. Signed-off-by: Christoph Hellwig <[email protected]> Tested-by: Andreas Larsson <[email protected]> Acked-by: David S. Miller <[email protected]>
1 parent 2c38d6a commit 837e80b

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

arch/sparc/kernel/ioport.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,6 @@
5252
#include <asm/io-unit.h>
5353
#include <asm/leon.h>
5454

55-
/* This function must make sure that caches and memory are coherent after DMA
56-
* On LEON systems without cache snooping it flushes the entire D-CACHE.
57-
*/
58-
static inline void dma_make_coherent(unsigned long pa, unsigned long len)
59-
{
60-
if (sparc_cpu_model == sparc_leon) {
61-
if (!sparc_leon3_snooping_enabled())
62-
leon_flush_dcache_all();
63-
}
64-
}
65-
6655
static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz);
6756
static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
6857
unsigned long size, char *name);
@@ -365,13 +354,19 @@ void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
365354
free_pages((unsigned long)phys_to_virt(dma_addr), get_order(size));
366355
}
367356

368-
/* IIep is write-through, not flushing on cpu to device transfer. */
369-
357+
/*
358+
* IIep is write-through, not flushing on cpu to device transfer.
359+
*
360+
* On LEON systems without cache snooping, the entire D-CACHE must be flushed to
361+
* make DMA to cacheable memory coherent.
362+
*/
370363
void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
371364
enum dma_data_direction dir)
372365
{
373-
if (dir != PCI_DMA_TODEVICE)
374-
dma_make_coherent(paddr, PAGE_ALIGN(size));
366+
if (dir != PCI_DMA_TODEVICE &&
367+
sparc_cpu_model == sparc_leon &&
368+
!sparc_leon3_snooping_enabled())
369+
leon_flush_dcache_all();
375370
}
376371

377372
#ifdef CONFIG_PROC_FS

0 commit comments

Comments
 (0)