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