blob: 60bf1633d5541757af6165c4c6413226a369ba98 [file] [log] [blame]
Sam Ravnborga439fe52008-07-27 23:00:59 +02001#ifndef ___ASM_SPARC_DMA_MAPPING_H
2#define ___ASM_SPARC_DMA_MAPPING_H
FUJITA Tomonorid6986412009-05-14 16:23:11 +00003
4#include <linux/scatterlist.h>
5#include <linux/mm.h>
FUJITA Tomonori02f7a182009-08-10 11:53:13 +09006#include <linux/dma-debug.h>
FUJITA Tomonorib9f69f42009-05-14 16:23:08 +00007
David S. Miller0d1d9092014-11-26 13:36:41 -08008static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
9 enum dma_data_direction dir)
10{
11 /* Since dma_{alloc,free}_noncoherent() allocated coherent memory, this
12 * routine can be a nop.
13 */
14}
15
Bart Van Assche52997092017-01-20 13:04:01 -080016extern const struct dma_map_ops *dma_ops;
Bart Van Assche52997092017-01-20 13:04:01 -080017extern const struct dma_map_ops pci32_dma_ops;
Sam Ravnborg87e677c2012-05-26 15:56:03 +020018
FUJITA Tomonoriee664a92009-08-10 11:53:16 +090019extern struct bus_type pci_bus_type;
FUJITA Tomonori02f7a182009-08-10 11:53:13 +090020
Bart Van Assche815dd182017-01-20 13:04:04 -080021static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
FUJITA Tomonori02f7a182009-08-10 11:53:13 +090022{
Andreas Larssonb84ca922014-09-08 09:48:52 +020023#ifdef CONFIG_SPARC_LEON
Sam Ravnborg87e677c2012-05-26 15:56:03 +020024 if (sparc_cpu_model == sparc_leon)
Christoph Hellwigc6d333e2017-05-22 09:06:26 +020025 return &pci32_dma_ops;
Andreas Larssonb84ca922014-09-08 09:48:52 +020026#endif
27#if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
Bart Van Assche815dd182017-01-20 13:04:04 -080028 if (bus == &pci_bus_type)
FUJITA Tomonoriee664a92009-08-10 11:53:16 +090029 return &pci32_dma_ops;
30#endif
FUJITA Tomonori02f7a182009-08-10 11:53:13 +090031 return dma_ops;
32}
33
Sam Ravnborga439fe52008-07-27 23:00:59 +020034#endif