1 From d593f8fc627f8cdaee9c14e4d22b0770a09baaf1 Mon Sep 17 00:00:00 2001
2 From: Felix Fietkau <nbd@openwrt.org>
3 Date: Thu, 15 Aug 2013 10:47:47 +0200
4 Subject: [PATCH] MIPS: improve checks for noncoherent DMA
6 Only one MIPS development board actually supports enabling/disabling DMA
7 coherency at runtime, so it's not a good idea to push the overhead of
8 checking that configuration setting onto every other supported target as
11 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
13 arch/mips/Kconfig | 6 +++++-
14 arch/mips/include/asm/dma-coherence.h | 7 +++++++
15 arch/mips/include/asm/mach-generic/dma-coherence.h | 4 ----
16 arch/mips/mm/dma-default.c | 2 ++
17 4 files changed, 14 insertions(+), 5 deletions(-)
19 --- a/arch/mips/Kconfig
20 +++ b/arch/mips/Kconfig
21 @@ -296,7 +296,7 @@ config MIPS_MALTA
25 - select DMA_NONCOHERENT
26 + select DMA_MAYBE_COHERENT
27 select GENERIC_ISA_DMA
28 select HAVE_PCSPKR_PLATFORM
30 @@ -947,6 +947,10 @@ config FW_CFE
31 config ARCH_DMA_ADDR_T_64BIT
32 def_bool (HIGHMEM && 64BIT_PHYS_ADDR) || 64BIT
34 +config DMA_MAYBE_COHERENT
35 + select DMA_NONCOHERENT
41 --- a/arch/mips/include/asm/dma-coherence.h
42 +++ b/arch/mips/include/asm/dma-coherence.h
44 #ifndef __ASM_DMA_COHERENCE_H
45 #define __ASM_DMA_COHERENCE_H
47 +#ifdef CONFIG_DMA_MAYBE_COHERENT
48 extern int coherentio;
49 extern int hw_coherentio;
51 +#ifdef CONFIG_DMA_COHERENT
56 +#define hw_coherentio 0
57 +#endif /* CONFIG_DMA_MAYBE_COHERENT */
60 --- a/arch/mips/include/asm/mach-generic/dma-coherence.h
61 +++ b/arch/mips/include/asm/mach-generic/dma-coherence.h
62 @@ -49,11 +49,7 @@ static inline int plat_dma_supported(str
64 static inline int plat_device_is_coherent(struct device *dev)
66 -#ifdef CONFIG_DMA_COHERENT
73 #endif /* __ASM_MACH_GENERIC_DMA_COHERENCE_H */
74 --- a/arch/mips/mm/dma-default.c
75 +++ b/arch/mips/mm/dma-default.c
78 #include <dma-coherence.h>
80 +#ifdef CONFIG_DMA_MAYBE_COHERENT
81 int coherentio = 0; /* User defined DMA coherency from command line. */
82 EXPORT_SYMBOL_GPL(coherentio);
83 int hw_coherentio = 0; /* Actual hardware supported DMA coherency setting. */
84 @@ -41,6 +42,7 @@ static int __init setnocoherentio(char *
87 early_param("nocoherentio", setnocoherentio);
90 static inline struct page *dma_addr_to_page(struct device *dev,