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 | |
Bart Van Assche | 5299709 | 2017-01-20 13:04:01 -0800 | [diff] [blame] | 9 | extern const struct dma_map_ops *dma_ops; |
Bart Van Assche | 5299709 | 2017-01-20 13:04:01 -0800 | [diff] [blame] | 10 | extern const struct dma_map_ops pci32_dma_ops; |
Sam Ravnborg | 87e677c | 2012-05-26 15:56:03 +0200 | [diff] [blame] | 11 | |
FUJITA Tomonori | ee664a9 | 2009-08-10 11:53:16 +0900 | [diff] [blame] | 12 | extern struct bus_type pci_bus_type; |
FUJITA Tomonori | 02f7a18 | 2009-08-10 11:53:13 +0900 | [diff] [blame] | 13 | |
Bart Van Assche | 815dd18 | 2017-01-20 13:04:04 -0800 | [diff] [blame] | 14 | 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] | 15 | { |
Andreas Larsson | b84ca92 | 2014-09-08 09:48:52 +0200 | [diff] [blame] | 16 | #ifdef CONFIG_SPARC_LEON |
Sam Ravnborg | 87e677c | 2012-05-26 15:56:03 +0200 | [diff] [blame] | 17 | if (sparc_cpu_model == sparc_leon) |
Christoph Hellwig | c6d333e | 2017-05-22 09:06:26 +0200 | [diff] [blame] | 18 | return &pci32_dma_ops; |
Andreas Larsson | b84ca92 | 2014-09-08 09:48:52 +0200 | [diff] [blame] | 19 | #endif |
| 20 | #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI) |
Bart Van Assche | 815dd18 | 2017-01-20 13:04:04 -0800 | [diff] [blame] | 21 | if (bus == &pci_bus_type) |
FUJITA Tomonori | ee664a9 | 2009-08-10 11:53:16 +0900 | [diff] [blame] | 22 | return &pci32_dma_ops; |
| 23 | #endif |
FUJITA Tomonori | 02f7a18 | 2009-08-10 11:53:13 +0900 | [diff] [blame] | 24 | return dma_ops; |
| 25 | } |
| 26 | |
Sam Ravnborg | a439fe5 | 2008-07-27 23:00:59 +0200 | [diff] [blame] | 27 | #endif |