1 #ifndef _H8300_DMA_MAPPING_H
2 #define _H8300_DMA_MAPPING_H
4 #include <asm-generic/dma-coherent.h>
6 extern struct dma_map_ops h8300_dma_map_ops
;
8 static inline struct dma_map_ops
*get_dma_ops(struct device
*dev
)
10 return &h8300_dma_map_ops
;
13 #include <asm-generic/dma-mapping-common.h>
15 static inline int dma_supported(struct device
*dev
, u64 mask
)
20 static inline int dma_set_mask(struct device
*dev
, u64 mask
)
25 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
26 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
28 #define dma_alloc_coherent(d, s, h, f) dma_alloc_attrs(d, s, h, f, NULL)
30 static inline void *dma_alloc_attrs(struct device
*dev
, size_t size
,
31 dma_addr_t
*dma_handle
, gfp_t flag
,
32 struct dma_attrs
*attrs
)
34 struct dma_map_ops
*ops
= get_dma_ops(dev
);
37 memory
= ops
->alloc(dev
, size
, dma_handle
, flag
, attrs
);
41 #define dma_free_coherent(d, s, c, h) dma_free_attrs(d, s, c, h, NULL)
43 static inline void dma_free_attrs(struct device
*dev
, size_t size
,
44 void *cpu_addr
, dma_addr_t dma_handle
,
45 struct dma_attrs
*attrs
)
47 struct dma_map_ops
*ops
= get_dma_ops(dev
);
49 ops
->free(dev
, size
, cpu_addr
, dma_handle
, attrs
);
52 static inline int dma_mapping_error(struct device
*dev
, dma_addr_t dma_addr
)