of_dma.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. int of_dma_nbcells;
  21. struct dma_chan *(*of_dma_xlate)
  22. (struct of_phandle_args *, struct of_dma *);
  23. void *of_dma_data;
  24. };
  25. struct of_dma_filter_info {
  26. dma_cap_mask_t dma_cap;
  27. dma_filter_fn filter_fn;
  28. };
  29. #ifdef CONFIG_OF
  30. extern int of_dma_controller_register(struct device_node *np,
  31. struct dma_chan *(*of_dma_xlate)
  32. (struct of_phandle_args *, struct of_dma *),
  33. void *data);
  34. extern void of_dma_controller_free(struct device_node *np);
  35. extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
  36. char *name);
  37. extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
  38. struct of_dma *ofdma);
  39. #else
  40. static int of_dma_controller_register(struct device_node *np,
  41. struct dma_chan *(*of_dma_xlate)
  42. (struct of_phandle_args *, struct of_dma *),
  43. void *data)
  44. {
  45. return -ENODEV;
  46. }
  47. static void of_dma_controller_free(struct device_node *np)
  48. {
  49. }
  50. static struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
  51. char *name)
  52. {
  53. return NULL;
  54. }
  55. static struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
  56. struct of_dma *ofdma)
  57. {
  58. return NULL;
  59. }
  60. #endif
  61. #endif /* __LINUX_OF_DMA_H */