Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Sam Ravnborg | a439fe5 | 2008-07-27 23:00:59 +0200 | [diff] [blame] | 2 | #ifndef ___ASM_SPARC_DMA_MAPPING_H |
| 3 | #define ___ASM_SPARC_DMA_MAPPING_H |
FUJITA Tomonori | d698641 | 2009-05-14 16:23:11 +0000 | [diff] [blame] | 4 | |
| 5 | #include <linux/scatterlist.h> |
| 6 | #include <linux/mm.h> |
FUJITA Tomonori | 02f7a18 | 2009-08-10 11:53:13 +0900 | [diff] [blame] | 7 | #include <linux/dma-debug.h> |
FUJITA Tomonori | b9f69f4 | 2009-05-14 16:23:08 +0000 | [diff] [blame] | 8 | |
David S. Miller | 0d1d909 | 2014-11-26 13:36:41 -0800 | [diff] [blame] | 9 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
| 10 | enum dma_data_direction dir) |
| 11 | { |
| 12 | /* Since dma_{alloc,free}_noncoherent() allocated coherent memory, this |
| 13 | * routine can be a nop. |
| 14 | */ |
| 15 | } |
| 16 | |
Bart Van Assche | 5299709 | 2017-01-20 13:04:01 -0800 | [diff] [blame] | 17 | extern const struct dma_map_ops *dma_ops; |
Bart Van Assche | 5299709 | 2017-01-20 13:04:01 -0800 | [diff] [blame] | 18 | extern const struct dma_map_ops pci32_dma_ops; |
Sam Ravnborg | 87e677c | 2012-05-26 15:56:03 +0200 | [diff] [blame] | 19 | |
FUJITA Tomonori | ee664a9 | 2009-08-10 11:53:16 +0900 | [diff] [blame] | 20 | extern struct bus_type pci_bus_type; |
FUJITA Tomonori | 02f7a18 | 2009-08-10 11:53:13 +0900 | [diff] [blame] | 21 | |
Bart Van Assche | 815dd18 | 2017-01-20 13:04:04 -0800 | [diff] [blame] | 22 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
FUJITA Tomonori | 02f7a18 | 2009-08-10 11:53:13 +0900 | [diff] [blame] | 23 | { |
Andreas Larsson | b84ca92 | 2014-09-08 09:48:52 +0200 | [diff] [blame] | 24 | #ifdef CONFIG_SPARC_LEON |
Sam Ravnborg | 87e677c | 2012-05-26 15:56:03 +0200 | [diff] [blame] | 25 | if (sparc_cpu_model == sparc_leon) |
Christoph Hellwig | c6d333e | 2017-05-22 09:06:26 +0200 | [diff] [blame] | 26 | return &pci32_dma_ops; |
Andreas Larsson | b84ca92 | 2014-09-08 09:48:52 +0200 | [diff] [blame] | 27 | #endif |
| 28 | #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI) |
Bart Van Assche | 815dd18 | 2017-01-20 13:04:04 -0800 | [diff] [blame] | 29 | if (bus == &pci_bus_type) |
FUJITA Tomonori | ee664a9 | 2009-08-10 11:53:16 +0900 | [diff] [blame] | 30 | return &pci32_dma_ops; |
| 31 | #endif |
FUJITA Tomonori | 02f7a18 | 2009-08-10 11:53:13 +0900 | [diff] [blame] | 32 | return dma_ops; |
| 33 | } |
| 34 | |
Sam Ravnborg | a439fe5 | 2008-07-27 23:00:59 +0200 | [diff] [blame] | 35 | #endif |