dma-mapping.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef _H8300_DMA_MAPPING_H
  2. #define _H8300_DMA_MAPPING_H
  3. #include <asm-generic/dma-coherent.h>
  4. extern struct dma_map_ops h8300_dma_map_ops;
  5. static inline struct dma_map_ops *get_dma_ops(struct device *dev)
  6. {
  7. return &h8300_dma_map_ops;
  8. }
  9. #include <asm-generic/dma-mapping-common.h>
  10. static inline int dma_supported(struct device *dev, u64 mask)
  11. {
  12. return 0;
  13. }
  14. static inline int dma_set_mask(struct device *dev, u64 mask)
  15. {
  16. return 0;
  17. }
  18. #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
  19. #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
  20. #define dma_alloc_coherent(d, s, h, f) dma_alloc_attrs(d, s, h, f, NULL)
  21. static inline void *dma_alloc_attrs(struct device *dev, size_t size,
  22. dma_addr_t *dma_handle, gfp_t flag,
  23. struct dma_attrs *attrs)
  24. {
  25. struct dma_map_ops *ops = get_dma_ops(dev);
  26. void *memory;
  27. memory = ops->alloc(dev, size, dma_handle, flag, attrs);
  28. return memory;
  29. }
  30. #define dma_free_coherent(d, s, c, h) dma_free_attrs(d, s, c, h, NULL)
  31. static inline void dma_free_attrs(struct device *dev, size_t size,
  32. void *cpu_addr, dma_addr_t dma_handle,
  33. struct dma_attrs *attrs)
  34. {
  35. struct dma_map_ops *ops = get_dma_ops(dev);
  36. ops->free(dev, size, cpu_addr, dma_handle, attrs);
  37. }
  38. static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
  39. {
  40. return 0;
  41. }
  42. #endif