blob: 1180ae25415489d1642ffc94a5db70011f250dd9 [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
8#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
9
Christoph Hellwigee196372015-09-09 15:39:49 -070010#define HAVE_ARCH_DMA_SUPPORTED 1
Sam Ravnborgf05a6862014-05-16 23:25:50 +020011int dma_supported(struct device *dev, u64 mask);
FUJITA Tomonorib9f69f42009-05-14 16:23:08 +000012
David S. Miller0d1d9092014-11-26 13:36:41 -080013static 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
Sam Ravnborg87e677c2012-05-26 15:56:03 +020021extern struct dma_map_ops *dma_ops;
22extern struct dma_map_ops *leon_dma_ops;
23extern struct dma_map_ops pci32_dma_ops;
24
FUJITA Tomonoriee664a92009-08-10 11:53:16 +090025extern struct bus_type pci_bus_type;
FUJITA Tomonori02f7a182009-08-10 11:53:13 +090026
27static inline struct dma_map_ops *get_dma_ops(struct device *dev)
28{
Andreas Larssonb84ca922014-09-08 09:48:52 +020029#ifdef CONFIG_SPARC_LEON
Sam Ravnborg87e677c2012-05-26 15:56:03 +020030 if (sparc_cpu_model == sparc_leon)
31 return leon_dma_ops;
Andreas Larssonb84ca922014-09-08 09:48:52 +020032#endif
33#if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
34 if (dev->bus == &pci_bus_type)
FUJITA Tomonoriee664a92009-08-10 11:53:16 +090035 return &pci32_dma_ops;
36#endif
FUJITA Tomonori02f7a182009-08-10 11:53:13 +090037 return dma_ops;
38}
39
Sam Ravnborga439fe52008-07-27 23:00:59 +020040#endif