License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-2.6-block.git] / arch / mips / include / asm / dma-mapping.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4
LT
2#ifndef _ASM_DMA_MAPPING_H
3#define _ASM_DMA_MAPPING_H
4
84be456f 5#include <linux/scatterlist.h>
b6d92b4a 6#include <asm/dma-coherence.h>
1da177e4
LT
7#include <asm/cache.h>
8
70342287 9#ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */
48e1fd5a 10#include <dma-coherence.h>
a5602a32 11#endif
1da177e4 12
5299709d 13extern const struct dma_map_ops *mips_dma_map_ops;
1da177e4 14
815dd187 15static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
48e1fd5a 16{
815dd187 17 return mips_dma_map_ops;
48e1fd5a 18}
1da177e4 19
48e1fd5a
DD
20static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
21{
22 if (!dev->dma_mask)
3db27425 23 return false;
1da177e4 24
48e1fd5a
DD
25 return addr + size <= *dev->dma_mask;
26}
27
28static inline void dma_mark_clean(void *addr, size_t size) {}
29
d3fa72e4 30extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
1da177e4
LT
31 enum dma_data_direction direction);
32
20d33064
PB
33#define arch_setup_dma_ops arch_setup_dma_ops
34static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
35 u64 size, const struct iommu_ops *iommu,
36 bool coherent)
37{
38#ifdef CONFIG_DMA_PERDEV_COHERENT
39 dev->archdata.dma_coherent = coherent;
40#endif
41}
42
1da177e4 43#endif /* _ASM_DMA_MAPPING_H */