diff options
Diffstat (limited to 'arch/mips/mm/dma-default.c')
-rw-r--r-- | arch/mips/mm/dma-default.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index f9ef83829a52..caf92ecb37d6 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c | |||
@@ -22,6 +22,26 @@ | |||
22 | 22 | ||
23 | #include <dma-coherence.h> | 23 | #include <dma-coherence.h> |
24 | 24 | ||
25 | int coherentio = 0; /* User defined DMA coherency from command line. */ | ||
26 | EXPORT_SYMBOL_GPL(coherentio); | ||
27 | int hw_coherentio = 0; /* Actual hardware supported DMA coherency setting. */ | ||
28 | |||
29 | static int __init setcoherentio(char *str) | ||
30 | { | ||
31 | coherentio = 1; | ||
32 | pr_info("Hardware DMA cache coherency (command line)\n"); | ||
33 | return 0; | ||
34 | } | ||
35 | early_param("coherentio", setcoherentio); | ||
36 | |||
37 | static int __init setnocoherentio(char *str) | ||
38 | { | ||
39 | coherentio = 0; | ||
40 | pr_info("Software DMA cache coherency (command line)\n"); | ||
41 | return 0; | ||
42 | } | ||
43 | early_param("nocoherentio", setnocoherentio); | ||
44 | |||
25 | static inline struct page *dma_addr_to_page(struct device *dev, | 45 | static inline struct page *dma_addr_to_page(struct device *dev, |
26 | dma_addr_t dma_addr) | 46 | dma_addr_t dma_addr) |
27 | { | 47 | { |
@@ -115,7 +135,8 @@ static void *mips_dma_alloc_coherent(struct device *dev, size_t size, | |||
115 | 135 | ||
116 | if (!plat_device_is_coherent(dev)) { | 136 | if (!plat_device_is_coherent(dev)) { |
117 | dma_cache_wback_inv((unsigned long) ret, size); | 137 | dma_cache_wback_inv((unsigned long) ret, size); |
118 | ret = UNCAC_ADDR(ret); | 138 | if (!hw_coherentio) |
139 | ret = UNCAC_ADDR(ret); | ||
119 | } | 140 | } |
120 | } | 141 | } |
121 | 142 | ||
@@ -142,7 +163,7 @@ static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, | |||
142 | 163 | ||
143 | plat_unmap_dma_mem(dev, dma_handle, size, DMA_BIDIRECTIONAL); | 164 | plat_unmap_dma_mem(dev, dma_handle, size, DMA_BIDIRECTIONAL); |
144 | 165 | ||
145 | if (!plat_device_is_coherent(dev)) | 166 | if (!plat_device_is_coherent(dev) && !hw_coherentio) |
146 | addr = CAC_ADDR(addr); | 167 | addr = CAC_ADDR(addr); |
147 | 168 | ||
148 | free_pages(addr, get_order(size)); | 169 | free_pages(addr, get_order(size)); |