aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2016-10-05 13:18:14 -0400
committerRalf Baechle <ralf@linux-mips.org>2016-10-06 12:01:28 -0400
commitf23020230e682a43cc4706cabb041bba469df2d6 (patch)
tree50a67f63a49b3e63273848c936173de59cb05149 /arch/mips/include/asm
parent87dd9a4de421f052fd9be58c7da08a453f340d5e (diff)
MIPS: Sanitise coherentio semantics
The coherentio variable has previously been used as a boolean value, indicating whether the user specified that coherent I/O should be enabled or disabled. It failed to take into account the case where the user does not specify any preference, in which case it makes sense that we should default to coherent I/O if the hardware supports it (hw_coherentio is non-zero). Introduce an enum to clarify the 3 different values of coherentio & use it throughout the code, modifying plat_device_is_coherent() & r4k_cache_init() to take into account the default case. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Cc: Paul Burton <paul.burton@imgtec.com> Patchwork: https://patchwork.linux-mips.org/patch/14347/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include/asm')
-rw-r--r--arch/mips/include/asm/dma-coherence.h12
-rw-r--r--arch/mips/include/asm/mach-generic/dma-coherence.h10
2 files changed, 18 insertions, 4 deletions
diff --git a/arch/mips/include/asm/dma-coherence.h b/arch/mips/include/asm/dma-coherence.h
index bc5e85d579e6..4fbce79fb57f 100644
--- a/arch/mips/include/asm/dma-coherence.h
+++ b/arch/mips/include/asm/dma-coherence.h
@@ -9,14 +9,20 @@
9#ifndef __ASM_DMA_COHERENCE_H 9#ifndef __ASM_DMA_COHERENCE_H
10#define __ASM_DMA_COHERENCE_H 10#define __ASM_DMA_COHERENCE_H
11 11
12enum coherent_io_user_state {
13 IO_COHERENCE_DEFAULT,
14 IO_COHERENCE_ENABLED,
15 IO_COHERENCE_DISABLED,
16};
17
12#ifdef CONFIG_DMA_MAYBE_COHERENT 18#ifdef CONFIG_DMA_MAYBE_COHERENT
13extern int coherentio; 19extern enum coherent_io_user_state coherentio;
14extern int hw_coherentio; 20extern int hw_coherentio;
15#else 21#else
16#ifdef CONFIG_DMA_COHERENT 22#ifdef CONFIG_DMA_COHERENT
17#define coherentio 1 23#define coherentio IO_COHERENCE_ENABLED
18#else 24#else
19#define coherentio 0 25#define coherentio IO_COHERENCE_DISABLED
20#endif 26#endif
21#define hw_coherentio 0 27#define hw_coherentio 0
22#endif /* CONFIG_DMA_MAYBE_COHERENT */ 28#endif /* CONFIG_DMA_MAYBE_COHERENT */
diff --git a/arch/mips/include/asm/mach-generic/dma-coherence.h b/arch/mips/include/asm/mach-generic/dma-coherence.h
index 0f8a354fd468..8484f82fc794 100644
--- a/arch/mips/include/asm/mach-generic/dma-coherence.h
+++ b/arch/mips/include/asm/mach-generic/dma-coherence.h
@@ -49,7 +49,15 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
49 49
50static inline int plat_device_is_coherent(struct device *dev) 50static inline int plat_device_is_coherent(struct device *dev)
51{ 51{
52 return coherentio; 52 switch (coherentio) {
53 default:
54 case IO_COHERENCE_DEFAULT:
55 return hw_coherentio;
56 case IO_COHERENCE_ENABLED:
57 return 1;
58 case IO_COHERENCE_DISABLED:
59 return 0;
60 }
53} 61}
54 62
55#ifndef plat_post_dma_flush 63#ifndef plat_post_dma_flush