of_dma.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * OF helpers for DMA request / controller
  3. *
  4. * Based on of_gpio.h
  5. *
  6. * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __LINUX_OF_DMA_H
  13. #define __LINUX_OF_DMA_H
  14. #include <linux/of.h>
  15. #include <linux/dmaengine.h>
  16. struct device_node;
  17. struct of_dma {
  18. struct list_head of_dma_controllers;
  19. struct device_node *of_node;
  20. struct dma_chan *(*of_dma_xlate)
  21. (struct of_phandle_args *, struct of_dma *);
  22. void *of_dma_data;
  23. };
  24. struct of_dma_filter_info {
  25. dma_cap_mask_t dma_cap;
  26. dma_filter_fn filter_fn;
  27. };
  28. #ifdef CONFIG_OF
  29. extern int of_dma_controller_register(struct device_node *np,
  30. struct dma_chan *(*of_dma_xlate)
  31. (struct of_phandle_args *, struct of_dma *),
  32. void *data);
  33. extern void of_dma_controller_free(struct device_node *np);
  34. extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
  35. const char *name);
  36. extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
  37. struct of_dma *ofdma);
  38. #else
  39. static inline int of_dma_controller_register(struct device_node *np,
  40. struct dma_chan *(*of_dma_xlate)
  41. (struct of_phandle_args *, struct of_dma *),
  42. void *data)
  43. {
  44. return -ENODEV;
  45. }
  46. static inline void of_dma_controller_free(struct device_node *np)
  47. {
  48. }
  49. static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
  50. const char *name)
  51. {
  52. return NULL;
  53. }
  54. static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
  55. struct of_dma *ofdma)
  56. {
  57. return NULL;
  58. }
  59. #endif
  60. #endif /* __LINUX_OF_DMA_H */