blob: 2f3490dd37dea4feb2a1b030bfa49cf6e6618ced [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Sam Ravnborga439fe52008-07-27 23:00:59 +02002#ifndef ___ASM_SPARC_DMA_MAPPING_H
3#define ___ASM_SPARC_DMA_MAPPING_H
FUJITA Tomonorid6986412009-05-14 16:23:11 +00004
5#include <linux/scatterlist.h>
6#include <linux/mm.h>
FUJITA Tomonori02f7a182009-08-10 11:53:13 +09007#include <linux/dma-debug.h>
FUJITA Tomonorib9f69f42009-05-14 16:23:08 +00008
David S. Miller0d1d9092014-11-26 13:36:41 -08009static 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 Assche52997092017-01-20 13:04:01 -080017extern const struct dma_map_ops *dma_ops;
Bart Van Assche52997092017-01-20 13:04:01 -080018extern const struct dma_map_ops pci32_dma_ops;
Sam Ravnborg87e677c2012-05-26 15:56:03 +020019
FUJITA Tomonoriee664a92009-08-10 11:53:16 +090020extern struct bus_type pci_bus_type;
FUJITA Tomonori02f7a182009-08-10 11:53:13 +090021
Bart Van Assche815dd182017-01-20 13:04:04 -080022static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
FUJITA Tomonori02f7a182009-08-10 11:53:13 +090023{
Andreas Larssonb84ca922014-09-08 09:48:52 +020024#ifdef CONFIG_SPARC_LEON
Sam Ravnborg87e677c2012-05-26 15:56:03 +020025 if (sparc_cpu_model == sparc_leon)
Christoph Hellwigc6d333e2017-05-22 09:06:26 +020026 return &pci32_dma_ops;
Andreas Larssonb84ca922014-09-08 09:48:52 +020027#endif
28#if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
Bart Van Assche815dd182017-01-20 13:04:04 -080029 if (bus == &pci_bus_type)
FUJITA Tomonoriee664a92009-08-10 11:53:16 +090030 return &pci32_dma_ops;
31#endif
FUJITA Tomonori02f7a182009-08-10 11:53:13 +090032 return dma_ops;
33}
34
Sam Ravnborga439fe52008-07-27 23:00:59 +020035#endif